@aristid/leav-types 0.0.7-bb2bc01 → 0.0.7-bc44cb0

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.
@@ -41,6 +41,8 @@ export declare namespace auth {
41
41
  let wellKnownEndpoint: string;
42
42
  let clientId: string;
43
43
  let postLogoutRedirectUri: string;
44
+ let skipLogoutConfirmationPage: string | boolean;
45
+ let idTokenUserClaim: string;
44
46
  }
45
47
  let testApiKey: string;
46
48
  }
@@ -1,5 +1,6 @@
1
1
  import { AttributeFormats, AttributeTypes, IAttribute } from '../../_types/attribute';
2
2
  export declare const mockAttrSimple: IAttribute;
3
+ export declare const mockUniqueAttrSimple: IAttribute;
3
4
  export declare const mockAttrId: IAttribute;
4
5
  export declare const mockAttrAdv: IAttribute;
5
6
  export declare const mockAttrAdvMultiVal: IAttribute;
@@ -75,11 +75,15 @@ export interface IAuth {
75
75
  wellKnownEndpoint?: string;
76
76
  clientId?: string;
77
77
  postLogoutRedirectUri?: string;
78
+ skipLogoutConfirmationPage?: boolean;
79
+ idTokenUserClaim?: string;
78
80
  } | {
79
81
  enable: true;
80
82
  wellKnownEndpoint: string;
81
83
  clientId: string;
82
84
  postLogoutRedirectUri: string;
85
+ skipLogoutConfirmationPage?: boolean;
86
+ idTokenUserClaim: string;
83
87
  };
84
88
  testApiKey?: string;
85
89
  }
@@ -2,6 +2,7 @@ import { AnyPrimitive, Override } from '@leav/utils';
2
2
  import { IDbEdge } from 'infra/db/_types';
3
3
  import { IRecord } from './record';
4
4
  import { ITreeNode, TreePaths } from './tree';
5
+ import { EMPTY_VALUE } from 'infra/value/valueRepo';
5
6
  export type IValueFromGql = Override<Omit<IValue, 'version'>, {
6
7
  value: IValue['payload'];
7
8
  metadata: Array<{
@@ -28,6 +29,7 @@ export interface IDbValueVersion {
28
29
  export interface IValueMetadata {
29
30
  [fieldName: string]: IStandardValue | AnyPrimitive;
30
31
  }
32
+ export type EmptyValue = typeof EMPTY_VALUE;
31
33
  export interface IGenericValue {
32
34
  id_value?: string;
33
35
  attribute?: string;
@@ -41,8 +43,8 @@ export interface IGenericValue {
41
43
  isCalculated?: boolean;
42
44
  }
43
45
  export interface IStandardValue extends IGenericValue {
44
- payload?: any;
45
- raw_payload?: any;
46
+ payload?: any | EmptyValue;
47
+ raw_payload?: any | EmptyValue;
46
48
  }
47
49
  export interface ILinkValue extends IGenericValue {
48
50
  payload?: IRecord;
@@ -40,6 +40,10 @@ export interface IViewValuesVersionForGraphql {
40
40
  export type ViewFromGraphQL = Omit<IView, 'valuesVersions' | 'settings'> & {
41
41
  valuesVersions: IViewValuesVersionForGraphql[];
42
42
  };
43
+ export type PartialViewFromGraphQL = Omit<IView, 'id' | 'valuesVersions' | 'settings'> & {
44
+ id: string;
45
+ valuesVersions: IViewValuesVersionForGraphql[];
46
+ };
43
47
  export interface IViewFilterOptions extends ICoreEntityFilterOptions {
44
48
  created_by?: string;
45
49
  library?: string;
@@ -1,12 +1,13 @@
1
1
  import { ActionsListValueType, IActionsListContext } from '_types/actionsList';
2
2
  import { IVariableFunctions } from '../calculationsVariableFunctions';
3
+ import { ITreeNode } from '../../../_types/tree';
3
4
  interface IDeps {
4
5
  'core.domain.helpers.calculationsVariableFunctions': IVariableFunctions;
5
6
  }
6
7
  export interface IVariableValue {
7
8
  recordId: string;
8
9
  library: string;
9
- payload: string | number | boolean | Record<string, any>;
10
+ payload: string | number | boolean | ITreeNode | Record<string, any>;
10
11
  raw_payload?: string | number | boolean | Record<string, any>;
11
12
  }
12
13
  export interface ICalculationVariable {
@@ -20,6 +20,8 @@ import { IRecordPermissionDomain } from '../permission/recordPermissionDomain';
20
20
  import { SendRecordUpdateEventHelper } from './helpers/sendRecordUpdateEvent';
21
21
  import { ICreateRecordResult, IFindRecordParams } from './_types';
22
22
  import { IFormRepo } from 'infra/form/formRepo';
23
+ import { IRecordAttributePermissionDomain } from '../permission/recordAttributePermissionDomain';
24
+ import { IAttributePermissionDomain } from '../permission/attributePermissionDomain';
23
25
  export interface IRecordDomain {
24
26
  createRecord(params: {
25
27
  library: string;
@@ -90,6 +92,8 @@ export interface IRecordDomainDeps {
90
92
  'core.domain.value': IValueDomain;
91
93
  'core.domain.permission.record': IRecordPermissionDomain;
92
94
  'core.domain.permission.library': ILibraryPermissionDomain;
95
+ 'core.domain.permission.attribute': IAttributePermissionDomain;
96
+ 'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
93
97
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
94
98
  'core.domain.helpers.validate': IValidateHelper;
95
99
  'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
@@ -102,4 +106,4 @@ export interface IRecordDomainDeps {
102
106
  'core.utils': IUtils;
103
107
  translator: i18n;
104
108
  }
105
- export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.permission.library': libraryPermissionDomain, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.infra.value': valueRepo, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, translator }: IRecordDomainDeps): IRecordDomain;
109
+ export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.permission.library': libraryPermissionDomain, 'core.domain.permission.attribute': attrPermissionDomain, 'core.domain.permission.recordAttribute': recordAttributePermissionDomain, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.infra.value': valueRepo, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, translator }: IRecordDomainDeps): IRecordDomain;
@@ -6,12 +6,12 @@ import { IQueryInfos } from '_types/queryInfos';
6
6
  import { IValue } from '_types/value';
7
7
  import { ErrorFieldDetail, Errors } from '../../../_types/errors';
8
8
  import { RecordAttributePermissionsActions, RecordPermissionsActions } from '../../../_types/permissions';
9
- interface ICanSaveValueRes {
9
+ interface ICanSaveRecordValueRes {
10
10
  canSave: boolean;
11
11
  reason?: RecordAttributePermissionsActions | RecordPermissionsActions | Errors;
12
12
  fields?: ErrorFieldDetail<IValue>;
13
13
  }
14
- interface ICanSaveValueParams {
14
+ interface ICanSaveRecordValueParams {
15
15
  attributeProps: IAttribute;
16
16
  value: IValue;
17
17
  library: string;
@@ -24,5 +24,5 @@ interface ICanSaveValueParams {
24
24
  config: IConfig;
25
25
  };
26
26
  }
27
- declare const _default: (params: ICanSaveValueParams) => Promise<ICanSaveValueRes>;
27
+ declare const _default: (params: ICanSaveRecordValueParams) => Promise<ICanSaveRecordValueRes>;
28
28
  export default _default;
@@ -0,0 +1,5 @@
1
+ import { IValue, EmptyValue } from '_types/value';
2
+ declare const _default: (value: IValue) => value is IValue & {
3
+ payload: EmptyValue;
4
+ };
5
+ export default _default;
@@ -10,7 +10,7 @@ interface IValidateValueParams {
10
10
  attributeProps: IAttribute;
11
11
  value: IValue;
12
12
  library: string;
13
- recordId: string;
13
+ recordId?: string;
14
14
  infos?: IQueryInfos;
15
15
  keepEmpty: boolean;
16
16
  deps: {
@@ -48,9 +48,9 @@ export interface IAttributeTypeRepo {
48
48
  /**
49
49
  * Check if a value is unique
50
50
  */
51
- isValueUnique?({ library, recordId, attribute, value, ctx }: {
51
+ isValueUsed?({ library, excludedRecordId, attribute, value, ctx }: {
52
52
  library: string;
53
- recordId: string;
53
+ excludedRecordId?: string;
54
54
  attribute: IAttribute;
55
55
  value: IValue;
56
56
  ctx: IQueryInfos;
@@ -12,7 +12,9 @@ export interface IOIDCClientService {
12
12
  redirectUri: string;
13
13
  queryId: string;
14
14
  }) => Promise<string>;
15
- getLogoutUrl: () => string;
15
+ getLogoutUrl: (params: {
16
+ userId: string;
17
+ }) => Promise<string>;
16
18
  saveOIDCTokens: (params: {
17
19
  userId: string;
18
20
  tokens: TokenSet;
@@ -5,6 +5,7 @@ import { IValue, IValuesOptions } from '_types/value';
5
5
  import { IAttributeTypesRepo, IAttributeWithRevLink } from '../attributeTypes/attributeTypesRepo';
6
6
  export declare const VALUES_LINKS_COLLECTION = "core_edge_values_links";
7
7
  export declare const VALUES_COLLECTION = "core_values";
8
+ export declare const EMPTY_VALUE = "__empty_value__";
8
9
  export interface IValueRepo {
9
10
  createValue({ library, recordId, attribute, value, ctx }: {
10
11
  library: string;
@@ -33,9 +34,13 @@ export interface IValueRepo {
33
34
  value: IValue;
34
35
  ctx: IQueryInfos;
35
36
  }): Promise<IValue>;
36
- isValueUnique({ library, recordId, attribute, value, ctx }: {
37
+ /**
38
+ * Check if a value is unique expeted for the given record
39
+ * if recordId is null, it will check for the whole library
40
+ */
41
+ isValueUsed({ library, excludedRecordId, attribute, value, ctx }: {
37
42
  library: string;
38
- recordId: string;
43
+ excludedRecordId?: string;
39
44
  attribute: IAttribute;
40
45
  value: IValue;
41
46
  ctx: IQueryInfos;
@@ -4,7 +4,8 @@ export declare enum FormUIElementTypes {
4
4
  FIELDS_CONTAINER = "fields_container",
5
5
  TAB_FIELDS_CONTAINER = "tab_fields_container",
6
6
  TEXT_BLOCK = "text_block",
7
- TABS = "tabs"
7
+ TABS = "tabs",
8
+ FRAME = "frame"
8
9
  }
9
10
  export declare enum FormFieldTypes {
10
11
  TEXT_INPUT = "input_field",
@@ -41,6 +42,10 @@ export interface IFormTabsSettings {
41
42
  export interface IFormTextBlockSettings {
42
43
  content?: string;
43
44
  }
45
+ export interface IFormFrameSettings {
46
+ url: string;
47
+ height?: string;
48
+ }
44
49
  export interface IFormDateFieldSettings extends ICommonFieldsSettings {
45
50
  withTime: boolean;
46
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "0.0.7-bb2bc01",
3
+ "version": "0.0.7-bc44cb0",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",