@aws-amplify/datastore 3.11.1-unstable.1 → 3.11.1
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 +11 -0
- package/dist/aws-amplify-datastore.js +56 -3
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +2 -2
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/datastore/datastore.js +14 -0
- package/lib/datastore/datastore.js.map +1 -1
- package/lib-esm/datastore/datastore.js +14 -0
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +16 -0
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.11.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.11.0...@aws-amplify/datastore@3.11.1) (2022-05-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add error for when schema is not initialized ([#9874](https://github.com/aws-amplify/amplify-js/issues/9874)) ([a63f0ee](https://github.com/aws-amplify/amplify-js/commit/a63f0eec70b96dba2d220f3eeb0c799af8622b5c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.11.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.10.0...@aws-amplify/datastore@3.11.0) (2022-05-03)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -58572,6 +58572,16 @@ function () {
|
|
|
58572
58572
|
GraphQLAPIClass.prototype.cancel = function (request, message) {
|
|
58573
58573
|
return this._api.cancel(request, message);
|
|
58574
58574
|
};
|
|
58575
|
+
/**
|
|
58576
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
58577
|
+
* @params request - The request promise
|
|
58578
|
+
* @return if the request has a corresponding cancel token.
|
|
58579
|
+
*/
|
|
58580
|
+
|
|
58581
|
+
|
|
58582
|
+
GraphQLAPIClass.prototype.hasCancelToken = function (request) {
|
|
58583
|
+
return this._api.hasCancelToken(request);
|
|
58584
|
+
};
|
|
58575
58585
|
|
|
58576
58586
|
GraphQLAPIClass.prototype._graphqlSubscribe = function (_a, additionalHeaders) {
|
|
58577
58587
|
var query = _a.query,
|
|
@@ -59176,6 +59186,16 @@ function () {
|
|
|
59176
59186
|
RestAPIClass.prototype.cancel = function (request, message) {
|
|
59177
59187
|
return this._api.cancel(request, message);
|
|
59178
59188
|
};
|
|
59189
|
+
/**
|
|
59190
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
59191
|
+
* @params request - The request promise
|
|
59192
|
+
* @return if the request has a corresponding cancel token.
|
|
59193
|
+
*/
|
|
59194
|
+
|
|
59195
|
+
|
|
59196
|
+
RestAPIClass.prototype.hasCancelToken = function (request) {
|
|
59197
|
+
return this._api.hasCancelToken(request);
|
|
59198
|
+
};
|
|
59179
59199
|
/**
|
|
59180
59200
|
* Getting endpoint for API
|
|
59181
59201
|
* @param {string} apiName - The name of the api
|
|
@@ -59740,9 +59760,20 @@ function () {
|
|
|
59740
59760
|
|
|
59741
59761
|
if (source) {
|
|
59742
59762
|
source.cancel(message);
|
|
59763
|
+
return true;
|
|
59743
59764
|
}
|
|
59744
59765
|
|
|
59745
|
-
return
|
|
59766
|
+
return false;
|
|
59767
|
+
};
|
|
59768
|
+
/**
|
|
59769
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
59770
|
+
* @params request - The request promise
|
|
59771
|
+
* @return if the request has a corresponding cancel token.
|
|
59772
|
+
*/
|
|
59773
|
+
|
|
59774
|
+
|
|
59775
|
+
RestClient.prototype.hasCancelToken = function (request) {
|
|
59776
|
+
return this._cancelTokenMap.has(request);
|
|
59746
59777
|
};
|
|
59747
59778
|
/**
|
|
59748
59779
|
* Checks to see if an error thrown is from an api request cancellation
|
|
@@ -60241,7 +60272,7 @@ function () {
|
|
|
60241
60272
|
return this._restApi.isCancel(error);
|
|
60242
60273
|
};
|
|
60243
60274
|
/**
|
|
60244
|
-
* Cancels an inflight request
|
|
60275
|
+
* Cancels an inflight request for either a GraphQL request or a Rest API request.
|
|
60245
60276
|
* @param request - request to cancel
|
|
60246
60277
|
* @param [message] - custom error message
|
|
60247
60278
|
* @return If the request was cancelled
|
|
@@ -60249,7 +60280,13 @@ function () {
|
|
|
60249
60280
|
|
|
60250
60281
|
|
|
60251
60282
|
APIClass.prototype.cancel = function (request, message) {
|
|
60252
|
-
|
|
60283
|
+
if (this._restApi.hasCancelToken(request)) {
|
|
60284
|
+
return this._restApi.cancel(request, message);
|
|
60285
|
+
} else if (this._graphqlApi.hasCancelToken(request)) {
|
|
60286
|
+
return this._graphqlApi.cancel(request, message);
|
|
60287
|
+
}
|
|
60288
|
+
|
|
60289
|
+
return false;
|
|
60253
60290
|
};
|
|
60254
60291
|
/**
|
|
60255
60292
|
* Getting endpoint for API
|
|
@@ -82060,6 +82097,20 @@ var initSchema = function initSchema(userSchema) {
|
|
|
82060
82097
|
});
|
|
82061
82098
|
return userClasses;
|
|
82062
82099
|
};
|
|
82100
|
+
/* Checks if the schema has been initialized by initSchema().
|
|
82101
|
+
*
|
|
82102
|
+
* Call this function before accessing schema.
|
|
82103
|
+
* Currently this only needs to be called in start() and clear() because all other functions will call start first.
|
|
82104
|
+
*/
|
|
82105
|
+
|
|
82106
|
+
|
|
82107
|
+
var checkSchemaInitialized = function checkSchemaInitialized() {
|
|
82108
|
+
if (schema === undefined) {
|
|
82109
|
+
var message = 'Schema is not initialized. DataStore will not function as expected. This could happen if you have multiple versions of DataStore installed. Please see https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/#check-for-duplicate-versions';
|
|
82110
|
+
logger.error(message);
|
|
82111
|
+
throw new Error(message);
|
|
82112
|
+
}
|
|
82113
|
+
};
|
|
82063
82114
|
|
|
82064
82115
|
var createTypeClasses = function createTypeClasses(namespace) {
|
|
82065
82116
|
var classes = {};
|
|
@@ -82585,6 +82636,7 @@ function () {
|
|
|
82585
82636
|
case 4:
|
|
82586
82637
|
_b.sent();
|
|
82587
82638
|
|
|
82639
|
+
checkSchemaInitialized();
|
|
82588
82640
|
return [4
|
|
82589
82641
|
/*yield*/
|
|
82590
82642
|
, checkSchemaVersion(this.storage, schema.version)];
|
|
@@ -83249,6 +83301,7 @@ function () {
|
|
|
83249
83301
|
return __generator(this, function (_a) {
|
|
83250
83302
|
switch (_a.label) {
|
|
83251
83303
|
case 0:
|
|
83304
|
+
checkSchemaInitialized();
|
|
83252
83305
|
if (!(this.storage === undefined)) return [3
|
|
83253
83306
|
/*break*/
|
|
83254
83307
|
, 2]; // connect to storage so that it can be cleared without fully starting DataStore
|