@aws-amplify/datastore 3.7.9-unstable.2 → 3.7.10-unstable.2

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.7.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.8...@aws-amplify/datastore@3.7.9) (2022-03-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **@aws-amplify/datastore:** fix mutations to retry indefinitely on network error ([#9724](https://github.com/aws-amplify/amplify-js/issues/9724)) ([5371380](https://github.com/aws-amplify/amplify-js/commit/53713804b79df9c69ac29b75ffc576b4c2002507))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.7.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.7...@aws-amplify/datastore@3.7.8) (2022-03-10)
7
18
 
8
19
  **Note:** Version bump only for package @aws-amplify/datastore
@@ -58672,17 +58672,11 @@ __webpack_require__.r(__webpack_exports__);
58672
58672
 
58673
58673
  "use strict";
58674
58674
  __webpack_require__.r(__webpack_exports__);
58675
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return GRAPHQL_AUTH_MODE; });
58676
58675
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GraphQLAuthError", function() { return GraphQLAuthError; });
58677
- var GRAPHQL_AUTH_MODE;
58676
+ /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/auth */ "../auth/lib-esm/index.js");
58677
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0__["GRAPHQL_AUTH_MODE"]; });
58678
+
58678
58679
 
58679
- (function (GRAPHQL_AUTH_MODE) {
58680
- GRAPHQL_AUTH_MODE["API_KEY"] = "API_KEY";
58681
- GRAPHQL_AUTH_MODE["AWS_IAM"] = "AWS_IAM";
58682
- GRAPHQL_AUTH_MODE["OPENID_CONNECT"] = "OPENID_CONNECT";
58683
- GRAPHQL_AUTH_MODE["AMAZON_COGNITO_USER_POOLS"] = "AMAZON_COGNITO_USER_POOLS";
58684
- GRAPHQL_AUTH_MODE["AWS_LAMBDA"] = "AWS_LAMBDA";
58685
- })(GRAPHQL_AUTH_MODE || (GRAPHQL_AUTH_MODE = {}));
58686
58680
 
58687
58681
  var GraphQLAuthError;
58688
58682
 
@@ -64624,7 +64618,7 @@ var AuthErrorStrings;
64624
64618
  /*!********************************!*\
64625
64619
  !*** ../auth/lib-esm/index.js ***!
64626
64620
  \********************************/
64627
- /*! exports provided: default, Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, appendToCognitoUserAgent, AuthErrorStrings */
64621
+ /*! exports provided: default, Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, appendToCognitoUserAgent, AuthErrorStrings, GRAPHQL_AUTH_MODE */
64628
64622
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
64629
64623
 
64630
64624
  "use strict";
@@ -64635,6 +64629,8 @@ __webpack_require__.r(__webpack_exports__);
64635
64629
  /* harmony import */ var _types_Auth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types/Auth */ "../auth/lib-esm/types/Auth.js");
64636
64630
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CognitoHostedUIIdentityProvider", function() { return _types_Auth__WEBPACK_IMPORTED_MODULE_1__["CognitoHostedUIIdentityProvider"]; });
64637
64631
 
64632
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return _types_Auth__WEBPACK_IMPORTED_MODULE_1__["GRAPHQL_AUTH_MODE"]; });
64633
+
64638
64634
  /* harmony import */ var amazon_cognito_identity_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! amazon-cognito-identity-js */ "../amazon-cognito-identity-js/es/index.js");
64639
64635
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CognitoUser", function() { return amazon_cognito_identity_js__WEBPACK_IMPORTED_MODULE_2__["CognitoUser"]; });
64640
64636
 
@@ -64674,7 +64670,7 @@ __webpack_require__.r(__webpack_exports__);
64674
64670
  /*!*************************************!*\
64675
64671
  !*** ../auth/lib-esm/types/Auth.js ***!
64676
64672
  \*************************************/
64677
- /*! exports provided: CognitoHostedUIIdentityProvider, isFederatedSignInOptions, isFederatedSignInOptionsCustom, hasCustomState, isCognitoHostedOpts, AuthErrorTypes, isUsernamePasswordOpts */
64673
+ /*! exports provided: CognitoHostedUIIdentityProvider, isFederatedSignInOptions, isFederatedSignInOptionsCustom, hasCustomState, isCognitoHostedOpts, AuthErrorTypes, isUsernamePasswordOpts, GRAPHQL_AUTH_MODE */
64678
64674
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
64679
64675
 
64680
64676
  "use strict";
@@ -64686,6 +64682,7 @@ __webpack_require__.r(__webpack_exports__);
64686
64682
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCognitoHostedOpts", function() { return isCognitoHostedOpts; });
64687
64683
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AuthErrorTypes", function() { return AuthErrorTypes; });
64688
64684
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUsernamePasswordOpts", function() { return isUsernamePasswordOpts; });
64685
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return GRAPHQL_AUTH_MODE; });
64689
64686
  /*
64690
64687
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
64691
64688
  *
@@ -64751,6 +64748,15 @@ var AuthErrorTypes;
64751
64748
  function isUsernamePasswordOpts(obj) {
64752
64749
  return !!obj.username;
64753
64750
  }
64751
+ var GRAPHQL_AUTH_MODE;
64752
+
64753
+ (function (GRAPHQL_AUTH_MODE) {
64754
+ GRAPHQL_AUTH_MODE["API_KEY"] = "API_KEY";
64755
+ GRAPHQL_AUTH_MODE["AWS_IAM"] = "AWS_IAM";
64756
+ GRAPHQL_AUTH_MODE["OPENID_CONNECT"] = "OPENID_CONNECT";
64757
+ GRAPHQL_AUTH_MODE["AMAZON_COGNITO_USER_POOLS"] = "AMAZON_COGNITO_USER_POOLS";
64758
+ GRAPHQL_AUTH_MODE["AWS_LAMBDA"] = "AWS_LAMBDA";
64759
+ })(GRAPHQL_AUTH_MODE || (GRAPHQL_AUTH_MODE = {}));
64754
64760
 
64755
64761
  /***/ }),
64756
64762
 
@@ -64758,7 +64764,7 @@ function isUsernamePasswordOpts(obj) {
64758
64764
  /*!**************************************!*\
64759
64765
  !*** ../auth/lib-esm/types/index.js ***!
64760
64766
  \**************************************/
64761
- /*! exports provided: CognitoHostedUIIdentityProvider, isFederatedSignInOptions, isFederatedSignInOptionsCustom, hasCustomState, isCognitoHostedOpts, AuthErrorTypes, isUsernamePasswordOpts */
64767
+ /*! exports provided: CognitoHostedUIIdentityProvider, isFederatedSignInOptions, isFederatedSignInOptionsCustom, hasCustomState, isCognitoHostedOpts, AuthErrorTypes, isUsernamePasswordOpts, GRAPHQL_AUTH_MODE */
64762
64768
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
64763
64769
 
64764
64770
  "use strict";
@@ -64778,6 +64784,8 @@ __webpack_require__.r(__webpack_exports__);
64778
64784
 
64779
64785
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isUsernamePasswordOpts", function() { return _Auth__WEBPACK_IMPORTED_MODULE_0__["isUsernamePasswordOpts"]; });
64780
64786
 
64787
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return _Auth__WEBPACK_IMPORTED_MODULE_0__["GRAPHQL_AUTH_MODE"]; });
64788
+
64781
64789
  /*
64782
64790
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
64783
64791
  *
@@ -71098,7 +71106,7 @@ var getAmplifyUserAgent = function getAmplifyUserAgent() {
71098
71106
  __webpack_require__.r(__webpack_exports__);
71099
71107
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
71100
71108
  // generated by genversion
71101
- var version = '4.4.1';
71109
+ var version = '4.4.2';
71102
71110
 
71103
71111
  /***/ }),
71104
71112
 
@@ -73481,13 +73489,14 @@ function () {
73481
73489
  /*!*************************************!*\
73482
73490
  !*** ../core/lib-esm/Util/Retry.js ***!
73483
73491
  \*************************************/
73484
- /*! exports provided: NonRetryableError, retry, jitteredExponentialRetry */
73492
+ /*! exports provided: NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry */
73485
73493
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73486
73494
 
73487
73495
  "use strict";
73488
73496
  __webpack_require__.r(__webpack_exports__);
73489
73497
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NonRetryableError", function() { return NonRetryableError; });
73490
73498
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return retry; });
73499
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jitteredBackoff", function() { return jitteredBackoff; });
73491
73500
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jitteredExponentialRetry", function() { return jitteredExponentialRetry; });
73492
73501
  /* harmony import */ var _Logger_ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Logger/ConsoleLogger */ "../core/lib-esm/Logger/ConsoleLogger.js");
73493
73502
  var __extends = undefined && undefined.__extends || function () {
@@ -73802,8 +73811,16 @@ function retry(functionToRetry, args, delayFn, attempt) {
73802
73811
  });
73803
73812
  }
73804
73813
  var MAX_DELAY_MS = 5 * 60 * 1000;
73814
+ /**
73815
+ * @private
73816
+ * Internal use of Amplify only
73817
+ */
73805
73818
 
73806
73819
  function jitteredBackoff(maxDelayMs) {
73820
+ if (maxDelayMs === void 0) {
73821
+ maxDelayMs = MAX_DELAY_MS;
73822
+ }
73823
+
73807
73824
  var BASE_TIME_MS = 100;
73808
73825
  var JITTER_FACTOR = 100;
73809
73826
  return function (attempt) {
@@ -73816,7 +73833,6 @@ function jitteredBackoff(maxDelayMs) {
73816
73833
  * Internal use of Amplify only
73817
73834
  */
73818
73835
 
73819
-
73820
73836
  var jitteredExponentialRetry = function jitteredExponentialRetry(functionToRetry, args, maxDelayMs) {
73821
73837
  if (maxDelayMs === void 0) {
73822
73838
  maxDelayMs = MAX_DELAY_MS;
@@ -73855,7 +73871,7 @@ function urlSafeDecode(hex) {
73855
73871
  /*!*************************************!*\
73856
73872
  !*** ../core/lib-esm/Util/index.js ***!
73857
73873
  \*************************************/
73858
- /*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
73874
+ /*! exports provided: NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
73859
73875
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73860
73876
 
73861
73877
  "use strict";
@@ -73865,6 +73881,8 @@ __webpack_require__.r(__webpack_exports__);
73865
73881
 
73866
73882
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _Retry__WEBPACK_IMPORTED_MODULE_0__["retry"]; });
73867
73883
 
73884
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jitteredBackoff", function() { return _Retry__WEBPACK_IMPORTED_MODULE_0__["jitteredBackoff"]; });
73885
+
73868
73886
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jitteredExponentialRetry", function() { return _Retry__WEBPACK_IMPORTED_MODULE_0__["jitteredExponentialRetry"]; });
73869
73887
 
73870
73888
  /* harmony import */ var _Mutex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Mutex */ "../core/lib-esm/Util/Mutex.js");
@@ -73945,7 +73963,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
73945
73963
  /*!********************************!*\
73946
73964
  !*** ../core/lib-esm/index.js ***!
73947
73965
  \********************************/
73948
- /*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, Amplify, default */
73966
+ /*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, Amplify, default */
73949
73967
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73950
73968
 
73951
73969
  "use strict";
@@ -74058,6 +74076,8 @@ __webpack_require__.r(__webpack_exports__);
74058
74076
 
74059
74077
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["retry"]; });
74060
74078
 
74079
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jitteredBackoff", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["jitteredBackoff"]; });
74080
+
74061
74081
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "jitteredExponentialRetry", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["jitteredExponentialRetry"]; });
74062
74082
 
74063
74083
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Mutex", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["Mutex"]; });
@@ -92137,11 +92157,12 @@ function () {
92137
92157
  /*!*********************************************!*\
92138
92158
  !*** ./lib-esm/sync/processors/mutation.js ***!
92139
92159
  \*********************************************/
92140
- /*! exports provided: MutationProcessor */
92160
+ /*! exports provided: safeJitteredBackoff, MutationProcessor */
92141
92161
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92142
92162
 
92143
92163
  "use strict";
92144
92164
  __webpack_require__.r(__webpack_exports__);
92165
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeJitteredBackoff", function() { return safeJitteredBackoff; });
92145
92166
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MutationProcessor", function() { return MutationProcessor; });
92146
92167
  /* harmony import */ var _aws_amplify_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/api */ "../api/lib-esm/index.js");
92147
92168
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "../core/lib-esm/index.js");
@@ -92695,7 +92716,7 @@ function () {
92695
92716
  case 0:
92696
92717
  return [4
92697
92718
  /*yield*/
92698
- , Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["jitteredExponentialRetry"])(function (model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent) {
92719
+ , Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["retry"])(function (model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent) {
92699
92720
  return __awaiter(_this, void 0, void 0, function () {
92700
92721
  var _a, query, variables, graphQLCondition, opName, modelDefinition, authToken, tryWith, attempt, opType, result, err_1, _b, error, _c, _d, code, retryWith, err_2, _e, _f, opName_1, query_1, authToken_1, serverData, namespace, updatedMutation, err_3;
92701
92722
 
@@ -92900,7 +92921,7 @@ function () {
92900
92921
  }
92901
92922
  });
92902
92923
  });
92903
- }, [model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent])];
92924
+ }, [model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent], safeJitteredBackoff)];
92904
92925
 
92905
92926
  case 1:
92906
92927
  return [2
@@ -93042,6 +93063,33 @@ function () {
93042
93063
  return MutationProcessor;
93043
93064
  }();
93044
93065
 
93066
+ var MAX_RETRY_DELAY_MS = 5 * 60 * 1000;
93067
+ var originalJitteredBackoff = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["jitteredBackoff"])(MAX_RETRY_DELAY_MS);
93068
+ /**
93069
+ * @private
93070
+ * Internal use of Amplify only.
93071
+ *
93072
+ * Wraps the jittered backoff calculation to retry Network Errors indefinitely.
93073
+ * Backs off according to original jittered retry logic until the original retry
93074
+ * logic hits its max. After this occurs, if the error is a Network Error, we
93075
+ * ignore the attempt count and return MAX_RETRY_DELAY_MS to retry forever (until
93076
+ * the request succeeds).
93077
+ *
93078
+ * @param attempt ignored
93079
+ * @param _args ignored
93080
+ * @param error tested to see if `.message` is 'Network Error'
93081
+ * @returns number | false :
93082
+ */
93083
+
93084
+ var safeJitteredBackoff = function safeJitteredBackoff(attempt, _args, error) {
93085
+ var attemptResult = originalJitteredBackoff(attempt); // If this is the last attempt and it is a network error, we retry indefinitively every 5 minutes
93086
+
93087
+ if (attemptResult === false && (error === null || error === void 0 ? void 0 : error.message) === 'Network Error') {
93088
+ return MAX_RETRY_DELAY_MS;
93089
+ }
93090
+
93091
+ return attemptResult;
93092
+ };
93045
93093
 
93046
93094
 
93047
93095
  /***/ }),