Coder Social home page Coder Social logo

ujjwalguptaofficial / jsstore Goto Github PK

View Code? Open in Web Editor NEW
835.0 21.0 106.0 34.58 MB

A complete IndexedDB wrapper with SQL like syntax.

Home Page: http://jsstore.net/

License: MIT License

JavaScript 67.96% HTML 1.76% TypeScript 30.24% CSS 0.04%
indexeddb sql wrapper library storage sql-syntax jsstore javascript-library typescript-library typescript

jsstore's Introduction

osnft GitHub version CI Backers on Open Collective Sponsors on Open Collective npm version GitHub Discussions CodeQL npm Downloads

Sauce Test Status

Overview

Harness the power of JsStore to streamline database operations in your web applications. With its SQL-like API, JsStore simplifies IndexedDB interactions, enabling developers to easily query, filter, and manipulate data with familiar syntax and efficiency.

Features

  • Executes In Web Worker
  • Simple readable apis
  • Easy to learn
  • TypeScript Support
  • Join Support
  • DataType Support
  • Complex Queries Support
  • Api Sync Support
  • Sql Support - through an extension sqlweb
  • IDBStudio - A management & debugging tool for jsstore.

Examples

Check out repo - https://github.com/ujjwalguptaofficial/jsstore-examples

Docs

http://jsstore.net/

Contributors

You are very welcome to contribute, please see contributing guidelines - [Contribute].

Thank you to all the people who already contributed to JsStore!

Support JsStore

Support this project by stars. We would be more greateful if you sponsor the project which allows us to keep developing, educate people, organize different events.

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Backers

Thank you to all our backers! 🙏 [Become a backer]

jsstore's People

Contributors

carsonchr avatar dependabot[bot] avatar jaymehtasa avatar monkeywithacupcake avatar pilou64 avatar sam-blackfly avatar ujjwalguptaofficial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsstore's Issues

Conditional Statements?

Hi, thank you for sharing this wonderful tool. This is by far the best indexedDb wrapper I have found.

Is it possible to add a new feature for conditional statements, something like connection.if ()?

Wrong selection when dealing with null values

Hi again
During development, I found that this query produces a wrong selection:

        {
            From: 'Job',
            Where: {
              jobSuspended_flag: { '!=': 1 },
              state: {
                In: ['Working', 'Diagnostics', 'FinalTest']
              }
            }

The records have the jobSuspended_flag set to 1, but they are selected anyway. There can be two values for this field, 1 or null.

If I change the row to this:

jobSuspended_flag: null

It throws an error:

scripts.bundle.js:3 TypeError: Cannot read property '!=' of null
    at scripts.bundle.js:3
    at Array.every (<anonymous>)
    at e.containsNot (scripts.bundle.js:3)
    at e.addGreatAndLessToNotOp (scripts.bundle.js:3)
    at e.execute (scripts.bundle.js:3)
    at Main.select (scripts.bundle.js:3)
    at Main.executeLogic (scripts.bundle.js:3)
    at Main.checkConnectionAndExecuteLogic (scripts.bundle.js:3)
    at e.executeCodeDirect (scripts.bundle.js:3)
    at e.executeCode (scripts.bundle.js:3)

I'm currently trying to understand JSStore's code in order to debug these problems myself (and maybe posting pull requests), but the way it's structured makes it hard for me. Also there are some type bugs, for example declaring the Promise as any in CodeExecutionHelper.ts makes the compiler angry:

ERROR in node_modules/JsStore/dist/jsstore.d.ts(1051,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'.
src/app/@core/data/db.service.ts(2,26): error TS2306: File '/Users/mc128k/Dropbox/Projects/TRIAD/99 Web Apps/40 TRIAD_Dashboard/node_modules/JsStore/dist/jsstore.d.ts' is not a module.chunk

but the issue here is with the selection. I'm trying to figure out these by myself, just wanted to let you know.

Bulk insert: how is updating handled?

The bulkInsert function is really handy, but it's not clear how it treats data where a record with the same primary key already exists. I found in my experiments that the insertion is simply ignored (as it should in case of errors), and the old record is kept.

As I'm dealing with a synced database, I will try an erase pass first (I hope there is a way to delete multiple records with a single operation, just checking it now) and then a bulk load, or an update operation.

Maybe it would be good to document how the bulkInsert works and point to some IndexedDB tech docs.

p.s.: I hope I'm not spamming in the issues, just trying to help with what I find

Where Clause Not Working

I have tried everything, and am getting no errors but whenever I try to execute a select with a where clause it returns an empty array. Here is the code I have:
initJsStore(); JSConn.select({ From: 'reports', Where: { report_id : '130' }, OnSuccess:function (results){ //results will be array of objects. alert('res' + results); console.log(results); showit(results); }, OnError:function (error) { alert(error.value); } });``

it returns in console
[]length: 0__proto__: Array(0)

remove the where to this:
` initJsStore();
JSConn.select({
From: 'reports',
OnSuccess:function (results){
//results will be array of objects.
alert('res ' + results);
console.log(results);
showit(results);
},
OnError:function (error) {
alert(error.value);
}
});

`

and it returns
["{"report_id":"130","device_id":"","show_report":"y…"","street2":null,"city":"","state":"","zip":""} "]
0
:
"{"report_id":"130","device_id":"","show_report":"yes","published":"no","published_date":null,"user_id":"30","client_id":"128","template_id":"19","template_name":"Default Template","employee_id":"29","inspection_date":"2017-11-18","end_date":null,"access_key":"d3ea87ea15de478eab26901d800f1587490eb2a4","creation_date":"2017-11-15 14:52:54","updated":"November 15, 2017 at 8:40:09 PM ","report_name":"bjjh","last_name":"cc","first_name":"mark","street":"","street2":null,"city":"","state":"","zip":""} "
length
:
1
proto
:
Array(0)

this is currently the only entry but obviously it returns all the rows from the table reports in the database when all i want is that one, ie. a Where clause. But for some reason it's not working.
I have tried everything, and am getting no errors but whenever I try to execute a select with a where clause it returns an empty array, every time, *note this is running on phonegap.

Uncaught TypeError: Cannot read property '_name' of null"

After clearing browsing data by pressing ctrl shift delete and then pressing clear data ,while running project I am getting below error

"jsstore.min.js:6 Uncaught TypeError: Cannot read property '_name' of
null"

while creating indexeddb using jsstore.

enter image description here

Failed to execute 'postMessage' on 'Worker' with Update function

On most of my update functions I get the following error in Chrome console;

Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Worker': function (results){

alert(results);
} could not be cloned.

Here is my code:

						
							JSConn.count({
From: "report_topics",
Where: {
user_id: userid,
report_cat_id: catid,
show_topic: 'show',
topic_id: topid
},
OnSuccess:function (results){
//results will be array of objects.
//console.log('c2' + results);
if(results > 0){
plzwork()
}
},
OnError:function (error) {
//error = JSON.parse(JSON.stringify(error));
// alert('e'); alert(error.Name + error.Message ); alert(Object.keys(error));
}
});
						function plzwork(){
						alert('update to hide');
JSConn.update({
In: "report_topics",
Set:{
show_topic:"hide"
},
Where: {
user_id: userid,
report_cat_id: catid,
topic_id: topid
},
onSuccess:function(results){

alert(results);
},
onError:function (error)
{
//error = JSON.parse(JSON.stringify(error));
// alert('e'); alert(error.Name + error.Message ); alert(Object.keys(error));
}});
}
` 
The function plzwork() fires but then the update fails with the error from above.
I'm running this with phonegap (cordova) it is part of a crossplatform app.  

EINVALIDTAGNAME error within installation

Hello. First of all thanks for your good job.
Could you please look at this error - I got it within the installation.
thx

node: v8.3.0
os: linux lts 16.0.4
npm v: 5.3.0
log file:
0 info it worked if it ends with ok 1 verbose cli [ '/home/maksim/.nvm/versions/node/v8.3.0/bin/node', 1 verbose cli '/home/maksim/.nvm/versions/node/v8.3.0/bin/npm', 1 verbose cli 'install', 1 verbose cli 'jsstore', 1 verbose cli '--save' ] 2 info using [email protected] 3 info using [email protected] 4 verbose npm-session 73935b444fd003ba 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 http fetch GET 304 https://registry.npmjs.org/jsstore 663ms (from cache) 8 silly pacote tag manifest for jsstore@latest fetched in 681ms 9 silly install loadIdealTree 10 silly install cloneCurrentTreeToIdealTree 11 silly install loadShrinkwrap 12 silly install loadAllDepsIntoIdealTree 13 silly resolveWithNewModule [email protected] checking installable status 14 verbose stack Error: Invalid tag name "typescript@latest": Tags may not have any characters that encodeURIComponent encodes. 14 verbose stack at invalidTagName (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:76:15) 14 verbose stack at fromRegistry (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:265:13) 14 verbose stack at Function.resolve (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:66:12) 14 verbose stack at childDependencySpecifier (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/lib/install/deps.js:80:14) 14 verbose stack at addDependency (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/lib/install/deps.js:518:15) 14 verbose stack at /home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/lib/install/deps.js:468:5 14 verbose stack at /home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35 14 verbose stack at Array.forEach (<anonymous>) 14 verbose stack at /home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11 14 verbose stack at Array.forEach (<anonymous>) 14 verbose stack at asyncMap (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8) 14 verbose stack at loadDeps (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/lib/install/deps.js:460:3) 14 verbose stack at Array.<anonymous> (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8) 14 verbose stack at LOOP (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14) 14 verbose stack at chain (/home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:5) 14 verbose stack at /home/maksim/.nvm/versions/node/v8.3.0/lib/node_modules/npm/lib/install/deps.js:355:5 15 verbose cwd /home/maksim/Documents/_projects/peopling/peopling-frontend 16 verbose Linux 4.10.0-35-generic 17 verbose argv "/home/maksim/.nvm/versions/node/v8.3.0/bin/node" "/home/maksim/.nvm/versions/node/v8.3.0/bin/npm" "install" "jsstore" "--save" 18 verbose node v8.3.0 19 verbose npm v5.3.0 20 error code EINVALIDTAGNAME 21 error Invalid tag name "typescript@latest": Tags may not have any characters that encodeURIComponent encodes. 22 verbose exit [ 1, true ]

raw sql?

Can be used directly such as:
jsStore.exec('select * from table_name where name = "alice"');

?

Get rowsaffected while inserting data into indexeddb using jsstore

Hi,

I used below code for geting response after inserting data

this.InsertIntoIndexedDB(this._allSectionArticles).then(res=>{
if(res==this._allSectionArticles.length)
{
}
});

But It returns always 0 ,1,5 alternatively inserted data is 25 but it returns 5 only.Can u pls tell me what is the issue here

Thanks

While Clearing browser data keystore is not deleted So that getting db not exist error

Hi,

While Clearing browser data keystore is not deleted So that getting db not exist error sometimes.Can you pls help me to fix it when u r free

I am using below code for checking dbexist

     JsStore.isDbExist(That._indexedDBLiveDBName).then(isExist => {
        if (!isExist) {
            const DataBase = That.getDbSchema();
            That._connection.createDb(DataBase, function () {
                That._isLiveDbCreated = true;
                localStorage.setItem('_isLiveDbCreated', 'true');
                return;
            });
        }
        else {
            That._isLiveDbCreated = true;
            localStorage.setItem('_isLiveDbCreated', 'true');

            return;
        }
    }).catch(err => {
        // this will be fired when indexedDB is not supported.
        console.log(err.Message);
    });

Thanks

And with OR operator

         customerId:parseInt(customerIdValue),
         stockNumber: { Like: '%' + searchValue + '%' },
         Or: {
         stockDescription: { Like: '%' + searchValue + '%'} 
         }

In the above example, customerIdValue should be present in customerId column and
searchValue should be present in stockNumber or stockDescription column.

Please help how to accomplish this in jsstore.

Multiple condition in where not working

Hi,

Below is my select query

return this._connection.select({
           From: this._indexedDBLiveDBArticleTableName,
           Where: {
             
               Url:{'!=':url},
               CustomSection: section
           },
           Limit: this._Count,
           
      
         
           
       });

In where clause ,I am checking 2 conditions .only one is working.another is not working

ERROR ReferenceError: JsStore is not defined

Dear All, i tried to run my angular 5 application inside a webworker but i faced an issue where it tells me that JsStore Is not defined.
any one faced a slimier issue?
below a screenshot for the error i'm facing.
thanks,
image

'dom' and 'webworker' can't coexist in tsconfig.json [v2]

As the title says, the two type declarations are mutually exclusive. Compiling with them produces the errors:

node_modules/typescript/lib/lib.webworker.d.ts(1949,6): error TS2300: Duplicate identifier 'USVString'.
node_modules/typescript/lib/lib.webworker.d.ts(1950,6): error TS2300: Duplicate identifier 'IDBValidKey'.
node_modules/typescript/lib/lib.webworker.d.ts(1951,6): error TS2300: Duplicate identifier 'BufferSource'.
...

See here for the related issue

Distinct

Right now the possibility to use SELECT DISTINCT(field) is implemented?

Cannot read property 'forEach' of undefined

I have the following error and I cannot see where its coming from: the orgination.
https://www.smartychat.co/InfluenceIO/storeAnalytics.html

jsstore.js:899 Uncaught TypeError: Cannot read property 'forEach' of undefined
at new Table (jsstore.js:899)
at DataBase. (jsstore.js:996)
at Array.forEach ()
at new DataBase (jsstore.js:995)
at Object. (jsstore.js:1756)
at Object. (jsstore.js:657)
at Object.KeyStore.processFinishedRequest (jsstore.js:97)
at Object. (jsstore.js:81)
at Main.returnResult (jsstore.js:377)
at Main. (jsstore.js:382)

Maximum call stack size exceeded

Hi,
I try to create a insert statement from a huge (40000 records) and then I get the Maximum call stack size exceeded. How can I solve this?

Typescript support ?

Can you rebuild the same for typescript support so that we can use it with angular 2?
We also need it in npm.
I am in for this contribution.
Looking forward towards your feedback on above.

Thanks,
Lakin

SELECT columns

Is it possible to specify columns in a SELECT statement - the examples only appear to be SELECT *

ignoreCase throws an error when one of the columns is number

.select({
from: storeName,
distinct: true,
ignoreCase: true,
where: {
Status: obj.category,
LastName: obj.lastName,
CaseId: 462385
}
})
got this error using ignoreCase when one of the columns is number (CaseId):
jsstore.worker.js:3718 TypeError: subWord.charAt is not a function
at doAndPushCombination (jsstore.worker.js:3966)
at Instance.BaseHelper.getCombination_ (jsstore.worker.js:3973)
at Instance.BaseHelper.getAllCombinationOfWord (jsstore.worker.js:3956)
at Instance.Base.makeQryInCaseSensitive (jsstore.worker.js:3805)
at Instance.Base.this.goToWhereLogic (jsstore.worker.js:3628)
at Instance.processWhere (jsstore.worker.js:2264)
at Instance.execute (jsstore.worker.js:2157)
at QueryExecutor.select (jsstore.worker.js:1555)
at QueryExecutor.executeLogic (jsstore.worker.js:1413)
at QueryExecutor.checkConnectionAndExecuteLogic (jsstore.worker.js:1368)

Where not working for boolean values

Hi,

I develop a web application with your library.
I have a bug. I can't do a where on a Boolean column.
buggy

My code
c.select({ From: "projets", Where: { pending:true } });

Table structure :

...
{
	Name: "pending",
	DataType: 'boolean',
	Default : false,
	NotNull: false
}
...

Why ?
(I use v1.2.5, your lastest version (1.2.6) crash my application ... I get result on OnError callback instead Onsuccess ...)

Mismatch in interface between schema returned by JsStore.getDbSchema and interface IDataBaseOption

The fields defined by IDataBaseOption don't match with the fields in the schema returned by JsStore.getDbSchema. All the fields in IDataBaseOption are UpperCamelCase (should also be lowerCamelCase according to the javascript code styling guide) while the fields of the object returned by JsStore.getDbSchema are prefixed with an underscore. For example _name or _tables instead of Name or Tables as defined by the interface IDataBaseOption

IAggregate type conversion issue in typescript

private getDatabase() {
const tblKpi: ITable = {
  name: 'kpi',
  columns: [{
    name: 'id',
    primaryKey: true,
    autoIncrement: true
  },
  {
    name: 'productName',
    dataType: DATA_TYPE.String,
    notNull: true
  },
  {
    name: 'location',
    dataType: DATA_TYPE.String,
    notNull: true
  },
  {
    name: 'vendor',
    dataType: DATA_TYPE.String,
    notNull: true
  },
  {
    name: 'severity',
    dataType: DATA_TYPE.String,
    notNull: true
  },
  {
    name: 'total',
    dataType: DATA_TYPE.String,
    notNull: true
  }
  ]
}

const dataBase: IDataBase = {
  name: this.dbname,
  tables: [tblKpi]
};
return dataBase;
}
this.connection.select({
from: "kpi",
aggregate: {
sum: "total"
}
});

hello am trying to run the above aggregate query but am getting the below error. can anyone please help in this
Argument of type '{ from: string; aggregate: { sum: string; }; }' is not assignable to parameter of type 'ISelect'.
Types of property 'aggregate' are incompatible.
Type '{ sum: string; }' is not assignable to type 'IAggregate'.
Types of property 'sum' are incompatible.
Type 'string' is not assignable to type 'any[]'.

how to use it in webpack

import it like this : import JsStore from "jsstore".

it dosen't work :(

how to import it as a module.

JsStore is not runing in web worker

Hi Ujjwal,

Amazing job with JsStore.

I get this warning whenever i run my html page using JsStore.

Can you please let me know if this would be an area of concern when i run my applications

Firefox issue

JsStore works great on Chrome, but when I tried firefox, I got the following errors:

image

QueryExecutor.onQueryFinished
https://localhost:44329/idb/jsstore.worker.js:810:17
QueryExecutor.executeCode/<
https://localhost:44329/idb/jsstore.worker.js:798:17
Main.prototype.returnResult
https://localhost:44329/idb/jsstore.worker.js:917:13
onError
https://localhost:44329/idb/jsstore.worker.js:928:13
InitDb/dbRequest.onerror
https://localhost:44329/idb/jsstore.worker.js:1197:17

not sure this is just me or something else. Thanks.

Can I use not operator in where clause using jsstore while fetching data from indexeddb

Hi,

Can I use not operator in where clause using jsstore while fetching data from indexeddb.I tried below but not working

this._connection.openDb(this._indexedDBLiveDBName);

    return this._connection.select({
        From: this._indexedDBLiveDBArticleTableName,
        Distinct: true,
        Where: {
            CustomSection: section,
           ** Url: ! url**
        },
        Limit: this._Count
    });

Thanks

Bug when opening database [v2]

Hi,
I'm playing with the version 2, and I think I understand how to handle it. I compiled it with webpack and placed the worker.js file in my project. For the main instance I'm referring the .ts files from my project, so I have the compiled worker and the native .ts imported from my project. I hope it's clear.

One thing I can't figure out is that in the worker, as soon as I try to open the database, I get an error where the dbName_ variable is undefined. I think it could be because the class is initialised before the IdbHelper actually has the data. This is the error:
screen shot 2018-05-02 at 15 15 43

And my code:

return this._conn.isDbExist(this._dbName)
      .then(exist => {
        if (exist) {
          this._conn.openDb(this._dbName); // <- fails after this
        } else {
          this._conn.createDb({
            name: this._dbName,
            tables: [{
              name: this._tableName,
              columns: [{
                name: 'id',
                primaryKey: true,
              }],
            }],
          });
        }
      })

Any clue?

Working with dates

Hi
I'm integrating this library into my project, and it works pretty well for my use. One of the thing that I see missing though is some date/time support. I understand that it's an advanced SQL topic, and it's reasonable to not include this in a small library that runs on a browser, but indeed I am facing a problem that is proving hard to solve.

How do I select a date range? The currently available operators can obviously work on integers, but nothing is documented on other data types. If I had some kind of functions like DAY() or the like (like SQL) the problem could be easily solved, but this is just a plain query system.

Any suggestion?
Thanks a lot

GROUP BY Clause

Hi
I came across a situation where i needed to perform a GROUP BY operation.
I figured out a way by applying filter after getting the complete set of results but it may not be the right and efficient way to do that.

It will be very helpful if you provide an API for GROUP BY too.

It seems like all the jsstore file links are broken in the examples

I do not know if this is supposed to be installed with NPM or something but, the links are going to .js and in the folders are .d.ts files instead. Why was this setup this way are is this on purpose. As a result the examples do not work. I would live to try out this library but I have a feeling there is a miss in the directions.

Saving Images

Hello, I have a base64 string want to save in the db, have tried using the object datatype but gives an error incorrect datatype provided for the column, when I use string datatype the base64 string is trimmed hence cannot be converted to back to an image. How do I go about this

Thanks

Runtime Error Instance() is not a constructor

Hello,

I'm building a Vue.js app and trying to use JsStore as my persistence mechanism. I define a TypeScript class like this:

import * as JsStore from 'jsstore'
export class testDb {
    myConnection: JsStore.Instance
    constructor() {
      this.myConnection  = new JsStore.Instance('testDatabase');
    }
  }

When I try to instantiate my class like this:

var myDb = new testDb();

I get the following error:

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0_jsstore.Instance is not a constructor

Been banging my head over this. Any help would be appreciated.

Scott

JsStore.isDbExist doesn't work if you haven't create an instance JsStore.Instance

The working of JsStore.isDbExist should't be dependent on logic outside this function but self contained
Now i always have to create an instance of JsStore.Instance before i call JsStore.isDbExist:

const instance  = new JsStore.Instance();
JsStore.isDbExist('my database').then(..);

while it should be working without const instance = new JsStore.Instance();

interface ISelect question

When I try to use a simple select, as shown in the example:

Connection.select({
   From: "Table_Name",
   OnSuccess:function (results){
       //results will be array of objects.
      console.log(results);
    },
   OnError:function (error) {
       alert(error.value);
    }
});

I get a "webpack: Failed to compile" error. It seems that the ISelect interface has all of its elements such as "From", "Where", "Skip", etc. as required. So, I am seeing "error TS2345" Argument of type '...' is not assignable to parameter of type 'ISelect'. Property 'Where' (or 'Skip' or 'Limit', etc) is missing in type ...'

So, it looks like I can only run "Connection.select" if I specify ALL parameters of the ISelect interface. I can't run the simple example as shown above. Is that right???

Thanks in advance.
Jim

Updating an object value as blob gives “Invalid Op Value 'size'”, _type: “invalid_operator”} error using jsstore

I would have updated a column (type object) by blob value.Iam getting

"Invalid Op Value 'size'", _type: "invalid_operator"} error.Can anyone pls help me to fix it

UpdateBLobInIndexedDb(blob,Id)
{
    this._connection.openDb(this._indexedDBLiveDBName);
    return this._connection.update({
        In: this._indexedDBLiveDBTableName,
        Set: {
            ImageBlob: blob,
        },
        Where: {
            ArticleId:Id
        }
   });
}

thanks

Transaction Support in JsStore

Hi,

I am working on a web app which stores some offline data in IndexedDB.
I am integrating this library into my project. I have a requirement of performing multiple operations tables in a single transaction, so that the operations can be rolled back, if any error occurs in any operation.
Indexed Db supports transaction as follows

var transaction = db.transaction();   //API for representation only
 var store = transaction.objectStore();  // //API for representation only 
 request = store.add();     //API for representation only

Does JsStore support transactions where I can perform multiple CRUD operations?
Can you please let me know if I can achieve similar functionality using JsStore?

Simulate NOT IN operator

Hi
I'm having difficulties simulating the NOT IN (...) operation.

As there is no negation operator for In, I thought that an AND operation with the same field would be fine, but it produces an error instead. This is the code I'm playing with:

    {
            From: 'Job',
            Where: [{
              dateExpiryStart: { '>': 0 },
              state: { '!=': 'Concluded' }
            }, {
              state: { '!=': 'WaitPickup' }
            }
            ],
    };

Any suggestion?

After clearing data using clear api got uncaught (in promise): undefined at resolvePromise issue in v:1.6.0

Hi,

while returning clear method I got below

"Error: Uncaught (in promise): undefined at resolvePromise
(webpack-internal:///../../../../zone.js/dist/zone.js:665:31) [] at
eval (webpack-internal:///../../../../zone.js/dist/zone.js:591:17) []
at Object.e.OnError (http://localhost:4200/assets/js/jsstore.min.js:6:81017)
[] at r.t.processFinishedRequest (
http://localhost:4200/assets/js/jsstore.min.js:6:82929) [] at
r.t.onMessageFromWorker (
http://localhost:4200/assets/js/jsstore.min.js:6:83644) [] at
r. (http://localhost:4200/assets/js/jsstore.min.js:6:81286)
[]"

Below zone.js code from where I am getting this error

function consoleError(e) {
if (Zone[symbol('ignoreConsoleErrorUncaughtError')]) {
return;
}
var rejection = e && e.rejection;
if (rejection) {
console.error('Unhandled Promise rejection:', rejection
instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name,
'; Task:', e.task && e.task.source, '; Value:', rejection, rejection
instanceof Error ? rejection.stack : undefined);
}
console.error(e);
}

Can you pls help me to fix it.

Thanks

GroupBy shows ungrouped fields

This is a minor issue, but it creates something incoherent. If I group by a field, the other fields are shown too, and this doesn't make sense as we don't really care to get unique fields if we are grouping them. SQL would complain that ungrouped fields must be part of an aggregation function (I think) or be equal.

Please tell me if you need some examples, it might be not perfectly clear.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.