@sassoftware/vi-api 1.5.0 → 1.9.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 (82) hide show
  1. package/alert-reps/index.d.ts +1 -1
  2. package/alert-reps/package.json +5 -0
  3. package/component/bindings.d.ts +10 -4
  4. package/component/index.d.ts +11 -10
  5. package/component/index.js +1 -1
  6. package/component/package.json +9 -0
  7. package/config/config-api.d.ts +21 -2
  8. package/config/package.json +9 -0
  9. package/control/control-api.d.ts +40 -15
  10. package/control/package.json +9 -0
  11. package/control/restrictions.d.ts +5 -1
  12. package/current-user/package.json +9 -0
  13. package/event/event-api.d.ts +3 -1
  14. package/event/event-api.js +2 -0
  15. package/event/package.json +9 -0
  16. package/file/package.json +9 -0
  17. package/http/package.json +9 -0
  18. package/index.d.ts +4 -2
  19. package/localization/package.json +9 -0
  20. package/metadata/metadata-api.d.ts +17 -14
  21. package/metadata/package.json +9 -0
  22. package/object/object-api.d.ts +34 -21
  23. package/object/package.json +9 -0
  24. package/package.json +2 -1
  25. package/page-admin/package.json +9 -0
  26. package/page-admin/page-admin-api.d.ts +2 -2
  27. package/page-model/package.json +9 -0
  28. package/page-model/page-model-api.d.ts +92 -1
  29. package/page-state/package.json +9 -0
  30. package/page-state/page-state-api.d.ts +6 -33
  31. package/property/package.json +9 -0
  32. package/property/property-api.d.ts +6 -6
  33. package/property/property-api.js +2 -2
  34. package/reference-data/package.json +9 -0
  35. package/resource/package.json +9 -0
  36. package/score-reps/index.d.ts +1 -1
  37. package/score-reps/package.json +5 -0
  38. package/search/client/client-search-api.d.ts +24 -14
  39. package/search/package.json +9 -0
  40. package/search/search-api.d.ts +1 -1
  41. package/sheet/package.json +9 -0
  42. package/sheet/sheet-api.d.ts +6 -6
  43. package/shell-tabs/package.json +9 -0
  44. package/shell-tabs/public-api.d.ts +2 -0
  45. package/shell-tabs/public-api.js +2 -0
  46. package/shell-tabs/shell-tabs-api.d.ts +199 -0
  47. package/shell-tabs/shell-tabs-api.js +6 -0
  48. package/shell-tabs/shell-tabs-lifecycle-api.d.ts +69 -0
  49. package/shell-tabs/shell-tabs-lifecycle-api.js +14 -0
  50. package/svi-datahub/index.d.ts +295 -135
  51. package/svi-datahub/package.json +5 -0
  52. package/svi-sand/index.d.ts +31 -24
  53. package/svi-sand/package.json +5 -0
  54. package/tab/package.json +9 -0
  55. package/tab/tab-api.d.ts +1 -1
  56. package/theme/package.json +9 -0
  57. package/time-slider/index.d.ts +9 -0
  58. package/traversal/package.json +9 -0
  59. package/api-init.service.js +0 -86
  60. package/component/component-api.service.js +0 -161
  61. package/config/config-api.service.js +0 -54
  62. package/current-user/currentUser-api.service.js +0 -49
  63. package/event/event-api.service.js +0 -32
  64. package/file/file-api.service.js +0 -24
  65. package/http/http-api.service.js +0 -64
  66. package/localization/localization-api.service.js +0 -38
  67. package/metadata/admin/admin-metadata-api.service.js +0 -30
  68. package/metadata/metadata-api.service.js +0 -85
  69. package/object/object-api.service.js +0 -207
  70. package/page-admin/page-admin-api.service.js +0 -25
  71. package/page-model/page-model-api.service.js +0 -25
  72. package/page-state/page-state-api.service.js +0 -70
  73. package/property/property-api.service.js +0 -34
  74. package/reference-data/refData.service.js +0 -40
  75. package/resource/resource-api.service.js +0 -24
  76. package/search/client/client-search-api.service.js +0 -111
  77. package/search/search-api.service.js +0 -28
  78. package/sheet/network-menu-handler.service.js +0 -39
  79. package/sheet/sheet-api.service.js +0 -140
  80. package/tab/tab-api.service.js +0 -35
  81. package/theme/theme-api.service.js +0 -35
  82. package/traversal/traversal-api.service.js +0 -77
@@ -1,111 +0,0 @@
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 { each } from "lodash-es";
9
- import { getAngularJsInjectable } from "../../../commons/angular-angularjs-utils";
10
- import { SEARCH_SELECTION_ID, VisualizationTypes } from "../../../sand/search/search";
11
- import { zoneWrap } from "../../../commons/api-utils";
12
- let ClientSearchApiService = class ClientSearchApiService {
13
- constructor(ngZone, searchApiService, sandRestService, sandDoSearchService, sandSearchStorageService, sandMetadataService, sandDocumentInfoService, searchAndCreateWizardService) {
14
- this.ngZone = ngZone;
15
- this.searchApiService = searchApiService;
16
- this.sandRestService = sandRestService;
17
- this.sandDoSearchService = sandDoSearchService;
18
- this.sandSearchStorageService = sandSearchStorageService;
19
- this.sandMetadataService = sandMetadataService;
20
- this.sandDocumentInfoService = sandDocumentInfoService;
21
- this.searchAndCreateWizardService = searchAndCreateWizardService;
22
- this.performSearch = (query) => {
23
- return new Promise(resolve => {
24
- this.sandRestService.search(query).subscribe(result => {
25
- resolve(result);
26
- });
27
- });
28
- };
29
- this.navigateSearch = (queryText, visualizationName, mapFilters, queryMode) => {
30
- this.sandDoSearchService.doSearch(queryText, visualizationName, mapFilters, queryMode);
31
- };
32
- this.getCurrentSearchQuery = () => {
33
- return this.sandSearchStorageService.getCurrentSearchQuery();
34
- };
35
- this.createQueryStringFromModel = (queryModel) => {
36
- const sandQueryBuilderQueryService = getAngularJsInjectable("sandQueryBuilderQueryService");
37
- return this.sandMetadataService
38
- .getMetadata()
39
- .toPromise()
40
- .then(metadata => {
41
- return sandQueryBuilderQueryService.createQueryStringFromModel(queryModel, metadata);
42
- });
43
- };
44
- this.getQueryBuilderModel = (id) => {
45
- if (!id) {
46
- id = SEARCH_SELECTION_ID;
47
- }
48
- return this.sandSearchStorageService.getQueryBuilderModel(id);
49
- };
50
- this.setQueryBuilderModel = (queryModel, id) => {
51
- if (!id) {
52
- id = SEARCH_SELECTION_ID;
53
- }
54
- this.sandSearchStorageService.saveQueryBuilderModel(id, queryModel);
55
- };
56
- this.openAddObjectsToWorkspaceDialog = (visualizationName, objects, currentObject, networkData) => {
57
- this.sandDocumentSelectionDialogService = getAngularJsInjectable("sandDocumentSelectionDialogService");
58
- this.sandDocumentSelectionDialogService.openAddAllObjectsToWorkspaceDialog(visualizationName, currentObject, objects, networkData);
59
- };
60
- this.openAddImageToInsightsDialog = (imageData, contentType, height, width) => {
61
- this.sandDocumentSelectionDialogService = getAngularJsInjectable("sandDocumentSelectionDialogService");
62
- this.sandDocumentSelectionDialogService.openAddImageToInsightDialog(VisualizationTypes.Image, imageData, height ?? undefined, width ?? undefined, contentType);
63
- };
64
- this.addToNewWorkspace = (objectsToAdd, targetObjectType, targetObjectId, visualization, workspaceName, networkData) => {
65
- const worksheetService = getAngularJsInjectable("worksheetService");
66
- const sheetService = getAngularJsInjectable("sheetService");
67
- each(objectsToAdd, object => {
68
- this.sandDocumentInfoService.createUniqueKey(object);
69
- });
70
- const targetObject = {
71
- id: targetObjectId,
72
- type: targetObjectType,
73
- objectType: targetObjectType,
74
- isNewDocument: targetObjectId ? false : true
75
- };
76
- if (!targetObject.isNewDocument && !sheetService.getOpenDocument(targetObject.id, targetObject.type)) {
77
- throw Error(`Cannot add objects to workspace. Object of type ${targetObject.type} and id ${targetObject.id} is not open.`);
78
- }
79
- else {
80
- worksheetService.addToSheet(targetObject, undefined, objectsToAdd, visualization, networkData, workspaceName);
81
- }
82
- };
83
- this.openSearchAndCreateDialog = (wizardValues) => {
84
- const values = {
85
- ...wizardValues,
86
- searchFirst: true,
87
- initialCreateData: null
88
- };
89
- return this.searchAndCreateWizardService.launch(values).closeResult.toPromise();
90
- };
91
- }
92
- getApi() {
93
- return {
94
- ...this.searchApiService.getApi(),
95
- performSearch: this.performSearch,
96
- navigateSearch: zoneWrap(this.navigateSearch, this.ngZone),
97
- getCurrentSearchQuery: this.getCurrentSearchQuery,
98
- createQueryStringFromModel: this.createQueryStringFromModel,
99
- getQueryBuilderModel: this.getQueryBuilderModel,
100
- setQueryBuilderModel: this.setQueryBuilderModel,
101
- openAddObjectsToWorkspaceDialog: zoneWrap(this.openAddObjectsToWorkspaceDialog, this.ngZone),
102
- openAddImageToInsightsDialog: zoneWrap(this.openAddImageToInsightsDialog, this.ngZone),
103
- addToNewWorkspace: zoneWrap(this.addToNewWorkspace, this.ngZone),
104
- openSearchAndCreateDialog: zoneWrap(this.openSearchAndCreateDialog, this.ngZone)
105
- };
106
- }
107
- };
108
- ClientSearchApiService = __decorate([
109
- Injectable()
110
- ], ClientSearchApiService);
111
- export { ClientSearchApiService };
@@ -1,28 +0,0 @@
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 { zoneWrap } from "../../commons/api-utils";
9
- let SearchApiService = class SearchApiService {
10
- constructor(sandQueryBuilderDialogService, ngZone) {
11
- this.sandQueryBuilderDialogService = sandQueryBuilderDialogService;
12
- this.ngZone = ngZone;
13
- this.openQueryBuilderDialog = (dialogTitle, submitButtonText, queryModel, enforceObjectType, restrictObjectTypes) => {
14
- return this.sandQueryBuilderDialogService
15
- .openQueryBuilderDialog(queryModel, dialogTitle, submitButtonText, enforceObjectType, restrictObjectTypes)
16
- .toPromise();
17
- };
18
- }
19
- getApi() {
20
- return {
21
- openQueryBuilderDialog: zoneWrap(this.openQueryBuilderDialog, this.ngZone)
22
- };
23
- }
24
- };
25
- SearchApiService = __decorate([
26
- Injectable()
27
- ], SearchApiService);
28
- export { SearchApiService };
@@ -1,39 +0,0 @@
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
- /**
9
- * This service is an intermediary between the client API and the Network.
10
- * It keeps a record of network menu handlers registered via the client API.
11
- */
12
- let NetworkMenuHandlerService = class NetworkMenuHandlerService {
13
- constructor() {
14
- this.networkMenuHandlers = new Map();
15
- }
16
- /**
17
- * Call the registered callback function to modify/extend the context menu
18
- * @param menuType The type of menu
19
- * @param menu The menu object to be modified
20
- * @param workspaceClientId The Client ID of the current workspace
21
- */
22
- extendNetworkContextMenu(menuType, menu, workspaceClientId) {
23
- this.networkMenuHandlers.get(menuType)?.(menu, workspaceClientId);
24
- }
25
- /**
26
- * Register a callback function for the given menu type
27
- * @param menuType The type of menu: Node or Network
28
- * @param callback The callback function
29
- */
30
- registerNetworkMenuCallback(menuType, callback) {
31
- this.networkMenuHandlers.set(menuType, callback);
32
- }
33
- };
34
- NetworkMenuHandlerService = __decorate([
35
- Injectable({
36
- providedIn: "root"
37
- })
38
- ], NetworkMenuHandlerService);
39
- export { NetworkMenuHandlerService };
@@ -1,140 +0,0 @@
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 { each } from "lodash-es";
9
- import { getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
10
- import { VisualizationTypes } from "../../sand/search/search";
11
- import { zoneWrap } from "../../commons/api-utils";
12
- let SheetApiService = class SheetApiService {
13
- constructor(networkMenuHandlerService, ngZone, notificationService, resourceService, sandDocumentInfoService) {
14
- this.networkMenuHandlerService = networkMenuHandlerService;
15
- this.ngZone = ngZone;
16
- this.notificationService = notificationService;
17
- this.resourceService = resourceService;
18
- this.sandDocumentInfoService = sandDocumentInfoService;
19
- this.getOpenObject = (objectId, objectType) => {
20
- this.sheetService = getAngularJsInjectable("sheetService");
21
- return this.sheetService.getOpenDocument(objectId, objectType) ?? undefined;
22
- };
23
- this.getOpenObjects = () => {
24
- this.sheetService = getAngularJsInjectable("sheetService");
25
- return this.sheetService.getOpenDocuments();
26
- };
27
- this.getOpenObjectBySheet = (sheet) => {
28
- const worksheetService = getAngularJsInjectable("worksheetService");
29
- return worksheetService.getCurrentDocument(sheet);
30
- };
31
- this.createContextMenuForNodes = (workspace, handleAddToWorkspaceFn, handleAddToInsightsFn) => {
32
- return workspace.networkDiagramComponent.framework.view.constructNodeContextMenu(handleAddToWorkspaceFn, handleAddToInsightsFn).items;
33
- };
34
- this.registerNetworkMenuCallback = (menuType, callback) => {
35
- this.networkMenuHandlerService.registerNetworkMenuCallback(menuType, callback);
36
- };
37
- this.openAddAllObjectsToWorkspaceDialog = (objects, options) => {
38
- this.sandDocumentSelectionDialogService = getAngularJsInjectable("sandDocumentSelectionDialogService");
39
- this.sandDocumentSelectionDialogService.openAddAllObjectsToWorkspaceDialog(options?.visualizationName, options?.currentObject, objects, options?.networkData);
40
- };
41
- this.openAddImageToInsightsDialog = (imageData, contentType = "image/png", height, width) => {
42
- this.sandDocumentSelectionDialogService = getAngularJsInjectable("sandDocumentSelectionDialogService");
43
- if (imageData instanceof Uint8Array) {
44
- this.sandDocumentSelectionDialogService.openAddImageToInsightDialog(VisualizationTypes.Image, imageData, height, width, contentType);
45
- }
46
- else {
47
- const util = getAngularJsInjectable("Util");
48
- return this.imgToB64(imageData).then((image) => {
49
- const imageBlob = util.b64toBlob(image);
50
- this.sandDocumentSelectionDialogService.openAddImageToInsightDialog(VisualizationTypes.Image, imageBlob, undefined, undefined, contentType);
51
- });
52
- }
53
- };
54
- /**
55
- * Creates an HTML canvas for the img element.
56
- * Generates a new unscaled image based on the original image source.
57
- * If there is an error loading the new image, an error alert is displayed.
58
- *
59
- * @param element {HTMLElement} Element containing the image.
60
- * @returns {Promise<string>} A Promise which resolves to the Base64 string representing the image.
61
- * @ignore
62
- */
63
- this.imgToB64 = (element) => {
64
- const canvasElement = document.createElement("canvas");
65
- const canvasContext = canvasElement.getContext("2d");
66
- return new Promise(resolve => {
67
- if (canvasContext) {
68
- const originalImageElement = element.querySelector("img");
69
- const unscaledImage = new Image();
70
- unscaledImage.crossOrigin = "Anonymous";
71
- unscaledImage.onload = () => {
72
- canvasElement.width = unscaledImage.width;
73
- canvasElement.height = unscaledImage.height;
74
- // An intermittent issue in IE11 means we use a timeout to move the drawimage out
75
- // of the current execution
76
- // https://stackoverflow.com/questions/25214395/unexpected-call-to-method-or-property-access-while-
77
- // drawing-svg-image-onto-canvas
78
- setTimeout(() => {
79
- canvasContext.drawImage(unscaledImage, 0, 0, unscaledImage.width, unscaledImage.height);
80
- resolve(canvasElement.toDataURL());
81
- canvasElement.remove();
82
- });
83
- };
84
- unscaledImage.onerror = () => {
85
- this.notificationService.alertError(this.resourceService.get("spb.images.addToWorkspaceError.title"), this.resourceService.get("spb.images.addToWorkspaceError.txt"));
86
- canvasElement.remove();
87
- };
88
- unscaledImage.src = originalImageElement.src;
89
- }
90
- });
91
- };
92
- this.addToNewWorkspace = (objectsToAdd, targetObjectType, options) => {
93
- const worksheetService = getAngularJsInjectable("worksheetService");
94
- const sheetService = getAngularJsInjectable("sheetService");
95
- each(objectsToAdd, object => {
96
- this.sandDocumentInfoService.createUniqueKey(object);
97
- });
98
- const targetObject = {
99
- id: options?.targetObjectId,
100
- type: targetObjectType,
101
- objectType: targetObjectType,
102
- isNewDocument: !options?.targetObjectId
103
- };
104
- if (!targetObject.isNewDocument &&
105
- targetObject.id &&
106
- !sheetService.getOpenDocument(targetObject.id, targetObject.type)) {
107
- console.warn(`Cannot add objects to workspace. Object of type ${targetObject.type} and id ${targetObject.id} is not open.`);
108
- }
109
- else {
110
- worksheetService.addToSheet(targetObject, undefined, objectsToAdd, options?.visualization, options?.networkData, options?.workspaceName);
111
- }
112
- };
113
- this.addToExistingWorkspace = (targetObject, workspaceClientId, objectsToAdd, networkData, isUndoRedo) => {
114
- const worksheetService = getAngularJsInjectable("worksheetService");
115
- each(objectsToAdd, object => {
116
- this.sandDocumentInfoService.createUniqueKey(object);
117
- });
118
- worksheetService.addToExistingWorksheet(targetObject, workspaceClientId, objectsToAdd, true, networkData, isUndoRedo);
119
- };
120
- }
121
- getApi() {
122
- return {
123
- getOpenObject: this.getOpenObject,
124
- getOpenObjects: this.getOpenObjects,
125
- getOpenObjectBySheet: this.getOpenObjectBySheet,
126
- createContextMenuForNodes: zoneWrap(this.createContextMenuForNodes, this.ngZone),
127
- registerNetworkMenuCallback: zoneWrap(this.registerNetworkMenuCallback, this.ngZone),
128
- openAddAllObjectsToWorkspaceDialog: zoneWrap(this.openAddAllObjectsToWorkspaceDialog, this.ngZone),
129
- openAddImageToInsightsDialog: zoneWrap(this.openAddImageToInsightsDialog, this.ngZone),
130
- addToExistingWorkspace: zoneWrap(this.addToExistingWorkspace, this.ngZone),
131
- addToNewWorkspace: zoneWrap(this.addToNewWorkspace, this.ngZone)
132
- };
133
- }
134
- };
135
- SheetApiService = __decorate([
136
- Injectable({
137
- providedIn: "root"
138
- })
139
- ], SheetApiService);
140
- export { SheetApiService };
@@ -1,35 +0,0 @@
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
- import { zoneWrap } from "../../commons/api-utils";
10
- let TabApiService = class TabApiService {
11
- constructor(ngZone) {
12
- this.ngZone = ngZone;
13
- this.tabService = () => getAngularJsInjectable("spbDocumentTabService");
14
- this.openTab = (objectType, objectId, suppressNavigation = false, mode = "open" /* OPEN */) => {
15
- return this.tabService().openDocumentTab(objectId, objectType, suppressNavigation, mode);
16
- };
17
- this.isOpenTabDirty = (objectType, objectId) => {
18
- return this.tabService().getDirty(objectType, objectId);
19
- };
20
- this.setOpenTabDirty = (objectType, objectId, dirtyState) => {
21
- return this.tabService().setTabDirtyState(objectType, objectId, dirtyState);
22
- };
23
- }
24
- getApi() {
25
- return {
26
- openTab: zoneWrap(this.openTab, this.ngZone),
27
- isOpenTabDirty: this.isOpenTabDirty,
28
- setOpenTabDirty: zoneWrap(this.setOpenTabDirty, this.ngZone)
29
- };
30
- }
31
- };
32
- TabApiService = __decorate([
33
- Injectable()
34
- ], TabApiService);
35
- export { TabApiService };
@@ -1,35 +0,0 @@
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 ThemeApiService = class ThemeApiService {
10
- constructor(eventService) {
11
- this.eventService = eventService;
12
- this.themeService = () => getAngularJsInjectable("sngThemeService");
13
- this.getCurrent = () => {
14
- return this.themeService().getCurrentTheme();
15
- };
16
- this.onChange = (callback) => {
17
- const subscription = this.eventService.subscribe(this.themeService().themeChangedEventName, (event) => {
18
- callback(event.args.newValue);
19
- });
20
- return () => {
21
- subscription?.unsubscribe();
22
- };
23
- };
24
- }
25
- getApi() {
26
- return {
27
- getCurrent: this.getCurrent,
28
- onChange: this.onChange
29
- };
30
- }
31
- };
32
- ThemeApiService = __decorate([
33
- Injectable()
34
- ], ThemeApiService);
35
- export { ThemeApiService };
@@ -1,77 +0,0 @@
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
- let TraversalApiService = class TraversalApiService {
10
- constructor(adminTraversalsClientService, pathService) {
11
- this.adminTraversalsClientService = adminTraversalsClientService;
12
- this.pathService = pathService;
13
- /**
14
- * Gets an array of Records from a list of given traversals filtered by destinationType.
15
- * The returned records will contain the values for fields specified in the fields param.
16
- * @param rootObjectId {string} Traversal's root object ID.
17
- * @param rootObjectType {string} Traversal's root object Type.
18
- * @param traversalUuids {string[]} Array of traversal UUIDs associated with the root object type.
19
- * @param destinationObjectType {string} Destination object's type.
20
- * @param fields {string[]} Names of the fields to be retrieved.
21
- * @param options {object} Optional object containing options: includeDisplayLabels.
22
- * @returns {Promise<SviRecord[]>} An array of SviRecords for the given Traversal.
23
- */
24
- this.getFieldsByTraversals = (rootObjectId, rootObjectType, traversalUuids, destinationObjectType, fields, options) => {
25
- return this.pathService
26
- .getRecordValuesByTraversals(rootObjectId, rootObjectType, traversalUuids, destinationObjectType, fields, options)
27
- .toPromise()
28
- .then((result) => {
29
- return result || [];
30
- })
31
- .catch((err) => Promise.reject(err?.message));
32
- };
33
- this.getTraversals = () => {
34
- return this.adminTraversalsClientService
35
- .getTraversals()
36
- .pipe(map(result => (result.body ? this.addTraversalEndPoint(result.body) : [])))
37
- .toPromise()
38
- .catch(err => Promise.reject(err?.error?.message));
39
- };
40
- /**
41
- * Adds the traversal end point to the top level of the object.
42
- * @param traversals {Traversal[]} Traversals that need end points added.
43
- * @returns {TraversalWithEndpoint[]} Array of traversals with end points.
44
- * @ignore
45
- */
46
- this.addTraversalEndPoint = (traversals) => {
47
- traversals?.forEach((traversal) => {
48
- let traversalBranch = traversal.traversalDefinition;
49
- if (traversalBranch) {
50
- while (traversalBranch.nextLevel) {
51
- traversalBranch = traversalBranch.nextLevel;
52
- }
53
- traversal.endPoint = traversalBranch.vertexTypes ? traversalBranch.vertexTypes[0] : null;
54
- }
55
- });
56
- return traversals;
57
- };
58
- this.getTraversalByUuid = (uuid) => {
59
- return this.adminTraversalsClientService
60
- .getTraversalByUuid(uuid)
61
- .pipe(map(result => result.body))
62
- .toPromise()
63
- .catch(err => Promise.reject(err?.error?.message));
64
- };
65
- }
66
- getApi() {
67
- return {
68
- getFieldsByTraversals: this.getFieldsByTraversals,
69
- getTraversals: this.getTraversals,
70
- getTraversalByUuid: this.getTraversalByUuid
71
- };
72
- }
73
- };
74
- TraversalApiService = __decorate([
75
- Injectable()
76
- ], TraversalApiService);
77
- export { TraversalApiService };