Merge pull request #5 from Caseyyu2/xiyu/add-getmultiple-api-support
Adding index support to getMultiple API. This allows developers to fetch multiple entries for a specific set of keys on any index in the schema (earlier you could only fetch on the primary index).
This commit is contained in:
Коммит
a037ade456
|
@ -13,7 +13,7 @@
|
|||
"--timeout",
|
||||
"5000",
|
||||
"--colors",
|
||||
"${workspaceFolder}/dist/tests/NoSqlProviderTests.js"
|
||||
"${workspaceFolder}/dist/src/tests/NoSqlProviderTests.js"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -15,6 +15,7 @@ export declare abstract class DbIndexFTSFromRangeQueries implements DbIndex {
|
|||
constructor(_indexSchema: IndexSchema | undefined, _primaryKeyPath: string | string[]);
|
||||
fullTextSearch(searchPhrase: string, resolution?: FullTextTermResolution, limit?: number): Promise<ItemType[]>;
|
||||
abstract getAll(reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
abstract getMultiple(keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]>;
|
||||
abstract getOnly(key: KeyType, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
abstract getRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
abstract getKeysForRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean): Promise<any[]>;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"FullTextSearchHelpers.js","sourceRoot":"","sources":["../../src/FullTextSearchHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;;;;;;;;;;;;;;;;;;;;AAEF,iCAGgB;AAChB,2CAA2C;AAE3C,iDAAkH;AAClH,2DAA4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AAI,KAAK,EAAE;oBACP,OAAO,aAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;iBAC5B;gBACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAChC;YAED,IAAI,UAAU,KAAK,sCAAsB,CAAC,GAAG,EAAE;gBACrC,IAAA,qBAA6B,EAA5B,aAAK,EAAE,sBAAqB,CAAC;gBACpC,IAAM,GAAG,GAAG,eAAM,CAAC,KAAK,EAAE,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,cAAK,CAAC,QAAM,EAAE,UAAA,GAAG,IAAI,OAAA,GAAG,IAAI,GAAG,EAAV,CAAU,CAAC,EAAhC,CAAgC,CAAyB,CAAC;gBACrG,IAAM,IAAI,GAAG,eAAM,CAAC,GAAG,CAAC,CAAC;gBACzB,IAAI,KAAK,EAAE;oBACP,OAAO,aAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;iBAC5B;gBACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAChC;YAED,OAAO,OAAO,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC;IAgBL,iCAAC;AAAD,CAAC,AApED,IAoEC;AApEqB,gEAA0B"}
|
|
@ -43,6 +43,7 @@ declare class InMemoryIndex extends DbIndexFTSFromRangeQueries {
|
|||
internal_SetTransaction(trans: InMemoryTransaction): void;
|
||||
internal_getKeysFromItem(item: ItemType): string[] | undefined;
|
||||
put(itemOrItems: ItemType | ItemType[], skipTransactionOnCreation?: boolean): void;
|
||||
getMultiple(keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]>;
|
||||
remove(key: string, skipTransactionOnCreation?: boolean): void;
|
||||
getAll(reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getOnly(key: KeyType, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
|
|
|
@ -360,6 +360,31 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
});
|
||||
});
|
||||
};
|
||||
InMemoryIndex.prototype.getMultiple = function (keyOrKeys) {
|
||||
var _this = this;
|
||||
var e_2, _a;
|
||||
var joinedKeys = lodash_1.attempt(function () {
|
||||
return NoSqlProviderUtils_1.formListOfSerializedKeys(keyOrKeys, _this._keyPath);
|
||||
});
|
||||
if (lodash_1.isError(joinedKeys)) {
|
||||
return Promise.reject(joinedKeys);
|
||||
}
|
||||
var values = [];
|
||||
try {
|
||||
for (var joinedKeys_1 = __values(joinedKeys), joinedKeys_1_1 = joinedKeys_1.next(); !joinedKeys_1_1.done; joinedKeys_1_1 = joinedKeys_1.next()) {
|
||||
var key = joinedKeys_1_1.value;
|
||||
values.push(red_black_tree_1.get(key, this._rbIndex));
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (joinedKeys_1_1 && !joinedKeys_1_1.done && (_a = joinedKeys_1.return)) _a.call(joinedKeys_1);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
return Promise.resolve(lodash_1.compact(lodash_1.flatten(values)));
|
||||
};
|
||||
InMemoryIndex.prototype.remove = function (key, skipTransactionOnCreation) {
|
||||
if (!skipTransactionOnCreation && !this._trans.internal_isOpen()) {
|
||||
throw new Error('InMemoryTransaction already closed');
|
||||
|
@ -367,7 +392,7 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
red_black_tree_1.remove(key, this._rbIndex);
|
||||
};
|
||||
InMemoryIndex.prototype.getAll = function (reverseOrSortOrder, limit, offset) {
|
||||
var e_2, _a;
|
||||
var e_3, _a;
|
||||
limit = limit ? limit : this._rbIndex._size;
|
||||
offset = offset ? offset : 0;
|
||||
var data = new Array(limit);
|
||||
|
@ -384,12 +409,12 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return)) _a.call(iterator_1);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
};
|
||||
|
@ -399,7 +424,7 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
InMemoryIndex.prototype.getRange = function (keyLowRange, keyHighRange, lowRangeExclusive, highRangeExclusive, reverseOrSortOrder, limit, offset) {
|
||||
var _this = this;
|
||||
var values = lodash_1.attempt(function () {
|
||||
var e_3, _a;
|
||||
var e_4, _a;
|
||||
var reverse = reverseOrSortOrder === true || reverseOrSortOrder === NoSqlProvider_1.QuerySortOrder.Reverse;
|
||||
limit = limit ? limit : _this._rbIndex._size;
|
||||
offset = offset ? offset : 0;
|
||||
|
@ -423,12 +448,12 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (iterator_2_1 && !iterator_2_1.done && (_a = iterator_2.return)) _a.call(iterator_2);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
finally { if (e_4) throw e_4.error; }
|
||||
}
|
||||
return values;
|
||||
});
|
||||
|
@ -449,7 +474,7 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
};
|
||||
// Warning: This function can throw, make sure to trap.
|
||||
InMemoryIndex.prototype._getKeysForRange = function (keyLowRange, keyHighRange, lowRangeExclusive, highRangeExclusive) {
|
||||
var e_4, _a;
|
||||
var e_5, _a;
|
||||
var keyLow = NoSqlProviderUtils_1.serializeKeyToString(keyLowRange, this._keyPath);
|
||||
var keyHigh = NoSqlProviderUtils_1.serializeKeyToString(keyHighRange, this._keyPath);
|
||||
var iterator = red_black_tree_1.iterateKeysFromFirst(this._rbIndex);
|
||||
|
@ -462,12 +487,12 @@ var InMemoryIndex = /** @class */ (function (_super) {
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
||||
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (iterator_3_1 && !iterator_3_1.done && (_a = iterator_3.return)) _a.call(iterator_3);
|
||||
}
|
||||
finally { if (e_4) throw e_4.error; }
|
||||
finally { if (e_5) throw e_5.error; }
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -688,6 +688,23 @@ var IndexedDbIndex = /** @class */ (function (_super) {
|
|||
var req = this._store.openCursor(keyRange, reverse ? 'prev' : 'next');
|
||||
return this._resolveCursorResult(req, limit, offset);
|
||||
};
|
||||
IndexedDbIndex.prototype.getMultiple = function (keyOrKeys) {
|
||||
var _this = this;
|
||||
var keys = lodash_1.attempt(function () {
|
||||
var keys = NoSqlProviderUtils_1.formListOfKeys(keyOrKeys, _this._keyPath);
|
||||
// if (this._fakeComplicatedKeys && isCompoundKeyPath(this._keyPath)) {
|
||||
// return map(keys, key => serializeKeyToString(key, this._keyPath));
|
||||
// }
|
||||
return keys;
|
||||
});
|
||||
if (lodash_1.isError(keys)) {
|
||||
return Promise.reject(keys);
|
||||
}
|
||||
if (this._store.get && !this._fakeComplicatedKeys) {
|
||||
return Promise.all(lodash_1.map(keys, function (key) { return IndexedDbProvider.WrapRequest(_this._store.get(key)); })).then(lodash_1.compact);
|
||||
}
|
||||
return Promise.all(lodash_1.map(keys, function (key) { return _this.getOnly(key); })).then(function (vals) { return lodash_1.compact(lodash_1.flatten(vals)); });
|
||||
};
|
||||
// Warning: This function can throw, make sure to trap.
|
||||
IndexedDbIndex.prototype._getKeyRangeForOnly = function (key) {
|
||||
if (this._fakeComplicatedKeys && NoSqlProviderUtils_1.isCompoundKeyPath(this._keyPath)) {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -45,6 +45,7 @@ export declare enum FullTextTermResolution {
|
|||
}
|
||||
export interface DbIndex {
|
||||
getAll(reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getMultiple(keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]>;
|
||||
getOnly(key: KeyType, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getKeysForRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean): Promise<any[]>;
|
||||
|
@ -81,7 +82,7 @@ export declare abstract class DbProvider {
|
|||
protected abstract _deleteDatabaseInternal(): Promise<void>;
|
||||
private _getStoreTransaction;
|
||||
get(storeName: string, key: KeyType): Promise<ItemType | undefined>;
|
||||
getMultiple(storeName: string, keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]>;
|
||||
getMultiple(storeName: string, keyOrKeys: KeyType | KeyType[], indexName?: string): Promise<ItemType[]>;
|
||||
put(storeName: string, itemOrItems: ItemType | ItemType[]): Promise<void>;
|
||||
remove(storeName: string, keyOrKeys: KeyType | KeyType[]): Promise<void>;
|
||||
removeRange(storeName: string, indexName: string, keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean): Promise<void>;
|
||||
|
|
|
@ -72,9 +72,9 @@ var DbProvider = /** @class */ (function () {
|
|||
return store.get(key);
|
||||
});
|
||||
};
|
||||
DbProvider.prototype.getMultiple = function (storeName, keyOrKeys) {
|
||||
return this._getStoreTransaction(storeName, false).then(function (store) {
|
||||
return store.getMultiple(keyOrKeys);
|
||||
DbProvider.prototype.getMultiple = function (storeName, keyOrKeys, indexName) {
|
||||
return this._getStoreIndexTransaction(storeName, false, indexName).then(function (index) {
|
||||
return index.getMultiple(keyOrKeys);
|
||||
});
|
||||
};
|
||||
DbProvider.prototype.put = function (storeName, itemOrItems) {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -109,7 +109,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
]
|
||||
};
|
||||
return openProvider(provName, schema, true)
|
||||
openProvider(provName, schema, true)
|
||||
.then(function (prov) {
|
||||
// insert some stuff
|
||||
return prov.put('test', { id: 'a', val: 'b' })
|
||||
|
@ -181,6 +181,11 @@ describe('NoSqlProvider', function () {
|
|||
return 'indexa' + i;
|
||||
}
|
||||
};
|
||||
var t0 = prov.getMultiple('test', compound ? formIndex(1, 1) : 'indexa1', indexName).then(function (retVal) {
|
||||
var ret = retVal;
|
||||
assert.equal(ret.length, 1, 'getMultiple');
|
||||
[1].forEach(function (v) { assert(lodash_1.find(ret, function (r) { return r.val === 'val' + v; }), 'cant find ' + v); });
|
||||
});
|
||||
var t1 = prov.getAll('test', indexName).then(function (retVal) {
|
||||
var ret = retVal;
|
||||
assert.equal(ret.length, 5, 'getAll');
|
||||
|
@ -294,7 +299,7 @@ describe('NoSqlProvider', function () {
|
|||
var t6count = prov.countRange('test', indexName, formIndex(2), formIndex(4), true, true).then(function (ret) {
|
||||
assert.equal(ret, 1, 'countRange--');
|
||||
});
|
||||
return Promise.all([t1, t1count, t1b, t1c, t2, t2count, t3, t3count, t3b, t3b2, t3b3, t3b4, t3c, t3d, t3d2, t3d3,
|
||||
return Promise.all([t0, t1, t1count, t1b, t1c, t2, t2count, t3, t3count, t3b, t3b2, t3b3, t3b4, t3c, t3d, t3d2, t3d3,
|
||||
t3d4, t4, t4count, t5, t5count, t6, t6count]).then(function () {
|
||||
if (compound) {
|
||||
var tt1 = prov.getRange('test', indexName, formIndex(2, 2), formIndex(4, 3))
|
||||
|
@ -338,7 +343,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
};
|
||||
it('Simple primary key put/get/getAll', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -362,7 +367,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Empty gets/puts', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -385,7 +390,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('getMultiple with blank', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -404,7 +409,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Removing items', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -437,7 +442,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (inclusive low/high)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -468,7 +473,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (exclusive low, inclusive high)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -500,7 +505,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (inclusive low, exclusive high)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -532,7 +537,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (exclusive low, exclusive high)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -565,7 +570,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (nothing done)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -596,7 +601,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove range (all removed)', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -622,7 +627,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Invalid Key Type', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -644,7 +649,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
});
|
||||
it('Primary Key Basic KeyPath', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -658,7 +663,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
var _loop_1 = function (i) {
|
||||
it('Simple index put/get, getAll, getOnly, and getRange' + (i === 0 ? '' : ' (includeData)'), function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -682,7 +687,7 @@ describe('NoSqlProvider', function () {
|
|||
_loop_1(i);
|
||||
}
|
||||
it('Multipart primary key basic test', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -695,7 +700,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Multipart index basic test', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -714,7 +719,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Compound primary key basic test', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -727,7 +732,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Compound index basic test', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -747,7 +752,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
var _loop_2 = function (i) {
|
||||
it('MultiEntry multipart indexed tests' + (i === 0 ? '' : ' (includeData)'), function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -809,7 +814,7 @@ describe('NoSqlProvider', function () {
|
|||
_loop_2(i);
|
||||
}
|
||||
it('MultiEntry multipart indexed - update index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -861,8 +866,42 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('MultiEntry multipart indexed tests - getMultiple', function (done) {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
name: 'test',
|
||||
primaryKeyPath: 'id',
|
||||
indexes: [
|
||||
{
|
||||
name: 'key',
|
||||
multiEntry: true,
|
||||
keyPath: 'k.k'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}, true).then(function (prov) {
|
||||
return prov.put('test', { id: 'a', id2: '1', val: 'b', k: { k: ['w', 'x', 'y', 'z'] } })
|
||||
.then(function () {
|
||||
var g = prov.getMultiple('test', ['x', 'y'], 'key').then(function (retVal) {
|
||||
var ret = retVal;
|
||||
assert.equal(ret.length, 2);
|
||||
ret.forEach(function (r) { assert.equal(r.val, 'b'); });
|
||||
});
|
||||
var g1 = prov.getMultiple('test', ['lala'], 'key').then(function (retVal) {
|
||||
var ret = retVal;
|
||||
assert.equal(ret.length, 0);
|
||||
});
|
||||
return Promise.all([g, g1]).then(function () {
|
||||
return prov.close();
|
||||
});
|
||||
});
|
||||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('MultiEntry multipart indexed tests - Compound Key', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -919,7 +958,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('MultiEntry multipart indexed - update index - Compound', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -975,7 +1014,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
describe('Transaction Semantics', function () {
|
||||
it('Testing transaction expiration', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1009,7 +1048,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Testing aborting', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1042,7 +1081,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
});
|
||||
it('Testing read/write transaction locks', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1092,7 +1131,7 @@ describe('NoSqlProvider', function () {
|
|||
if (provName.indexOf('memory') === -1) {
|
||||
describe('Schema Upgrades', function () {
|
||||
it('Opening an older DB version', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 2,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1124,7 +1163,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Basic NOOP schema upgrade path', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1154,7 +1193,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Adding new store', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1205,7 +1244,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Removing old store', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1239,7 +1278,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Remove store with index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1277,7 +1316,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Add index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1374,16 +1413,16 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
}
|
||||
it('Add index - Large records - batched upgrade', function (done) {
|
||||
return testBatchUpgrade(10000).then(function () { return done(); }, function (err) { return done(err); });
|
||||
testBatchUpgrade(10000).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Add index - small records - No batch upgrade', function (done) {
|
||||
return testBatchUpgrade(1).then(function () { return done(); }, function (err) { return done(err); });
|
||||
testBatchUpgrade(1).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
if (provName.indexOf('indexeddb') !== 0) {
|
||||
// This migration works on indexeddb because we don't check the types and the browsers silently accept it but just
|
||||
// neglect to index the field...
|
||||
it('Add index to boolean field should fail', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1417,7 +1456,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
}
|
||||
it('Add multiEntry index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1466,7 +1505,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Changing multiEntry index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1523,7 +1562,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Removing old index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1561,7 +1600,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Changing index keypath', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1608,7 +1647,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Change non-multientry index to includeDataInIndex', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1659,7 +1698,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Change non-multientry index from includeDataInIndex', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1711,7 +1750,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Change multientry index to includeDataInIndex', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1766,7 +1805,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Change multientry index from includeDataInIndex', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1822,7 +1861,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Adding new FTS store', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1878,7 +1917,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Adding new FTS index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1922,7 +1961,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Removing FTS index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2022,7 +2061,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Adding two indexes at once - backfill and not', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2082,7 +2121,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Change no backfill index into a normal index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2137,7 +2176,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Perform two updates which require no backfill', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2219,7 +2258,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Removes index without pulling data to JS', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2269,7 +2308,7 @@ describe('NoSqlProvider', function () {
|
|||
}).then(function () { return done(); }, function (err) { return done(err); });
|
||||
});
|
||||
it('Add and remove index in the same upgrade', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2326,7 +2365,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
}
|
||||
it('Full Text Index', function (done) {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -5,7 +5,7 @@
|
|||
"author": "David de Regt <David.de.Regt@microsoft.com>",
|
||||
"scripts": {
|
||||
"ci-test": "npm run build && npm run test",
|
||||
"test": "mocha dist/tests/NoSqlProviderTests.js --timeout 5000",
|
||||
"test": "mocha dist/src/tests/NoSqlProviderTests.js --timeout 5000",
|
||||
"webtest": "webpack --watch",
|
||||
"build": "npm run tslint && tsc",
|
||||
"tslint": "tslint --project tsconfig.json -r tslint.json -r ./node_modules/tslint-microsoft-contrib --fix || true"
|
||||
|
|
|
@ -94,6 +94,8 @@ export abstract class DbIndexFTSFromRangeQueries implements DbIndex {
|
|||
|
||||
abstract getAll(reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number)
|
||||
: Promise<ItemType[]>;
|
||||
abstract getMultiple(keyOrKeys: KeyType | KeyType[])
|
||||
: Promise<ItemType[]>;
|
||||
abstract getOnly(key: KeyType, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number)
|
||||
: Promise<ItemType[]>;
|
||||
abstract getRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* NoSqlProvider provider setup for a non-persisted in-memory database backing provider.
|
||||
*/
|
||||
|
||||
import { attempt, isError, each, includes, compact, map, find, values } from 'lodash';
|
||||
import { attempt, isError, each, includes, compact, map, find, values, flatten } from 'lodash';
|
||||
import { DbIndexFTSFromRangeQueries, getFullTextIndexWordsForItem } from './FullTextSearchHelpers';
|
||||
import {
|
||||
StoreSchema, DbProvider, DbSchema, DbTransaction,
|
||||
|
@ -369,6 +369,21 @@ class InMemoryIndex extends DbIndexFTSFromRangeQueries {
|
|||
});
|
||||
}
|
||||
|
||||
getMultiple(keyOrKeys: KeyType|KeyType[]): Promise<ItemType[]> {
|
||||
const joinedKeys = attempt(() => {
|
||||
return formListOfSerializedKeys(keyOrKeys, this._keyPath);
|
||||
});
|
||||
if (isError(joinedKeys)) {
|
||||
return Promise.reject(joinedKeys);
|
||||
}
|
||||
|
||||
let values = [] as ItemType[];
|
||||
for (const key of joinedKeys) {
|
||||
values.push(get(key, this._rbIndex) as ItemType[]);
|
||||
}
|
||||
return Promise.resolve(compact(flatten(values)));
|
||||
}
|
||||
|
||||
public remove(key: string, skipTransactionOnCreation?: boolean) {
|
||||
if (!skipTransactionOnCreation && !this._trans!.internal_isOpen()) {
|
||||
throw new Error('InMemoryTransaction already closed');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* NoSqlProvider provider setup for IndexedDB, a web browser storage module.
|
||||
*/
|
||||
|
||||
import { each, some, find, includes, isObject, attempt, isError, map, filter, compact, clone, isArray, noop } from 'lodash';
|
||||
import { each, some, find, includes, isObject, attempt, isError, map, filter, compact, clone, isArray, noop, flatten } from 'lodash';
|
||||
|
||||
import { DbIndexFTSFromRangeQueries, getFullTextIndexWordsForItem } from './FullTextSearchHelpers';
|
||||
import { DbProvider, DbSchema, DbStore, DbTransaction, StoreSchema, DbIndex, QuerySortOrder, IndexSchema } from './NoSqlProvider';
|
||||
|
@ -482,7 +482,6 @@ class IndexedDbStore implements DbStore {
|
|||
if (isError(keys)) {
|
||||
return Promise.reject(keys);
|
||||
}
|
||||
|
||||
// There isn't a more optimized way to do this with indexeddb, have to get the results one by one
|
||||
return Promise.all(map(keys, key =>
|
||||
IndexedDbProvider.WrapRequest(this._store.get(key)).then(val => removeFullTextMetadataAndReturn(this._schema, val))))
|
||||
|
@ -755,6 +754,25 @@ class IndexedDbIndex extends DbIndexFTSFromRangeQueries {
|
|||
return this._resolveCursorResult(req, limit, offset);
|
||||
}
|
||||
|
||||
getMultiple(keyOrKeys: KeyType | KeyType[])
|
||||
: Promise<ItemType[]> {
|
||||
|
||||
const keys = attempt(() => {
|
||||
const keys = formListOfKeys(keyOrKeys, this._keyPath);
|
||||
return keys;
|
||||
});
|
||||
if (isError(keys)) {
|
||||
return Promise.reject(keys);
|
||||
}
|
||||
|
||||
if (this._store.get && !this._fakeComplicatedKeys) {
|
||||
return Promise.all<object[]>(map(keys, key => IndexedDbProvider.WrapRequest(this._store.get(key)))).then(compact);
|
||||
}
|
||||
|
||||
// when dealing with fakeComplicatedKeys, the store tries to store key and refkey, not the entire object.
|
||||
// therefore it calls getOnly to get the whole object through openCursor
|
||||
return Promise.all(map(keys, key => this.getOnly(key))).then(vals => compact(flatten(vals)));
|
||||
}
|
||||
// Warning: This function can throw, make sure to trap.
|
||||
private _getKeyRangeForOnly(key: KeyType): IDBKeyRange {
|
||||
if (this._fakeComplicatedKeys && isCompoundKeyPath(this._keyPath)) {
|
||||
|
|
|
@ -60,6 +60,7 @@ export enum FullTextTermResolution {
|
|||
// Interface type describing an index being opened for querying.
|
||||
export interface DbIndex {
|
||||
getAll(reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getMultiple(keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]>;
|
||||
getOnly(key: KeyType, reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
getRange(keyLowRange: KeyType, keyHighRange: KeyType, lowRangeExclusive?: boolean, highRangeExclusive?: boolean,
|
||||
reverseOrSortOrder?: boolean | QuerySortOrder, limit?: number, offset?: number): Promise<ItemType[]>;
|
||||
|
@ -169,9 +170,9 @@ export abstract class DbProvider {
|
|||
});
|
||||
}
|
||||
|
||||
getMultiple(storeName: string, keyOrKeys: KeyType | KeyType[]): Promise<ItemType[]> {
|
||||
return this._getStoreTransaction(storeName, false).then(store => {
|
||||
return store.getMultiple(keyOrKeys);
|
||||
getMultiple(storeName: string, keyOrKeys: KeyType | KeyType[], indexName?: string): Promise<ItemType[]> {
|
||||
return this._getStoreIndexTransaction(storeName, false, indexName).then(index => {
|
||||
return index.getMultiple(keyOrKeys);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
]
|
||||
};
|
||||
return openProvider(provName, schema, true)
|
||||
openProvider(provName, schema, true)
|
||||
.then(prov => {
|
||||
// insert some stuff
|
||||
return prov.put('test', { id: 'a', val: 'b' })
|
||||
|
@ -192,6 +192,12 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
};
|
||||
|
||||
let t0 = prov.getMultiple('test', compound ? formIndex(1, 1) : 'indexa1', indexName).then(retVal => {
|
||||
const ret = retVal as TestObj[];
|
||||
assert.equal(ret.length, 1, 'getMultiple');
|
||||
[1].forEach(v => { assert(find(ret, r => r.val === 'val' + v), 'cant find ' + v); });
|
||||
});
|
||||
|
||||
let t1 = prov.getAll('test', indexName).then(retVal => {
|
||||
const ret = retVal as TestObj[];
|
||||
assert.equal(ret.length, 5, 'getAll');
|
||||
|
@ -331,8 +337,8 @@ describe('NoSqlProvider', function () {
|
|||
let t6count = prov.countRange('test', indexName, formIndex(2), formIndex(4), true, true).then(ret => {
|
||||
assert.equal(ret, 1, 'countRange--');
|
||||
});
|
||||
|
||||
return Promise.all([t1, t1count, t1b, t1c, t2, t2count, t3, t3count, t3b, t3b2, t3b3, t3b4, t3c, t3d, t3d2, t3d3,
|
||||
|
||||
return Promise.all([t0, t1, t1count, t1b, t1c, t2, t2count, t3, t3count, t3b, t3b2, t3b3, t3b4, t3c, t3d, t3d2, t3d3,
|
||||
t3d4, t4, t4count, t5, t5count, t6, t6count]).then(() => {
|
||||
if (compound) {
|
||||
let tt1 = prov.getRange('test', indexName, formIndex(2, 2), formIndex(4, 3))
|
||||
|
@ -382,7 +388,7 @@ describe('NoSqlProvider', function () {
|
|||
};
|
||||
|
||||
it('Simple primary key put/get/getAll', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -409,7 +415,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Empty gets/puts', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -433,7 +439,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('getMultiple with blank', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -453,7 +459,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Removing items', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -487,7 +493,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (inclusive low/high)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -519,7 +525,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (exclusive low, inclusive high)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -552,7 +558,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (inclusive low, exclusive high)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -585,7 +591,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (exclusive low, exclusive high)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -619,7 +625,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (nothing done)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -651,7 +657,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove range (all removed)', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -678,7 +684,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Invalid Key Type', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -701,7 +707,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Primary Key Basic KeyPath', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -716,7 +722,7 @@ describe('NoSqlProvider', function () {
|
|||
|
||||
for (let i = 0; i <= 1; i++) {
|
||||
it('Simple index put/get, getAll, getOnly, and getRange' + (i === 0 ? '' : ' (includeData)'), (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -738,7 +744,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
|
||||
it('Multipart primary key basic test', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -752,7 +758,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Multipart index basic test', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -772,7 +778,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Compound primary key basic test', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -786,7 +792,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Compound index basic test', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -807,7 +813,7 @@ describe('NoSqlProvider', function () {
|
|||
|
||||
for (let i = 0; i <= 1; i++) {
|
||||
it('MultiEntry multipart indexed tests' + (i === 0 ? '' : ' (includeData)'), (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -867,7 +873,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
|
||||
it('MultiEntry multipart indexed - update index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -920,8 +926,43 @@ describe('NoSqlProvider', function () {
|
|||
}).then(() => done(), (err) => done(err));
|
||||
});
|
||||
|
||||
it('MultiEntry multipart indexed tests - getMultiple', (done) => {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
name: 'test',
|
||||
primaryKeyPath: 'id',
|
||||
indexes: [
|
||||
{
|
||||
name: 'key',
|
||||
multiEntry: true,
|
||||
keyPath: 'k.k'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}, true).then(prov => {
|
||||
return prov.put('test', { id: 'a', id2: '1', val: 'b', k: { k: ['w', 'x', 'y', 'z'] } })
|
||||
.then(() => {
|
||||
var g = prov.getMultiple('test', ['x', 'y'], 'key').then(retVal => {
|
||||
const ret = retVal as TestObj[];
|
||||
assert.equal(ret.length, 2);
|
||||
ret.forEach(r => { assert.equal(r.val, 'b'); });
|
||||
});
|
||||
var g1 = prov.getMultiple('test', ['lala'], 'key').then(retVal => {
|
||||
const ret = retVal as TestObj[];
|
||||
assert.equal(ret.length, 0);
|
||||
});
|
||||
return Promise.all([g, g1]).then(() => {
|
||||
return prov.close();
|
||||
});
|
||||
});
|
||||
}).then(() => done(), (err) => done(err));
|
||||
});
|
||||
|
||||
it('MultiEntry multipart indexed tests - Compound Key', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -979,7 +1020,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('MultiEntry multipart indexed - update index - Compound', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1036,7 +1077,7 @@ describe('NoSqlProvider', function () {
|
|||
|
||||
describe('Transaction Semantics', () => {
|
||||
it('Testing transaction expiration', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1071,7 +1112,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Testing aborting', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1105,7 +1146,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Testing read/write transaction locks', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1156,7 +1197,7 @@ describe('NoSqlProvider', function () {
|
|||
if (provName.indexOf('memory') === -1) {
|
||||
describe('Schema Upgrades', () => {
|
||||
it('Opening an older DB version', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 2,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1189,7 +1230,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Basic NOOP schema upgrade path', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1220,7 +1261,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Adding new store', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1272,7 +1313,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Removing old store', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1307,7 +1348,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Remove store with index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1346,7 +1387,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Add index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1445,18 +1486,18 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
|
||||
it('Add index - Large records - batched upgrade', (done) => {
|
||||
return testBatchUpgrade(10000).then(() => done(), (err) => done(err));
|
||||
testBatchUpgrade(10000).then(() => done(), (err) => done(err));
|
||||
});
|
||||
|
||||
it('Add index - small records - No batch upgrade', (done) => {
|
||||
return testBatchUpgrade(1).then(() => done(), (err) => done(err));
|
||||
testBatchUpgrade(1).then(() => done(), (err) => done(err));
|
||||
});
|
||||
|
||||
if (provName.indexOf('indexeddb') !== 0) {
|
||||
// This migration works on indexeddb because we don't check the types and the browsers silently accept it but just
|
||||
// neglect to index the field...
|
||||
it('Add index to boolean field should fail', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1491,7 +1532,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
|
||||
it('Add multiEntry index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1541,7 +1582,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Changing multiEntry index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1599,7 +1640,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Removing old index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1638,7 +1679,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Changing index keypath', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1686,7 +1727,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Change non-multientry index to includeDataInIndex', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1738,7 +1779,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Change non-multientry index from includeDataInIndex', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1791,7 +1832,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Change multientry index to includeDataInIndex', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1847,7 +1888,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Change multientry index from includeDataInIndex', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1904,7 +1945,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Adding new FTS store', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -1961,7 +2002,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Adding new FTS index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2006,7 +2047,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Removing FTS index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2109,7 +2150,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Adding two indexes at once - backfill and not', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2170,7 +2211,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Change no backfill index into a normal index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2226,7 +2267,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Perform two updates which require no backfill', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2309,7 +2350,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Removes index without pulling data to JS', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2360,7 +2401,7 @@ describe('NoSqlProvider', function () {
|
|||
});
|
||||
|
||||
it('Add and remove index in the same upgrade', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
@ -2419,7 +2460,7 @@ describe('NoSqlProvider', function () {
|
|||
}
|
||||
|
||||
it('Full Text Index', (done) => {
|
||||
return openProvider(provName, {
|
||||
openProvider(provName, {
|
||||
version: 1,
|
||||
stores: [
|
||||
{
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mocha Tests</title>
|
||||
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
|
||||
<link href="node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
|
||||
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
|
||||
<script src="node_modules/mocha/mocha.js"></script>
|
||||
|
||||
<script>mocha.setup({ui: 'bdd'})</script>
|
||||
<script src="dist/NoSqlProviderTestsPack.js"></script>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"forin": true,
|
||||
"indent": [true, "spaces"],
|
||||
"label-position": true,
|
||||
"max-line-length": [ true, 140 ],
|
||||
"max-line-length": [ true, 180 ],
|
||||
"no-arg": true,
|
||||
"no-bitwise": false,
|
||||
"no-consecutive-blank-lines": true,
|
||||
|
|
Загрузка…
Ссылка в новой задаче