@sassoftware/vi-api 0.0.29 → 1.5.0

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.
Files changed (79) hide show
  1. package/LICENSE.txt +333 -0
  2. package/README.md +9 -0
  3. package/alert-reps/index.d.ts +5 -1
  4. package/api-init.service.js +86 -0
  5. package/api.module.js +72 -0
  6. package/component/bindings.d.ts +5 -3
  7. package/component/component-api.service.js +161 -0
  8. package/config/config-api.d.ts +2 -1
  9. package/config/config-api.service.js +54 -0
  10. package/control/control-api.d.ts +21 -9
  11. package/control/data-types.d.ts +6 -1
  12. package/control/page.d.ts +14 -0
  13. package/control/toolbar-property-api.d.ts +2 -1
  14. package/current-user/currentUser-api.service.js +49 -0
  15. package/event/event-api.d.ts +1 -0
  16. package/event/event-api.js +1 -0
  17. package/event/event-api.service.js +32 -0
  18. package/file/file-api.service.js +24 -0
  19. package/http/http-api.service.js +64 -0
  20. package/localization/localization-api.service.js +38 -0
  21. package/metadata/admin/admin-metadata-api.service.js +30 -0
  22. package/metadata/metadata-api.d.ts +3 -0
  23. package/metadata/metadata-api.service.js +85 -0
  24. package/object/object-api.d.ts +9 -20
  25. package/object/object-api.service.js +207 -0
  26. package/package.json +24 -2
  27. package/page-admin/page-admin-api.service.js +25 -0
  28. package/page-model/page-model-api.d.ts +21 -13
  29. package/page-model/page-model-api.service.js +25 -0
  30. package/page-state/page-state-api.d.ts +23 -0
  31. package/page-state/page-state-api.service.js +70 -0
  32. package/property/property-api.d.ts +62 -2
  33. package/property/property-api.service.js +34 -0
  34. package/reference-data/refData.service.js +40 -0
  35. package/resource/resource-api.service.js +24 -0
  36. package/score-reps/index.d.ts +1 -1
  37. package/search/client/client-search-api.d.ts +8 -4
  38. package/search/client/client-search-api.js +1 -1
  39. package/search/client/client-search-api.service.js +111 -0
  40. package/search/search-api.d.ts +6 -6
  41. package/search/search-api.service.js +28 -0
  42. package/sheet/network-menu-handler.service.js +39 -0
  43. package/sheet/sheet-api.d.ts +35 -3
  44. package/sheet/sheet-api.js +9 -1
  45. package/sheet/sheet-api.service.js +140 -0
  46. package/svi-datahub/index.d.ts +203 -171
  47. package/svi-sand/index.d.ts +10 -10
  48. package/tab/tab-api.service.js +35 -0
  49. package/theme/theme-api.d.ts +1 -1
  50. package/theme/theme-api.js +1 -1
  51. package/theme/theme-api.service.js +35 -0
  52. package/time-slider/index.d.ts +6 -0
  53. package/traversal/traversal-api.d.ts +7 -1
  54. package/traversal/traversal-api.service.js +77 -0
  55. package/alert-reps/package.json +0 -5
  56. package/component/package.json +0 -9
  57. package/config/package.json +0 -9
  58. package/control/package.json +0 -9
  59. package/current-user/package.json +0 -9
  60. package/event/package.json +0 -9
  61. package/file/package.json +0 -9
  62. package/http/package.json +0 -9
  63. package/localization/package.json +0 -9
  64. package/metadata/package.json +0 -9
  65. package/object/package.json +0 -9
  66. package/page-admin/package.json +0 -9
  67. package/page-model/package.json +0 -9
  68. package/page-state/package.json +0 -9
  69. package/property/package.json +0 -9
  70. package/reference-data/package.json +0 -9
  71. package/resource/package.json +0 -9
  72. package/score-reps/package.json +0 -5
  73. package/search/package.json +0 -9
  74. package/sheet/package.json +0 -9
  75. package/svi-datahub/package.json +0 -5
  76. package/svi-sand/package.json +0 -5
  77. package/tab/package.json +0 -9
  78. package/theme/package.json +0 -9
  79. package/traversal/package.json +0 -9
@@ -0,0 +1,85 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from "@angular/core";
8
+ import { getAngularJsInjectable, promiseWrap } from "../../commons/angular-angularjs-utils";
9
+ let MetadataApiService = class MetadataApiService {
10
+ constructor(linksMetadataService, picklistService, sandMetadataService, spbEntityMetadataService) {
11
+ this.linksMetadataService = linksMetadataService;
12
+ this.picklistService = picklistService;
13
+ this.sandMetadataService = sandMetadataService;
14
+ this.spbEntityMetadataService = spbEntityMetadataService;
15
+ this.dataDictionaryService = () => getAngularJsInjectable("dataDictionaryService");
16
+ this.getEntityAccessRules = (objectType) => {
17
+ return {
18
+ create: this.dataDictionaryService().canCreateDataSourceType(objectType),
19
+ read: this.dataDictionaryService().canReadDataSourceType(objectType),
20
+ update: this.dataDictionaryService().canUpdateDataSourceType(objectType)
21
+ };
22
+ };
23
+ this.getEntity = (objectType) => {
24
+ return this.dataDictionaryService().getDataSource(objectType);
25
+ };
26
+ this.getField = (objectType, fieldName) => {
27
+ return this.dataDictionaryService().getFieldMetadata(objectType, fieldName);
28
+ };
29
+ this.getManagedEntityTypes = () => {
30
+ return this.dataDictionaryService().getManagedDocumentTypes();
31
+ };
32
+ this.getRootTypes = () => {
33
+ return this.dataDictionaryService().getRootTypes();
34
+ };
35
+ this.getChildEntityTypes = (objectType) => {
36
+ return this.dataDictionaryService().getSubDocumentTypes({ name: objectType });
37
+ };
38
+ this.getAllValidRelationshipTypes = (objectType, relationshipObjectType, relationshipName) => {
39
+ const relateToMenuService = getAngularJsInjectable("relateToMenuService");
40
+ return relateToMenuService.getAllValidLinkTypes(objectType, relationshipObjectType, relationshipName);
41
+ };
42
+ this.getResolvedEntities = () => {
43
+ return this.dataDictionaryService().getEntities();
44
+ };
45
+ this.getResolvedEntityMetadata = (objectType) => {
46
+ return this.dataDictionaryService().getEntityMetadata(objectType);
47
+ };
48
+ this.getIconForEntity = (objectType, iconType) => {
49
+ return this.spbEntityMetadataService.getIconForEntity(objectType, iconType);
50
+ };
51
+ /**
52
+ * @deprecated Use `getRootTypes()` and `getResolvedEntities()` instead.
53
+ */
54
+ this.getSearchMetadata = () => {
55
+ return this.sandMetadataService.getMetadata().toPromise();
56
+ };
57
+ this.getReferenceData = (refDataName, options) => {
58
+ return this.picklistService.getPicklist(refDataName, options).toPromise();
59
+ };
60
+ this.getRelationshipsFilteredByEndType = (endType, includeHeterogeneous = false) => {
61
+ return this.linksMetadataService.getLinksFilteredByEndType(endType, includeHeterogeneous).toPromise();
62
+ };
63
+ }
64
+ getApi() {
65
+ return {
66
+ getEntityAccessRules: this.getEntityAccessRules,
67
+ getEntity: promiseWrap(this.getEntity),
68
+ getField: promiseWrap(this.getField),
69
+ getManagedEntityTypes: promiseWrap(this.getManagedEntityTypes),
70
+ getRootTypes: promiseWrap(this.getRootTypes),
71
+ getChildEntityTypes: promiseWrap(this.getChildEntityTypes),
72
+ getAllValidRelationshipTypes: promiseWrap(this.getAllValidRelationshipTypes),
73
+ getIconForEntity: this.getIconForEntity,
74
+ getResolvedEntities: promiseWrap(this.getResolvedEntities),
75
+ getResolvedEntityMetadata: promiseWrap(this.getResolvedEntityMetadata),
76
+ getSearchMetadata: this.getSearchMetadata,
77
+ getReferenceData: this.getReferenceData,
78
+ getRelationshipsFilteredByEndType: this.getRelationshipsFilteredByEndType
79
+ };
80
+ }
81
+ };
82
+ MetadataApiService = __decorate([
83
+ Injectable()
84
+ ], MetadataApiService);
85
+ export { MetadataApiService };
@@ -1,4 +1,4 @@
1
- import { Relationship, StoredObjectFieldDTO } from "../svi-datahub";
1
+ import { Relationship, StoredObjectFieldDTO, Comment } from "../svi-datahub";
2
2
  import { FileOperation } from "../file/file-api";
3
3
  import { PageModel } from "../page-model/page-model-api";
4
4
  import { ClientSheet, Sheet } from "../sheet/sheet-api";
@@ -77,13 +77,13 @@ export interface ObjectApi {
77
77
  * @description Updates an existing object with the provided data.
78
78
  * @param objectType {string} Object type.
79
79
  * @param objectId {string} Object ID.
80
- * @param objectTypeId {string} Object type ID.
80
+ * @param objectTypeId {number} Object type ID.
81
81
  * @param objectTypeVersion {number} Object type version.
82
82
  * @param fieldValues {FieldValues} Field values of the object.
83
83
  * @param [options] {UpdateObjectOptions} Optional extra parameters.
84
84
  * @return A promise that resolves to the updated object once the object has successfully been updated.
85
85
  */
86
- updateObject(objectType: string, objectId: string, objectTypeId: string, objectTypeVersion: number, fieldValues: FieldValues, options?: UpdateObjectOptions): Promise<VIObject>;
86
+ updateObject(objectType: string, objectId: string, objectTypeId: number, objectTypeVersion: number, fieldValues: FieldValues, options?: UpdateObjectOptions): Promise<VIObject>;
87
87
  /**
88
88
  * @method
89
89
  * @description Deletes an object.
@@ -96,12 +96,12 @@ export interface ObjectApi {
96
96
  * @method
97
97
  * @description Creates an object.
98
98
  * @param objectType {string} Object type.
99
- * @param objectTypeId {string} Object type ID.
99
+ * @param objectTypeId {number} Object type ID.
100
100
  * @param fieldValues {FieldValues} Field values of the object.
101
101
  * @param [options] {CreateObjectOptions} Optional extra parameters.
102
102
  * @return A promise that resolves to the created object once the object has successfully been created.
103
103
  */
104
- createObject(objectType: string, objectTypeId: string, fieldValues: FieldValues, options?: CreateObjectOptions): Promise<VIObject>;
104
+ createObject(objectType: string, objectTypeId: number, fieldValues: FieldValues, options?: CreateObjectOptions): Promise<VIObject>;
105
105
  /**
106
106
  * @method
107
107
  * @description Gets relationship via the relationship ID.
@@ -219,10 +219,11 @@ export interface VIObject {
219
219
  createdAt: string;
220
220
  displayLabel?: string;
221
221
  lastUpdatedAt: string;
222
- objectTypeId: string;
222
+ objectTypeId: number;
223
223
  objectTypeName: string;
224
224
  sheets?: Sheet[];
225
225
  id: string;
226
+ title?: string;
226
227
  }
227
228
  export interface ValidationResult {
228
229
  isValid: boolean;
@@ -441,10 +442,10 @@ export interface ObjectRelationship {
441
442
  qualifiedTypeName?: string;
442
443
  }
443
444
  export interface AttachmentRow {
444
- description: string;
445
+ description?: string;
445
446
  location: string;
446
447
  id: string;
447
- uploadedBy: string;
448
+ uploadedBy?: string;
448
449
  name: string;
449
450
  size: number;
450
451
  type: string;
@@ -488,18 +489,6 @@ export interface FileAssociationResponse {
488
489
  displayOrder?: number;
489
490
  links?: RestRepresentationsLink[];
490
491
  }
491
- export interface Comment {
492
- category: string;
493
- createDate: string;
494
- detail: string;
495
- id: number;
496
- lastUpdatedBy: string;
497
- lastUpdatedAt: string;
498
- author: {
499
- id: string;
500
- name: string;
501
- };
502
- }
503
492
  export interface DisplayTextFields {
504
493
  name: string;
505
494
  displayIndex: number;
@@ -0,0 +1,207 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from "@angular/core";
8
+ import { map } from "rxjs/operators";
9
+ import { getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
10
+ let ObjectApiService = class ObjectApiService {
11
+ constructor(attachmentsService, childObjectViewerValidationService) {
12
+ this.attachmentsService = attachmentsService;
13
+ this.childObjectViewerValidationService = childObjectViewerValidationService;
14
+ this.documentService = () => getAngularJsInjectable("spbDocumentService");
15
+ this.documentDisplayFormatter = () => getAngularJsInjectable("spbDocumentDisplayFormatter");
16
+ this.dataDictionaryService = () => getAngularJsInjectable("dataDictionaryService");
17
+ this.getObjectAccessRules = (objectType, objectId) => {
18
+ return {
19
+ canReadObject: this.dataDictionaryService().canReadDocument(objectType, objectId),
20
+ canUpdateObject: this.dataDictionaryService().canUpdateDocument(objectType, objectId),
21
+ canDeleteObject: this.dataDictionaryService().canDeleteDocument(objectType, objectId)
22
+ };
23
+ };
24
+ this.getObject = (objectType, objectId, includeDisplayLabel = true) => {
25
+ return this.documentService().getDocument(objectType, objectId, { includeDisplayLabel });
26
+ };
27
+ this.getChildObjects = (objectType, objectId, childObjectType, maxResponses = 25) => {
28
+ return this.documentService().getSubDocuments(objectId, objectType, childObjectType, { maxResponses });
29
+ };
30
+ this.updateObject = (objectType, objectId, objectTypeId, objectTypeVersion, fieldValues, options) => {
31
+ return this.documentService().saveDocument(objectTypeId, objectType, objectTypeVersion, objectId, fieldValues, options?.fileOperations, options?.sheets, options?.isExternalObject);
32
+ };
33
+ this.deleteObject = (objectType, objectId) => {
34
+ return this.documentService().deleteDocument(objectType, objectId);
35
+ };
36
+ this.createObject = (objectType, objectTypeId, fieldValues, options) => {
37
+ return this.documentService().createDocument(objectTypeId, objectType, fieldValues, options?.fileOperations, options?.comments, options?.sheets);
38
+ };
39
+ this.getObjectRelationship = (relationshipId) => {
40
+ return this.documentService().getLink(relationshipId);
41
+ };
42
+ this.updateObjectRelationship = (relationshipId, payload) => {
43
+ return this.documentService().saveLink(relationshipId, payload);
44
+ };
45
+ this.deleteObjectRelationship = (relationshipId) => {
46
+ return this.documentService().deleteLink(relationshipId);
47
+ };
48
+ this.relateObject = (from, to, relationship) => {
49
+ return new Promise((resolve, reject) => {
50
+ this.documentService()
51
+ .linkDocument(this.convertObjectForType(from), this.convertObjectForType(to), this.convertObjectRelationshipForName(relationship))
52
+ .then(result => {
53
+ resolve(result.data);
54
+ })
55
+ .catch(error => {
56
+ reject(error.data.message);
57
+ });
58
+ });
59
+ };
60
+ this.getObjectSummaryLabel = (objectType, objectId) => {
61
+ return this.documentService().getDocumentSummaryLabel(objectType, objectId);
62
+ };
63
+ this.createAndRelateObject = (from, to, relationship) => {
64
+ return new Promise((resolve, reject) => {
65
+ this.documentService()
66
+ .createAndLinkDocument(this.convertObjectForType(from), this.convertObjectForData(to), this.convertObjectRelationshipForName(relationship))
67
+ .then(result => {
68
+ resolve(result.data);
69
+ })
70
+ .catch(error => {
71
+ reject(error.data.message);
72
+ });
73
+ });
74
+ };
75
+ this.formatObjectFieldsForDisplay = (objects, objectType, options) => {
76
+ return this.documentDisplayFormatter().processDocumentArray(objects, objectType, options?.skipFormatReferenceData ?? false, options?.skipFormatUserGroups ?? false, options?.skipFormatBooleans ?? false, options?.formatCallback);
77
+ };
78
+ this.uploadAttachment = (attachmentModel, objectType, objectId) => {
79
+ return this.attachmentsService
80
+ .createAttachment(attachmentModel, objectType, objectId)
81
+ .pipe(map(result => result.body ?? {}))
82
+ .toPromise()
83
+ .catch(error => Promise.reject(error.message));
84
+ };
85
+ this.deleteAttachment = (objectType, objectId, attachmentId) => {
86
+ return this.attachmentsService
87
+ .removeAttachment(objectType, objectId, attachmentId)
88
+ .toPromise()
89
+ .then(() => Promise.resolve())
90
+ .catch(error => Promise.reject(error.message));
91
+ };
92
+ this.getAttachment = (objectType, objectId, attachmentId) => {
93
+ return this.attachmentsService
94
+ .getAttachment(objectId, objectType, attachmentId)
95
+ .pipe(map(result => result.body ?? {}))
96
+ .toPromise()
97
+ .catch(error => Promise.reject(error.message));
98
+ };
99
+ this.validate = (pageModel, childObject) => {
100
+ return this.childObjectViewerValidationService
101
+ .validate(pageModel, childObject)
102
+ .toPromise();
103
+ };
104
+ /**
105
+ * Edits the property names of the type to conform to AngularJS services currently injected.
106
+ *
107
+ * fieldValues to data
108
+ * objectTypeName to name
109
+ *
110
+ * @param object {VIObject} The SAS Visual Investigator Object to be edited.
111
+ * @return {ObjectForDocumentServiceRelationships}
112
+ * @ignore
113
+ *
114
+ */
115
+ this.convertObjectForData = (object) => {
116
+ return {
117
+ data: object.fieldValues,
118
+ fileOperations: object.fileOperations,
119
+ comments: object.comments,
120
+ createdAt: object.createdAt,
121
+ lastUpdatedAt: object.lastUpdatedAt,
122
+ objectTypeId: object.objectTypeId,
123
+ type: object.objectTypeName,
124
+ sheets: object.sheets,
125
+ id: object.id
126
+ };
127
+ };
128
+ /**
129
+ * Edits the property names of the type to conform to AngularJS services currently injected.
130
+ *
131
+ * objectTypeName to name
132
+ *
133
+ * @param object {VIObject} The SAS Visual Investigator Object to be edited.
134
+ * @returns {ObjectForDocumentServiceRelationships}
135
+ * @ignore
136
+ */
137
+ this.convertObjectForType = (object) => {
138
+ return {
139
+ fieldValues: object.fieldValues,
140
+ fileOperations: object.fileOperations,
141
+ comments: object.comments,
142
+ createdAt: object.createdAt,
143
+ lastUpdatedAt: object.lastUpdatedAt,
144
+ objectTypeId: object.objectTypeId,
145
+ type: object.objectTypeName,
146
+ sheets: object.sheets,
147
+ id: object.id
148
+ };
149
+ };
150
+ /**
151
+ * Edits the property names of the type to conform to AngularJS services currently injected.
152
+ *
153
+ * relationshipTypeName to name
154
+ *
155
+ * @param relationship {ObjectRelationship} Object Relationship to be edited.
156
+ * @returns {RelationshipForDocumentServiceRelationships}
157
+ * @ignore
158
+ */
159
+ this.convertObjectRelationshipForName = (relationship) => {
160
+ return {
161
+ name: relationship.relationshipTypeName,
162
+ relationshipTypeLabel: relationship.relationshipTypeLabel,
163
+ id: relationship.id,
164
+ createdAt: relationship.createdAt,
165
+ lastUpdatedAt: relationship.lastUpdatedAt,
166
+ validFrom: relationship.validFrom,
167
+ validTo: relationship.validTo,
168
+ displayLabel: relationship.displayLabel,
169
+ fromObjectTypeName: relationship.fromObjectTypeName,
170
+ fromObjectTypeVersion: relationship.fromObjectTypeVersion,
171
+ fromObjectId: relationship.fromObjectId,
172
+ fromObjectDisplayLabel: relationship.fromObjectDisplayLabel,
173
+ toObjectTypeName: relationship.toObjectTypeName,
174
+ toObjectTypeVersion: relationship.toObjectTypeVersion,
175
+ toObjectId: relationship.toObjectId,
176
+ toObjectDisplayLabel: relationship.toObjectDisplayLabel,
177
+ fieldValues: relationship.fieldValues,
178
+ qualifiedTypeName: relationship.qualifiedTypeName
179
+ };
180
+ };
181
+ }
182
+ getApi() {
183
+ return {
184
+ getObjectRelationship: this.getObjectRelationship,
185
+ updateObjectRelationship: this.updateObjectRelationship,
186
+ deleteObjectRelationship: this.deleteObjectRelationship,
187
+ getObject: this.getObject,
188
+ updateObject: this.updateObject,
189
+ deleteObject: this.deleteObject,
190
+ createObject: this.createObject,
191
+ getChildObjects: this.getChildObjects,
192
+ relateObject: this.relateObject,
193
+ getObjectSummaryLabel: this.getObjectSummaryLabel,
194
+ createAndRelateObject: this.createAndRelateObject,
195
+ formatObjectFieldsForDisplay: this.formatObjectFieldsForDisplay,
196
+ uploadAttachment: this.uploadAttachment,
197
+ deleteAttachment: this.deleteAttachment,
198
+ getAttachment: this.getAttachment,
199
+ getObjectAccessRules: this.getObjectAccessRules,
200
+ validate: this.validate
201
+ };
202
+ }
203
+ };
204
+ ObjectApiService = __decorate([
205
+ Injectable()
206
+ ], ObjectApiService);
207
+ export { ObjectApiService };
package/package.json CHANGED
@@ -1,9 +1,31 @@
1
1
  {
2
2
  "name": "@sassoftware/vi-api",
3
- "version": "0.0.29",
3
+ "version": "1.5.0",
4
+ "description": "Types used in the SAS Visual Investigator API",
5
+ "keywords": [
6
+ "SAS",
7
+ "VI",
8
+ "Visual Investigator",
9
+ "solution",
10
+ "extension",
11
+ "angular",
12
+ "API",
13
+ "types"
14
+ ],
15
+ "homepage": "https://github.com/sassoftware/vi-solution-extensions",
16
+ "bugs": {
17
+ "url": "https://github.com/sassoftware/vi-solution-extensions/issues"
18
+ },
19
+ "license": "SEE LICENSE IN LICENSE.txt",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/sassoftware/vi-solution-extensions"
23
+ },
4
24
  "files": [
5
25
  "**/*.d.ts",
6
- "**/*.js"
26
+ "**/*.js",
27
+ "./README.md",
28
+ "./LICENSE.txt"
7
29
  ],
8
30
  "main": "public-api.js",
9
31
  "types": "public-api.d.ts",
@@ -0,0 +1,25 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from "@angular/core";
8
+ import { getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
9
+ let PageAdminApiService = class PageAdminApiService {
10
+ constructor() {
11
+ this.spbPageDesignerConfigService = () => getAngularJsInjectable("spbPageDesignerConfigService");
12
+ this.registerPageType = (name, applicationType, templateType, controlGroups, canvasCssClass, previewCssClass, options, dataTypeControlMappings) => {
13
+ this.spbPageDesignerConfigService().registerPageType(name, applicationType, templateType, controlGroups, canvasCssClass, previewCssClass, options, dataTypeControlMappings);
14
+ };
15
+ }
16
+ getApi() {
17
+ return {
18
+ registerPageType: this.registerPageType
19
+ };
20
+ }
21
+ };
22
+ PageAdminApiService = __decorate([
23
+ Injectable()
24
+ ], PageAdminApiService);
25
+ export { PageAdminApiService };
@@ -1,6 +1,8 @@
1
+ import { FileRestrictions } from "../control/restrictions";
1
2
  import { Control } from "../control/page";
2
3
  import { FileOperation, SASObjectAttachedFile } from "../file/file-api";
3
4
  import { ObjectFieldRestrictions } from "../object/object-api";
5
+ import { PathsRepresentation } from "../svi-sand";
4
6
  export declare enum PageMode {
5
7
  Create = "create",
6
8
  Edit = "edit",
@@ -22,14 +24,17 @@ export interface PageAction {
22
24
  actionName: string;
23
25
  attributes: {
24
26
  [property: string]: any;
25
- displayName: string;
26
- disabled: string;
27
+ displayName?: string;
28
+ disabled?: string;
27
29
  };
28
30
  controlId?: number;
29
31
  displayName: string;
32
+ type: string;
30
33
  };
34
+ childNodes?: PageAction[];
31
35
  }
32
36
  export interface PageActions {
37
+ disabled: boolean;
33
38
  items?: PageAction[];
34
39
  }
35
40
  export interface PageModelData {
@@ -40,20 +45,18 @@ export interface PageModelObjectData {
40
45
  data: PageModelData;
41
46
  displayLabel?: string;
42
47
  fieldRestrictions?: ObjectFieldRestrictions;
43
- fileRestrictions?: ObjectFieldRestrictions;
48
+ fileRestrictions?: Record<string, Record<string, FileRestrictions>>;
44
49
  id?: string;
45
- linkedPages?: any[];
50
+ linkedPages?: LinkedPage[];
46
51
  mode?: PageMode;
47
- objectTypeId?: string;
52
+ objectTypeId?: number;
48
53
  objectTypeVersion?: number;
49
54
  serverPageMode?: ServerPageMode;
50
55
  template?: PageTemplate;
51
56
  templateMetadata?: PageTemplateMetadata;
52
- toolbar?: {
53
- disabled: boolean;
54
- items: Control[];
55
- };
57
+ toolbar?: PageActions;
56
58
  type?: string;
59
+ uuid: string;
57
60
  }
58
61
  export interface PageModel extends PageModelObjectData {
59
62
  attachmentCount?: number;
@@ -72,8 +75,8 @@ export interface PageModel extends PageModelObjectData {
72
75
  getAllMissingFileCategories(): Promise<string[]>;
73
76
  getAllMissingRequiredFields(): string[];
74
77
  setParentModel(parentModel: PageModel): void;
75
- getParentModel(): PageModel;
76
- destroy(): void;
78
+ getParentModel(): PageModel | undefined;
79
+ destroy(): Promise<void>;
77
80
  }
78
81
  export interface PageTemplate {
79
82
  errors?: boolean;
@@ -103,6 +106,11 @@ export interface PageTemplateScreen {
103
106
  locked?: boolean;
104
107
  childNodes?: Control[];
105
108
  }
109
+ export interface LinkedPage {
110
+ templateUuid?: string;
111
+ traversalUuid?: string;
112
+ traversal?: PathsRepresentation;
113
+ }
106
114
  /**
107
115
  * This API is used for creating a PageModel object from source data.
108
116
  * Accessed from the window at window.sas.vi.pageModel.
@@ -111,12 +119,12 @@ export interface PageModelApi {
111
119
  /**
112
120
  * @method
113
121
  * @description Creates a new instance of a PageModel when given the object source.
114
- * @param objectSource {PageModelObjectData} Object containing data for the page model.
122
+ * @param object {Partial<PageModel>} Object containing data for the page model.
115
123
  * @param [options] {PageModelApi~CreateFromObjectOptions} Contains a boolean "clone" declaring whether to deep clone the object
116
124
  * when creating the Page Model.
117
125
  * @returns The instance of PageModel
118
126
  */
119
- createFromObject(objectSource: PageModelObjectData, options?: {
127
+ createFromObject(object: Partial<PageModel>, options?: {
120
128
  clone?: boolean;
121
129
  }): PageModel;
122
130
  }
@@ -0,0 +1,25 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from "@angular/core";
8
+ import { getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
9
+ let PageModelApiService = class PageModelApiService {
10
+ constructor() {
11
+ this.createFromObject = (objectSource, options) => {
12
+ this.spbPageModel = getAngularJsInjectable("spbPageModel");
13
+ return this.spbPageModel.createFromObject(objectSource, options);
14
+ };
15
+ }
16
+ getApi() {
17
+ return {
18
+ createFromObject: this.createFromObject
19
+ };
20
+ }
21
+ };
22
+ PageModelApiService = __decorate([
23
+ Injectable()
24
+ ], PageModelApiService);
25
+ export { PageModelApiService };
@@ -1,3 +1,4 @@
1
+ import { Template, StoredObjectDTO } from "../svi-datahub";
1
2
  /**
2
3
  * SAS Visual Investigator API's representation of a UI-Router state.
3
4
  * Accessed from the window at window.sas.vi.pageState.
@@ -25,6 +26,18 @@ export interface StateObject {
25
26
  root(): StateObject;
26
27
  toString(): string;
27
28
  }
29
+ export interface HomepageDesignerState {
30
+ isNew: boolean;
31
+ page: Template;
32
+ designerType: string;
33
+ }
34
+ export interface ObjectPageDesignerState {
35
+ isNew: boolean;
36
+ page: Template;
37
+ designerType: string;
38
+ childEntityDataSources: StoredObjectDTO[];
39
+ primaryDataSource: StoredObjectDTO;
40
+ }
28
41
  /**
29
42
  * This API provides functionality that pertains to the page state.
30
43
  * Accessed from the window at window.sas.vi.pageState.
@@ -56,4 +69,14 @@ export interface PageStateApi {
56
69
  * @param id {string | number} ID of the page to be deleted.
57
70
  */
58
71
  remove(id: string | number): void;
72
+ /**
73
+ * Gives the currently active homepages state, or undefined if a homepage
74
+ * designer tab is not active.
75
+ */
76
+ getCurrentHomepageDesigner(): HomepageDesignerState | undefined;
77
+ /**
78
+ * Gives the currently active object pages state, or undefined if an object page
79
+ * designer tab is not active.
80
+ */
81
+ getCurrentObjectPageDesigner(): ObjectPageDesignerState | undefined;
59
82
  }
@@ -0,0 +1,70 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from "@angular/core";
8
+ import { getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
9
+ let PageStateApiService = class PageStateApiService {
10
+ constructor(spbPageStateService) {
11
+ this.spbPageStateService = spbPageStateService;
12
+ this.pageDesignerConfig = () => getAngularJsInjectable("spbPageDesignerConfigService");
13
+ this.tabs = () => getAngularJsInjectable("TabService");
14
+ this.getCurrentPageState = () => {
15
+ return this.spbPageStateService.getCurrentState();
16
+ };
17
+ this.getPageState = (id) => {
18
+ return this.spbPageStateService.get(id);
19
+ };
20
+ this.addPageState = (id, state) => {
21
+ this.spbPageStateService.add(id, state);
22
+ };
23
+ this.removePageState = (id) => {
24
+ this.spbPageStateService.remove(id);
25
+ };
26
+ this.getCurrentHomepageDesigner = () => {
27
+ if (!this.isOnHomepageDesigner())
28
+ return undefined;
29
+ return this.spbPageStateService.getCurrentState();
30
+ };
31
+ this.getCurrentObjectPageDesigner = () => {
32
+ if (!this.isOnObjectPageDesigner())
33
+ return undefined;
34
+ return this.spbPageStateService.getCurrentState();
35
+ };
36
+ }
37
+ getApi() {
38
+ return {
39
+ getCurrent: this.getCurrentPageState,
40
+ get: this.getPageState,
41
+ add: this.addPageState,
42
+ remove: this.removePageState,
43
+ getCurrentHomepageDesigner: this.getCurrentHomepageDesigner,
44
+ getCurrentObjectPageDesigner: this.getCurrentObjectPageDesigner
45
+ };
46
+ }
47
+ isOnPageDesigner() {
48
+ return this.tabs().getActiveTab().type === "pageTemplate";
49
+ }
50
+ isOnHomepageDesigner() {
51
+ if (!this.isOnPageDesigner())
52
+ return false;
53
+ const state = this.spbPageStateService.getCurrentState();
54
+ if (!state)
55
+ return false;
56
+ return this.pageDesignerConfig().getDesignerConfig(state.designerType).templateType === "homepage";
57
+ }
58
+ isOnObjectPageDesigner() {
59
+ if (!this.isOnPageDesigner())
60
+ return false;
61
+ const state = this.spbPageStateService.getCurrentState();
62
+ if (!state)
63
+ return false;
64
+ return this.pageDesignerConfig().getDesignerConfig(state.designerType).templateType === "page";
65
+ }
66
+ };
67
+ PageStateApiService = __decorate([
68
+ Injectable()
69
+ ], PageStateApiService);
70
+ export { PageStateApiService };