@aws-amplify/datastore 3.7.4-custom-pk.94 → 3.7.4-custom-pk.96
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/dist/aws-amplify-datastore.js +19 -9
- 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 +13 -8
- package/lib/datastore/datastore.js.map +1 -1
- package/lib/storage/storage.js.map +1 -1
- package/lib/util.d.ts +1 -0
- package/lib/util.js +2 -1
- package/lib/util.js.map +1 -1
- package/lib-esm/datastore/datastore.js +13 -8
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/lib-esm/storage/storage.js.map +1 -1
- package/lib-esm/util.d.ts +1 -0
- package/lib-esm/util.js +2 -1
- package/lib-esm/util.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +9 -2
- package/src/storage/storage.ts +0 -1
- package/src/util.ts +3 -1
|
@@ -83037,17 +83037,17 @@ function () {
|
|
|
83037
83037
|
|
|
83038
83038
|
this["delete"] = function (modelOrConstructor, identifierOrCriteria) {
|
|
83039
83039
|
return __awaiter(_this, void 0, void 0, function () {
|
|
83040
|
-
var condition, msg, modelConstructor, msg, modelDefinition,
|
|
83040
|
+
var condition, msg, modelConstructor, msg, modelDefinition, keyFields, msg, msg, _a, deleted, model, modelConstructor, msg, modelDefinition, pkPredicate, msg, _b, _c, deleted;
|
|
83041
83041
|
|
|
83042
|
-
return __generator(this, function (
|
|
83043
|
-
switch (
|
|
83042
|
+
return __generator(this, function (_d) {
|
|
83043
|
+
switch (_d.label) {
|
|
83044
83044
|
case 0:
|
|
83045
83045
|
return [4
|
|
83046
83046
|
/*yield*/
|
|
83047
83047
|
, this.start()];
|
|
83048
83048
|
|
|
83049
83049
|
case 1:
|
|
83050
|
-
|
|
83050
|
+
_d.sent();
|
|
83051
83051
|
|
|
83052
83052
|
if (!modelOrConstructor) {
|
|
83053
83053
|
msg = 'Model or Model Constructor required';
|
|
@@ -83073,8 +83073,17 @@ function () {
|
|
|
83073
83073
|
modelDefinition = getModelDefinition(modelConstructor);
|
|
83074
83074
|
|
|
83075
83075
|
if (typeof identifierOrCriteria === 'string') {
|
|
83076
|
-
|
|
83077
|
-
|
|
83076
|
+
keyFields = Object(_util__WEBPACK_IMPORTED_MODULE_12__["extractPrimaryKeyFieldNames"])(modelDefinition);
|
|
83077
|
+
|
|
83078
|
+
if (keyFields.length > 1) {
|
|
83079
|
+
msg = _util__WEBPACK_IMPORTED_MODULE_12__["errorMessages"].deleteByPkWithCompositeKeyPresent;
|
|
83080
|
+
logger.error(msg, {
|
|
83081
|
+
keyFields: keyFields
|
|
83082
|
+
});
|
|
83083
|
+
throw new Error(msg);
|
|
83084
|
+
}
|
|
83085
|
+
|
|
83086
|
+
condition = _predicates__WEBPACK_IMPORTED_MODULE_8__["ModelPredicateCreator"].createForSingleField(getModelDefinition(modelConstructor), keyFields[0], identifierOrCriteria);
|
|
83078
83087
|
} else {
|
|
83079
83088
|
if (Object(_types__WEBPACK_IMPORTED_MODULE_11__["isIdentifierObject"])(identifierOrCriteria, modelDefinition)) {
|
|
83080
83089
|
condition = _predicates__WEBPACK_IMPORTED_MODULE_8__["ModelPredicateCreator"].createForPk(modelDefinition, identifierOrCriteria);
|
|
@@ -83101,7 +83110,7 @@ function () {
|
|
|
83101
83110
|
, this.storage["delete"](modelConstructor, condition)];
|
|
83102
83111
|
|
|
83103
83112
|
case 2:
|
|
83104
|
-
|
|
83113
|
+
_a = __read.apply(void 0, [_d.sent(), 1]), deleted = _a[0];
|
|
83105
83114
|
return [2
|
|
83106
83115
|
/*return*/
|
|
83107
83116
|
, deleted];
|
|
@@ -83140,7 +83149,7 @@ function () {
|
|
|
83140
83149
|
, this.storage["delete"](model, condition)];
|
|
83141
83150
|
|
|
83142
83151
|
case 4:
|
|
83143
|
-
|
|
83152
|
+
_b = __read.apply(void 0, [_d.sent(), 1]), _c = __read(_b[0], 1), deleted = _c[0];
|
|
83144
83153
|
return [2
|
|
83145
83154
|
/*return*/
|
|
83146
83155
|
, deleted];
|
|
@@ -97512,7 +97521,8 @@ var __values = undefined && undefined.__values || function (o) {
|
|
|
97512
97521
|
var ID = 'id';
|
|
97513
97522
|
var errorMessages = {
|
|
97514
97523
|
idEmptyString: 'An index field cannot contain an empty string value',
|
|
97515
|
-
queryByPkWithCompositeKeyPresent: 'Models with composite primary keys cannot
|
|
97524
|
+
queryByPkWithCompositeKeyPresent: 'Models with composite primary keys cannot be queried by a single key value. Use object literal syntax for composite keys instead: https://docs.amplify.aws/lib/datastore/advanced-workflows/q/platform/js/#querying-records-with-custom-primary-keys',
|
|
97525
|
+
deleteByPkWithCompositeKeyPresent: 'Models with composite primary keys cannot be deleted by a single key value, unless using a predicate. Use object literal syntax for composite keys instead: https://docs.amplify.aws/lib/datastore/advanced-workflows/q/platform/js/#querying-records-with-custom-primary-keys',
|
|
97516
97526
|
observeWithObjectLiteral: 'Object literal syntax cannot be used with observe. Use a predicate instead: https://docs.amplify.aws/lib/datastore/data-access/q/platform/js/#predicates'
|
|
97517
97527
|
};
|
|
97518
97528
|
function extractKeyIfExists(modelDefinition) {
|