@sassoftware/vi-api 1.5.0 → 1.7.1

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 (70) hide show
  1. package/alert-reps/package.json +5 -0
  2. package/component/bindings.d.ts +10 -4
  3. package/component/index.d.ts +11 -10
  4. package/component/index.js +1 -1
  5. package/component/package.json +9 -0
  6. package/config/config-api.d.ts +20 -2
  7. package/config/package.json +9 -0
  8. package/control/control-api.d.ts +25 -15
  9. package/control/package.json +9 -0
  10. package/current-user/package.json +9 -0
  11. package/event/package.json +9 -0
  12. package/file/package.json +9 -0
  13. package/http/package.json +9 -0
  14. package/index.d.ts +2 -2
  15. package/localization/package.json +9 -0
  16. package/metadata/metadata-api.d.ts +12 -12
  17. package/metadata/package.json +9 -0
  18. package/object/object-api.d.ts +20 -20
  19. package/object/package.json +9 -0
  20. package/package.json +2 -1
  21. package/page-admin/package.json +9 -0
  22. package/page-admin/page-admin-api.d.ts +2 -2
  23. package/page-model/package.json +9 -0
  24. package/page-model/page-model-api.d.ts +92 -1
  25. package/page-state/package.json +9 -0
  26. package/page-state/page-state-api.d.ts +1 -1
  27. package/property/package.json +9 -0
  28. package/property/property-api.d.ts +6 -6
  29. package/property/property-api.js +2 -2
  30. package/reference-data/package.json +9 -0
  31. package/resource/package.json +9 -0
  32. package/score-reps/package.json +5 -0
  33. package/search/client/client-search-api.d.ts +8 -8
  34. package/search/package.json +9 -0
  35. package/search/search-api.d.ts +1 -1
  36. package/sheet/package.json +9 -0
  37. package/sheet/sheet-api.d.ts +6 -6
  38. package/svi-datahub/index.d.ts +37 -24
  39. package/svi-datahub/package.json +5 -0
  40. package/svi-sand/index.d.ts +31 -24
  41. package/svi-sand/package.json +5 -0
  42. package/tab/package.json +9 -0
  43. package/tab/tab-api.d.ts +1 -1
  44. package/theme/package.json +9 -0
  45. package/time-slider/index.d.ts +9 -0
  46. package/traversal/package.json +9 -0
  47. package/api-init.service.js +0 -86
  48. package/component/component-api.service.js +0 -161
  49. package/config/config-api.service.js +0 -54
  50. package/current-user/currentUser-api.service.js +0 -49
  51. package/event/event-api.service.js +0 -32
  52. package/file/file-api.service.js +0 -24
  53. package/http/http-api.service.js +0 -64
  54. package/localization/localization-api.service.js +0 -38
  55. package/metadata/admin/admin-metadata-api.service.js +0 -30
  56. package/metadata/metadata-api.service.js +0 -85
  57. package/object/object-api.service.js +0 -207
  58. package/page-admin/page-admin-api.service.js +0 -25
  59. package/page-model/page-model-api.service.js +0 -25
  60. package/page-state/page-state-api.service.js +0 -70
  61. package/property/property-api.service.js +0 -34
  62. package/reference-data/refData.service.js +0 -40
  63. package/resource/resource-api.service.js +0 -24
  64. package/search/client/client-search-api.service.js +0 -111
  65. package/search/search-api.service.js +0 -28
  66. package/sheet/network-menu-handler.service.js +0 -39
  67. package/sheet/sheet-api.service.js +0 -140
  68. package/tab/tab-api.service.js +0 -35
  69. package/theme/theme-api.service.js +0 -35
  70. package/traversal/traversal-api.service.js +0 -77
@@ -1,161 +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, get, isFunction, noop, set } from "lodash-es";
9
- import { compileAngularJsComponent, getAngularJsInjectable } from "../../commons/angular-angularjs-utils";
10
- import { TimeSliderComponent } from "../../commons/time-slider/time-slider.component";
11
- import { SandSearchInputComponent } from "../../sand/search-input/sand-search-input.component";
12
- import { ControlCollectionComponent } from "../../spb/page-viewer/control-collection/control-collection.component";
13
- import { zoneWrap } from "../../commons/api-utils";
14
- import { SearchAndSelectWithPreviewComponent } from "../../sand/search-and-select-with-preview/search-and-select-with-preview.component";
15
- /* The details of our supported components. This maps each SviComponent to its associated selector
16
- or Angular Component class. This indirection allows us to change implementation details at a later
17
- date. */
18
- export const components = {
19
- "svi-control-collection": {
20
- selector: "spb-control-collection",
21
- class: ControlCollectionComponent
22
- },
23
- "svi-relationship-details": {
24
- selector: "relate-to-details",
25
- fnBindings: {
26
- onLinkReasonSelected: { params: ["linkReason"] },
27
- setApi: { params: ["api"] },
28
- onRelatedPageLoad: { params: [] },
29
- onRelatedPageChange: { params: ["change"] },
30
- onRelationshipValuesChange: { params: ["current", "previous"] }
31
- },
32
- defaultBindings: {
33
- onRelatedPageLoad: () => {
34
- window.sas.vi?.component.detectChanges();
35
- }
36
- }
37
- },
38
- "svi-search-input": {
39
- selector: "sand-search-input",
40
- class: SandSearchInputComponent
41
- },
42
- "svi-page": {
43
- selector: "spb-sds-page-viewer",
44
- fnBindings: {
45
- setApi: { params: ["api"] },
46
- onDirty: { params: ["isDirty"] },
47
- onPageLoad: { params: [] },
48
- onChange: { params: ["change"] }
49
- },
50
- defaultBindings: {
51
- onPageLoad: () => {
52
- window.sas.vi?.component.detectChanges();
53
- }
54
- }
55
- },
56
- "svi-search-and-select-with-preview": {
57
- selector: "sand-search-and-select-with-preview",
58
- class: SearchAndSelectWithPreviewComponent
59
- },
60
- "svi-time-slider": {
61
- selector: "svi-time-slider",
62
- class: TimeSliderComponent
63
- }
64
- };
65
- let ComponentApiService = class ComponentApiService {
66
- constructor(componentFactoryResolver, injector, appRef, ngZone) {
67
- this.componentFactoryResolver = componentFactoryResolver;
68
- this.injector = injector;
69
- this.appRef = appRef;
70
- this.ngZone = ngZone;
71
- this.$timeout = () => getAngularJsInjectable("$timeout");
72
- this.getApi = () => {
73
- return {
74
- create: zoneWrap(this.create.bind(this), this.ngZone),
75
- detectChanges: this.detectChanges
76
- };
77
- };
78
- this.detectChanges = (callback = noop) => {
79
- // $timeout for AngularJS
80
- this.$timeout()(() => {
81
- // ngZone.run() for Angular. A single $timeout is not enough in some circumstances.
82
- this.ngZone.run(callback);
83
- });
84
- };
85
- this.compileComponent = (component, target, bindings = {}) => {
86
- const details = components[component];
87
- bindings = { ...bindings, ...details.defaultBindings };
88
- if (details.class) {
89
- return this.compileAngularComponent(details.class, target, bindings);
90
- }
91
- return this.compileAngularJSComponent(component, target, bindings);
92
- };
93
- this.compileAngularJSComponent = (component, target, bindings = {}) => {
94
- const selector = components[component].selector;
95
- const attrs = this.getAngularJsAttrs(bindings, component);
96
- const { element, destroy, scope } = compileAngularJsComponent(target, selector, bindings, attrs, true);
97
- return Promise.resolve({ element, destroy, component: scope });
98
- };
99
- this.getAngularJsAttrs = (bindings, component) => {
100
- const attrs = {};
101
- each(bindings, (_v, k) => {
102
- const fnBinding = get(components[component].fnBindings, k);
103
- if (fnBinding) {
104
- // The attribute value for function bindings (&) must be of the form:
105
- // on-foo="onFoo(arg1,arg2)"
106
- // If not, the function will not be invoked. The argument names must
107
- // also match those that the caller uses.
108
- const params = fnBinding.params.join(",");
109
- set(attrs, k, `${k}(${params})`);
110
- }
111
- else {
112
- set(attrs, k, k);
113
- }
114
- });
115
- return attrs;
116
- };
117
- }
118
- create(component, target, bindings) {
119
- if (!(component in components)) {
120
- console.warn(`"${component}" is not a component that can be created.`);
121
- return Promise.reject();
122
- }
123
- return this.compileComponent(component, target, bindings).then((result) => {
124
- this.detectChanges();
125
- return result;
126
- });
127
- }
128
- compileAngularComponent(component, target, bindings) {
129
- const factory = this.componentFactoryResolver.resolveComponentFactory(component);
130
- const ref = factory.create(this.injector);
131
- const instance = ref.instance;
132
- const element = ref.hostView.rootNodes[0];
133
- const subscriptions = [];
134
- each(bindings, (v, k) => {
135
- if (isFunction(v)) {
136
- const sub = instance[k].subscribe(v);
137
- subscriptions.push(sub);
138
- }
139
- else {
140
- set(instance, k, v);
141
- }
142
- });
143
- this.appRef.attachView(ref.hostView);
144
- target.append(element);
145
- this.appRef.tick();
146
- return Promise.resolve({
147
- element,
148
- destroy: () => {
149
- this.appRef.detachView(ref.hostView);
150
- ref.destroy();
151
- each(subscriptions, s => s.unsubscribe());
152
- this.detectChanges();
153
- },
154
- component: instance
155
- });
156
- }
157
- };
158
- ComponentApiService = __decorate([
159
- Injectable()
160
- ], ComponentApiService);
161
- export { ComponentApiService };
@@ -1,54 +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 ConfigApiService = class ConfigApiService {
10
- constructor(networkConfigService, controlService) {
11
- this.networkConfigService = networkConfigService;
12
- this.controlService = controlService;
13
- this.getSoftExpansionLimit = () => {
14
- return this.networkConfigService.getSoftExpansionLimit().toPromise();
15
- };
16
- this.getHardExpansionLimit = () => {
17
- return this.networkConfigService.getHardExpansionLimit().toPromise();
18
- };
19
- this.getSolutions = () => {
20
- return this.solutions;
21
- };
22
- this.registerSolution = (key, label, version) => {
23
- if (key && label && !this.solutions.has(key)) {
24
- this.solutions.set(key, { label, version });
25
- }
26
- };
27
- this.getSolutionExtension = (name) => {
28
- return this.controlService
29
- .whenInitialized()
30
- .pipe(map(() => this.controlService.getControlByName(name)))
31
- .toPromise();
32
- };
33
- this.registerSolutionExtension = (config) => {
34
- return this.controlService.registerControl(config).toPromise();
35
- };
36
- this.solutions = new Map();
37
- }
38
- getApi() {
39
- return {
40
- getSoftExpansionLimit: this.getSoftExpansionLimit,
41
- getHardExpansionLimit: this.getHardExpansionLimit,
42
- getSolutions: this.getSolutions,
43
- registerSolution: this.registerSolution,
44
- getSolutionExtension: this.getSolutionExtension,
45
- registerSolutionExtension: this.registerSolutionExtension
46
- };
47
- }
48
- };
49
- ConfigApiService = __decorate([
50
- Injectable({
51
- providedIn: "root"
52
- })
53
- ], ConfigApiService);
54
- export { ConfigApiService };
@@ -1,49 +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 { pick } from "lodash-es";
9
- let CurrentUserApiService = class CurrentUserApiService {
10
- constructor(configurationService, featureService, identitiesService) {
11
- this.configurationService = configurationService;
12
- this.featureService = featureService;
13
- this.identitiesService = identitiesService;
14
- this.getSessionDetails = () => {
15
- return pick(this.configurationService.getSessionDetails(), [
16
- "authorizedFeatures",
17
- "displayName",
18
- "id",
19
- "softwareVersionNumber"
20
- ]);
21
- };
22
- this.getUserDetails = () => {
23
- return this.identitiesService.getUserDetails(this.userId).toPromise();
24
- };
25
- this.getUserMemberships = () => {
26
- return this.identitiesService.getUserMemberships(this.userId).toPromise();
27
- };
28
- this.hasAdminFeatures = () => {
29
- return this.featureService.hasAdminFeatures();
30
- };
31
- this.hasFeatures = (features) => {
32
- return this.featureService.hasRequiredFeatures(features);
33
- };
34
- this.userId = configurationService.getSessionDetails().id;
35
- }
36
- getApi() {
37
- return {
38
- getSessionDetails: this.getSessionDetails,
39
- getUserDetails: this.getUserDetails,
40
- getUserMemberships: this.getUserMemberships,
41
- hasAdminFeatures: this.hasAdminFeatures,
42
- hasFeatures: this.hasFeatures
43
- };
44
- }
45
- };
46
- CurrentUserApiService = __decorate([
47
- Injectable()
48
- ], CurrentUserApiService);
49
- export { CurrentUserApiService };
@@ -1,32 +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
- let EventApiService = class EventApiService {
9
- constructor(eventService) {
10
- this.eventService = eventService;
11
- this.publish = (eventName, payload) => {
12
- this.eventService.publish(eventName, payload);
13
- };
14
- this.subscribe = (eventName, observer) => {
15
- return this.eventService.subscribe(eventName, observer);
16
- };
17
- this.unsubscribe = (subscription) => {
18
- this.eventService.unsubscribe(subscription);
19
- };
20
- }
21
- getApi() {
22
- return {
23
- publish: this.publish,
24
- subscribe: this.subscribe,
25
- unsubscribe: this.unsubscribe
26
- };
27
- }
28
- };
29
- EventApiService = __decorate([
30
- Injectable()
31
- ], EventApiService);
32
- export { EventApiService };
@@ -1,24 +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
- let FileApiService = class FileApiService {
9
- constructor(sviFilesService) {
10
- this.sviFilesService = sviFilesService;
11
- this.uploadToViFolder = (file, fileName) => {
12
- return this.sviFilesService.uploadFileToViFolderFromFile(file, fileName).toPromise();
13
- };
14
- }
15
- getApi() {
16
- return {
17
- uploadToViFolder: this.uploadToViFolder
18
- };
19
- }
20
- };
21
- FileApiService = __decorate([
22
- Injectable()
23
- ], FileApiService);
24
- export { FileApiService };
@@ -1,64 +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
- let HttpApiService = class HttpApiService {
9
- constructor(httpClient) {
10
- this.httpClient = httpClient;
11
- this.getApi = () => {
12
- return {
13
- get: this.get.bind(this),
14
- head: this.head.bind(this),
15
- post: this.post.bind(this),
16
- put: this.put.bind(this),
17
- patch: this.patch.bind(this),
18
- delete: this.delete.bind(this),
19
- options: this.options.bind(this),
20
- request: this.request.bind(this)
21
- };
22
- };
23
- }
24
- get(url, options) {
25
- return this.httpClient.get(url, options);
26
- }
27
- /**
28
- * @typedef {Object} HttpApiService~HeadOptions
29
- * @property [headers] {Record<string, string | string[]>}
30
- * @property [params] {Record<string, string | string[]>}
31
- */
32
- /**
33
- * Constructs a `HEAD` request that returns a null body and the full HttpResponse.
34
- *
35
- * @param url {string} Endpoint URL.
36
- * @param options {HttpApiService~HeadOptions} HTTP options to send with the request.
37
- * @return {Promise<HttpResponse<null>>} A Promise of the HttpResponse for the request with the response body of null.
38
- */
39
- head(url, options) {
40
- return this.httpClient.head(url, options);
41
- }
42
- post(url, body, options) {
43
- return this.httpClient.post(url, body, options);
44
- }
45
- put(url, body, options) {
46
- return this.httpClient.put(url, body, options);
47
- }
48
- patch(url, body, options) {
49
- return this.httpClient.patch(url, body, options);
50
- }
51
- delete(url, options) {
52
- return this.httpClient.delete(url, options);
53
- }
54
- options(url, options) {
55
- return this.httpClient.options(url, options);
56
- }
57
- request(method, url, options) {
58
- return this.httpClient.request(method, url, options);
59
- }
60
- };
61
- HttpApiService = __decorate([
62
- Injectable()
63
- ], HttpApiService);
64
- export { HttpApiService };
@@ -1,38 +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
- let LocalizationApiService = class LocalizationApiService {
9
- constructor(formatterService, configurationService) {
10
- this.formatterService = formatterService;
11
- this.configurationService = configurationService;
12
- this.getLocalizedDateTimeFormat = (showTime = true) => {
13
- if (showTime) {
14
- return this.formatterService.momentShortDateTimeFormatString();
15
- }
16
- else {
17
- return this.formatterService.momentShortDateFormatString();
18
- }
19
- };
20
- this.getLocale = () => {
21
- return this.configurationService.getUserLocale();
22
- };
23
- this.getDirection = () => {
24
- return this.configurationService.getUserDirection();
25
- };
26
- }
27
- getApi() {
28
- return {
29
- getLocalizedDateTimeFormat: this.getLocalizedDateTimeFormat,
30
- getLocale: this.getLocale,
31
- getDirection: this.getDirection
32
- };
33
- }
34
- };
35
- LocalizationApiService = __decorate([
36
- Injectable()
37
- ], LocalizationApiService);
38
- export { LocalizationApiService };
@@ -1,30 +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 { MetadataApiService } from "../metadata-api.service";
10
- let AdminMetadataApiService = class AdminMetadataApiService extends MetadataApiService {
11
- constructor(linksMetadataService, picklistService, sandMetadataService, spbEntityMetadataService, resourceService) {
12
- super(linksMetadataService, picklistService, sandMetadataService, spbEntityMetadataService);
13
- this.resourceService = resourceService;
14
- this.getFieldDataTypeLabels = () => {
15
- const fdhResources = this.resourceService.getResources().fdh;
16
- const documentSvc = getAngularJsInjectable("documentSvc");
17
- return documentSvc.getFieldDataTypeLabels(fdhResources);
18
- };
19
- }
20
- getApi() {
21
- return {
22
- ...super.getApi(),
23
- getFieldDataTypeLabels: this.getFieldDataTypeLabels
24
- };
25
- }
26
- };
27
- AdminMetadataApiService = __decorate([
28
- Injectable()
29
- ], AdminMetadataApiService);
30
- export { AdminMetadataApiService };
@@ -1,85 +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, 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 };