Skip to content

Commit 5c7ca2c

Browse files
committed
- rename "exists" method to "exist" for Hive(str).Store
1 parent 3d67522 commit 5c7ca2c

File tree

8 files changed

+97
-97
lines changed

8 files changed

+97
-97
lines changed

backendless.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ declare module Backendless {
336336

337337
delete(keys: Array<string>): Promise<void>;
338338

339-
exists(keys: Array<string>): Promise<number>;
339+
exist(keys: Array<string>): Promise<number>;
340340

341341
touch(keys: Array<string>): Promise<void>;
342342
}
@@ -350,7 +350,7 @@ declare module Backendless {
350350

351351
rename(newKeyName: string, overwrite?: boolean): Promise<void>;
352352

353-
exists(): Promise<boolean>;
353+
exist(): Promise<boolean>;
354354

355355
getExpiration(): Promise<number>;
356356

src/hive/stores/base-store.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Utils from '../../utils'
22

33
export class HiveStore {
44

5-
static STATIC_METHODS = ['keys', 'delete', 'exists', 'touch']
5+
static STATIC_METHODS = ['keys', 'delete', 'exist', 'touch']
66

77
static registerType(hive) {
88
const context = { ...this, app: hive.app, hiveName: hive.hiveName }
@@ -68,14 +68,14 @@ export class HiveStore {
6868
})
6969
}
7070

71-
static exists(keys) {
71+
static exist(keys) {
7272
if (!Array.isArray(keys)) {
7373
throw new Error('Keys must be provided and must be a list of strings.')
7474
}
7575

7676
return this.app.request
7777
.post({
78-
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/exists`,
78+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/exist`,
7979
data: keys
8080
})
8181
}
@@ -100,8 +100,8 @@ export class HiveStore {
100100
return this.constructor.delete.call({ ...this, ...this.constructor }, [this.storeKey])
101101
}
102102

103-
async exists() {
104-
const result = await this.constructor.exists.call({ ...this, ...this.constructor }, [this.storeKey])
103+
async exist() {
104+
const result = await this.constructor.exist.call({ ...this, ...this.constructor }, [this.storeKey])
105105

106106
return !!result
107107
}

test/tsd.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -744,14 +744,14 @@ function testHiveStores() {
744744
promiseStoreKeysResult = Backendless.Hive(str).KeyValueStore.keys(storeKeysOptions);
745745

746746
promiseVoid = Backendless.Hive(str).KeyValueStore.delete(strArr);
747-
promiseNumber = Backendless.Hive(str).KeyValueStore.exists(strArr);
747+
promiseNumber = Backendless.Hive(str).KeyValueStore.exist(strArr);
748748
promiseVoid = Backendless.Hive(str).KeyValueStore.touch(strArr);
749749
}
750750

751751
function testGeneralInstance() {
752752
promiseNumber = Backendless.Hive(str).KeyValueStore(str).delete();
753753

754-
promiseBoolean = Backendless.Hive(str).KeyValueStore(str).exists();
754+
promiseBoolean = Backendless.Hive(str).KeyValueStore(str).exist();
755755

756756
promiseVoid = Backendless.Hive(str).KeyValueStore(str).rename(str);
757757
promiseVoid = Backendless.Hive(str).KeyValueStore(str).rename(str, bool);
@@ -808,14 +808,14 @@ function testHiveStores() {
808808
promiseStoreKeysResult = Backendless.Hive(str).ListStore.keys(storeKeysOptions);
809809

810810
promiseVoid = Backendless.Hive(str).ListStore.delete(strArr);
811-
promiseNumber = Backendless.Hive(str).ListStore.exists(strArr);
811+
promiseNumber = Backendless.Hive(str).ListStore.exist(strArr);
812812
promiseVoid = Backendless.Hive(str).ListStore.touch(strArr);
813813
}
814814

815815
function testGeneralInstance() {
816816
promiseNumber = Backendless.Hive(str).ListStore(str).delete();
817817

818-
promiseBoolean = Backendless.Hive(str).ListStore(str).exists();
818+
promiseBoolean = Backendless.Hive(str).ListStore(str).exist();
819819

820820
promiseVoid = Backendless.Hive(str).ListStore(str).rename(str);
821821
promiseVoid = Backendless.Hive(str).ListStore(str).rename(str, bool);
@@ -903,14 +903,14 @@ function testHiveStores() {
903903
promiseStoreKeysResult = Backendless.Hive(str).MapStore.keys(storeKeysOptions);
904904

905905
promiseVoid = Backendless.Hive(str).MapStore.delete(strArr);
906-
promiseNumber = Backendless.Hive(str).MapStore.exists(strArr);
906+
promiseNumber = Backendless.Hive(str).MapStore.exist(strArr);
907907
promiseVoid = Backendless.Hive(str).MapStore.touch(strArr);
908908
}
909909

910910
function testGeneralInstance() {
911911
promiseNumber = Backendless.Hive(str).MapStore(str).delete();
912912

913-
promiseBoolean = Backendless.Hive(str).MapStore(str).exists();
913+
promiseBoolean = Backendless.Hive(str).MapStore(str).exist();
914914

915915
promiseVoid = Backendless.Hive(str).MapStore(str).rename(str);
916916
promiseVoid = Backendless.Hive(str).MapStore(str).rename(str, bool);
@@ -975,14 +975,14 @@ function testHiveStores() {
975975
promiseStoreKeysResult = Backendless.Hive(str).SetStore.keys(storeKeysOptions);
976976

977977
promiseVoid = Backendless.Hive(str).SetStore.delete(strArr);
978-
promiseNumber = Backendless.Hive(str).SetStore.exists(strArr);
978+
promiseNumber = Backendless.Hive(str).SetStore.exist(strArr);
979979
promiseVoid = Backendless.Hive(str).SetStore.touch(strArr);
980980
}
981981

982982
function testGeneralInstance() {
983983
promiseNumber = Backendless.Hive(str).SetStore(str).delete();
984984

985-
promiseBoolean = Backendless.Hive(str).SetStore(str).exists();
985+
promiseBoolean = Backendless.Hive(str).SetStore(str).exist();
986986

987987
promiseVoid = Backendless.Hive(str).SetStore(str).rename(str);
988988
promiseVoid = Backendless.Hive(str).SetStore(str).rename(str, bool);
@@ -1065,14 +1065,14 @@ function testHiveStores() {
10651065
promiseStoreKeysResult = Backendless.Hive(str).SortedSetStore.keys(storeKeysOptions);
10661066

10671067
promiseVoid = Backendless.Hive(str).SortedSetStore.delete(strArr);
1068-
promiseNumber = Backendless.Hive(str).SortedSetStore.exists(strArr);
1068+
promiseNumber = Backendless.Hive(str).SortedSetStore.exist(strArr);
10691069
promiseVoid = Backendless.Hive(str).SortedSetStore.touch(strArr);
10701070
}
10711071

10721072
function testGeneralInstance() {
10731073
promiseNumber = Backendless.Hive(str).SortedSetStore(str).delete();
10741074

1075-
promiseBoolean = Backendless.Hive(str).SortedSetStore(str).exists();
1075+
promiseBoolean = Backendless.Hive(str).SortedSetStore(str).exist();
10761076

10771077
promiseVoid = Backendless.Hive(str).SortedSetStore(str).rename(str);
10781078
promiseVoid = Backendless.Hive(str).SortedSetStore(str).rename(str, bool);

test/unit/specs/hive/key-value.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ describe('Hive - Key Value Store', function() {
140140
it('success with multi keys', async () => {
141141
const request = prepareMockRequest(fakeResult)
142142

143-
const result = await Store.exists(['testKey1', 'testKey1'])
143+
const result = await Store.exist(['testKey1', 'testKey1'])
144144

145145
expect(request).to.deep.include({
146146
method : 'POST',
147-
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exists`,
147+
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exist`,
148148
headers: { 'Content-Type': 'application/json' },
149149
body : ['testKey1', 'testKey1']
150150
})
@@ -155,16 +155,16 @@ describe('Hive - Key Value Store', function() {
155155
it('fails when key(s) is invalid', async () => {
156156
const errorMsg = 'Keys must be provided and must be a list of strings.'
157157

158-
await expect(() => Store.exists(undefined)).to.throw(errorMsg)
159-
await expect(() => Store.exists(null)).to.throw(errorMsg)
160-
await expect(() => Store.exists(false)).to.throw(errorMsg)
161-
await expect(() => Store.exists(true)).to.throw(errorMsg)
162-
await expect(() => Store.exists('')).to.throw(errorMsg)
163-
await expect(() => Store.exists('key')).to.throw(errorMsg)
164-
await expect(() => Store.exists(0)).to.throw(errorMsg)
165-
await expect(() => Store.exists(123)).to.throw(errorMsg)
166-
await expect(() => Store.exists(() => undefined)).to.throw(errorMsg)
167-
await expect(() => Store.exists({})).to.throw(errorMsg)
158+
await expect(() => Store.exist(undefined)).to.throw(errorMsg)
159+
await expect(() => Store.exist(null)).to.throw(errorMsg)
160+
await expect(() => Store.exist(false)).to.throw(errorMsg)
161+
await expect(() => Store.exist(true)).to.throw(errorMsg)
162+
await expect(() => Store.exist('')).to.throw(errorMsg)
163+
await expect(() => Store.exist('key')).to.throw(errorMsg)
164+
await expect(() => Store.exist(0)).to.throw(errorMsg)
165+
await expect(() => Store.exist(123)).to.throw(errorMsg)
166+
await expect(() => Store.exist(() => undefined)).to.throw(errorMsg)
167+
await expect(() => Store.exist({})).to.throw(errorMsg)
168168
})
169169
})
170170

@@ -241,19 +241,19 @@ describe('Hive - Key Value Store', function() {
241241
const req1 = prepareMockRequest(1)
242242
const req2 = prepareMockRequest(0)
243243

244-
const result1 = await store.exists(storeKey)
245-
const result2 = await store.exists(storeKey)
244+
const result1 = await store.exist(storeKey)
245+
const result2 = await store.exist(storeKey)
246246

247247
expect(req1).to.deep.include({
248248
method : 'POST',
249-
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exists`,
249+
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exist`,
250250
headers: { 'Content-Type': 'application/json' },
251251
body : [storeKey]
252252
})
253253

254254
expect(req2).to.deep.include({
255255
method : 'POST',
256-
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exists`,
256+
path : `${APP_PATH}/hive/${hiveName}/key-value/action/exist`,
257257
headers: { 'Content-Type': 'application/json' },
258258
body : [storeKey]
259259
})

test/unit/specs/hive/list.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ describe('Hive - List Store', function() {
141141
it('success with multi keys', async () => {
142142
const request = prepareMockRequest(fakeResult)
143143

144-
const result = await Store.exists(['testKey1', 'testKey1'])
144+
const result = await Store.exist(['testKey1', 'testKey1'])
145145

146146
expect(request).to.deep.include({
147147
method : 'POST',
148-
path : `${APP_PATH}/hive/${hiveName}/list/action/exists`,
148+
path : `${APP_PATH}/hive/${hiveName}/list/action/exist`,
149149
headers: { 'Content-Type': 'application/json' },
150150
body : ['testKey1', 'testKey1']
151151
})
@@ -156,16 +156,16 @@ describe('Hive - List Store', function() {
156156
it('fails when key(s) is invalid', async () => {
157157
const errorMsg = 'Keys must be provided and must be a list of strings.'
158158

159-
await expect(() => Store.exists(undefined)).to.throw(errorMsg)
160-
await expect(() => Store.exists(null)).to.throw(errorMsg)
161-
await expect(() => Store.exists(false)).to.throw(errorMsg)
162-
await expect(() => Store.exists(true)).to.throw(errorMsg)
163-
await expect(() => Store.exists('')).to.throw(errorMsg)
164-
await expect(() => Store.exists('key')).to.throw(errorMsg)
165-
await expect(() => Store.exists(0)).to.throw(errorMsg)
166-
await expect(() => Store.exists(123)).to.throw(errorMsg)
167-
await expect(() => Store.exists(() => undefined)).to.throw(errorMsg)
168-
await expect(() => Store.exists({})).to.throw(errorMsg)
159+
await expect(() => Store.exist(undefined)).to.throw(errorMsg)
160+
await expect(() => Store.exist(null)).to.throw(errorMsg)
161+
await expect(() => Store.exist(false)).to.throw(errorMsg)
162+
await expect(() => Store.exist(true)).to.throw(errorMsg)
163+
await expect(() => Store.exist('')).to.throw(errorMsg)
164+
await expect(() => Store.exist('key')).to.throw(errorMsg)
165+
await expect(() => Store.exist(0)).to.throw(errorMsg)
166+
await expect(() => Store.exist(123)).to.throw(errorMsg)
167+
await expect(() => Store.exist(() => undefined)).to.throw(errorMsg)
168+
await expect(() => Store.exist({})).to.throw(errorMsg)
169169
})
170170
})
171171

@@ -243,19 +243,19 @@ describe('Hive - List Store', function() {
243243
const req1 = prepareMockRequest(1)
244244
const req2 = prepareMockRequest(0)
245245

246-
const result1 = await store.exists(storeKey)
247-
const result2 = await store.exists(storeKey)
246+
const result1 = await store.exist(storeKey)
247+
const result2 = await store.exist(storeKey)
248248

249249
expect(req1).to.deep.include({
250250
method : 'POST',
251-
path : `${APP_PATH}/hive/${hiveName}/list/action/exists`,
251+
path : `${APP_PATH}/hive/${hiveName}/list/action/exist`,
252252
headers: { 'Content-Type': 'application/json' },
253253
body : [storeKey]
254254
})
255255

256256
expect(req2).to.deep.include({
257257
method : 'POST',
258-
path : `${APP_PATH}/hive/${hiveName}/list/action/exists`,
258+
path : `${APP_PATH}/hive/${hiveName}/list/action/exist`,
259259
headers: { 'Content-Type': 'application/json' },
260260
body : [storeKey]
261261
})

test/unit/specs/hive/map.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ describe('Hive - Map Store', function() {
140140
it('success with multi keys', async () => {
141141
const request = prepareMockRequest(fakeResult)
142142

143-
const result = await Store.exists(['testKey1', 'testKey1'])
143+
const result = await Store.exist(['testKey1', 'testKey1'])
144144

145145
expect(request).to.deep.include({
146146
method : 'POST',
147-
path : `${APP_PATH}/hive/${hiveName}/map/action/exists`,
147+
path : `${APP_PATH}/hive/${hiveName}/map/action/exist`,
148148
headers: { 'Content-Type': 'application/json' },
149149
body : ['testKey1', 'testKey1']
150150
})
@@ -155,16 +155,16 @@ describe('Hive - Map Store', function() {
155155
it('fails when key(s) is invalid', async () => {
156156
const errorMsg = 'Keys must be provided and must be a list of strings.'
157157

158-
await expect(() => Store.exists(undefined)).to.throw(errorMsg)
159-
await expect(() => Store.exists(null)).to.throw(errorMsg)
160-
await expect(() => Store.exists(false)).to.throw(errorMsg)
161-
await expect(() => Store.exists(true)).to.throw(errorMsg)
162-
await expect(() => Store.exists('')).to.throw(errorMsg)
163-
await expect(() => Store.exists('key')).to.throw(errorMsg)
164-
await expect(() => Store.exists(0)).to.throw(errorMsg)
165-
await expect(() => Store.exists(123)).to.throw(errorMsg)
166-
await expect(() => Store.exists(() => undefined)).to.throw(errorMsg)
167-
await expect(() => Store.exists({})).to.throw(errorMsg)
158+
await expect(() => Store.exist(undefined)).to.throw(errorMsg)
159+
await expect(() => Store.exist(null)).to.throw(errorMsg)
160+
await expect(() => Store.exist(false)).to.throw(errorMsg)
161+
await expect(() => Store.exist(true)).to.throw(errorMsg)
162+
await expect(() => Store.exist('')).to.throw(errorMsg)
163+
await expect(() => Store.exist('key')).to.throw(errorMsg)
164+
await expect(() => Store.exist(0)).to.throw(errorMsg)
165+
await expect(() => Store.exist(123)).to.throw(errorMsg)
166+
await expect(() => Store.exist(() => undefined)).to.throw(errorMsg)
167+
await expect(() => Store.exist({})).to.throw(errorMsg)
168168
})
169169
})
170170

@@ -242,19 +242,19 @@ describe('Hive - Map Store', function() {
242242
const req1 = prepareMockRequest(1)
243243
const req2 = prepareMockRequest(0)
244244

245-
const result1 = await store.exists(storeKey)
246-
const result2 = await store.exists(storeKey)
245+
const result1 = await store.exist(storeKey)
246+
const result2 = await store.exist(storeKey)
247247

248248
expect(req1).to.deep.include({
249249
method : 'POST',
250-
path : `${APP_PATH}/hive/${hiveName}/map/action/exists`,
250+
path : `${APP_PATH}/hive/${hiveName}/map/action/exist`,
251251
headers: { 'Content-Type': 'application/json' },
252252
body : [storeKey]
253253
})
254254

255255
expect(req2).to.deep.include({
256256
method : 'POST',
257-
path : `${APP_PATH}/hive/${hiveName}/map/action/exists`,
257+
path : `${APP_PATH}/hive/${hiveName}/map/action/exist`,
258258
headers: { 'Content-Type': 'application/json' },
259259
body : [storeKey]
260260
})

test/unit/specs/hive/set.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ describe('Hive - Set Store', function() {
140140
it('success with multi keys', async () => {
141141
const request = prepareMockRequest(fakeResult)
142142

143-
const result = await Store.exists(['testKey1', 'testKey1'])
143+
const result = await Store.exist(['testKey1', 'testKey1'])
144144

145145
expect(request).to.deep.include({
146146
method : 'POST',
147-
path : `${APP_PATH}/hive/${hiveName}/set/action/exists`,
147+
path : `${APP_PATH}/hive/${hiveName}/set/action/exist`,
148148
headers: { 'Content-Type': 'application/json' },
149149
body : ['testKey1', 'testKey1']
150150
})
@@ -155,16 +155,16 @@ describe('Hive - Set Store', function() {
155155
it('fails when key(s) is invalid', async () => {
156156
const errorMsg = 'Keys must be provided and must be a list of strings.'
157157

158-
await expect(() => Store.exists(undefined)).to.throw(errorMsg)
159-
await expect(() => Store.exists(null)).to.throw(errorMsg)
160-
await expect(() => Store.exists(false)).to.throw(errorMsg)
161-
await expect(() => Store.exists(true)).to.throw(errorMsg)
162-
await expect(() => Store.exists('')).to.throw(errorMsg)
163-
await expect(() => Store.exists('key')).to.throw(errorMsg)
164-
await expect(() => Store.exists(0)).to.throw(errorMsg)
165-
await expect(() => Store.exists(123)).to.throw(errorMsg)
166-
await expect(() => Store.exists(() => undefined)).to.throw(errorMsg)
167-
await expect(() => Store.exists({})).to.throw(errorMsg)
158+
await expect(() => Store.exist(undefined)).to.throw(errorMsg)
159+
await expect(() => Store.exist(null)).to.throw(errorMsg)
160+
await expect(() => Store.exist(false)).to.throw(errorMsg)
161+
await expect(() => Store.exist(true)).to.throw(errorMsg)
162+
await expect(() => Store.exist('')).to.throw(errorMsg)
163+
await expect(() => Store.exist('key')).to.throw(errorMsg)
164+
await expect(() => Store.exist(0)).to.throw(errorMsg)
165+
await expect(() => Store.exist(123)).to.throw(errorMsg)
166+
await expect(() => Store.exist(() => undefined)).to.throw(errorMsg)
167+
await expect(() => Store.exist({})).to.throw(errorMsg)
168168
})
169169
})
170170

@@ -242,19 +242,19 @@ describe('Hive - Set Store', function() {
242242
const req1 = prepareMockRequest(1)
243243
const req2 = prepareMockRequest(0)
244244

245-
const result1 = await store.exists(storeKey)
246-
const result2 = await store.exists(storeKey)
245+
const result1 = await store.exist(storeKey)
246+
const result2 = await store.exist(storeKey)
247247

248248
expect(req1).to.deep.include({
249249
method : 'POST',
250-
path : `${APP_PATH}/hive/${hiveName}/set/action/exists`,
250+
path : `${APP_PATH}/hive/${hiveName}/set/action/exist`,
251251
headers: { 'Content-Type': 'application/json' },
252252
body : [storeKey]
253253
})
254254

255255
expect(req2).to.deep.include({
256256
method : 'POST',
257-
path : `${APP_PATH}/hive/${hiveName}/set/action/exists`,
257+
path : `${APP_PATH}/hive/${hiveName}/set/action/exist`,
258258
headers: { 'Content-Type': 'application/json' },
259259
body : [storeKey]
260260
})

0 commit comments

Comments
 (0)