Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
dac5342a19 | |||
1829db1d82 | |||
3c4cba97c2 | |||
b86bd61cbf | |||
ad95154284 | |||
7fb47d224e |
@ -36,6 +36,7 @@ auditProductionDependencies:
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
23358
package-lock.json
generated
23358
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/webstore",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.18",
|
||||
"private": false,
|
||||
"description": "high performance storage in the browser using indexed db",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -12,20 +12,20 @@
|
||||
"build": "(tsbuild --web)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.52",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.11.10",
|
||||
"@gitzone/tsbuild": "^2.1.29",
|
||||
"@gitzone/tstest": "^1.0.60",
|
||||
"@pushrocks/tapbundle": "^4.0.0",
|
||||
"@types/node": "^17.0.10",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartjson": "^4.0.5",
|
||||
"@pushrocks/smartpromise": "^3.1.3",
|
||||
"@pushrocks/smartrx": "^2.0.19",
|
||||
"idb": "^5.0.7"
|
||||
"@pushrocks/lik": "^5.0.0",
|
||||
"@pushrocks/smartjson": "^4.0.6",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"@pushrocks/smartrx": "^2.0.20",
|
||||
"idb": "^7.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
|
11
test/test.typedrequestcache.browser.ts
Normal file
11
test/test.typedrequestcache.browser.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as webstore from '../ts/index';
|
||||
|
||||
let testTypedrequestcache: webstore.TypedrequestCache;
|
||||
|
||||
tap.test('first test', async () => {
|
||||
testTypedrequestcache = new webstore.TypedrequestCache('https://test.lossless.com/typedrequest')
|
||||
expect(testTypedrequestcache).toBeInstanceOf(webstore.TypedrequestCache);
|
||||
});
|
||||
|
||||
tap.start();
|
@ -8,12 +8,12 @@ tap.test('first test', async () => {
|
||||
dbName: 'mytest-db',
|
||||
storeName: 'mytest-store',
|
||||
});
|
||||
expect(testWebstore).to.be.instanceOf(webstore.WebStore);
|
||||
expect(testWebstore).toBeInstanceOf(webstore.WebStore);
|
||||
});
|
||||
|
||||
tap.test('should allow storing a string', async () => {
|
||||
await testWebstore.set('mystring', 'heythere');
|
||||
expect(await testWebstore.get('mystring')).to.equal('heythere');
|
||||
expect(await testWebstore.get('mystring')).toEqual('heythere');
|
||||
});
|
||||
|
||||
tap.test('should allow storing an object', async () => {
|
||||
@ -33,8 +33,8 @@ tap.test('should overwrite a value', async () => {
|
||||
tap.test('should correctly check the existence of keys', async () => {
|
||||
const resultNotThere = await testWebstore.check('notThere');
|
||||
const resultThere = await testWebstore.check('testProp1');
|
||||
expect(resultNotThere).to.be.false;
|
||||
expect(resultThere).to.be.true;
|
||||
expect(resultNotThere).toBeFalse();
|
||||
expect(resultThere).toBeTrue();
|
||||
});
|
||||
|
||||
tap.start();
|
@ -1 +1,2 @@
|
||||
export * from './webstore.classes.typedrequestcache';
|
||||
export * from './webstore.classes.webstore';
|
||||
|
@ -5,10 +5,14 @@ import * as plugins from './webstore.plugins';
|
||||
* a cache that can be used to store and retrieve typedrequests
|
||||
*/
|
||||
export class TypedrequestCache {
|
||||
private webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
|
||||
dbName: 'trStore',
|
||||
storeName: 'trStore',
|
||||
});
|
||||
private webstore: WebStore;
|
||||
|
||||
constructor(domainArg = 'default') {
|
||||
this.webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
|
||||
dbName: 'trStore',
|
||||
storeName: `trStore-${domainArg}`,
|
||||
});
|
||||
}
|
||||
|
||||
private buildKey(requestArg: plugins.typedrequestInterfaces.ITypedRequest) {
|
||||
return plugins.smartjson.stringify({
|
||||
|
Reference in New Issue
Block a user