@aristid/leav-types 1.5.0-525ae43e → 1.5.0-7b0e51fb

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.
@@ -63,7 +63,8 @@ export declare enum TaskType {
63
63
  EXPORT = "EXPORT",
64
64
  IMPORT_CONFIG = "IMPORT_CONFIG",
65
65
  IMPORT_DATA = "IMPORT_DATA",
66
- INDEXATION = "INDEXATION"
66
+ INDEXATION = "INDEXATION",
67
+ SAVE_VALUE_BULK = "SAVE_VALUE_BULK"
67
68
  }
68
69
  export interface ITaskRole {
69
70
  type: TaskType;
@@ -4,13 +4,15 @@ import { type IRecordDomain } from 'domain/record/recordDomain';
4
4
  import { type IValueDomain } from 'domain/value/valueDomain';
5
5
  import { type IUtils } from 'utils/utils';
6
6
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
7
+ import { type ISaveValueBulkTask } from '../../domain/value/tasks/saveValueBulk';
7
8
  export type ICoreValueApp = IGraphqlAppModule;
8
9
  interface IDeps {
9
10
  'core.domain.value': IValueDomain;
10
11
  'core.domain.attribute': IAttributeDomain;
11
12
  'core.domain.record': IRecordDomain;
13
+ 'core.domain.value.tasks.saveValueBulk': ISaveValueBulkTask;
12
14
  'core.app.helpers.convertVersionFromGqlFormat': ConvertVersionFromGqlFormatFunc;
13
15
  'core.utils': IUtils;
14
16
  }
15
- export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, }: IDeps): ICoreValueApp;
17
+ export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.value.tasks.saveValueBulk': saveValueBulkTask, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, }: IDeps): ICoreValueApp;
16
18
  export {};
@@ -3,4 +3,3 @@ export { default as deleteRecord } from './deleteRecord';
3
3
  export { default as sendRecordUpdateEvent } from './sendRecordUpdateEvent';
4
4
  export { default as getAccessPermissionFilters } from './getAccessPermissionFilters';
5
5
  export { default as findRecords } from './findRecords';
6
- export { default as getRecordFieldValue } from './getRecordFieldValue';
@@ -21,7 +21,6 @@ import { type CreateRecordHelper } from './helpers/createRecord';
21
21
  import { type IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
22
22
  import { type ILogger } from '@leav/logger';
23
23
  import { type FindRecordsHelper } from './helpers/findRecords';
24
- import { type GetRecordFieldValueHelper } from './helpers/getRecordFieldValue';
25
24
  export declare const ATTRIBUTE_ACTIVE = "active";
26
25
  export interface IRecordDomain {
27
26
  /**
@@ -69,16 +68,7 @@ export interface IRecordDomain {
69
68
  ctx: IQueryInfos;
70
69
  }): Promise<IListWithCursor<IRecord>>;
71
70
  /**
72
- * Get the value of targeted attribute with actions applied on it including metadata.
73
- *
74
- * Avoid requesting DB if attribute already found in `record` param.
75
- *
76
- * @param {Object} params
77
- * @param params.library
78
- * @param params.record Could be emulated with only `{ id: <real_id> }`
79
- * @param params.attributeId
80
- * @param params.options
81
- * @param params.ctx
71
+ * @deprecated use valueDomain.getRecordFieldValue instead
82
72
  */
83
73
  getRecordFieldValue({ library, record, attributeId, options, ctx, }: {
84
74
  library: string;
@@ -123,7 +113,6 @@ export interface IRecordDomainDeps {
123
113
  'core.domain.record.helpers.createRecord': CreateRecordHelper;
124
114
  'core.domain.record.helpers.deleteRecord': DeleteRecordHelper;
125
115
  'core.domain.record.helpers.findRecords': FindRecordsHelper;
126
- 'core.domain.record.helpers.getRecordFieldValue': GetRecordFieldValueHelper;
127
116
  'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
128
117
  'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
129
118
  'core.infra.form': IFormRepo;
@@ -133,4 +122,4 @@ export interface IRecordDomainDeps {
133
122
  'core.utils': IUtils;
134
123
  translator: i18n;
135
124
  }
136
- export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.domain.record.helpers.getRecordFieldValue': getRecordFieldValueHelper, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.createRecord': createRecordHelper, 'core.domain.record.helpers.deleteRecord': deleteRecordHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils.logger': logger, 'core.utils': utils, translator, }: IRecordDomainDeps): IRecordDomain;
125
+ export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.createRecord': createRecordHelper, 'core.domain.record.helpers.deleteRecord': deleteRecordHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils.logger': logger, 'core.utils': utils, translator, }: IRecordDomainDeps): IRecordDomain;
@@ -0,0 +1 @@
1
+ export { default as saveValueBulk } from './saveValueBulk';
@@ -0,0 +1,36 @@
1
+ import { type IValidateHelper } from 'domain/helpers/validate';
2
+ import { type IValueDomain } from 'domain/value/valueDomain';
3
+ import { type i18n } from 'i18next';
4
+ import type * as Config from '_types/config';
5
+ import { type IQueryInfos } from '../../../_types/queryInfos';
6
+ import { type IRecordFilterLight } from '../../../_types/record';
7
+ import { type ITreeNode } from '../../../_types/tree';
8
+ import { type IAttributeDomain } from '../../attribute/attributeDomain';
9
+ import { type FindRecordsHelper } from '../../record/helpers/findRecords';
10
+ import { type ITaskFuncParams } from '../../../_types/tasksManager';
11
+ import { type ITasksManagerDomain } from '../../tasksManager/tasksManagerDomain';
12
+ import { type INotificationDomain } from '../../notification/notificationDomain';
13
+ export interface ISaveValueBulkParams {
14
+ libraryId: string;
15
+ recordsFilters: IRecordFilterLight[];
16
+ attributeId: string;
17
+ mapValues: Array<{
18
+ before: ITreeNode['id'] | null;
19
+ after: ITreeNode['id'] | null;
20
+ }>;
21
+ ctx: IQueryInfos;
22
+ }
23
+ export interface ISaveValueBulkTask {
24
+ saveValueBulk: (params: ISaveValueBulkParams, task?: ITaskFuncParams) => Promise<string>;
25
+ }
26
+ export interface ISaveValueBulkTaskDeps {
27
+ config: Config.IConfig;
28
+ 'core.domain.helpers.validate': IValidateHelper;
29
+ 'core.domain.attribute': IAttributeDomain;
30
+ 'core.domain.tasksManager': ITasksManagerDomain;
31
+ 'core.domain.record.helpers.findRecords': FindRecordsHelper;
32
+ 'core.domain.notification': INotificationDomain;
33
+ translator: i18n;
34
+ 'core.domain.value': IValueDomain;
35
+ }
36
+ export default function ({ config, 'core.domain.helpers.validate': validate, 'core.domain.attribute': attributeDomain, 'core.domain.tasksManager': tasksManagerDomain, 'core.domain.notification': notificationDomain, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.domain.value': valueDomain, translator, }: ISaveValueBulkTaskDeps): ISaveValueBulkTask;
@@ -20,7 +20,7 @@ import { type IAttributeDomain } from '../attribute/attributeDomain';
20
20
  import { type IValidateHelper } from '../helpers/validate';
21
21
  import { type IRecordAttributePermissionDomain } from '../permission/recordAttributePermissionDomain';
22
22
  import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
23
- import { type IDeleteValueParams, type IRunActionListParams } from './_types';
23
+ import { type IDeleteValueParams } from './_types';
24
24
  import { type DeleteRecordHelper } from 'domain/record/helpers/deleteRecord';
25
25
  import { type CreateRecordHelper } from 'domain/record/helpers/createRecord';
26
26
  import { type IfLibraryJoinLinkAttribute } from '../attribute/helpers/ifLibraryJoinLinkAttribute';
@@ -88,6 +88,25 @@ export interface IValueDomain {
88
88
  library: string;
89
89
  ctx: IQueryInfos;
90
90
  }): Promise<IValue>;
91
+ /**
92
+ * Get the value of targeted attribute with actions applied on it including metadata.
93
+ *
94
+ * Avoid requesting DB if attribute already found in `record` param.
95
+ *
96
+ * @param {Object} params
97
+ * @param params.library
98
+ * @param params.record Could be emulated with only `{ id: <real_id> }`
99
+ * @param params.attributeId
100
+ * @param params.options
101
+ * @param params.ctx
102
+ */
103
+ getRecordFieldValue(params: {
104
+ library: string;
105
+ record: IRecord;
106
+ attributeId: string;
107
+ options?: IValuesOptions;
108
+ ctx: IQueryInfos;
109
+ }): Promise<IValue[]>;
91
110
  countValuesOccurrences({ libraryId, attributeId, recordFilters, options, ctx, }: {
92
111
  libraryId: string;
93
112
  attributeId: string;
@@ -97,7 +116,6 @@ export interface IValueDomain {
97
116
  };
98
117
  ctx: IQueryInfos;
99
118
  }): Promise<IValuesOccurrencesResult>;
100
- runActionsList(params: IRunActionListParams): Promise<IValue[]>;
101
119
  }
102
120
  export interface IValueDomainDeps {
103
121
  config: Config.IConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.5.0-525ae43e",
3
+ "version": "1.5.0-7b0e51fb",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",
@@ -1,31 +0,0 @@
1
- import { type IQueryInfos } from '../../../_types/queryInfos';
2
- import { type IRecord } from '../../../_types/record';
3
- import { type IAttributeDomain } from '../../attribute/attributeDomain';
4
- import { type IValue, type IValuesOptions } from '../../../_types/value';
5
- import { type IRecordAttributePermissionDomain } from '../../permission/recordAttributePermissionDomain';
6
- import { type IValueDomain } from '../../value/valueDomain';
7
- /**
8
- * Get the value of targeted attribute with actions applied on it including metadata.
9
- *
10
- * Avoid requesting DB if attribute already found in `record` param.
11
- *
12
- * @param {Object} params
13
- * @param params.library
14
- * @param params.record Could be emulated with only `{ id: <real_id> }`
15
- * @param params.attributeId
16
- * @param params.options
17
- * @param params.ctx
18
- */
19
- export type GetRecordFieldValueHelper = ({ library, record, attributeId, options, ctx, }: {
20
- library: string;
21
- record: IRecord;
22
- attributeId: string;
23
- options?: IValuesOptions;
24
- ctx: IQueryInfos;
25
- }) => Promise<IValue[]>;
26
- export interface IGetRecordFieldValueHelperDeps {
27
- 'core.domain.attribute': IAttributeDomain;
28
- 'core.domain.value': IValueDomain;
29
- 'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
30
- }
31
- export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.recordAttribute': recordAttributePermissionDomain, }: IGetRecordFieldValueHelperDeps): GetRecordFieldValueHelper;