@aws-amplify/datastore 5.0.1-console-preview.67f944e.0 → 5.0.1-console-preview.0bbe168.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/datastore/datastore.d.ts +1 -1
  2. package/lib/datastore/datastore.js +5 -8
  3. package/lib/storage/storage.d.ts +1 -1
  4. package/lib/storage/storage.js +11 -9
  5. package/lib/sync/datastoreConnectivity.d.ts +1 -1
  6. package/lib/sync/datastoreConnectivity.js +2 -5
  7. package/lib/sync/datastoreReachability/index.d.ts +1 -3
  8. package/lib/sync/datastoreReachability/index.native.d.ts +1 -3
  9. package/lib/sync/index.d.ts +1 -1
  10. package/lib/sync/index.js +6 -6
  11. package/lib/sync/processors/mutation.d.ts +1 -1
  12. package/lib/sync/processors/mutation.js +2 -5
  13. package/lib/sync/processors/subscription.d.ts +1 -1
  14. package/lib/sync/processors/subscription.js +3 -7
  15. package/lib/sync/processors/sync.d.ts +1 -1
  16. package/lib/sync/processors/sync.js +2 -5
  17. package/lib/tsconfig.tsbuildinfo +1 -1
  18. package/lib-esm/datastore/datastore.d.ts +1 -1
  19. package/lib-esm/datastore/datastore.js +3 -3
  20. package/lib-esm/storage/storage.d.ts +1 -1
  21. package/lib-esm/storage/storage.js +11 -9
  22. package/lib-esm/sync/datastoreConnectivity.d.ts +1 -1
  23. package/lib-esm/sync/datastoreConnectivity.js +1 -1
  24. package/lib-esm/sync/datastoreReachability/index.d.ts +1 -3
  25. package/lib-esm/sync/datastoreReachability/index.native.d.ts +1 -3
  26. package/lib-esm/sync/index.d.ts +1 -1
  27. package/lib-esm/sync/index.js +4 -4
  28. package/lib-esm/sync/processors/mutation.d.ts +1 -1
  29. package/lib-esm/sync/processors/mutation.js +1 -1
  30. package/lib-esm/sync/processors/subscription.d.ts +1 -1
  31. package/lib-esm/sync/processors/subscription.js +1 -2
  32. package/lib-esm/sync/processors/sync.d.ts +1 -1
  33. package/lib-esm/sync/processors/sync.js +1 -1
  34. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +8 -9
  36. package/src/datastore/datastore.ts +5 -5
  37. package/src/storage/storage.ts +26 -22
  38. package/src/sync/datastoreConnectivity.ts +3 -3
  39. package/src/sync/index.ts +10 -8
  40. package/src/sync/processors/mutation.ts +2 -2
  41. package/src/sync/processors/subscription.ts +5 -6
  42. package/src/sync/processors/sync.ts +1 -1
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { PredicateAll } from '../predicates';
3
3
  import { ConflictHandler, DataStoreConfig, ProducerPaginationInput, PersistentModel, PersistentModelConstructor, Schema, SubscriptionMessage, DataStoreSnapshot, TypeConstructorMap, ErrorHandler, ObserveQueryOptions, PersistentModelMetaData, IdentifierFieldOrIdentifierObject, RecursiveModelPredicateExtender, ModelPredicateExtender } from '../types';
4
4
  export declare let syncClasses: TypeConstructorMap;
@@ -120,7 +120,7 @@ import { InternalAPI } from '@aws-amplify/api/internals';
120
120
  import { Amplify, Hub, Cache } from '@aws-amplify/core';
121
121
  import { immerable, produce, setAutoFreeze, enablePatches, } from 'immer';
122
122
  import { v4 as uuid4 } from 'uuid';
123
- import Observable from 'zen-observable-ts';
123
+ import { Observable, filter } from 'rxjs';
124
124
  import { defaultAuthStrategy, multiAuthStrategy } from '../authModeStrategies';
125
125
  import { isPredicatesAll, ModelPredicateCreator, ModelSortPredicateCreator, } from '../predicates';
126
126
  import { ExclusiveStorage as Storage } from '../storage/storage';
@@ -1764,10 +1764,10 @@ var DataStore = /** @class */ (function () {
1764
1764
  // Filter the events returned by Storage according to namespace,
1765
1765
  // append original element data, and subscribe to the observable
1766
1766
  source = this.storage.observe(modelConstructor)
1767
- .filter(function (_a) {
1767
+ .pipe(filter(function (_a) {
1768
1768
  var model = _a.model;
1769
1769
  return namespaceResolver(model) === USER;
1770
- })
1770
+ }))
1771
1771
  .subscribe({
1772
1772
  next: function (item) {
1773
1773
  return _this.runningProcesses.isOpen &&
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { Patch } from 'immer';
3
3
  import { ModelInstanceCreator } from '../datastore/datastore';
4
4
  import { InternalSchema, ModelInstanceMetadata, ModelPredicate, NamespaceResolver, OpType, PaginationInput, PersistentModel, PersistentModelConstructor, QueryOne, SchemaNamespace, InternalSubscriptionMessage, SubscriptionMessage } from '../types';
@@ -83,7 +83,9 @@ var __values = (this && this.__values) || function(o) {
83
83
  };
84
84
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
85
85
  };
86
- import PushStream from 'zen-push';
86
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
+ // SPDX-License-Identifier: Apache-2.0
88
+ import { filter, map, Subject } from 'rxjs';
87
89
  import { ModelPredicateCreator } from '../predicates';
88
90
  import { OpType, QueryOne, isTargetNameAssociation, } from '../types';
89
91
  import { isModelConstructor, STORAGE, validatePredicate, valuesEqual, } from '../util';
@@ -100,7 +102,7 @@ var StorageClass = /** @class */ (function () {
100
102
  this.adapter = adapter;
101
103
  this.sessionId = sessionId;
102
104
  this.adapter = this.adapter || getDefaultAdapter();
103
- this.pushStream = new PushStream();
105
+ this.pushStream = new Subject();
104
106
  }
105
107
  StorageClass.getNamespace = function () {
106
108
  var namespace = {
@@ -289,17 +291,17 @@ var StorageClass = /** @class */ (function () {
289
291
  var listenToAll = !modelConstructor;
290
292
  var _a = (predicate && ModelPredicateCreator.getPredicates(predicate, false)) ||
291
293
  {}, predicates = _a.predicates, type = _a.type;
292
- var result = this.pushStream.observable
293
- .filter(function (_a) {
294
+ var result = this.pushStream
295
+ .pipe(filter(function (_a) {
294
296
  var mutator = _a.mutator;
295
297
  return !skipOwn || mutator !== skipOwn;
296
- })
297
- .map(function (_a) {
298
+ }))
299
+ .pipe(map(function (_a) {
298
300
  var _mutator = _a.mutator, message = __rest(_a, ["mutator"]);
299
301
  return message;
300
- });
302
+ }));
301
303
  if (!listenToAll) {
302
- result = result.filter(function (_a) {
304
+ result = result.pipe(filter(function (_a) {
303
305
  var model = _a.model, element = _a.element;
304
306
  if (modelConstructor !== model) {
305
307
  return false;
@@ -308,7 +310,7 @@ var StorageClass = /** @class */ (function () {
308
310
  return validatePredicate(element, type, predicates);
309
311
  }
310
312
  return true;
311
- });
313
+ }));
312
314
  }
313
315
  return result;
314
316
  };
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  type ConnectionStatus = {
3
3
  online: boolean;
4
4
  };
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
49
49
  // SPDX-License-Identifier: Apache-2.0
50
- import Observable from 'zen-observable-ts';
50
+ import { Observable } from 'rxjs';
51
51
  import { ReachabilityMonitor } from './datastoreReachability';
52
52
  import { Logger } from '@aws-amplify/core/internals/utils';
53
53
  var logger = new Logger('DataStore');
@@ -1,3 +1 @@
1
- export declare const ReachabilityMonitor: import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;
1
+ export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -1,3 +1 @@
1
- export declare const ReachabilityMonitor: import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;
1
+ export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { ModelInstanceCreator } from '../datastore/datastore';
3
3
  import { ExclusiveStorage as Storage } from '../storage/storage';
4
4
  import { ConflictHandler, ControlMessageType, ErrorHandler, InternalSchema, ModelInit, MutableModel, NamespaceResolver, PersistentModelConstructor, SchemaModel, SchemaNamespace, TypeConstructorMap, ModelPredicate, AuthModeStrategy, ManagedIdentifier, OptionallyManagedIdentifier, AmplifyContext } from '../types';
@@ -74,7 +74,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
74
74
  // SPDX-License-Identifier: Apache-2.0
75
75
  import { Logger, BackgroundProcessManager, } from '@aws-amplify/core/internals/utils';
76
76
  import { Hub } from '@aws-amplify/core';
77
- import Observable from 'zen-observable-ts';
77
+ import { filter, Observable, of } from 'rxjs';
78
78
  import { ModelPredicateCreator } from '../predicates';
79
79
  import { OpType, } from '../types';
80
80
  import { getNow, SYNC, USER } from '../util';
@@ -333,11 +333,11 @@ var SyncEngine = /** @class */ (function () {
333
333
  });
334
334
  this.storage
335
335
  .observe(null, null, ownSymbol)
336
- .filter(function (_a) {
336
+ .pipe(filter(function (_a) {
337
337
  var model = _a.model;
338
338
  var modelDefinition = _this.getModelDefinition(model);
339
339
  return modelDefinition.syncable === true;
340
- })
340
+ }))
341
341
  .subscribe({
342
342
  next: function (_a) {
343
343
  var opType = _a.opType, model = _a.model, element = _a.element, condition = _a.condition;
@@ -438,7 +438,7 @@ var SyncEngine = /** @class */ (function () {
438
438
  SyncEngine.prototype.syncQueriesObservable = function () {
439
439
  var _this = this;
440
440
  if (!this.online) {
441
- return Observable.of();
441
+ return of({}); // TODO(v6): fix this
442
442
  }
443
443
  return new Observable(function (observer) {
444
444
  var syncQueriesSubscription;
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { MutationEvent } from '../';
3
3
  import { ModelInstanceCreator } from '../../datastore/datastore';
4
4
  import { ExclusiveStorage as Storage } from '../../storage/storage';
@@ -85,7 +85,7 @@ var __values = (this && this.__values) || function(o) {
85
85
  };
86
86
  import { InternalAPI } from '@aws-amplify/api/internals';
87
87
  import { Category, Logger, DataStoreAction, jitteredBackoff, NonRetryableError, retry, BackgroundProcessManager, } from '@aws-amplify/core/internals/utils';
88
- import Observable from 'zen-observable-ts';
88
+ import { Observable } from 'rxjs';
89
89
  import { DISCARD, isModelFieldType, isTargetNameAssociation, OpType, ProcessName, } from '../../types';
90
90
  import { extractTargetNamesFromSrc, USER, ID } from '../../util';
91
91
  import { buildGraphQLOperation, createMutationInstanceFromModelOperation, getModelAuthModes, TransformerMutationType, getTokenForCustomAuth, } from '../utils';
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { InternalSchema, PersistentModel, SchemaModel, ModelPredicate, AuthModeStrategy, ErrorHandler, AmplifyContext } from '../../types';
3
3
  import { TransformerMutationType } from '../utils';
4
4
  export declare enum CONTROL_MSG {
@@ -73,7 +73,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
73
73
  import { InternalAPI } from '@aws-amplify/api/internals';
74
74
  import { Hub, fetchAuthSession } from '@aws-amplify/core';
75
75
  import { Category, Logger, DataStoreAction, BackgroundProcessManager, } from '@aws-amplify/core/internals/utils';
76
- import Observable from 'zen-observable-ts';
76
+ import { Observable } from 'rxjs';
77
77
  import { ProcessName, } from '../../types';
78
78
  import { buildSubscriptionGraphQLOperation, getAuthorizationRules, getModelAuthModes, getUserGroupsFromToken, TransformerMutationType, getTokenForCustomAuth, predicateToGraphQLFilter, RTFError, generateRTFRemediation, } from '../utils';
79
79
  import { ModelPredicateCreator } from '../../predicates';
@@ -301,7 +301,6 @@ var SubscriptionProcessor = /** @class */ (function () {
301
301
  queryObservable = this.amplifyContext.InternalAPI.graphql(__assign(__assign({ query: query, variables: variables }, { authMode: authMode }), { authToken: authToken }), undefined, customUserAgentDetails);
302
302
  // TODO: consider onTerminate.then(() => API.cancel(...))
303
303
  subscriptions[modelDefinition.name][transformerMutationType].push(queryObservable
304
- .filter(function () { return true; }) // to make change more readable
305
304
  .subscribe({
306
305
  next: function (result) {
307
306
  var data = result.data, errors = result.errors;
@@ -1,4 +1,4 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { InternalSchema, ModelInstanceMetadata, SchemaModel, ModelPredicate, AuthModeStrategy, ErrorHandler, AmplifyContext } from '../../types';
3
3
  declare class SyncProcessor {
4
4
  private readonly schema;
@@ -62,7 +62,7 @@ var __values = (this && this.__values) || function(o) {
62
62
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
63
63
  };
64
64
  import { InternalAPI } from '@aws-amplify/api/internals';
65
- import Observable from 'zen-observable-ts';
65
+ import { Observable } from 'rxjs';
66
66
  import { ProcessName, } from '../../types';
67
67
  import { buildGraphQLOperation, getModelAuthModes, getClientSideAuthError, getForbiddenError, predicateToGraphQLFilter, getTokenForCustomAuth, } from '../utils';
68
68
  import { jitteredExponentialRetry, Category, ConsoleLogger as Logger, DataStoreAction, NonRetryableError, BackgroundProcessManager, } from '@aws-amplify/core/internals/utils';