@autofleet/sadot 0.10.2-beta-34311f07.0 → 0.10.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.
@@ -40,7 +40,7 @@ const updateInstanceValues = async ({ modelId, modelType, identifiers, customFie
40
40
  if (!options?.useCustomFieldsEntries) {
41
41
  return;
42
42
  }
43
- const { dataValues: { customFields: oldCustomFields } } = await EntriesRepo.findEntriesByModelId(modelId) ?? { dataValues: {} };
43
+ const { dataValues: { customFields: oldCustomFields } } = await EntriesRepo.findEntriesByModelId(modelId, options) ?? { dataValues: {} };
44
44
  const newCustomFields = { ...oldCustomFields, ...customFields };
45
45
  await EntriesRepo.updateEntries(modelId, modelType, newCustomFields, identifiers, {
46
46
  ...options,
@@ -5,7 +5,7 @@ type CustomFieldEntriesModelOptions = ModelOptions & {
5
5
  include?: Includeable;
6
6
  transaction?: Transaction;
7
7
  };
8
- export declare const findEntriesByModelId: (modelId: string) => Promise<CustomFieldEntries>;
8
+ export declare const findEntriesByModelId: (modelId: string, options?: CustomFieldEntriesModelOptions) => Promise<CustomFieldEntries>;
9
9
  export declare const findEntriesByModelIds: (modelIds: string[], options?: CustomFieldEntriesModelOptions) => Promise<CustomFieldEntries[]>;
10
10
  export declare const updateEntries: (modelId: string, modelType: string, customFields: Record<string, any>, identifiers: string[], options?: FindOptions & {
11
11
  modelOptions?: ModelOptions;
@@ -31,7 +31,13 @@ const models_1 = require("../models");
31
31
  const logger_1 = __importDefault(require("../utils/logger"));
32
32
  const errors_1 = require("../errors");
33
33
  const DefinitionRepo = __importStar(require("./definition"));
34
- const findEntriesByModelId = async (modelId) => models_1.CustomFieldEntries.findOne({ where: { modelId } });
34
+ const findEntriesByModelId = async (modelId, options = {}) => {
35
+ const { transaction } = options;
36
+ return models_1.CustomFieldEntries.findOne({
37
+ where: { modelId },
38
+ transaction,
39
+ });
40
+ };
35
41
  exports.findEntriesByModelId = findEntriesByModelId;
36
42
  const findEntriesByModelIds = async (modelIds, options = {}) => {
37
43
  const { transaction } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sadot",
3
- "version": "0.10.2-beta-34311f07.0",
3
+ "version": "0.10.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@ const updateInstanceValues = async ({
45
45
  return;
46
46
  }
47
47
 
48
- const { dataValues: { customFields: oldCustomFields } } = await EntriesRepo.findEntriesByModelId(modelId) ?? { dataValues: {} };
48
+ const { dataValues: { customFields: oldCustomFields } } = await EntriesRepo.findEntriesByModelId(modelId, options) ?? { dataValues: {} };
49
49
  const newCustomFields = { ...oldCustomFields, ...customFields };
50
50
 
51
51
  await EntriesRepo.updateEntries(
@@ -12,7 +12,13 @@ import * as DefinitionRepo from './definition';
12
12
 
13
13
  type CustomFieldEntriesModelOptions = ModelOptions & { include?: Includeable, transaction?: Transaction };
14
14
 
15
- export const findEntriesByModelId = async (modelId: string) => CustomFieldEntries.findOne({ where: { modelId } });
15
+ export const findEntriesByModelId = async (modelId: string, options: CustomFieldEntriesModelOptions = {}) => {
16
+ const { transaction } = options;
17
+ return CustomFieldEntries.findOne({
18
+ where: { modelId },
19
+ transaction,
20
+ });
21
+ };
16
22
 
17
23
  export const findEntriesByModelIds = async (modelIds: string[], options: CustomFieldEntriesModelOptions = {}) => {
18
24
  const { transaction } = options;
package/.env DELETED
@@ -1,4 +0,0 @@
1
- AF_SERVICE_NAME=sadot
2
- NODE_ENV=test
3
- DB_USERNAME=postgres
4
- DB_PASSWORD=postgres