@contrail/document-generation 2.1.15 → 2.1.17

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.
@@ -134,7 +134,7 @@ class BoardDocumentGenerator {
134
134
  static findDeepestSubgroups(group, subgroups, totalDepth, currentDepth, stopAtSecondary) {
135
135
  if (currentDepth === totalDepth && group.subGroups.length > 0) {
136
136
  if (!group.isSecondaryGroup &&
137
- group.subGroups.filter(subgroup => subgroup.name === group.subGroups[0].name).length > 1) {
137
+ group.subGroups.filter((subgroup) => subgroup.name === group.subGroups[0].name).length > 1) {
138
138
  subgroups.push(group.subGroups[0]);
139
139
  }
140
140
  else {
@@ -0,0 +1,142 @@
1
+ export declare const typeMap: {
2
+ item: {
3
+ pk: number;
4
+ id: string;
5
+ createdOn: string;
6
+ updatedOn: string;
7
+ createdById: string;
8
+ updatedById: string;
9
+ isArchived: boolean;
10
+ orgId: string;
11
+ slug: string;
12
+ label: string;
13
+ typePath: string;
14
+ typeRootId: string;
15
+ parentId: any;
16
+ typePolicyIds: any[];
17
+ typePolicies: any[];
18
+ typeProperties: {
19
+ pk: number;
20
+ id: string;
21
+ createdOn: string;
22
+ updatedOn: string;
23
+ createdById: string;
24
+ updatedById: string;
25
+ isArchived: boolean;
26
+ orgId: string;
27
+ propertyType: string;
28
+ slug: string;
29
+ label: string;
30
+ editable: boolean;
31
+ core: boolean;
32
+ typePropertyOptionSetId: any;
33
+ typePropertyUserListId: any;
34
+ carryOverBehavior: any;
35
+ carryOverDefault: any;
36
+ copyBehavior: any;
37
+ copyDefault: any;
38
+ formula: any;
39
+ numberFormat: {
40
+ format: any;
41
+ currency: string;
42
+ };
43
+ referencedTypeRootSlug: any;
44
+ referencedTypeRole: any;
45
+ referencedTypeFilterProperties: any;
46
+ referencedTypeId: any;
47
+ referencedTypePath: any;
48
+ defaultValue: any;
49
+ propertyLevel: string;
50
+ formulaFunction: any;
51
+ validationFunction: string;
52
+ description: any;
53
+ apiDetails: any;
54
+ notes: any;
55
+ searchable: boolean;
56
+ isFederationProperty: boolean;
57
+ isUniqueProperty: boolean;
58
+ isUniquePropertyInFamily: boolean;
59
+ required: boolean;
60
+ sequenceSeedValue: any;
61
+ optionsSet: any;
62
+ inherited: boolean;
63
+ used: boolean;
64
+ overriddenPropertySlugs: any[];
65
+ typePropertyPolicyIds: any[];
66
+ canRead: boolean;
67
+ canUpdate: boolean;
68
+ canDelete: boolean;
69
+ canCreate: boolean;
70
+ }[];
71
+ };
72
+ projectItem: {
73
+ pk: number;
74
+ id: string;
75
+ createdOn: string;
76
+ updatedOn: string;
77
+ createdById: string;
78
+ updatedById: string;
79
+ isArchived: boolean;
80
+ orgId: string;
81
+ slug: string;
82
+ label: string;
83
+ typePath: string;
84
+ typeRootId: string;
85
+ parentId: any;
86
+ typePolicyIds: any[];
87
+ typePolicies: any[];
88
+ typeProperties: {
89
+ id: string;
90
+ createdOn: string;
91
+ updatedOn: string;
92
+ createdById: string;
93
+ updatedById: string;
94
+ isArchived: boolean;
95
+ orgId: string;
96
+ propertyType: string;
97
+ slug: string;
98
+ label: string;
99
+ editable: boolean;
100
+ core: boolean;
101
+ typePropertyOptionSetId: any;
102
+ typePropertyUserListId: any;
103
+ carryOverBehavior: any;
104
+ carryOverDefault: any;
105
+ copyBehavior: any;
106
+ copyDefault: any;
107
+ formula: any;
108
+ numberFormat: {
109
+ format: string;
110
+ currency: string;
111
+ precision: number;
112
+ };
113
+ referencedTypeRootSlug: any;
114
+ referencedTypeRole: any;
115
+ referencedTypeFilterProperties: any;
116
+ referencedTypeId: any;
117
+ referencedTypePath: any;
118
+ defaultValue: any;
119
+ propertyLevel: string;
120
+ formulaFunction: any;
121
+ validationFunction: string;
122
+ description: any;
123
+ apiDetails: any;
124
+ notes: any;
125
+ searchable: boolean;
126
+ isFederationProperty: boolean;
127
+ isUniqueProperty: boolean;
128
+ isUniquePropertyInFamily: boolean;
129
+ required: boolean;
130
+ sequenceSeedValue: any;
131
+ optionsSet: any;
132
+ inherited: boolean;
133
+ used: boolean;
134
+ overriddenPropertySlugs: any[];
135
+ typePropertyPolicyIds: string[];
136
+ canRead: boolean;
137
+ canUpdate: boolean;
138
+ canDelete: boolean;
139
+ canCreate: boolean;
140
+ }[];
141
+ };
142
+ };
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typeMap = void 0;
4
+ exports.typeMap = {
5
+ item: {
6
+ pk: 731,
7
+ id: 'ivE7yP0zkKHIkfU-',
8
+ createdOn: '2021-07-09T14:01:49.217Z',
9
+ updatedOn: '2021-07-09T14:01:49.217Z',
10
+ createdById: 'G5YQopiRBlfmnDn3',
11
+ updatedById: 'G5YQopiRBlfmnDn3',
12
+ isArchived: false,
13
+ orgId: 'Z5KDga-mUfxIXk21',
14
+ slug: 'item',
15
+ label: 'Item',
16
+ typePath: 'item',
17
+ typeRootId: '3735b33f-52c4-4ff5-a52c-95c0f97f16c3',
18
+ parentId: null,
19
+ typePolicyIds: [],
20
+ typePolicies: [],
21
+ typeProperties: [
22
+ {
23
+ pk: 2370,
24
+ id: '4hL2d44GPxAzmr1S',
25
+ createdOn: '2022-05-26T18:30:35.057Z',
26
+ updatedOn: '2023-05-05T21:17:06.810Z',
27
+ createdById: 'G5YQopiRBlfmnDn3',
28
+ updatedById: 'G5YQopiRBlfmnDn3',
29
+ isArchived: false,
30
+ orgId: 'Z5KDga-mUfxIXk21',
31
+ propertyType: 'string',
32
+ slug: 'overridableProp',
33
+ label: 'Overridable Prop',
34
+ editable: true,
35
+ core: false,
36
+ typePropertyOptionSetId: null,
37
+ typePropertyUserListId: null,
38
+ carryOverBehavior: null,
39
+ carryOverDefault: null,
40
+ copyBehavior: null,
41
+ copyDefault: null,
42
+ formula: null,
43
+ numberFormat: {
44
+ format: null,
45
+ currency: 'USD',
46
+ },
47
+ referencedTypeRootSlug: null,
48
+ referencedTypeRole: null,
49
+ referencedTypeFilterProperties: null,
50
+ referencedTypeId: null,
51
+ referencedTypePath: null,
52
+ defaultValue: null,
53
+ propertyLevel: 'overridable',
54
+ formulaFunction: null,
55
+ validationFunction: '',
56
+ description: null,
57
+ apiDetails: null,
58
+ notes: null,
59
+ searchable: false,
60
+ isFederationProperty: false,
61
+ isUniqueProperty: false,
62
+ isUniquePropertyInFamily: false,
63
+ required: false,
64
+ sequenceSeedValue: null,
65
+ optionsSet: null,
66
+ inherited: false,
67
+ used: true,
68
+ overriddenPropertySlugs: [],
69
+ typePropertyPolicyIds: [],
70
+ canRead: true,
71
+ canUpdate: true,
72
+ canDelete: true,
73
+ canCreate: true,
74
+ },
75
+ ],
76
+ },
77
+ projectItem: {
78
+ pk: 1291,
79
+ id: 'ina_V3kyFcasfKXE',
80
+ createdOn: '2022-07-08T18:48:05.530Z',
81
+ updatedOn: '2022-07-08T18:48:05.530Z',
82
+ createdById: 'G5YQopiRBlfmnDn3',
83
+ updatedById: 'G5YQopiRBlfmnDn3',
84
+ isArchived: false,
85
+ orgId: 'Z5KDga-mUfxIXk21',
86
+ slug: 'project-item',
87
+ label: 'ProjectItem',
88
+ typePath: 'project-item',
89
+ typeRootId: 'AX-F0PADgcRGENr3',
90
+ parentId: null,
91
+ typePolicyIds: [],
92
+ typePolicies: [],
93
+ typeProperties: [
94
+ {
95
+ id: 'mkO5HfQAELNJ__Yt',
96
+ createdOn: '2022-07-16T15:49:03.102Z',
97
+ updatedOn: '2025-07-28T04:09:25.706Z',
98
+ createdById: 'G5YQopiRBlfmnDn3',
99
+ updatedById: 'G5YQopiRBlfmnDn3',
100
+ isArchived: false,
101
+ orgId: 'Z5KDga-mUfxIXk21',
102
+ propertyType: 'currency',
103
+ slug: 'outletPrice',
104
+ label: 'Outlet Price',
105
+ editable: true,
106
+ core: false,
107
+ typePropertyOptionSetId: null,
108
+ typePropertyUserListId: null,
109
+ carryOverBehavior: null,
110
+ carryOverDefault: null,
111
+ copyBehavior: null,
112
+ copyDefault: null,
113
+ formula: null,
114
+ numberFormat: {
115
+ format: 'currency',
116
+ currency: 'USD',
117
+ precision: 2,
118
+ },
119
+ referencedTypeRootSlug: null,
120
+ referencedTypeRole: null,
121
+ referencedTypeFilterProperties: null,
122
+ referencedTypeId: null,
123
+ referencedTypePath: null,
124
+ defaultValue: null,
125
+ propertyLevel: 'option',
126
+ formulaFunction: null,
127
+ validationFunction: '',
128
+ description: null,
129
+ apiDetails: null,
130
+ notes: null,
131
+ searchable: false,
132
+ isFederationProperty: false,
133
+ isUniqueProperty: false,
134
+ isUniquePropertyInFamily: false,
135
+ required: false,
136
+ sequenceSeedValue: null,
137
+ optionsSet: null,
138
+ inherited: false,
139
+ used: true,
140
+ overriddenPropertySlugs: [],
141
+ typePropertyPolicyIds: ['daLwIOoOfKEaAm9F'],
142
+ canRead: true,
143
+ canUpdate: true,
144
+ canDelete: false,
145
+ canCreate: false,
146
+ },
147
+ ],
148
+ },
149
+ };
@@ -27,16 +27,15 @@ class DocumentDynamicTextElementUtil {
27
27
  }
28
28
  if (propertyLevel && propertyLevel === types_1.PropertyLevel.FAMILY) {
29
29
  componentModels = JSON.parse(JSON.stringify(dataGroup.data));
30
- componentModels.forEach(d => {
30
+ componentModels.forEach((componentModel) => {
31
31
  var _a;
32
- const entity = d[entityType];
33
- if (entity && ['item', 'project-item'].includes(entity.entityType) && ((_a = entity.roles) === null || _a === void 0 ? void 0 : _a.includes('option'))) {
34
- if (entity.itemFamily) {
35
- d[entityType] = entity.itemFamily;
36
- }
37
- else if (entity.familyProjectItem) {
38
- d[entityType] = entity.familyProjectItem;
39
- }
32
+ const entity = componentModel[entityType];
33
+ const isOption = (_a = entity === null || entity === void 0 ? void 0 : entity.roles) === null || _a === void 0 ? void 0 : _a.includes('option');
34
+ if (isOption && entityType === 'item' && entity.itemFamily) {
35
+ componentModel[entityType] = entity.itemFamily;
36
+ }
37
+ if (isOption && entityType === 'project-item' && entity.familyProjectItem) {
38
+ componentModel[entityType] = entity.familyProjectItem;
40
39
  }
41
40
  });
42
41
  }
@@ -50,9 +49,9 @@ class DocumentDynamicTextElementUtil {
50
49
  }
51
50
  static setTypeMap(typeMap) {
52
51
  DocumentDynamicTextElementUtil.typeMap = typeMap;
53
- Object.keys(DocumentDynamicTextElementUtil.typeMap).forEach(type => {
52
+ Object.keys(DocumentDynamicTextElementUtil.typeMap).forEach((type) => {
54
53
  DocumentDynamicTextElementUtil.propertyMapByType[type] = { properties: {} };
55
- typeMap[type].typeProperties.forEach(p => {
54
+ typeMap[type].typeProperties.forEach((p) => {
56
55
  DocumentDynamicTextElementUtil.propertyMapByType[type].properties[p.slug] = p;
57
56
  });
58
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",