Socket
Socket
Sign inDemoInstall

kinvey-js-sdk

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kinvey-js-sdk - npm Package Compare versions

Comparing version 3.13.0-next.31 to 3.13.0-next.33

4

lib/datastore/cache.d.ts
import { Storage, Entity } from '../storage';
import { HttpResponse } from '../http';
import { Query } from '../query';

@@ -17,4 +16,2 @@ export declare function isValidTag(tag: string): boolean;

serializeQuery(query?: Query): string;
findByKey(key: string): Promise<QueryEntity>;
saveQuery(query: Query, response: HttpResponse): Promise<QueryEntity>;
}

@@ -28,3 +25,2 @@ export declare enum SyncEvent {

entityId: string;
entity: Entity;
collection: string;

@@ -31,0 +27,0 @@ state: {

@@ -6,4 +6,2 @@ Object.defineProperty(exports, "__esModule", { value: true });

var storage_1 = require("../storage");
var http_1 = require("../http");
var query_1 = require("../query");
var kinvey_1 = require("../kinvey");

@@ -53,39 +51,2 @@ var QUERY_CACHE_TAG = '_QueryCache';

};
QueryCache.prototype.findByKey = function (key) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var query, docs;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
query = new query_1.Query().equalTo('query', key);
return [4 /*yield*/, this.find(query)];
case 1:
docs = _a.sent();
return [2 /*return*/, docs.shift()];
}
});
});
};
QueryCache.prototype.saveQuery = function (query, response) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var key, headers, doc;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
key = this.serializeQuery(query);
if (!(key !== null)) return [3 /*break*/, 2];
headers = new http_1.KinveyHttpHeaders(response.headers.toPlainObject());
return [4 /*yield*/, this.findByKey(key)];
case 1:
doc = _a.sent();
if (!doc) {
doc = { collectionName: this.collectionName, query: key, lastRequest: null };
}
doc.lastRequest = headers.requestStart;
return [2 /*return*/, _super.prototype.save.call(this, doc)];
case 2: return [2 /*return*/, null];
}
});
});
};
return QueryCache;

@@ -92,0 +53,0 @@ }(DataStoreCache));

110

lib/datastore/cachestore.js

@@ -276,3 +276,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

return tslib_1.__awaiter(this, void 0, void 0, function () {
var autoSync, cache, sync, count, docs, findQuery, syncDocs, pushQuery, pushResults;
var autoSync, cache, sync, count, docs, network, result;
return tslib_1.__generator(this, function (_a) {

@@ -301,17 +301,12 @@ switch (_a.label) {

if (!autoSync) return [3 /*break*/, 7];
findQuery = sync_1.queryToSyncQuery(query, this.collectionName);
return [4 /*yield*/, sync.find(findQuery)];
network = new networkstore_1.NetworkStore(this.collectionName);
return [4 /*yield*/, network.remove(query, options)];
case 5:
syncDocs = _a.sent();
if (!(syncDocs.length > 0)) return [3 /*break*/, 7];
pushQuery = new query_1.Query().contains('_id', syncDocs.map(function (doc) { return doc._id; }));
return [4 /*yield*/, sync.push(pushQuery)];
result = _a.sent();
count = result.count;
// Clear the sync items that match the query
return [4 /*yield*/, this.clearSync(query)];
case 6:
pushResults = _a.sent();
count = pushResults.reduce(function (count, pushResult) {
if (pushResult.error) {
return count - 1;
}
return count;
}, count || syncDocs.length);
// Clear the sync items that match the query
_a.sent();
_a.label = 7;

@@ -388,3 +383,3 @@ case 7: return [2 /*return*/, { count: count }];

}
// Return the cound
// Return the count
return [2 /*return*/, { count: count }];

@@ -402,3 +397,3 @@ }

return tslib_1.__awaiter(this, void 0, void 0, function () {
var network, cache, queryCache, useDeltaSet, useAutoPagination, count, key, queryCacheDoc, queryObject, url, request, response_1, _a, changed, deleted, removeQuery, error_5, response_2, count_1, pageSize_1, pageCount, pageQueries, pagePromises, pageCounts, totalPageCount, response, docs;
var network, cache, queryCache, useDeltaSet, useAutoPagination, queryKey, findQueryCacheQuery, queryCacheDocs, queryCacheDoc, count, queryObject, url, request, response_1, _a, changed, deleted, removeQuery, headers_1, error_5, response_2, count_1, pageSize_1, pageCount, pageQueries, pagePromises, pageCounts, totalPageCount, headers_2, response, docs, headers;
return tslib_1.__generator(this, function (_b) {

@@ -412,4 +407,10 @@ switch (_b.label) {

useAutoPagination = options.useAutoPagination === true || options.autoPagination || this.useAutoPagination;
queryKey = queryCache.serializeQuery(query);
findQueryCacheQuery = new query_1.Query().equalTo('query', queryKey).equalTo('collectionName', this.collectionName);
return [4 /*yield*/, queryCache.find(findQueryCacheQuery)];
case 1:
queryCacheDocs = _b.sent();
queryCacheDoc = queryCacheDocs.shift() || { collectionName: this.collectionName, query: queryKey, lastRequest: null };
return [4 /*yield*/, this.pendingSyncCount()];
case 1:
case 2:
count = _b.sent();

@@ -429,12 +430,6 @@ if (count > 0) {

}
if (!(useDeltaSet && (!query || (query.skip === 0 && query.limit === Number.MAX_SAFE_INTEGER)))) return [3 /*break*/, 12];
_b.label = 2;
case 2:
_b.trys.push([2, 11, , 12]);
key = queryCache.serializeQuery(query);
if (!(key !== null)) return [3 /*break*/, 10];
return [4 /*yield*/, queryCache.findByKey(key)];
if (!(useDeltaSet && queryCacheDoc && queryCacheDoc.lastRequest)) return [3 /*break*/, 11];
_b.label = 3;
case 3:
queryCacheDoc = _b.sent();
if (!(queryCacheDoc && queryCacheDoc.lastRequest)) return [3 /*break*/, 10];
_b.trys.push([3, 10, , 11]);
queryObject = { since: queryCacheDoc.lastRequest };

@@ -462,12 +457,11 @@ if (query) {

_b.label = 8;
case 8:
// Update the query cache
return [4 /*yield*/, queryCache.saveQuery(query, response_1)];
case 8:
headers_1 = new http_1.KinveyHttpHeaders(response_1.headers.toPlainObject());
queryCacheDoc.lastRequest = headers_1.requestStart;
return [4 /*yield*/, queryCache.save(queryCacheDoc)];
case 9:
// Update the query cache
_b.sent();
// Return the number of changed docs
return [2 /*return*/, changed.length];
case 10: return [3 /*break*/, 12];
case 11:
case 10:
error_5 = _b.sent();

@@ -477,12 +471,12 @@ if (!(error_5 instanceof missingConfiguration_1.MissingConfigurationError) && !(error_5 instanceof parameterValueOutOfRange_1.ParameterValueOutOfRangeError)) {

}
return [3 /*break*/, 12];
case 12:
return [3 /*break*/, 11];
case 11:
if (!useAutoPagination) return [3 /*break*/, 16];
// Clear the cache
return [4 /*yield*/, cache.clear()];
case 13:
case 12:
// Clear the cache
_b.sent();
return [4 /*yield*/, network.count(query, Object.assign({}, options, { rawResponse: true })).toPromise()];
case 14:
case 13:
response_2 = _b.sent();

@@ -504,7 +498,10 @@ count_1 = 'count' in response_2.data ? response_2.data.count : Number.MAX_SAFE_INTEGER;

return [4 /*yield*/, Promise.all(pagePromises)];
case 15:
case 14:
pageCounts = _b.sent();
totalPageCount = pageCounts.reduce(function (totalCount, pageCount) { return totalCount + pageCount; }, 0);
// Update the query cache
queryCache.saveQuery(query, response_2);
headers_2 = new http_1.KinveyHttpHeaders(response_2.headers.toPlainObject());
queryCacheDoc.lastRequest = headers_2.requestStart;
return [4 /*yield*/, queryCache.save(queryCacheDoc)];
case 15:
_b.sent();
// Return the total page count

@@ -531,6 +528,6 @@ return [2 /*return*/, totalPageCount];

_b.sent();
// Update the query cache
return [4 /*yield*/, queryCache.saveQuery(query, response)];
headers = new http_1.KinveyHttpHeaders(response.headers.toPlainObject());
queryCacheDoc.lastRequest = headers.requestStart;
return [4 /*yield*/, queryCache.save(queryCacheDoc)];
case 23:
// Update the query cache
_b.sent();

@@ -613,5 +610,9 @@ // Return the number of docs

CacheStore.prototype.pendingSyncDocs = function (query) {
var sync = new sync_1.Sync(this.collectionName, this.tag);
var findQuery = sync_1.queryToSyncQuery(query, this.collectionName);
return sync.find(findQuery);
return tslib_1.__awaiter(this, void 0, void 0, function () {
var sync;
return tslib_1.__generator(this, function (_a) {
sync = new sync_1.Sync(this.collectionName, this.tag);
return [2 /*return*/, sync.find(sync_1.queryToSyncQuery(query))];
});
});
};

@@ -622,13 +623,20 @@ CacheStore.prototype.pendingSyncEntities = function (query) {

CacheStore.prototype.pendingSyncCount = function (query) {
var sync = new sync_1.Sync(this.collectionName, this.tag);
var findQuery = sync_1.queryToSyncQuery(query, this.collectionName);
return sync.count(findQuery);
return tslib_1.__awaiter(this, void 0, void 0, function () {
var syncDocs;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.pendingSyncDocs(query)];
case 1:
syncDocs = _a.sent();
return [2 /*return*/, syncDocs.length];
}
});
});
};
CacheStore.prototype.clearSync = function (query) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var sync, clearQuery;
var sync;
return tslib_1.__generator(this, function (_a) {
sync = new sync_1.Sync(this.collectionName, this.tag);
clearQuery = sync_1.queryToSyncQuery(query, this.collectionName);
return [2 /*return*/, sync.remove(clearQuery)];
return [2 /*return*/, sync.remove(sync_1.queryToSyncQuery(query))];
});

@@ -635,0 +643,0 @@ });

@@ -15,3 +15,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: method,
auth: http_1.KinveyHttpAuth.Session,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: url,

@@ -18,0 +18,0 @@ body: body

import { Query } from '../query';
import { SyncEvent } from './cache';
export declare function queryToSyncQuery(query?: Query, collectionName?: string): Query;
export declare function queryToSyncQuery(query?: Query): Query;
export declare class Sync {

@@ -9,5 +9,5 @@ collectionName: string;

isPushInProgress(): boolean;
find(query?: Query): Promise<import("./cache").SyncEntity[]>;
find(providedQuery?: Query): Promise<import("./cache").SyncEntity[]>;
findById(id: string): Promise<import("../storage").Entity>;
count(query?: Query): Promise<number>;
count(providedQuery?: Query): Promise<number>;
addCreateSyncEvent(docs: any): Promise<any>;

@@ -17,6 +17,6 @@ addUpdateSyncEvent(docs: any): Promise<any>;

addSyncEvent(event: SyncEvent, docs: any): Promise<any>;
push(query?: Query, options?: any): Promise<any>;
remove(query?: Query): Promise<number>;
push(providedQuery?: Query, options?: any): Promise<any>;
remove(providedQuery?: Query): Promise<number>;
removeById(id: string): Promise<number>;
clear(): Promise<number>;
}

@@ -16,3 +16,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
function queryToSyncQuery(query, collectionName) {
function queryToSyncQuery(query) {
if (query && query instanceof query_1.Query) {

@@ -29,3 +29,3 @@ var newFilter = Object.keys(query.filter)

}, {});
var syncQuery = new query_1.Query({
return new query_1.Query({
filter: newFilter,

@@ -36,6 +36,2 @@ sort: newSort,

});
if (collectionName) {
syncQuery.equalTo('collection', collectionName);
}
return syncQuery;
}

@@ -53,4 +49,5 @@ return undefined;

};
Sync.prototype.find = function (query) {
Sync.prototype.find = function (providedQuery) {
var syncCache = new cache_1.SyncCache(this.tag);
var query = new query_1.Query(providedQuery).equalTo('collection', this.collectionName);
return syncCache.find(query);

@@ -62,4 +59,5 @@ };

};
Sync.prototype.count = function (query) {
Sync.prototype.count = function (providedQuery) {
var syncCache = new cache_1.SyncCache(this.tag);
var query = new query_1.Query(providedQuery).equalTo('collection', this.collectionName);
return syncCache.count(query);

@@ -112,2 +110,3 @@ };

entityId: doc._id,
entity: doc,
collection: _this.collectionName,

@@ -128,5 +127,5 @@ state: {

};
Sync.prototype.push = function (query, options) {
Sync.prototype.push = function (providedQuery, options) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var network, cache, syncCache, batchSize, syncDocs, i_1, batchPush_1;
var network, cache, syncCache, batchSize, query, syncDocs, i_1, batchPush_1;
var _this = this;

@@ -143,2 +142,3 @@ return tslib_1.__generator(this, function (_a) {

batchSize = 100;
query = new query_1.Query(providedQuery).equalTo('collection', this.collectionName);
return [4 /*yield*/, syncCache.find(query)];

@@ -294,7 +294,8 @@ case 1:

};
Sync.prototype.remove = function (query) {
Sync.prototype.remove = function (providedQuery) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var syncCache;
var syncCache, query;
return tslib_1.__generator(this, function (_a) {
syncCache = new cache_1.SyncCache(this.tag);
query = new query_1.Query(providedQuery).equalTo('collection', this.collectionName);
return [2 /*return*/, syncCache.remove(query)];

@@ -315,6 +316,7 @@ });

return tslib_1.__awaiter(this, void 0, void 0, function () {
var syncCache;
var syncCache, query;
return tslib_1.__generator(this, function (_a) {
syncCache = new cache_1.SyncCache(this.tag);
return [2 /*return*/, syncCache.remove()];
query = new query_1.Query().equalTo('collection', this.collectionName);
return [2 /*return*/, syncCache.remove(query)];
});

@@ -321,0 +323,0 @@ });

@@ -18,3 +18,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.POST,
auth: http_1.KinveyHttpAuth.Session,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Rpc, "/custom/" + endpoint),

@@ -21,0 +21,0 @@ body: args,

@@ -20,3 +20,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.GET,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Blob, "/" + id, queryStringObject),

@@ -23,0 +23,0 @@ timeout: options.timeout

@@ -29,3 +29,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.GET,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Blob, '/', queryStringObject),

@@ -32,0 +32,0 @@ timeout: options.timeout

@@ -13,3 +13,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.DELETE,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Blob, "/" + id),

@@ -16,0 +16,0 @@ timeout: options.timeout

@@ -36,3 +36,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

}),
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: metadata._id ? http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Blob, "/" + metadata._id) : http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.Blob),

@@ -39,0 +39,0 @@ body: metadata,

@@ -24,6 +24,8 @@ export declare class HttpHeaders {

export declare enum KinveyHttpAuth {
All = "All",
App = "App",
Master = "Master",
Session = "Session",
SessionOrApp = "SessionOrApp"
SessionOrApp = "SessionOrApp",
SessionOrMaster = "SessionOrMaster"
}

@@ -30,0 +32,0 @@ export declare function getAppVersion(): string;

@@ -95,2 +95,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

(function (KinveyHttpAuth) {
KinveyHttpAuth["All"] = "All";
KinveyHttpAuth["App"] = "App";

@@ -100,2 +101,3 @@ KinveyHttpAuth["Master"] = "Master";

KinveyHttpAuth["SessionOrApp"] = "SessionOrApp";
KinveyHttpAuth["SessionOrMaster"] = "SessionOrMaster";
})(KinveyHttpAuth = exports.KinveyHttpAuth || (exports.KinveyHttpAuth = {}));

@@ -155,2 +157,15 @@ var globalHeaders = new HttpHeaders();

}
else if (auth === KinveyHttpAuth.All) {
try {
return this.setAuthorization(KinveyHttpAuth.Session);
}
catch (error) {
try {
return this.setAuthorization(KinveyHttpAuth.App);
}
catch (error) {
return this.setAuthorization(KinveyHttpAuth.Master);
}
}
}
else if (auth === KinveyHttpAuth.SessionOrApp) {

@@ -164,2 +179,10 @@ try {

}
else if (auth === KinveyHttpAuth.SessionOrMaster) {
try {
return this.setAuthorization(KinveyHttpAuth.Session);
}
catch (error) {
return this.setAuthorization(KinveyHttpAuth.Master);
}
}
this.set('Authorization', value);

@@ -166,0 +189,0 @@ };

@@ -34,2 +34,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var headers_1 = require("./headers");
var isPlainObject = require("lodash/isPlainObject");
var HttpStatusCode;

@@ -56,3 +57,8 @@ (function (HttpStatusCode) {

if (isString_1.default(config.data) && contentType.indexOf('application/json') !== -1) {
this.data = JSON.parse(config.data);
try {
this.data = JSON.parse(config.data);
}
catch (error) {
this.data = config.data;
}
}

@@ -66,112 +72,115 @@ else {

if (!this.isSuccess()) {
var message = this.data.message || this.data.description;
var name_1 = this.data.name || this.data.error;
var debug = this.data.debug;
if (name_1 === 'APIVersionNotAvailable') {
return new apiVersionNotAvailable_1.APIVersionNotAvailableError(message, debug);
if (isPlainObject(this.data)) {
var message = this.data.message || this.data.description;
var name_1 = this.data.name || this.data.error;
var debug = this.data.debug;
if (name_1 === 'APIVersionNotAvailable') {
return new apiVersionNotAvailable_1.APIVersionNotAvailableError(message, debug);
}
else if (name_1 === 'APIVersionNotImplemented') {
return new apiVersionNotImplemented_1.APIVersionNotImplementedError(message, debug);
}
else if (name_1 === 'AppProblem') {
return new appProblem_1.AppProblemError(message, debug);
}
else if (name_1 === 'AppProblem') {
return new appProblem_1.AppProblemError(message, debug);
}
else if (name_1 === 'BadRequest') {
return new badRequest_1.BadRequestError(message, debug);
}
else if (name_1 === 'BLInternalError'
|| name_1 === 'BLRuntimeError'
|| name_1 === 'BLSyntaxError'
|| name_1 === 'BLTimeoutError'
|| name_1 === 'BLViolationError') {
return new bl_1.BLError(message, debug);
}
else if (name_1 === 'CORSDisabled') {
return new corsDisabled_1.CORSDisabledError(message, debug);
}
else if (name_1 === 'DuplicateEndUsers') {
return new duplicateEndUsers_1.DuplicateEndUsersError(message, debug);
}
else if (name_1 === 'FeatureUnavailable') {
return new featureUnavailable_1.FeatureUnavailableError(message, debug);
}
else if (name_1 === 'IncompleteRequestBody') {
return new incompleteRequestBody_1.IncompleteRequestBodyError(message, debug);
}
else if (name_1 === 'IndirectCollectionAccessDisallowed') {
return new indirectCollectionAccessDisallowed_1.IndirectCollectionAccessDisallowedError(message, debug);
}
else if (name_1 === 'InsufficientCredentials') {
return new insufficientCredentials_1.InsufficientCredentialsError(message, debug);
}
else if (name_1 === 'InvalidCredentials') {
return new invalidCredentials_1.InvalidCredentialsError(message, debug);
}
else if (name_1 === 'InvalidIdentifier') {
return new invalidIdentifier_1.InvalidIdentifierError(message, debug);
}
else if (name_1 === 'InvalidQuerySyntax') {
return new invalidQuerySyntax_1.InvalidQuerySyntaxError(message, debug);
}
else if (name_1 === 'JSONParseError') {
return new jsonParse_1.JSONParseError(message, debug);
}
else if (name_1 === 'KinveyInternalErrorRetry') {
return new kinveyInternalErrorRetry_1.KinveyInternalErrorRetry(message, debug);
}
else if (name_1 === 'KinveyInternalErrorStop') {
return new kinveyInternalErrorStop_1.KinveyInternalErrorStop(message, debug);
}
else if (name_1 === 'MissingQuery') {
return new missingQuery_1.MissingQueryError(message, debug);
}
else if (name_1 === 'MissingRequestHeader') {
return new missingRequestHeader_1.MissingRequestHeaderError(message, debug);
}
else if (name_1 === 'MissingRequestParameter') {
return new missingRequestParameter_1.MissingRequestParameterError(message, debug);
}
else if (name_1 === 'MissingConfiguration') {
return new missingConfiguration_1.MissingConfigurationError(message, debug);
}
else if (name_1 === 'EntityNotFound'
|| name_1 === 'CollectionNotFound'
|| name_1 === 'AppNotFound'
|| name_1 === 'UserNotFound'
|| name_1 === 'BlobNotFound'
|| name_1 === 'DocumentNotFound') {
return new notFound_1.NotFoundError(message, debug);
}
else if (name_1 === 'ParameterValueOutOfRange') {
return new parameterValueOutOfRange_1.ParameterValueOutOfRangeError(message, debug);
}
else if (name_1 === 'ResultSetSizeExceeded') {
return new resultSetSizeExceeded_1.ResultSetSizeExceededError(message, debug);
}
else if (name_1 === 'ServerError') {
return new server_1.ServerError(message, debug);
}
else if (name_1 === 'StaleRequest') {
return new staleRequest_1.StaleRequestError(message, debug);
}
else if (name_1 === 'UserAlreadyExists') {
return new userAlreadyExists_1.UserAlreadyExistsError(message, debug);
}
else if (name_1 === 'WritesToCollectionDisallowed') {
return new writesToCollectionDisallowed_1.WritesToCollectionDisallowedError(message, debug);
}
else if (this.statusCode === HttpStatusCode.Unauthorized
|| this.statusCode === HttpStatusCode.Forbidden) {
return new insufficientCredentials_1.InsufficientCredentialsError(message, debug);
}
else if (this.statusCode === HttpStatusCode.NotFound) {
return new notFound_1.NotFoundError(message, debug);
}
else if (this.statusCode === HttpStatusCode.ServerError) {
return new server_1.ServerError(message, debug);
}
return new kinvey_1.KinveyError(message, debug);
}
else if (name_1 === 'APIVersionNotImplemented') {
return new apiVersionNotImplemented_1.APIVersionNotImplementedError(message, debug);
}
else if (name_1 === 'AppProblem') {
return new appProblem_1.AppProblemError(message, debug);
}
else if (name_1 === 'AppProblem') {
return new appProblem_1.AppProblemError(message, debug);
}
else if (name_1 === 'BadRequest') {
return new badRequest_1.BadRequestError(message, debug);
}
else if (name_1 === 'BLInternalError'
|| name_1 === 'BLRuntimeError'
|| name_1 === 'BLSyntaxError'
|| name_1 === 'BLTimeoutError'
|| name_1 === 'BLViolationError') {
return new bl_1.BLError(message, debug);
}
else if (name_1 === 'CORSDisabled') {
return new corsDisabled_1.CORSDisabledError(message, debug);
}
else if (name_1 === 'DuplicateEndUsers') {
return new duplicateEndUsers_1.DuplicateEndUsersError(message, debug);
}
else if (name_1 === 'FeatureUnavailable') {
return new featureUnavailable_1.FeatureUnavailableError(message, debug);
}
else if (name_1 === 'IncompleteRequestBody') {
return new incompleteRequestBody_1.IncompleteRequestBodyError(message, debug);
}
else if (name_1 === 'IndirectCollectionAccessDisallowed') {
return new indirectCollectionAccessDisallowed_1.IndirectCollectionAccessDisallowedError(message, debug);
}
else if (name_1 === 'InsufficientCredentials') {
return new insufficientCredentials_1.InsufficientCredentialsError(message, debug);
}
else if (name_1 === 'InvalidCredentials') {
return new invalidCredentials_1.InvalidCredentialsError(message, debug);
}
else if (name_1 === 'InvalidIdentifier') {
return new invalidIdentifier_1.InvalidIdentifierError(message, debug);
}
else if (name_1 === 'InvalidQuerySyntax') {
return new invalidQuerySyntax_1.InvalidQuerySyntaxError(message, debug);
}
else if (name_1 === 'JSONParseError') {
return new jsonParse_1.JSONParseError(message, debug);
}
else if (name_1 === 'KinveyInternalErrorRetry') {
return new kinveyInternalErrorRetry_1.KinveyInternalErrorRetry(message, debug);
}
else if (name_1 === 'KinveyInternalErrorStop') {
return new kinveyInternalErrorStop_1.KinveyInternalErrorStop(message, debug);
}
else if (name_1 === 'MissingQuery') {
return new missingQuery_1.MissingQueryError(message, debug);
}
else if (name_1 === 'MissingRequestHeader') {
return new missingRequestHeader_1.MissingRequestHeaderError(message, debug);
}
else if (name_1 === 'MissingRequestParameter') {
return new missingRequestParameter_1.MissingRequestParameterError(message, debug);
}
else if (name_1 === 'MissingConfiguration') {
return new missingConfiguration_1.MissingConfigurationError(message, debug);
}
else if (name_1 === 'EntityNotFound'
|| name_1 === 'CollectionNotFound'
|| name_1 === 'AppNotFound'
|| name_1 === 'UserNotFound'
|| name_1 === 'BlobNotFound'
|| name_1 === 'DocumentNotFound') {
return new notFound_1.NotFoundError(message, debug);
}
else if (name_1 === 'ParameterValueOutOfRange') {
return new parameterValueOutOfRange_1.ParameterValueOutOfRangeError(message, debug);
}
else if (name_1 === 'ResultSetSizeExceeded') {
return new resultSetSizeExceeded_1.ResultSetSizeExceededError(message, debug);
}
else if (name_1 === 'ServerError') {
return new server_1.ServerError(message, debug);
}
else if (name_1 === 'StaleRequest') {
return new staleRequest_1.StaleRequestError(message, debug);
}
else if (name_1 === 'UserAlreadyExists') {
return new userAlreadyExists_1.UserAlreadyExistsError(message, debug);
}
else if (name_1 === 'WritesToCollectionDisallowed') {
return new writesToCollectionDisallowed_1.WritesToCollectionDisallowedError(message, debug);
}
else if (this.statusCode === HttpStatusCode.Unauthorized
|| this.statusCode === HttpStatusCode.Forbidden) {
return new insufficientCredentials_1.InsufficientCredentialsError(message, debug);
}
else if (this.statusCode === HttpStatusCode.NotFound) {
return new notFound_1.NotFoundError(message, debug);
}
else if (this.statusCode === HttpStatusCode.ServerError) {
return new server_1.ServerError(message, debug);
}
return new kinvey_1.KinveyError(message, debug);
return new kinvey_1.KinveyError();
}

@@ -178,0 +187,0 @@ return null;

@@ -10,4 +10,5 @@ import { Entity } from '../storage';

}
export declare function getKey(): string;
export declare function getSession(): SessionObject | null;
export declare function setSession(session: SessionObject): boolean;
export declare function removeSession(): boolean;

@@ -10,2 +10,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
exports.getKey = getKey;
function getSession() {

@@ -12,0 +13,0 @@ var session = getStore().get(getKey());

@@ -13,3 +13,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.GET,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.All,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.AppData),

@@ -16,0 +16,0 @@ timeout: options.timeout

@@ -33,3 +33,3 @@ import { Query } from './query';

clear(dbName: string, collectionName: string): Promise<any>;
clearDatabase(dbName: string): Promise<any>;
clearDatabase(dbName: string, exclude?: string[]): Promise<any>;
}

@@ -36,0 +36,0 @@ export declare class Storage<T extends Entity> {

@@ -9,2 +9,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var kinvey_1 = require("./errors/kinvey");
var http_1 = require("./http");
var queue = new p_queue_1.default({ concurrency: 1 });

@@ -161,3 +162,4 @@ function generateId(length) {

var storageAdapter = config_1.getConfig(config_1.ConfigKey.StorageAdapter);
return queue.add(function () { return storageAdapter.clearDatabase(dbName); });
var exclude = [http_1.getKey()];
return queue.add(function () { return storageAdapter.clearDatabase(dbName, exclude); });
};

@@ -164,0 +166,0 @@ return Storage;

@@ -21,3 +21,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.POST,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.User, '/_lookup'),

@@ -24,0 +24,0 @@ body: query ? query.filter : undefined,

@@ -25,3 +25,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.DELETE,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: url,

@@ -28,0 +28,0 @@ timeout: options.timeout

@@ -159,3 +159,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

method: http_1.HttpRequestMethod.PUT,
auth: http_1.KinveyHttpAuth.SessionOrApp,
auth: http_1.KinveyHttpAuth.SessionOrMaster,
url: http_1.formatKinveyBaasUrl(http_1.KinveyBaasNamespace.User, "/" + this._id),

@@ -162,0 +162,0 @@ body: body,

{
"name": "kinvey-js-sdk",
"description": "Kinvey JavaScript SDK for JavaScript applications.",
"version": "3.13.0-next.31",
"version": "3.13.0-next.33",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/Kinvey/js-sdk/tree/master/packages/js-sdk",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc