@nocobase/database 2.0.0-alpha.48 → 2.0.0-alpha.49

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.
@@ -51,7 +51,6 @@ module.exports = __toCommonJS(single_relation_repository_exports);
51
51
  var import_target_collection_decorator = __toESM(require("../decorators/target-collection-decorator"));
52
52
  var import_update_associations = require("../update-associations");
53
53
  var import_relation_repository = require("./relation-repository");
54
- var import_lodash = __toESM(require("lodash"));
55
54
  const _SingleRelationRepository = class _SingleRelationRepository extends import_relation_repository.RelationRepository {
56
55
  async remove(options) {
57
56
  const transaction2 = await this.getTransaction(options);
@@ -104,7 +103,7 @@ const _SingleRelationRepository = class _SingleRelationRepository extends import
104
103
  throw new Error("The record does not exist");
105
104
  }
106
105
  await (0, import_update_associations.updateModelByValues)(target, options == null ? void 0 : options.values, {
107
- ...import_lodash.default.omit(options, "values"),
106
+ ...options,
108
107
  transaction: transaction2
109
108
  });
110
109
  if (options.hooks !== false) {
@@ -220,11 +220,11 @@ async function updateSingleAssociation(model, key, value, options = {}) {
220
220
  }
221
221
  }, "checkBelongsToForeignKeyValue");
222
222
  if ((0, import_utils.isStringOrNumber)(value)) {
223
- await model[setAccessor](value, { context, transaction, associationKey: key });
223
+ await model[setAccessor](value, { context, transaction });
224
224
  return true;
225
225
  }
226
226
  if (value instanceof import_model.Model) {
227
- await model[setAccessor](value, { context, transaction, associationKey: key });
227
+ await model[setAccessor](value, { context, transaction });
228
228
  model.setDataValue(key, value);
229
229
  return true;
230
230
  }
@@ -255,7 +255,7 @@ async function updateSingleAssociation(model, key, value, options = {}) {
255
255
  if (association.associationType === "HasOne") {
256
256
  delete updateValues[association.foreignKey];
257
257
  }
258
- await instance2.update(updateValues, { ...options, transaction, associationKey: key });
258
+ await instance2.update(updateValues, { ...options, transaction, inputValues: updateValues });
259
259
  }
260
260
  await updateAssociations(instance2, value, {
261
261
  ...options,
@@ -271,7 +271,7 @@ async function updateSingleAssociation(model, key, value, options = {}) {
271
271
  values: value,
272
272
  operation: "create"
273
273
  });
274
- const instance = await model[createAccessor](value, { context, transaction, associationKey: key });
274
+ const instance = await model[createAccessor](value, { context, transaction, inputValues: value });
275
275
  await updateAssociations(instance, value, {
276
276
  ...options,
277
277
  transaction,
@@ -365,7 +365,7 @@ async function updateMultipleAssociation(model, key, value, options = {}) {
365
365
  values: item,
366
366
  operation: "create"
367
367
  });
368
- const instance = await model[createAccessor](item, accessorOptions);
368
+ const instance = await model[createAccessor](item, { ...accessorOptions, inputValues: item });
369
369
  await updateAssociations(instance, item, {
370
370
  ...options,
371
371
  transaction,
@@ -386,7 +386,7 @@ async function updateMultipleAssociation(model, key, value, options = {}) {
386
386
  values: item,
387
387
  operation: "create"
388
388
  });
389
- instance = await model[createAccessor](item, accessorOptions);
389
+ instance = await model[createAccessor](item, { ...accessorOptions, inputValues: item });
390
390
  await updateAssociations(instance, item, {
391
391
  ...options,
392
392
  transaction,
@@ -409,7 +409,7 @@ async function updateMultipleAssociation(model, key, value, options = {}) {
409
409
  values: item,
410
410
  operation: "update"
411
411
  });
412
- await instance.update(item, { ...options, transaction });
412
+ await instance.update(item, { ...options, transaction, inputValues: item });
413
413
  }
414
414
  await updateAssociations(instance, item, {
415
415
  ...options,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "2.0.0-alpha.48",
3
+ "version": "2.0.0-alpha.49",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "2.0.0-alpha.48",
10
- "@nocobase/utils": "2.0.0-alpha.48",
9
+ "@nocobase/logger": "2.0.0-alpha.49",
10
+ "@nocobase/utils": "2.0.0-alpha.49",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -39,5 +39,5 @@
39
39
  "url": "git+https://github.com/nocobase/nocobase.git",
40
40
  "directory": "packages/database"
41
41
  },
42
- "gitHead": "456be3a6e92f984fe283590c80d3ea9423695ba6"
42
+ "gitHead": "99f71bc8961da62a761630b3eae11092a4372e3e"
43
43
  }