Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/datastore

Package Overview
Dependencies
Maintainers
10
Versions
1831
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/datastore - npm Package Compare versions

Comparing version 1.0.7-preview.5319 to 1.0.7-rn-datastore.3

lib-esm/storage/adapter/asyncstorage.d.ts

22

CHANGELOG.md

@@ -10,8 +10,17 @@ # Change Log

## [1.0.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@1.0.3...@aws-amplify/datastore@1.0.4) (2020-01-10)
### Bug Fixes
- [#4311](https://github.com/aws-amplify/amplify-js/issues/4311) Update main entry field to point to CJS builds instead of webpack bundles ([#4678](https://github.com/aws-amplify/amplify-js/issues/4678)) ([54fbdf4](https://github.com/aws-amplify/amplify-js/commit/54fbdf4b1393567735fb7b5f4144db273f1a5f6a))
* [#4311](https://github.com/aws-amplify/amplify-js/issues/4311) Update main entry field to point to CJS builds instead of webpack bundles ([#4678](https://github.com/aws-amplify/amplify-js/issues/4678)) ([54fbdf4](https://github.com/aws-amplify/amplify-js/commit/54fbdf4b1393567735fb7b5f4144db273f1a5f6a))
## [1.0.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@1.0.2...@aws-amplify/datastore@1.0.3) (2019-12-18)

@@ -21,10 +30,19 @@

## [1.0.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@1.0.1...@aws-amplify/datastore@1.0.2) (2019-12-04)
### Bug Fixes
- **@aws-amplify/datastore:** Validate arrays of scalars in model constructor ([#4508](https://github.com/aws-amplify/amplify-js/issues/4508)) ([8d2ba6e](https://github.com/aws-amplify/amplify-js/commit/8d2ba6e85031a7880d2b573e1f68108d22a7de54))
* **@aws-amplify/datastore:** Validate arrays of scalars in model constructor ([#4508](https://github.com/aws-amplify/amplify-js/issues/4508)) ([8d2ba6e](https://github.com/aws-amplify/amplify-js/commit/8d2ba6e85031a7880d2b573e1f68108d22a7de54))
## 1.0.1 (2019-12-03)
**Note:** Version bump only for package @aws-amplify/datastore

91

lib-esm/datastore/datastore.js

@@ -59,29 +59,2 @@ var __assign = (this && this.__assign) || function () {

};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import { ConsoleLogger as Logger } from '@aws-amplify/core';

@@ -91,3 +64,3 @@ import { immerable, produce, setAutoFreeze } from 'immer';

import { isPredicatesAll, ModelPredicateCreator } from '../predicates';
import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { SyncEngine } from '../sync';

@@ -142,3 +115,2 @@ import { GraphQLScalarType, isGraphQLScalarType, } from '../types';

Object.keys(schema.namespaces).forEach(function (namespace) {
var e_1, _a;
schema.namespaces[namespace].relationships = establishRelation(schema.namespaces[namespace]);

@@ -167,18 +139,9 @@ var modelAssociations = new Map();

}
try {
for (var _b = (e_1 = void 0, __values(Array.from(modelAssociations.keys()))), _c = _b.next(); !_c.done; _c = _b.next()) {
var modelName = _c.value;
var parents = modelAssociations.get(modelName);
if (parents.every(function (x) { return result.has(x); })) {
result.set(modelName, parents);
}
for (var _i = 0, _a = Array.from(modelAssociations.keys()); _i < _a.length; _i++) {
var modelName = _a[_i];
var parents = modelAssociations.get(modelName);
if (parents.every(function (x) { return result.has(x); })) {
result.set(modelName, parents);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
Array.from(result.keys()).forEach(function (x) { return modelAssociations.delete(x); });

@@ -193,3 +156,3 @@ }

Object.entries(namespace.models).forEach(function (_a) {
var _b = __read(_a, 2), modelName = _b[0], modelDefinition = _b[1];
var modelName = _a[0], modelDefinition = _a[1];
var clazz = createModelClass(modelDefinition);

@@ -223,3 +186,3 @@ classes[modelName] = clazz;

Object.entries(init).forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
var k = _a[0], v = _a[1];
var fieldDefinition = modelDefinition.fields[k];

@@ -309,8 +272,8 @@ if (fieldDefinition !== undefined) {

var remove = function (modelOrConstructor, idOrCriteria) { return __awaiter(void 0, void 0, void 0, function () {
var condition, msg, modelConstructor, msg, msg, _a, deleted, model, modelConstructor, msg, modelDefinition, idPredicate, msg, _b, _c, deleted;
return __generator(this, function (_d) {
switch (_d.label) {
var condition, msg, modelConstructor, msg, msg, deleted, model, modelConstructor, msg, modelDefinition, idPredicate, msg, deleted;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, start()];
case 1:
_d.sent();
_a.sent();
if (!modelOrConstructor) {

@@ -341,3 +304,3 @@ msg = 'Model or Model Constructor required';

case 2:
_a = __read.apply(void 0, [_d.sent(), 1]), deleted = _a[0];
deleted = (_a.sent())[0];
return [2 /*return*/, deleted];

@@ -368,3 +331,3 @@ case 3:

case 4:
_b = __read.apply(void 0, [_d.sent(), 1]), _c = __read(_b[0], 1), deleted = _c[0];
deleted = (_a.sent())[0][0];
return [2 /*return*/, deleted];

@@ -403,8 +366,8 @@ }

var query = function (modelConstructor, idOrCriteria, pagination) { return __awaiter(void 0, void 0, void 0, function () {
var msg, predicate_1, _a, result, predicate, _b, limit, page;
return __generator(this, function (_c) {
switch (_c.label) {
var msg, predicate_1, result, predicate, _a, limit, page;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, start()];
case 1:
_c.sent();
_b.sent();
if (!isValidModelConstructor(modelConstructor)) {

@@ -422,3 +385,3 @@ msg = 'Constructor is not for a valid model';

case 2:
_a = __read.apply(void 0, [_c.sent(), 1]), result = _a[0];
result = (_b.sent())[0];
if (result) {

@@ -432,3 +395,3 @@ return [2 /*return*/, result];

: undefined;
_b = pagination || {}, limit = _b.limit, page = _b.page;
_a = pagination || {}, limit = _a.limit, page = _a.page;
if (page !== undefined && limit === undefined) {

@@ -520,5 +483,5 @@ throw new Error('Limit is required when requesting a page');

return [4 /*yield*/, storage.runExclusive(function (s) { return __awaiter(_this, void 0, void 0, function () {
var _a, schemaVersionSetting, storedValue;
return __generator(this, function (_b) {
switch (_b.label) {
var schemaVersionSetting, storedValue;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, s.query(Setting, ModelPredicateCreator.createFromExisting(modelDefinition, function (c) {

@@ -528,3 +491,3 @@ return c.key('eq', SETTING_SCHEMA_VERSION);

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), schemaVersionSetting = _a[0];
schemaVersionSetting = (_a.sent())[0];
if (!(schemaVersionSetting !== undefined)) return [3 /*break*/, 3];

@@ -535,4 +498,4 @@ storedValue = JSON.parse(schemaVersionSetting.value);

case 2:
_b.sent();
_b.label = 3;
_a.sent();
_a.label = 3;
case 3: return [4 /*yield*/, s.save(modelInstanceCreator(Setting, {

@@ -543,3 +506,3 @@ key: SETTING_SCHEMA_VERSION,

case 4:
_b.sent();
_a.sent();
return [2 /*return*/];

@@ -546,0 +509,0 @@ }

@@ -1,2 +0,2 @@

import { Amplify } from '@aws-amplify/core';
import Amplify from '@aws-amplify/core';
import { DataStore, initSchema } from './datastore/datastore';

@@ -3,0 +3,0 @@ import { Predicates } from './predicates';

@@ -44,22 +44,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
import { ConsoleLogger as Logger } from '@aws-amplify/core';

@@ -186,3 +173,3 @@ import * as idb from 'idb';

});
tx = this.db.transaction(__spread([storeName], Array.from(set.values())), 'readwrite');
tx = this.db.transaction(__spreadArrays([storeName], Array.from(set.values())), 'readwrite');
store = tx.objectStore(storeName);

@@ -278,3 +265,3 @@ return [4 /*yield*/, store.get(model.id)];

}
tx = this.db.transaction(__spread(connectionStoreNames), 'readonly');
tx = this.db.transaction(__spreadArrays(connectionStoreNames), 'readonly');
_e.label = 1;

@@ -404,8 +391,8 @@ case 1:

return __awaiter(this, void 0, void 0, function () {
var storeName, namespaceName, predicates, predicateObjs_1, type_1, idPredicate, id, record, _a, x, all, filtered, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
var storeName, namespaceName, predicates, predicateObjs_1, type_1, idPredicate, id, record, x, all, filtered, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, this.checkPrivate()];
case 1:
_d.sent();
_c.sent();
storeName = this.getStorenameForModel(modelConstructor);

@@ -423,3 +410,3 @@ namespaceName = this.namespaceResolver(modelConstructor);

case 2:
record = _d.sent();
record = _c.sent();
if (!record) return [3 /*break*/, 4];

@@ -430,3 +417,3 @@ return [4 /*yield*/, this.load(namespaceName, modelConstructor.name, [

case 3:
_a = __read.apply(void 0, [_d.sent(), 1]), x = _a[0];
x = (_c.sent())[0];
return [2 /*return*/, [x]];

@@ -436,3 +423,3 @@ case 4: return [2 /*return*/, []];

case 6:
all = _d.sent();
all = _c.sent();
filtered = predicateObjs_1

@@ -442,10 +429,10 @@ ? all.filter(function (m) { return validatePredicate(m, type_1, predicateObjs_1); })

return [4 /*yield*/, this.load(namespaceName, modelConstructor.name, this.inMemoryPagination(filtered, pagination))];
case 7: return [2 /*return*/, _d.sent()];
case 7: return [2 /*return*/, _c.sent()];
case 8:
_b = this.load;
_c = [namespaceName,
_a = this.load;
_b = [namespaceName,
modelConstructor.name];
return [4 /*yield*/, this.enginePagination(storeName, pagination)];
case 9: return [4 /*yield*/, _b.apply(this, _c.concat([_d.sent()]))];
case 10: return [2 /*return*/, _d.sent()];
case 9: return [4 /*yield*/, _a.apply(this, _b.concat([_c.sent()]))];
case 10: return [2 /*return*/, _c.sent()];
}

@@ -643,3 +630,3 @@ });

});
tx = this.db.transaction(__spread(connectionStoreNames), 'readwrite');
tx = this.db.transaction(__spreadArrays(connectionStoreNames), 'readwrite');
_c.label = 1;

@@ -646,0 +633,0 @@ case 1:

@@ -42,2 +42,2 @@ import Observable from 'zen-observable-ts';

}
export { ExclusiveStorage };
export default ExclusiveStorage;

@@ -48,18 +48,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import { Mutex } from '@aws-amplify/core';

@@ -70,10 +54,3 @@ import * as PushStream from 'zen-push';

import { isModelConstructor, STORAGE, validatePredicate } from '../util';
var getDefaultAdapter = function () {
if (window.indexedDB) {
return require('./adapter/indexeddb').default;
}
if (process && process.env) {
throw new Error('Node is not supported');
}
};
import getDefaultAdapter from './adapter/getDefaultAdapter';
var Storage = /** @class */ (function () {

@@ -86,3 +63,3 @@ function Storage(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator, adapter) {

this.adapter = adapter;
this.adapter = adapter || getDefaultAdapter();
this.adapter = getDefaultAdapter();
this.pushStream = new PushStream();

@@ -136,3 +113,3 @@ }

result.forEach(function (r) {
var _a = __read(r, 2), element = _a[0], opType = _a[1];
var element = r[0], opType = r[1];
var modelConstructor = Object.getPrototypeOf(element)

@@ -165,3 +142,3 @@ .constructor;

case 2:
_a = __read.apply(void 0, [_b.sent(), 2]), models = _a[0], deleted = _a[1];
_a = _b.sent(), models = _a[0], deleted = _a[1];
modelIds = new Set(models.map(function (_a) {

@@ -350,3 +327,3 @@ var id = _a.id;

}());
export { ExclusiveStorage };
export default ExclusiveStorage;
//# sourceMappingURL=storage.js.map
import Observable from 'zen-observable-ts';
import { ModelInstanceCreator } from '../datastore/datastore';
import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { ConflictHandler, ErrorHandler, InternalSchema, ModelInit, MutableModel, NamespaceResolver, PersistentModelConstructor, SchemaNamespace } from '../types';

@@ -5,0 +5,0 @@ import { TransformerMutationType } from './utils';

@@ -37,29 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
import { ConsoleLogger as Logger, Reachability } from '@aws-amplify/core';

@@ -115,3 +88,3 @@ import Observable from 'zen-observable-ts';

err_1 = _a.sent();
logger.error("Sync engine stopped. IndexedDB not supported in this browser's private mode");
logger.error('Sync engine error on start', err_1);
return [2 /*return*/];

@@ -129,3 +102,3 @@ case 3:

if (!online) return [3 /*break*/, 10];
_b = __read(this.subscriptionsProcessor.start(), 2), ctlSubsObservable = _b[0], dataSubsObservable = _b[1];
_b = this.subscriptionsProcessor.start(), ctlSubsObservable = _b[0], dataSubsObservable = _b[1];
_e.label = 1;

@@ -174,3 +147,3 @@ case 1:

.subscribe(function (_a) {
var _b = __read(_a, 3), _transformerMutationType = _b[0], modelDefinition = _b[1], item = _b[2];
var _transformerMutationType = _a[0], modelDefinition = _a[1], item = _a[2];
var modelConstructor = _this.userModelClasses[modelDefinition.name];

@@ -182,3 +155,3 @@ var model = _this.modelInstanceCreator(modelConstructor, item);

subscriptions.push(dataSubsObservable.subscribe(function (_a) {
var _b = __read(_a, 3), _transformerMutationType = _b[0], modelDefinition = _b[1], item = _b[2];
var _transformerMutationType = _a[0], modelDefinition = _a[1], item = _a[2];
var modelConstructor = _this.userModelClasses[modelDefinition.name];

@@ -265,18 +238,8 @@ var model = _this.modelInstanceCreator(modelConstructor, item);

SyncEngine.prototype.isFullSync = function (modelsMap) {
var e_1, _a;
try {
for (var _b = __values(Array.from(modelsMap.values())), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), syncFrom = _d[1];
if (syncFrom === 0) {
return true;
}
for (var _i = 0, _a = Array.from(modelsMap.values()); _i < _a.length; _i++) {
var _b = _a[_i], syncFrom = _b[1];
if (syncFrom === 0) {
return true;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return false;

@@ -406,10 +369,10 @@ };

promises = models.map(function (_a) {
var _b = __read(_a, 2), namespace = _b[0], model = _b[1];
var namespace = _a[0], model = _a[1];
return __awaiter(_this, void 0, void 0, function () {
var modelMetadata;
return __generator(this, function (_c) {
switch (_c.label) {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getModelMetadata(namespace, model)];
case 1:
modelMetadata = _c.sent();
modelMetadata = _b.sent();
if (!(modelMetadata === undefined)) return [3 /*break*/, 3];

@@ -424,3 +387,3 @@ return [4 /*yield*/, this.storage.save(this.modelInstanceCreator(ModelMetadata, {

case 2:
_c.sent();
_b.sent();
return [3 /*break*/, 5];

@@ -431,4 +394,4 @@ case 3: return [4 /*yield*/, this.storage.save(this.modelClasses.ModelMetadata.copyOf(modelMetadata, function (draft) {

case 4:
_c.sent();
_c.label = 5;
_b.sent();
_b.label = 5;
case 5: return [2 /*return*/];

@@ -465,5 +428,5 @@ }

return __awaiter(this, void 0, void 0, function () {
var ModelMetadata, predicate, _a, modelMetadata;
return __generator(this, function (_b) {
switch (_b.label) {
var ModelMetadata, predicate, modelMetadata;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -475,3 +438,3 @@ ModelMetadata = this.modelClasses

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), modelMetadata = _a[0];
modelMetadata = (_a.sent())[0];
return [2 /*return*/, modelMetadata];

@@ -478,0 +441,0 @@ }

@@ -1,2 +0,2 @@

import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { ModelInstanceMetadata } from '../types';

@@ -3,0 +3,0 @@ import { MutationEventOutbox } from './outbox';

import { MutationEvent } from '.';
import { ExclusiveStorage as Storage, StorageFacade } from '../storage/storage';
import Storage, { StorageFacade } from '../storage/storage';
import { InternalSchema, NamespaceResolver, PersistentModel, PersistentModelConstructor } from '../types';

@@ -4,0 +4,0 @@ declare class MutationEventOutbox {

@@ -37,18 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import { ModelPredicateCreator } from '../predicates';

@@ -68,6 +52,6 @@ import { QueryOne, } from '../types';

return __awaiter(this, void 0, void 0, function () {
var mutationEventModelDefinition, predicate, _a, first, incomingMutationType, incomingConditionJSON, incomingCondition;
var mutationEventModelDefinition, predicate, first, incomingMutationType, incomingConditionJSON, incomingCondition;
var _this = this;
return __generator(this, function (_b) {
switch (_b.label) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -82,7 +66,7 @@ mutationEventModelDefinition = this.schema.namespaces[SYNC].models['MutationEvent'];

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), first = _a[0];
first = (_a.sent())[0];
if (!(first === undefined)) return [3 /*break*/, 3];
return [4 /*yield*/, storage.save(mutationEvent, undefined, this.ownSymbol)];
case 2:
_b.sent();
_a.sent();
return [2 /*return*/];

@@ -97,3 +81,3 @@ case 3:

// delete all for model
_b.sent();
_a.sent();
return [3 /*break*/, 7];

@@ -107,4 +91,4 @@ case 5:

// first gets updated with incoming's data, condition intentionally skiped
_b.sent();
_b.label = 7;
_a.sent();
_a.label = 7;
case 7: return [3 /*break*/, 12];

@@ -119,4 +103,4 @@ case 8:

// delete all for model
_b.sent();
_b.label = 10;
_a.sent();
_a.label = 10;
case 10:

@@ -127,4 +111,4 @@ // Enqueue new one

// Enqueue new one
_b.sent();
_b.label = 12;
_a.sent();
_a.label = 12;
case 12: return [2 /*return*/];

@@ -131,0 +115,0 @@ }

import Observable from 'zen-observable-ts';
import { MutationEvent } from '../';
import { ModelInstanceCreator } from '../../datastore/datastore';
import { ExclusiveStorage as Storage } from '../../storage/storage';
import Storage from '../../storage/storage';
import { ConflictHandler, ErrorHandler, InternalSchema, PersistentModel, PersistentModelConstructor, SchemaModel } from '../../types';

@@ -6,0 +6,0 @@ import { MutationEventOutbox } from '../outbox';

@@ -59,18 +59,2 @@ var __assign = (this && this.__assign) || function () {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import API from '@aws-amplify/api';

@@ -107,5 +91,5 @@ import { ConsoleLogger as Logger, jitteredExponentialRetry, NonRetryableError, } from '@aws-amplify/core';

.forEach(function (model) {
var _a = __read(buildGraphQLOperation(model, 'CREATE'), 1), createMutation = _a[0];
var _b = __read(buildGraphQLOperation(model, 'UPDATE'), 1), updateMutation = _b[0];
var _c = __read(buildGraphQLOperation(model, 'DELETE'), 1), deleteMutation = _c[0];
var createMutation = buildGraphQLOperation(model, 'CREATE')[0];
var updateMutation = buildGraphQLOperation(model, 'UPDATE')[0];
var deleteMutation = buildGraphQLOperation(model, 'DELETE')[0];
_this.typeQuery.set(model, [

@@ -164,3 +148,3 @@ createMutation,

case 5:
_b = __read.apply(void 0, [_c.sent(), 3]), result = _b[0], opName = _b[1], modelDefinition = _b[2];
_b = _c.sent(), result = _b[0], opName = _b[1], modelDefinition = _b[2];
return [3 /*break*/, 7];

@@ -201,22 +185,22 @@ case 6:

case 0: return [4 /*yield*/, jitteredExponentialRetry(function (model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent) { return __awaiter(_this, void 0, void 0, function () {
var _a, query, variables, graphQLCondition, opName, modelDefinition, tryWith, attempt, opType, result, err_1, _b, error, retryWith, err_2, _c, _d, opName_1, query_1, serverData, namespace, updatedMutation;
var _e;
return __generator(this, function (_f) {
switch (_f.label) {
var _a, query, variables, graphQLCondition, opName, modelDefinition, tryWith, attempt, opType, result, err_1, error, retryWith, err_2, _b, opName_1, query_1, serverData, namespace, updatedMutation;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = __read(this.createQueryVariables(model, operation, data, condition), 5), query = _a[0], variables = _a[1], graphQLCondition = _a[2], opName = _a[3], modelDefinition = _a[4];
_a = this.createQueryVariables(model, operation, data, condition), query = _a[0], variables = _a[1], graphQLCondition = _a[2], opName = _a[3], modelDefinition = _a[4];
tryWith = { query: query, variables: variables };
attempt = 0;
opType = this.opTypeFromTransformerOperation(operation);
_f.label = 1;
_d.label = 1;
case 1:
_f.trys.push([1, 3, , 13]);
_d.trys.push([1, 3, , 13]);
return [4 /*yield*/, API.graphql(tryWith)];
case 2:
result = (_f.sent());
result = (_d.sent());
return [2 /*return*/, [result, opName, modelDefinition]];
case 3:
err_1 = _f.sent();
err_1 = _d.sent();
if (!(err_1.errors && err_1.errors.length > 0)) return [3 /*break*/, 12];
_b = __read(err_1.errors, 1), error = _b[0];
error = err_1.errors[0];
if (error.message === 'Network Error') {

@@ -236,3 +220,3 @@ if (!this.processing) {

case 4:
_f.trys.push([4, 6, , 7]);
_d.trys.push([4, 6, , 7]);
return [4 /*yield*/, this.conflictHandler({

@@ -246,6 +230,6 @@ modelConstructor: modelConstructor,

case 5:
retryWith = _f.sent();
retryWith = _d.sent();
return [3 /*break*/, 7];
case 6:
err_2 = _f.sent();
err_2 = _d.sent();
logger.warn('conflict trycatch', err_2);

@@ -255,3 +239,3 @@ return [3 /*break*/, 13];

if (!(retryWith === DISCARD)) return [3 /*break*/, 9];
_c = __read(buildGraphQLOperation(modelDefinition, 'GET'), 1), _d = __read(_c[0], 3), opName_1 = _d[1], query_1 = _d[2];
_b = buildGraphQLOperation(modelDefinition, 'GET')[0], opName_1 = _b[1], query_1 = _b[2];
return [4 /*yield*/, API.graphql({

@@ -262,3 +246,3 @@ query: query_1,

case 8:
serverData = _f.sent();
serverData = _d.sent();
return [2 /*return*/, [serverData, opName_1, modelDefinition]];

@@ -270,3 +254,3 @@ case 9:

case 10:
_f.sent();
_d.sent();
throw new NonRetryableError('RetryMutation');

@@ -293,3 +277,3 @@ case 11:

? [
{ data: (_e = {}, _e[opName] = error.data, _e) },
{ data: (_c = {}, _c[opName] = error.data, _c) },
opName,

@@ -300,7 +284,7 @@ modelDefinition,

}
_f.label = 12;
_d.label = 12;
case 12: return [3 /*break*/, 13];
case 13:
if (tryWith) return [3 /*break*/, 1];
_f.label = 14;
_d.label = 14;
case 14: return [2 /*return*/];

@@ -326,6 +310,6 @@ }

var queriesTuples = this.typeQuery.get(modelDefinition);
var _a = __read(queriesTuples.find(function (_a) {
var _b = __read(_a, 1), transformerMutationType = _b[0];
var _a = queriesTuples.find(function (_a) {
var transformerMutationType = _a[0];
return transformerMutationType === operation;
}), 3), opName = _a[1], query = _a[2];
}), opName = _a[1], query = _a[2];
var _b = JSON.parse(data), _version = _b._version, parsedData = __rest(_b, ["_version"]);

@@ -362,3 +346,3 @@ var filteredData = operation === TransformerMutationType.DELETE

.reduce(function (acc, _a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
var k = _a[0], v = _a[1];
acc[k] = v;

@@ -365,0 +349,0 @@ return acc;

@@ -48,18 +48,2 @@ var __assign = (this && this.__assign) || function () {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import '@aws-amplify/pubsub';

@@ -91,3 +75,3 @@ import Observable from 'zen-observable-ts';

var _a = this.getAuthorizationInfo(model, transformerMutationType, userCredentials, cognitoTokenPayload, oidcTokenPayload) || {}, authMode = _a.authMode, isOwner = _a.isOwner, ownerField = _a.ownerField, ownerValue = _a.ownerValue;
var _b = __read(buildSubscriptionGraphQLOperation(model, transformerMutationType, isOwner, ownerField), 3), opType = _b[0], opName = _b[1], query = _b[2];
var _b = buildSubscriptionGraphQLOperation(model, transformerMutationType, isOwner, ownerField), opType = _b[0], opName = _b[1], query = _b[2];
return { authMode: authMode, opType: opType, opName: opName, query: query, isOwner: isOwner, ownerField: ownerField, ownerValue: ownerValue };

@@ -289,5 +273,5 @@ };

error: function (subscriptionError) {
var _a = subscriptionError.error, _b = __read((_a === void 0 ? {
var _a = subscriptionError.error, _b = (_a === void 0 ? {
errors: [],
} : _a).errors, 1), _c = _b[0], _d = (_c === void 0 ? {} : _c).message, message = _d === void 0 ? '' : _d;
} : _a).errors[0], _c = (_b === void 0 ? {} : _b).message, message = _c === void 0 ? '' : _c;
observer.error(message);

@@ -294,0 +278,0 @@ },

@@ -37,29 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
import API from '@aws-amplify/api';

@@ -88,3 +61,3 @@ import Observable from 'zen-observable-ts';

.forEach(function (model) {
var _a = __read(buildGraphQLOperation(model, 'LIST'), 1), _b = __read(_a[0]), _transformerMutationType = _b[0], opNameQuery = _b.slice(1);
var _a = buildGraphQLOperation(model, 'LIST')[0], _transformerMutationType = _a[0], opNameQuery = _a.slice(1);
_this.typeQuery.set(model, opNameQuery);

@@ -101,3 +74,3 @@ });

case 0:
_a = __read(this.typeQuery.get(modelDefinition), 2), opName = _a[0], query = _a[1];
_a = this.typeQuery.get(modelDefinition), opName = _a[0], query = _a[1];
variables = {

@@ -148,17 +121,7 @@ limit: limit,

var sortedTypesLastSyncs = Object.values(_this.schema.namespaces).reduce(function (map, namespace) {
var e_1, _a;
try {
for (var _b = __values(Array.from(namespace.modelTopologicalOrdering.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
var modelName = _c.value;
var typeLastSync = typesLastSync.get(namespace.models[modelName]);
map.set(namespace.models[modelName], typeLastSync);
}
for (var _i = 0, _a = Array.from(namespace.modelTopologicalOrdering.keys()); _i < _a.length; _i++) {
var modelName = _a[_i];
var typeLastSync = typesLastSync.get(namespace.models[modelName]);
map.set(namespace.models[modelName], typeLastSync);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return map;

@@ -168,12 +131,12 @@ }, new Map());

.filter(function (_a) {
var _b = __read(_a, 1), syncable = _b[0].syncable;
var syncable = _a[0].syncable;
return syncable;
})
.map(function (_a) {
var _b = __read(_a, 2), modelDefinition = _b[0], _c = __read(_b[1], 2), namespace = _c[0], lastSync = _c[1];
var modelDefinition = _a[0], _b = _a[1], namespace = _b[0], lastSync = _b[1];
return __awaiter(_this, void 0, void 0, function () {
var done, nextToken, startedAt, items, recordsReceived, parents, promises, promise;
var _this = this;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -229,3 +192,3 @@ done = false;

case 1:
_d.sent();
_c.sent();
return [2 /*return*/];

@@ -232,0 +195,0 @@ }

@@ -37,18 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
import { isPredicateGroup, isPredicateObj, } from './types';

@@ -111,3 +95,3 @@ import { v4 as uuid } from 'uuid';

case 'between':
var _a = __read(operand, 2), min = _a[0], max = _a[1];
var _a = operand, min = _a[0], max = _a[1];
return value >= min && value <= max;

@@ -114,0 +98,0 @@ case 'beginsWith':

@@ -60,29 +60,2 @@ "use strict";

};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -128,3 +101,3 @@ var core_1 = require("@aws-amplify/core");

var dataStoreNamespace = getNamespace();
var storageNamespace = storage_1.ExclusiveStorage.getNamespace();
var storageNamespace = storage_1.default.getNamespace();
var syncNamespace = sync_1.SyncEngine.getNamespace();

@@ -144,3 +117,2 @@ dataStoreClasses = createModelClassses(dataStoreNamespace);

Object.keys(schema.namespaces).forEach(function (namespace) {
var e_1, _a;
schema.namespaces[namespace].relationships = util_1.establishRelation(schema.namespaces[namespace]);

@@ -169,18 +141,9 @@ var modelAssociations = new Map();

}
try {
for (var _b = (e_1 = void 0, __values(Array.from(modelAssociations.keys()))), _c = _b.next(); !_c.done; _c = _b.next()) {
var modelName = _c.value;
var parents = modelAssociations.get(modelName);
if (parents.every(function (x) { return result.has(x); })) {
result.set(modelName, parents);
}
for (var _i = 0, _a = Array.from(modelAssociations.keys()); _i < _a.length; _i++) {
var modelName = _a[_i];
var parents = modelAssociations.get(modelName);
if (parents.every(function (x) { return result.has(x); })) {
result.set(modelName, parents);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
Array.from(result.keys()).forEach(function (x) { return modelAssociations.delete(x); });

@@ -196,3 +159,3 @@ }

Object.entries(namespace.models).forEach(function (_a) {
var _b = __read(_a, 2), modelName = _b[0], modelDefinition = _b[1];
var modelName = _a[0], modelDefinition = _a[1];
var clazz = createModelClass(modelDefinition);

@@ -226,3 +189,3 @@ classes[modelName] = clazz;

Object.entries(init).forEach(function (_a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
var k = _a[0], v = _a[1];
var fieldDefinition = modelDefinition.fields[k];

@@ -312,8 +275,8 @@ if (fieldDefinition !== undefined) {

var remove = function (modelOrConstructor, idOrCriteria) { return __awaiter(void 0, void 0, void 0, function () {
var condition, msg, modelConstructor, msg, msg, _a, deleted, model, modelConstructor, msg, modelDefinition, idPredicate, msg, _b, _c, deleted;
return __generator(this, function (_d) {
switch (_d.label) {
var condition, msg, modelConstructor, msg, msg, deleted, model, modelConstructor, msg, modelDefinition, idPredicate, msg, deleted;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, start()];
case 1:
_d.sent();
_a.sent();
if (!modelOrConstructor) {

@@ -344,3 +307,3 @@ msg = 'Model or Model Constructor required';

case 2:
_a = __read.apply(void 0, [_d.sent(), 1]), deleted = _a[0];
deleted = (_a.sent())[0];
return [2 /*return*/, deleted];

@@ -371,3 +334,3 @@ case 3:

case 4:
_b = __read.apply(void 0, [_d.sent(), 1]), _c = __read(_b[0], 1), deleted = _c[0];
deleted = (_a.sent())[0][0];
return [2 /*return*/, deleted];

@@ -406,8 +369,8 @@ }

var query = function (modelConstructor, idOrCriteria, pagination) { return __awaiter(void 0, void 0, void 0, function () {
var msg, predicate_1, _a, result, predicate, _b, limit, page;
return __generator(this, function (_c) {
switch (_c.label) {
var msg, predicate_1, result, predicate, _a, limit, page;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, start()];
case 1:
_c.sent();
_b.sent();
if (!isValidModelConstructor(modelConstructor)) {

@@ -425,3 +388,3 @@ msg = 'Constructor is not for a valid model';

case 2:
_a = __read.apply(void 0, [_c.sent(), 1]), result = _a[0];
result = (_b.sent())[0];
if (result) {

@@ -435,3 +398,3 @@ return [2 /*return*/, result];

: undefined;
_b = pagination || {}, limit = _b.limit, page = _b.page;
_a = pagination || {}, limit = _a.limit, page = _a.page;
if (page !== undefined && limit === undefined) {

@@ -523,5 +486,5 @@ throw new Error('Limit is required when requesting a page');

return [4 /*yield*/, storage.runExclusive(function (s) { return __awaiter(_this, void 0, void 0, function () {
var _a, schemaVersionSetting, storedValue;
return __generator(this, function (_b) {
switch (_b.label) {
var schemaVersionSetting, storedValue;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, s.query(Setting, predicates_1.ModelPredicateCreator.createFromExisting(modelDefinition, function (c) {

@@ -531,3 +494,3 @@ return c.key('eq', SETTING_SCHEMA_VERSION);

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), schemaVersionSetting = _a[0];
schemaVersionSetting = (_a.sent())[0];
if (!(schemaVersionSetting !== undefined)) return [3 /*break*/, 3];

@@ -538,4 +501,4 @@ storedValue = JSON.parse(schemaVersionSetting.value);

case 2:
_b.sent();
_b.label = 3;
_a.sent();
_a.label = 3;
case 3: return [4 /*yield*/, s.save(modelInstanceCreator(Setting, {

@@ -546,3 +509,3 @@ key: SETTING_SCHEMA_VERSION,

case 4:
_b.sent();
_a.sent();
return [2 /*return*/];

@@ -569,3 +532,3 @@ }

}
storage = new storage_1.ExclusiveStorage(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator);
storage = new storage_1.default(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator);
return [4 /*yield*/, checkSchemaVersion(storage, schema.version)];

@@ -572,0 +535,0 @@ case 1:

@@ -13,3 +13,3 @@ "use strict";

__export(require("./types"));
core_1.Amplify.register(datastore_1.DataStore);
core_1.default.register(datastore_1.DataStore);
//# sourceMappingURL=index.js.map

@@ -45,22 +45,9 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -188,3 +175,3 @@ var core_1 = require("@aws-amplify/core");

});
tx = this.db.transaction(__spread([storeName], Array.from(set.values())), 'readwrite');
tx = this.db.transaction(__spreadArrays([storeName], Array.from(set.values())), 'readwrite');
store = tx.objectStore(storeName);

@@ -280,3 +267,3 @@ return [4 /*yield*/, store.get(model.id)];

}
tx = this.db.transaction(__spread(connectionStoreNames), 'readonly');
tx = this.db.transaction(__spreadArrays(connectionStoreNames), 'readonly');
_e.label = 1;

@@ -406,8 +393,8 @@ case 1:

return __awaiter(this, void 0, void 0, function () {
var storeName, namespaceName, predicates, predicateObjs_1, type_1, idPredicate, id, record, _a, x, all, filtered, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
var storeName, namespaceName, predicates, predicateObjs_1, type_1, idPredicate, id, record, x, all, filtered, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, this.checkPrivate()];
case 1:
_d.sent();
_c.sent();
storeName = this.getStorenameForModel(modelConstructor);

@@ -425,3 +412,3 @@ namespaceName = this.namespaceResolver(modelConstructor);

case 2:
record = _d.sent();
record = _c.sent();
if (!record) return [3 /*break*/, 4];

@@ -432,3 +419,3 @@ return [4 /*yield*/, this.load(namespaceName, modelConstructor.name, [

case 3:
_a = __read.apply(void 0, [_d.sent(), 1]), x = _a[0];
x = (_c.sent())[0];
return [2 /*return*/, [x]];

@@ -438,3 +425,3 @@ case 4: return [2 /*return*/, []];

case 6:
all = _d.sent();
all = _c.sent();
filtered = predicateObjs_1

@@ -444,10 +431,10 @@ ? all.filter(function (m) { return util_1.validatePredicate(m, type_1, predicateObjs_1); })

return [4 /*yield*/, this.load(namespaceName, modelConstructor.name, this.inMemoryPagination(filtered, pagination))];
case 7: return [2 /*return*/, _d.sent()];
case 7: return [2 /*return*/, _c.sent()];
case 8:
_b = this.load;
_c = [namespaceName,
_a = this.load;
_b = [namespaceName,
modelConstructor.name];
return [4 /*yield*/, this.enginePagination(storeName, pagination)];
case 9: return [4 /*yield*/, _b.apply(this, _c.concat([_d.sent()]))];
case 10: return [2 /*return*/, _d.sent()];
case 9: return [4 /*yield*/, _a.apply(this, _b.concat([_c.sent()]))];
case 10: return [2 /*return*/, _c.sent()];
}

@@ -645,3 +632,3 @@ });

});
tx = this.db.transaction(__spread(connectionStoreNames), 'readwrite');
tx = this.db.transaction(__spreadArrays(connectionStoreNames), 'readwrite');
_c.label = 1;

@@ -648,0 +635,0 @@ case 1:

@@ -42,2 +42,2 @@ import Observable from 'zen-observable-ts';

}
export { ExclusiveStorage };
export default ExclusiveStorage;

@@ -49,18 +49,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -72,10 +56,3 @@ var core_1 = require("@aws-amplify/core");

var util_1 = require("../util");
var getDefaultAdapter = function () {
if (window.indexedDB) {
return require('./adapter/indexeddb').default;
}
if (process && process.env) {
throw new Error('Node is not supported');
}
};
var getDefaultAdapter_1 = require("./adapter/getDefaultAdapter");
var Storage = /** @class */ (function () {

@@ -88,3 +65,3 @@ function Storage(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator, adapter) {

this.adapter = adapter;
this.adapter = adapter || getDefaultAdapter();
this.adapter = getDefaultAdapter_1.default();
this.pushStream = new PushStream();

@@ -138,3 +115,3 @@ }

result.forEach(function (r) {
var _a = __read(r, 2), element = _a[0], opType = _a[1];
var element = r[0], opType = r[1];
var modelConstructor = Object.getPrototypeOf(element)

@@ -167,3 +144,3 @@ .constructor;

case 2:
_a = __read.apply(void 0, [_b.sent(), 2]), models = _a[0], deleted = _a[1];
_a = _b.sent(), models = _a[0], deleted = _a[1];
modelIds = new Set(models.map(function (_a) {

@@ -352,3 +329,3 @@ var id = _a.id;

}());
exports.ExclusiveStorage = ExclusiveStorage;
exports.default = ExclusiveStorage;
//# sourceMappingURL=storage.js.map
import Observable from 'zen-observable-ts';
import { ModelInstanceCreator } from '../datastore/datastore';
import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { ConflictHandler, ErrorHandler, InternalSchema, ModelInit, MutableModel, NamespaceResolver, PersistentModelConstructor, SchemaNamespace } from '../types';

@@ -5,0 +5,0 @@ import { TransformerMutationType } from './utils';

@@ -38,29 +38,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -117,3 +90,3 @@ var core_1 = require("@aws-amplify/core");

err_1 = _a.sent();
logger.error("Sync engine stopped. IndexedDB not supported in this browser's private mode");
logger.error('Sync engine error on start', err_1);
return [2 /*return*/];

@@ -131,3 +104,3 @@ case 3:

if (!online) return [3 /*break*/, 10];
_b = __read(this.subscriptionsProcessor.start(), 2), ctlSubsObservable = _b[0], dataSubsObservable = _b[1];
_b = this.subscriptionsProcessor.start(), ctlSubsObservable = _b[0], dataSubsObservable = _b[1];
_e.label = 1;

@@ -176,3 +149,3 @@ case 1:

.subscribe(function (_a) {
var _b = __read(_a, 3), _transformerMutationType = _b[0], modelDefinition = _b[1], item = _b[2];
var _transformerMutationType = _a[0], modelDefinition = _a[1], item = _a[2];
var modelConstructor = _this.userModelClasses[modelDefinition.name];

@@ -184,3 +157,3 @@ var model = _this.modelInstanceCreator(modelConstructor, item);

subscriptions.push(dataSubsObservable.subscribe(function (_a) {
var _b = __read(_a, 3), _transformerMutationType = _b[0], modelDefinition = _b[1], item = _b[2];
var _transformerMutationType = _a[0], modelDefinition = _a[1], item = _a[2];
var modelConstructor = _this.userModelClasses[modelDefinition.name];

@@ -267,18 +240,8 @@ var model = _this.modelInstanceCreator(modelConstructor, item);

SyncEngine.prototype.isFullSync = function (modelsMap) {
var e_1, _a;
try {
for (var _b = __values(Array.from(modelsMap.values())), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), syncFrom = _d[1];
if (syncFrom === 0) {
return true;
}
for (var _i = 0, _a = Array.from(modelsMap.values()); _i < _a.length; _i++) {
var _b = _a[_i], syncFrom = _b[1];
if (syncFrom === 0) {
return true;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return false;

@@ -408,10 +371,10 @@ };

promises = models.map(function (_a) {
var _b = __read(_a, 2), namespace = _b[0], model = _b[1];
var namespace = _a[0], model = _a[1];
return __awaiter(_this, void 0, void 0, function () {
var modelMetadata;
return __generator(this, function (_c) {
switch (_c.label) {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getModelMetadata(namespace, model)];
case 1:
modelMetadata = _c.sent();
modelMetadata = _b.sent();
if (!(modelMetadata === undefined)) return [3 /*break*/, 3];

@@ -426,3 +389,3 @@ return [4 /*yield*/, this.storage.save(this.modelInstanceCreator(ModelMetadata, {

case 2:
_c.sent();
_b.sent();
return [3 /*break*/, 5];

@@ -433,4 +396,4 @@ case 3: return [4 /*yield*/, this.storage.save(this.modelClasses.ModelMetadata.copyOf(modelMetadata, function (draft) {

case 4:
_c.sent();
_c.label = 5;
_b.sent();
_b.label = 5;
case 5: return [2 /*return*/];

@@ -467,5 +430,5 @@ }

return __awaiter(this, void 0, void 0, function () {
var ModelMetadata, predicate, _a, modelMetadata;
return __generator(this, function (_b) {
switch (_b.label) {
var ModelMetadata, predicate, modelMetadata;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -477,3 +440,3 @@ ModelMetadata = this.modelClasses

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), modelMetadata = _a[0];
modelMetadata = (_a.sent())[0];
return [2 /*return*/, modelMetadata];

@@ -480,0 +443,0 @@ }

@@ -1,2 +0,2 @@

import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { ModelInstanceMetadata } from '../types';

@@ -3,0 +3,0 @@ import { MutationEventOutbox } from './outbox';

import { MutationEvent } from '.';
import { ExclusiveStorage as Storage, StorageFacade } from '../storage/storage';
import Storage, { StorageFacade } from '../storage/storage';
import { InternalSchema, NamespaceResolver, PersistentModel, PersistentModelConstructor } from '../types';

@@ -4,0 +4,0 @@ declare class MutationEventOutbox {

@@ -38,18 +38,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -70,6 +54,6 @@ var predicates_1 = require("../predicates");

return __awaiter(this, void 0, void 0, function () {
var mutationEventModelDefinition, predicate, _a, first, incomingMutationType, incomingConditionJSON, incomingCondition;
var mutationEventModelDefinition, predicate, first, incomingMutationType, incomingConditionJSON, incomingCondition;
var _this = this;
return __generator(this, function (_b) {
switch (_b.label) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -84,7 +68,7 @@ mutationEventModelDefinition = this.schema.namespaces[util_1.SYNC].models['MutationEvent'];

case 1:
_a = __read.apply(void 0, [_b.sent(), 1]), first = _a[0];
first = (_a.sent())[0];
if (!(first === undefined)) return [3 /*break*/, 3];
return [4 /*yield*/, storage.save(mutationEvent, undefined, this.ownSymbol)];
case 2:
_b.sent();
_a.sent();
return [2 /*return*/];

@@ -99,3 +83,3 @@ case 3:

// delete all for model
_b.sent();
_a.sent();
return [3 /*break*/, 7];

@@ -109,4 +93,4 @@ case 5:

// first gets updated with incoming's data, condition intentionally skiped
_b.sent();
_b.label = 7;
_a.sent();
_a.label = 7;
case 7: return [3 /*break*/, 12];

@@ -121,4 +105,4 @@ case 8:

// delete all for model
_b.sent();
_b.label = 10;
_a.sent();
_a.label = 10;
case 10:

@@ -129,4 +113,4 @@ // Enqueue new one

// Enqueue new one
_b.sent();
_b.label = 12;
_a.sent();
_a.label = 12;
case 12: return [2 /*return*/];

@@ -133,0 +117,0 @@ }

import Observable from 'zen-observable-ts';
import { MutationEvent } from '../';
import { ModelInstanceCreator } from '../../datastore/datastore';
import { ExclusiveStorage as Storage } from '../../storage/storage';
import Storage from '../../storage/storage';
import { ConflictHandler, ErrorHandler, InternalSchema, PersistentModel, PersistentModelConstructor, SchemaModel } from '../../types';

@@ -6,0 +6,0 @@ import { MutationEventOutbox } from '../outbox';

@@ -60,18 +60,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -109,5 +93,5 @@ var api_1 = require("@aws-amplify/api");

.forEach(function (model) {
var _a = __read(utils_1.buildGraphQLOperation(model, 'CREATE'), 1), createMutation = _a[0];
var _b = __read(utils_1.buildGraphQLOperation(model, 'UPDATE'), 1), updateMutation = _b[0];
var _c = __read(utils_1.buildGraphQLOperation(model, 'DELETE'), 1), deleteMutation = _c[0];
var createMutation = utils_1.buildGraphQLOperation(model, 'CREATE')[0];
var updateMutation = utils_1.buildGraphQLOperation(model, 'UPDATE')[0];
var deleteMutation = utils_1.buildGraphQLOperation(model, 'DELETE')[0];
_this.typeQuery.set(model, [

@@ -166,3 +150,3 @@ createMutation,

case 5:
_b = __read.apply(void 0, [_c.sent(), 3]), result = _b[0], opName = _b[1], modelDefinition = _b[2];
_b = _c.sent(), result = _b[0], opName = _b[1], modelDefinition = _b[2];
return [3 /*break*/, 7];

@@ -203,22 +187,22 @@ case 6:

case 0: return [4 /*yield*/, core_1.jitteredExponentialRetry(function (model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent) { return __awaiter(_this, void 0, void 0, function () {
var _a, query, variables, graphQLCondition, opName, modelDefinition, tryWith, attempt, opType, result, err_1, _b, error, retryWith, err_2, _c, _d, opName_1, query_1, serverData, namespace, updatedMutation;
var _e;
return __generator(this, function (_f) {
switch (_f.label) {
var _a, query, variables, graphQLCondition, opName, modelDefinition, tryWith, attempt, opType, result, err_1, error, retryWith, err_2, _b, opName_1, query_1, serverData, namespace, updatedMutation;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = __read(this.createQueryVariables(model, operation, data, condition), 5), query = _a[0], variables = _a[1], graphQLCondition = _a[2], opName = _a[3], modelDefinition = _a[4];
_a = this.createQueryVariables(model, operation, data, condition), query = _a[0], variables = _a[1], graphQLCondition = _a[2], opName = _a[3], modelDefinition = _a[4];
tryWith = { query: query, variables: variables };
attempt = 0;
opType = this.opTypeFromTransformerOperation(operation);
_f.label = 1;
_d.label = 1;
case 1:
_f.trys.push([1, 3, , 13]);
_d.trys.push([1, 3, , 13]);
return [4 /*yield*/, api_1.default.graphql(tryWith)];
case 2:
result = (_f.sent());
result = (_d.sent());
return [2 /*return*/, [result, opName, modelDefinition]];
case 3:
err_1 = _f.sent();
err_1 = _d.sent();
if (!(err_1.errors && err_1.errors.length > 0)) return [3 /*break*/, 12];
_b = __read(err_1.errors, 1), error = _b[0];
error = err_1.errors[0];
if (error.message === 'Network Error') {

@@ -238,3 +222,3 @@ if (!this.processing) {

case 4:
_f.trys.push([4, 6, , 7]);
_d.trys.push([4, 6, , 7]);
return [4 /*yield*/, this.conflictHandler({

@@ -248,6 +232,6 @@ modelConstructor: modelConstructor,

case 5:
retryWith = _f.sent();
retryWith = _d.sent();
return [3 /*break*/, 7];
case 6:
err_2 = _f.sent();
err_2 = _d.sent();
logger.warn('conflict trycatch', err_2);

@@ -257,3 +241,3 @@ return [3 /*break*/, 13];

if (!(retryWith === types_1.DISCARD)) return [3 /*break*/, 9];
_c = __read(utils_1.buildGraphQLOperation(modelDefinition, 'GET'), 1), _d = __read(_c[0], 3), opName_1 = _d[1], query_1 = _d[2];
_b = utils_1.buildGraphQLOperation(modelDefinition, 'GET')[0], opName_1 = _b[1], query_1 = _b[2];
return [4 /*yield*/, api_1.default.graphql({

@@ -264,3 +248,3 @@ query: query_1,

case 8:
serverData = _f.sent();
serverData = _d.sent();
return [2 /*return*/, [serverData, opName_1, modelDefinition]];

@@ -272,3 +256,3 @@ case 9:

case 10:
_f.sent();
_d.sent();
throw new core_1.NonRetryableError('RetryMutation');

@@ -295,3 +279,3 @@ case 11:

? [
{ data: (_e = {}, _e[opName] = error.data, _e) },
{ data: (_c = {}, _c[opName] = error.data, _c) },
opName,

@@ -302,7 +286,7 @@ modelDefinition,

}
_f.label = 12;
_d.label = 12;
case 12: return [3 /*break*/, 13];
case 13:
if (tryWith) return [3 /*break*/, 1];
_f.label = 14;
_d.label = 14;
case 14: return [2 /*return*/];

@@ -328,6 +312,6 @@ }

var queriesTuples = this.typeQuery.get(modelDefinition);
var _a = __read(queriesTuples.find(function (_a) {
var _b = __read(_a, 1), transformerMutationType = _b[0];
var _a = queriesTuples.find(function (_a) {
var transformerMutationType = _a[0];
return transformerMutationType === operation;
}), 3), opName = _a[1], query = _a[2];
}), opName = _a[1], query = _a[2];
var _b = JSON.parse(data), _version = _b._version, parsedData = __rest(_b, ["_version"]);

@@ -364,3 +348,3 @@ var filteredData = operation === utils_1.TransformerMutationType.DELETE

.reduce(function (acc, _a) {
var _b = __read(_a, 2), k = _b[0], v = _b[1];
var k = _a[0], v = _a[1];
acc[k] = v;

@@ -367,0 +351,0 @@ return acc;

@@ -49,18 +49,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -93,3 +77,3 @@ require("@aws-amplify/pubsub");

var _a = this.getAuthorizationInfo(model, transformerMutationType, userCredentials, cognitoTokenPayload, oidcTokenPayload) || {}, authMode = _a.authMode, isOwner = _a.isOwner, ownerField = _a.ownerField, ownerValue = _a.ownerValue;
var _b = __read(utils_1.buildSubscriptionGraphQLOperation(model, transformerMutationType, isOwner, ownerField), 3), opType = _b[0], opName = _b[1], query = _b[2];
var _b = utils_1.buildSubscriptionGraphQLOperation(model, transformerMutationType, isOwner, ownerField), opType = _b[0], opName = _b[1], query = _b[2];
return { authMode: authMode, opType: opType, opName: opName, query: query, isOwner: isOwner, ownerField: ownerField, ownerValue: ownerValue };

@@ -291,5 +275,5 @@ };

error: function (subscriptionError) {
var _a = subscriptionError.error, _b = __read((_a === void 0 ? {
var _a = subscriptionError.error, _b = (_a === void 0 ? {
errors: [],
} : _a).errors, 1), _c = _b[0], _d = (_c === void 0 ? {} : _c).message, message = _d === void 0 ? '' : _d;
} : _a).errors[0], _c = (_b === void 0 ? {} : _b).message, message = _c === void 0 ? '' : _c;
observer.error(message);

@@ -296,0 +280,0 @@ },

@@ -38,29 +38,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -90,3 +63,3 @@ var api_1 = require("@aws-amplify/api");

.forEach(function (model) {
var _a = __read(utils_1.buildGraphQLOperation(model, 'LIST'), 1), _b = __read(_a[0]), _transformerMutationType = _b[0], opNameQuery = _b.slice(1);
var _a = utils_1.buildGraphQLOperation(model, 'LIST')[0], _transformerMutationType = _a[0], opNameQuery = _a.slice(1);
_this.typeQuery.set(model, opNameQuery);

@@ -103,3 +76,3 @@ });

case 0:
_a = __read(this.typeQuery.get(modelDefinition), 2), opName = _a[0], query = _a[1];
_a = this.typeQuery.get(modelDefinition), opName = _a[0], query = _a[1];
variables = {

@@ -150,17 +123,7 @@ limit: limit,

var sortedTypesLastSyncs = Object.values(_this.schema.namespaces).reduce(function (map, namespace) {
var e_1, _a;
try {
for (var _b = __values(Array.from(namespace.modelTopologicalOrdering.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
var modelName = _c.value;
var typeLastSync = typesLastSync.get(namespace.models[modelName]);
map.set(namespace.models[modelName], typeLastSync);
}
for (var _i = 0, _a = Array.from(namespace.modelTopologicalOrdering.keys()); _i < _a.length; _i++) {
var modelName = _a[_i];
var typeLastSync = typesLastSync.get(namespace.models[modelName]);
map.set(namespace.models[modelName], typeLastSync);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return map;

@@ -170,12 +133,12 @@ }, new Map());

.filter(function (_a) {
var _b = __read(_a, 1), syncable = _b[0].syncable;
var syncable = _a[0].syncable;
return syncable;
})
.map(function (_a) {
var _b = __read(_a, 2), modelDefinition = _b[0], _c = __read(_b[1], 2), namespace = _c[0], lastSync = _c[1];
var modelDefinition = _a[0], _b = _a[1], namespace = _b[0], lastSync = _b[1];
return __awaiter(_this, void 0, void 0, function () {
var done, nextToken, startedAt, items, recordsReceived, parents, promises, promise;
var _this = this;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -231,3 +194,3 @@ done = false;

case 1:
_d.sent();
_c.sent();
return [2 /*return*/];

@@ -234,0 +197,0 @@ }

@@ -38,18 +38,2 @@ "use strict";

};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -113,3 +97,3 @@ var types_1 = require("./types");

case 'between':
var _a = __read(operand, 2), min = _a[0], max = _a[1];
var _a = operand, min = _a[0], max = _a[1];
return value >= min && value <= max;

@@ -116,0 +100,0 @@ case 'beginsWith':

{
"name": "@aws-amplify/datastore",
"version": "1.0.7-preview.5319+02ff9ef6",
"version": "1.0.7-rn-datastore.3+0d78e166",
"description": "AppSyncLocal support for aws-amplify",

@@ -11,3 +11,2 @@ "main": "./lib/index.js",

},
"sideEffects": false,
"scripts": {

@@ -40,5 +39,5 @@ "test": "tslint 'src/**/*.ts' && jest -w 1 --coverage",

"dependencies": {
"@aws-amplify/api": "1.0.38-preview.98+02ff9ef6",
"@aws-amplify/core": "1.0.29-preview.121+02ff9ef6",
"@aws-amplify/pubsub": "1.0.30-preview.121+02ff9ef6",
"@aws-amplify/api": "2.1.6-rn-datastore.3+0d78e166",
"@aws-amplify/core": "2.2.5-rn-datastore.3+0d78e166",
"@aws-amplify/pubsub": "2.1.6-rn-datastore.3+0d78e166",
"idb": "4.0.4",

@@ -95,3 +94,3 @@ "immer": "3.1.3",

},
"gitHead": "02ff9ef64c5449463b5c17bb903d2174c7829b4f"
"gitHead": "0d78e1660c96e5d8f568f303e3ff4e26b9dd7d39"
}

@@ -6,3 +6,3 @@ import { ConsoleLogger as Logger } from '@aws-amplify/core';

import { isPredicatesAll, ModelPredicateCreator } from '../predicates';
import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { SyncEngine } from '../sync';

@@ -9,0 +9,0 @@ import {

@@ -1,2 +0,2 @@

import { Amplify } from '@aws-amplify/core';
import Amplify from '@aws-amplify/core';
import { DataStore, initSchema } from './datastore/datastore';

@@ -3,0 +3,0 @@ import { Predicates } from './predicates';

@@ -23,12 +23,4 @@ import { Mutex } from '@aws-amplify/core';

import { Adapter } from './adapter';
import getDefaultAdapter from './adapter/getDefaultAdapter';
const getDefaultAdapter: () => Adapter = () => {
if (window.indexedDB) {
return require('./adapter/indexeddb').default;
}
if (process && process.env) {
throw new Error('Node is not supported');
}
};
export type StorageSubscriptionMessage = SubscriptionMessage<any> & {

@@ -56,3 +48,3 @@ mutator?: Symbol;

) {
this.adapter = adapter || getDefaultAdapter();
this.adapter = getDefaultAdapter();
this.pushStream = new PushStream();

@@ -350,2 +342,2 @@ }

export { ExclusiveStorage };
export default ExclusiveStorage;

@@ -5,3 +5,3 @@ import { ConsoleLogger as Logger, Reachability } from '@aws-amplify/core';

import { ModelPredicateCreator } from '../predicates';
import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import {

@@ -134,5 +134,3 @@ ConflictHandler,

} catch (err) {
logger.error(
"Sync engine stopped. IndexedDB not supported in this browser's private mode"
);
logger.error('Sync engine error on start', err);
return;

@@ -139,0 +137,0 @@ }

@@ -1,2 +0,2 @@

import { ExclusiveStorage as Storage } from '../storage/storage';
import Storage from '../storage/storage';
import { ModelInstanceMetadata } from '../types';

@@ -3,0 +3,0 @@ import { MutationEventOutbox } from './outbox';

import { MutationEvent } from '.';
import { ModelPredicateCreator } from '../predicates';
import { ExclusiveStorage as Storage, StorageFacade } from '../storage/storage';
import Storage, { StorageFacade } from '../storage/storage';
import {

@@ -5,0 +5,0 @@ InternalSchema,

@@ -10,3 +10,3 @@ import API, { GraphQLResult } from '@aws-amplify/api';

import { ModelInstanceCreator } from '../../datastore/datastore';
import { ExclusiveStorage as Storage } from '../../storage/storage';
import Storage from '../../storage/storage';
import {

@@ -13,0 +13,0 @@ ConflictHandler,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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