@aws-amplify/datastore 3.11.1-unstable.3 → 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 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
 
@@ -82097,6 +82097,20 @@ var initSchema = function initSchema(userSchema) {
82097
82097
  });
82098
82098
  return userClasses;
82099
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
+ };
82100
82114
 
82101
82115
  var createTypeClasses = function createTypeClasses(namespace) {
82102
82116
  var classes = {};
@@ -82622,6 +82636,7 @@ function () {
82622
82636
  case 4:
82623
82637
  _b.sent();
82624
82638
 
82639
+ checkSchemaInitialized();
82625
82640
  return [4
82626
82641
  /*yield*/
82627
82642
  , checkSchemaVersion(this.storage, schema.version)];
@@ -83286,6 +83301,7 @@ function () {
83286
83301
  return __generator(this, function (_a) {
83287
83302
  switch (_a.label) {
83288
83303
  case 0:
83304
+ checkSchemaInitialized();
83289
83305
  if (!(this.storage === undefined)) return [3
83290
83306
  /*break*/
83291
83307
  , 2]; // connect to storage so that it can be cleared without fully starting DataStore