@sassoftware/vi-api 1.7.1 → 1.15.2

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 (45) hide show
  1. package/api.module.js +60 -72
  2. package/component/bindings.d.ts +44 -0
  3. package/config/config-api.d.ts +57 -0
  4. package/control/control-api.d.ts +14 -0
  5. package/control/events.d.ts +1 -0
  6. package/control/page.d.ts +2 -2
  7. package/control/restrictions.d.ts +5 -1
  8. package/event/event-api.d.ts +3 -1
  9. package/event/event-api.js +2 -0
  10. package/index.d.ts +70 -65
  11. package/index.js +1 -1
  12. package/init/index.d.ts +54 -0
  13. package/init/index.js +17 -0
  14. package/init/init-api.d.ts +26 -0
  15. package/init/init-api.js +83 -0
  16. package/init/package.json +9 -0
  17. package/init/public-api.d.ts +1 -0
  18. package/init/public-api.js +1 -0
  19. package/localization/localization-api.d.ts +75 -0
  20. package/metadata/metadata-api.d.ts +40 -3
  21. package/object/object-api.d.ts +36 -9
  22. package/object/object-api.js +5 -0
  23. package/package.json +1 -1
  24. package/page-state/page-state-api.d.ts +5 -32
  25. package/property/property-api.d.ts +71 -1
  26. package/public-api.d.ts +1 -1
  27. package/public-api.js +1 -1
  28. package/resource/resource-api.d.ts +1 -0
  29. package/search/client/client-search-api.d.ts +22 -17
  30. package/sheet/sheet-api.d.ts +7 -7
  31. package/shell-tabs/package.json +9 -0
  32. package/shell-tabs/public-api.d.ts +2 -0
  33. package/shell-tabs/public-api.js +2 -0
  34. package/shell-tabs/shell-tabs-api.d.ts +199 -0
  35. package/shell-tabs/shell-tabs-api.js +6 -0
  36. package/shell-tabs/shell-tabs-lifecycle-api.d.ts +69 -0
  37. package/shell-tabs/shell-tabs-lifecycle-api.js +14 -0
  38. package/alert-reps/index.d.ts +0 -681
  39. package/alert-reps/package.json +0 -5
  40. package/score-reps/index.d.ts +0 -133
  41. package/score-reps/package.json +0 -5
  42. package/svi-datahub/index.d.ts +0 -4559
  43. package/svi-datahub/package.json +0 -5
  44. package/svi-sand/index.d.ts +0 -1064
  45. package/svi-sand/package.json +0 -5
package/api.module.js CHANGED
@@ -1,72 +1,60 @@
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 { NgModule } from "@angular/core";
8
- import { ComponentApiService } from "./component/component-api.service";
9
- import { ConfigApiService } from "./config/config-api.service";
10
- import { CurrentUserApiService } from "./current-user/currentUser-api.service";
11
- import { EventApiService } from "./event/event-api.service";
12
- import { FileApiService } from "./file/file-api.service";
13
- import { HttpApiService } from "./http/http-api.service";
14
- import { LocalizationApiService } from "./localization/localization-api.service";
15
- import { AdminMetadataApiService } from "./metadata/admin/admin-metadata-api.service";
16
- import { MetadataApiService } from "./metadata/metadata-api.service";
17
- import { ObjectApiService } from "./object/object-api.service";
18
- import { PageAdminApiService } from "./page-admin/page-admin-api.service";
19
- import { PageModelApiService } from "./page-model/page-model-api.service";
20
- import { PageStateApiService } from "./page-state/page-state-api.service";
21
- import { PropertyApiService } from "./property/property-api.service";
22
- import { RefDataApiService } from "./reference-data/refData.service";
23
- import { ResourceApiService } from "./resource/resource-api.service";
24
- import { ClientSearchApiService } from "./search/client/client-search-api.service";
25
- import { SearchApiService } from "./search/search-api.service";
26
- import { SheetApiService } from "./sheet/sheet-api.service";
27
- import { TabApiService } from "./tab/tab-api.service";
28
- import { ThemeApiService } from "./theme/theme-api.service";
29
- import { TraversalApiService } from "./traversal/traversal-api.service";
30
- import { LifeCycleEvent } from "../application-life-cycle.service";
31
- import { filter, take } from "rxjs/operators";
32
- let ApiModule = class ApiModule {
33
- constructor(appBootstrapService, apiInitService) {
34
- this.appBootstrapService = appBootstrapService;
35
- this.apiInitService = apiInitService;
36
- this.appBootstrapService
37
- .getCurrentLifeCycleStage()
38
- .pipe(filter(lifeCycleEvent => lifeCycleEvent === LifeCycleEvent.InitComplete), take(1))
39
- .subscribe(() => {
40
- this.apiInitService.createSviApi();
41
- });
42
- }
43
- };
44
- ApiModule = __decorate([
45
- NgModule({
46
- providers: [
47
- AdminMetadataApiService,
48
- ClientSearchApiService,
49
- ComponentApiService,
50
- ConfigApiService,
51
- CurrentUserApiService,
52
- EventApiService,
53
- FileApiService,
54
- HttpApiService,
55
- LocalizationApiService,
56
- MetadataApiService,
57
- ObjectApiService,
58
- PageAdminApiService,
59
- PageModelApiService,
60
- PageStateApiService,
61
- PropertyApiService,
62
- RefDataApiService,
63
- ResourceApiService,
64
- SheetApiService,
65
- SearchApiService,
66
- TabApiService,
67
- ThemeApiService,
68
- TraversalApiService
69
- ]
70
- })
71
- ], ApiModule);
72
- export { ApiModule };
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 { NgModule } from "@angular/core";
8
+ import { ComponentApiService } from "./component/component-api.service";
9
+ import { ConfigApiService } from "./config/config-api.service";
10
+ import { CurrentUserApiService } from "./current-user/currentUser-api.service";
11
+ import { EventApiService } from "./event/event-api.service";
12
+ import { FileApiService } from "./file/file-api.service";
13
+ import { HttpApiService } from "./http/http-api.service";
14
+ import { LocalizationApiService } from "./localization/localization-api.service";
15
+ import { AdminMetadataApiService } from "./metadata/admin/admin-metadata-api.service";
16
+ import { MetadataApiService } from "./metadata/metadata-api.service";
17
+ import { ObjectApiService } from "./object/object-api.service";
18
+ import { PageAdminApiService } from "./page-admin/page-admin-api.service";
19
+ import { PageModelApiService } from "./page-model/page-model-api.service";
20
+ import { PageStateApiService } from "./page-state/page-state-api.service";
21
+ import { PropertyApiService } from "./property/property-api.service";
22
+ import { RefDataApiService } from "./reference-data/refData.service";
23
+ import { ResourceApiService } from "./resource/resource-api.service";
24
+ import { ClientSearchApiService } from "./search/client/client-search-api.service";
25
+ import { SearchApiService } from "./search/search-api.service";
26
+ import { SheetApiService } from "./sheet/sheet-api.service";
27
+ import { TabApiService } from "./tab/tab-api.service";
28
+ import { ThemeApiService } from "./theme/theme-api.service";
29
+ import { TraversalApiService } from "./traversal/traversal-api.service";
30
+ let ApiModule = class ApiModule {
31
+ };
32
+ ApiModule = __decorate([
33
+ NgModule({
34
+ providers: [
35
+ AdminMetadataApiService,
36
+ ClientSearchApiService,
37
+ ComponentApiService,
38
+ ConfigApiService,
39
+ CurrentUserApiService,
40
+ EventApiService,
41
+ FileApiService,
42
+ HttpApiService,
43
+ LocalizationApiService,
44
+ MetadataApiService,
45
+ ObjectApiService,
46
+ PageAdminApiService,
47
+ PageModelApiService,
48
+ PageStateApiService,
49
+ PropertyApiService,
50
+ RefDataApiService,
51
+ ResourceApiService,
52
+ SheetApiService,
53
+ SearchApiService,
54
+ TabApiService,
55
+ ThemeApiService,
56
+ TraversalApiService
57
+ ]
58
+ })
59
+ ], ApiModule);
60
+ export { ApiModule };
@@ -68,6 +68,50 @@ export interface SearchInputInputBindings {
68
68
  showQueryBuilder?: boolean;
69
69
  queryText?: string;
70
70
  autoFocus?: boolean;
71
+ queryBuilderOkButtonLabel?: string;
72
+ queryModel?: QueryBuilderModel;
73
+ performSearch?: boolean;
74
+ }
75
+ export interface QueryBuilderModel {
76
+ manualQueryString?: string;
77
+ model: QueryBuilderEntityModel[];
78
+ }
79
+ export interface QueryBuilderEntityModel {
80
+ entity: string;
81
+ queries: QueryBuilderItem[];
82
+ singleChildSearch?: boolean;
83
+ }
84
+ export interface QueryBuilderItem {
85
+ booleanValue?: boolean | string;
86
+ boost?: number;
87
+ dateTimeValue?: string | Date;
88
+ dateValue?: string | Date;
89
+ exclude?: boolean;
90
+ field?: string;
91
+ fromDateTimeValue?: string | Date;
92
+ fromDateValue?: string | Date;
93
+ fromNumericValue?: number;
94
+ numericValue?: number;
95
+ operator?: string;
96
+ phonetic?: boolean;
97
+ previousField?: string;
98
+ proximity?: number;
99
+ rangeValidationError?: boolean;
100
+ referenceValue?: string;
101
+ relationshipField?: boolean;
102
+ relationshipTypeValue?: string;
103
+ relativeDateDatetimeNumericValue?: number;
104
+ relativeDateDatetimeUnitsValue?: string;
105
+ stringValidationError?: boolean;
106
+ synonym?: boolean;
107
+ textValue?: string;
108
+ toDateTimeValue?: string | Date;
109
+ toDateValue?: string | Date;
110
+ toNumericValue?: number;
111
+ userGroupValue?: Array<{
112
+ id: string;
113
+ type: string;
114
+ }>;
71
115
  }
72
116
  export interface SearchInputBindings extends SearchInputInputBindings {
73
117
  onSearch?: (model: SearchQuery) => void;
@@ -14,6 +14,7 @@ export interface SolutionExtension extends ControlMetadata {
14
14
  metadata?: SolutionExtensionMetadata;
15
15
  resolvedDisplayName?: string;
16
16
  resolvedDescription?: string;
17
+ clientApplication?: string;
17
18
  name: string;
18
19
  }
19
20
  export interface SolutionExtensionConfigTypeAttributes {
@@ -56,6 +57,36 @@ export interface SviLinkedFile {
56
57
  content?: string;
57
58
  size: number;
58
59
  }
60
+ export interface AppConfigBundle<T> {
61
+ /** unique bundle name */
62
+ name: string;
63
+ /** display name I18n resource key */
64
+ descriptiveName: string;
65
+ /** description I18n resource key */
66
+ description: string;
67
+ /** ID of the the app config that the bundle belongs to */
68
+ appConfigurationId: string;
69
+ /** configuration data */
70
+ configuration: T;
71
+ /** I18n resources to export localizable properties of the configuration data */
72
+ resources?: {
73
+ [key: string]: string;
74
+ };
75
+ /** configuration category e.g. category-desktop */
76
+ categoryId: string;
77
+ /** Visual Investigator version */
78
+ viVersion: string;
79
+ /** HTTP ETag header value based on the last modified timestamp */
80
+ eTag: string;
81
+ /** media type schema version */
82
+ version: number;
83
+ /** creation UTC timestamp string */
84
+ creationTimeStamp?: string;
85
+ /** last modified UTC timestamp string */
86
+ modifiedTimeStamp?: string;
87
+ /** name of the assigned solution */
88
+ solutionName?: string;
89
+ }
59
90
  /**
60
91
  * Functionality related to configuration.
61
92
  * Accessed from the window at window.sas.vi.config.
@@ -108,4 +139,30 @@ export interface ConfigApi {
108
139
  * @param config {SviDocumentManager} Document manager configuration.
109
140
  */
110
141
  registerDocumentManager(config: SviDocumentManager): void;
142
+ /**
143
+ * @method
144
+ * @description Register a callback to override the default action when selecting the given configuration bundle in the administration application.
145
+ * @param bundleName the name of the configuration bundle.
146
+ * @param callback a function which should open a view to
147
+ * allow the user to modify the given configuration bundle.
148
+ */
149
+ registerOpenConfigurationCallback(bundleName: string, callback: () => void): void;
150
+ /**
151
+ * GET an app configuration bundle.
152
+ *
153
+ * @param appConfigId ID for the the app config that the bundle belongs to.
154
+ * @param bundleName The name of the configuration bundle.
155
+ */
156
+ getAppConfigBundle<T extends object>(appConfigId: string, bundleName: string): Promise<AppConfigBundle<T>>;
157
+ /**
158
+ * Send a PUT request to the appConfigurations endpoint with an updated bundle.
159
+ * @param bundle The updated app configuration bundle.
160
+ * @returns a promise resolving resolving to the saved configuration bundle.
161
+ */
162
+ updateAppConfigBundle<T extends object>(bundle: AppConfigBundle<T>): Promise<AppConfigBundle<T>>;
163
+ /**
164
+ * @method
165
+ * @returns a reference to the HTML element which is the default container for modal dialogs to be spawned within the application.
166
+ */
167
+ getSharedDialogContainer(): HTMLElement;
111
168
  }
@@ -46,6 +46,10 @@ export interface ControlApiBase<ControlTypeAttributes extends TypeAttributes = T
46
46
  readonly state: ControlStateApi;
47
47
  /** Control type. */
48
48
  readonly type: string;
49
+ /** Control Mask */
50
+ isMaskedControl(): boolean;
51
+ /** Control Mask Authorization */
52
+ isAuthorizedToUnmask(): boolean;
49
53
  /**
50
54
  * Sets the value of the control's field.
51
55
  * Field must be configured as dataSource in the control's typeAttributes.
@@ -166,6 +170,16 @@ export interface ControlStateApi {
166
170
  * True if the control is hidden, otherwise false.
167
171
  */
168
172
  readonly hidden: boolean;
173
+ /**
174
+ * Returns the masked state of the calling control.
175
+ * True if the control is masked, otherwise false.
176
+ */
177
+ readonly maskActive: boolean;
178
+ /**
179
+ * Returns the disabled state of the calling control.
180
+ * True if the control is disabled, otherwise false.
181
+ */
182
+ readonly disabled: boolean;
169
183
  /**
170
184
  * Registers a function to be invoked whenever a state change event occurs.
171
185
  * This function receives an object that contains information about the change event.
@@ -72,4 +72,5 @@ export interface StateChange {
72
72
  allowInput?: boolean;
73
73
  couldBeReadOnly?: boolean;
74
74
  couldBeRequired?: boolean;
75
+ maskActive?: boolean;
75
76
  }
package/control/page.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Type } from "@angular/core";
2
+ import { ActionState } from "../object/object-api";
2
3
  export declare const enum PageModeEvent {
3
4
  CREATE = "create",
4
5
  EDIT = "edit",
@@ -16,8 +17,7 @@ export interface Control<ControlTypeAttributes extends TypeAttributes = TypeAttr
16
17
  export interface ControlAttrs {
17
18
  attributes?: {
18
19
  disabled: boolean;
19
- showActionHistory: boolean;
20
- showVersionHistory: boolean;
20
+ state?: ActionState;
21
21
  };
22
22
  id: string;
23
23
  category: string;
@@ -1,4 +1,4 @@
1
- import { FieldType } from "./data-types";
1
+ import { FieldType, NumberDataType } from "./data-types";
2
2
  export interface RequirableRestriction {
3
3
  required: boolean;
4
4
  }
@@ -16,6 +16,10 @@ export interface NumericRestrictions extends FieldRestrictions {
16
16
  scale?: number;
17
17
  precision?: number;
18
18
  }
19
+ export interface NumberRestrictions extends FieldRestrictions {
20
+ fieldDataType: NumberDataType;
21
+ precision?: number;
22
+ }
19
23
  export interface ReferenceDataRestrictions extends FieldRestrictions {
20
24
  constrainingListName: string;
21
25
  cascadingReferenceDataName?: string;
@@ -16,7 +16,9 @@ export declare enum PageEvents {
16
16
  SelectNodeEvent = "spb::selectNode",
17
17
  UpdateSubDocumentTypeEvent = "spb::updateSubDocumentType",
18
18
  TabSelectedEvent = "spb::tabSelected",
19
- VisitAllTabs = "spb::mark-all-tabs-visited"
19
+ VisitAllTabs = "spb::mark-all-tabs-visited",
20
+ MaskToggleEvent = "spb::mask-toggle",
21
+ MaskAllEvent = "spb::mask-all"
20
22
  }
21
23
  export interface Subscription {
22
24
  unsubscribe(): void;
@@ -18,6 +18,8 @@ export var PageEvents;
18
18
  PageEvents["UpdateSubDocumentTypeEvent"] = "spb::updateSubDocumentType";
19
19
  PageEvents["TabSelectedEvent"] = "spb::tabSelected";
20
20
  PageEvents["VisitAllTabs"] = "spb::mark-all-tabs-visited";
21
+ PageEvents["MaskToggleEvent"] = "spb::mask-toggle";
22
+ PageEvents["MaskAllEvent"] = "spb::mask-all";
21
23
  })(PageEvents || (PageEvents = {}));
22
24
  /**
23
25
  * Callback function executed when subscription is triggered by an event.
package/index.d.ts CHANGED
@@ -1,65 +1,70 @@
1
- import { ComponentApi } from "./component";
2
- import { ConfigApi } from "./config/config-api";
3
- import { CurrentUserApi } from "./current-user/currentUser-api";
4
- import { EventApi } from "./event/event-api";
5
- import { FileApi } from "./file/file-api";
6
- import { HttpApi } from "./http";
7
- import { LocalizationApi } from "./localization/localization-api";
8
- import { AdminMetadataApi } from "./metadata/admin/admin-metadata-api";
9
- import { MetadataApi } from "./metadata/metadata-api";
10
- import { ObjectApi } from "./object/object-api";
11
- import { PageAdminApi } from "./page-admin/page-admin-api";
12
- import { PageModelApi } from "./page-model/page-model-api";
13
- import { PageStateApi } from "./page-state/page-state-api";
14
- import { PropertyApi } from "./property/property-api";
15
- import { RefDataApi } from "./reference-data/refData";
16
- import { ResourceApi } from "./resource/resource-api";
17
- import { ClientSearchApi } from "./search/client/client-search-api";
18
- import { SearchApi } from "./search/search-api";
19
- import { SheetApi } from "./sheet/sheet-api";
20
- import { TabApi } from "./tab/tab-api";
21
- import { ThemeApi } from "./theme/theme-api";
22
- import { TraversalApi } from "./traversal/traversal-api";
23
- /**
24
- * Common API Functions.
25
- */
26
- export interface SviCommonApi {
27
- component: ComponentApi;
28
- currentUser: CurrentUserApi;
29
- event: EventApi;
30
- file: FileApi;
31
- http: HttpApi;
32
- localization: LocalizationApi;
33
- metadata: MetadataApi;
34
- pageAdmin: PageAdminApi;
35
- pageModel: PageModelApi;
36
- pageState: PageStateApi;
37
- property: PropertyApi;
38
- refData: RefDataApi;
39
- resource: ResourceApi;
40
- search: SearchApi;
41
- theme: ThemeApi;
42
- traversal: TraversalApi;
43
- config: ConfigApi;
44
- }
45
- /**
46
- * The Client API.
47
- */
48
- export interface SviClientApi extends SviCommonApi {
49
- object: ObjectApi;
50
- search: ClientSearchApi;
51
- sheet: SheetApi;
52
- tab: TabApi;
53
- }
54
- /**
55
- * The Admin API.
56
- */
57
- export interface SviAdminApi extends SviCommonApi {
58
- metadata: AdminMetadataApi;
59
- }
60
- export declare type SviApi = SviClientApi | SviAdminApi;
61
- export declare type SviWindow = typeof window & {
62
- sas: {
63
- vi: SviApi;
64
- };
65
- };
1
+ import { ComponentApi } from "./component";
2
+ import { ConfigApi } from "./config/config-api";
3
+ import { CurrentUserApi } from "./current-user/currentUser-api";
4
+ import { EventApi } from "./event/event-api";
5
+ import { FileApi } from "./file/file-api";
6
+ import { HttpApi } from "./http";
7
+ import { LocalizationApi } from "./localization/localization-api";
8
+ import { AdminMetadataApi } from "./metadata/admin/admin-metadata-api";
9
+ import { MetadataApi } from "./metadata/metadata-api";
10
+ import { ObjectApi } from "./object/object-api";
11
+ import { PageAdminApi } from "./page-admin/page-admin-api";
12
+ import { PageModelApi } from "./page-model/page-model-api";
13
+ import { PageStateApi } from "./page-state/page-state-api";
14
+ import { PropertyApi } from "./property/property-api";
15
+ import { RefDataApi } from "./reference-data/refData";
16
+ import { ResourceApi } from "./resource/resource-api";
17
+ import { ClientSearchApi } from "./search/client/client-search-api";
18
+ import { SearchApi } from "./search/search-api";
19
+ import { SheetApi } from "./sheet/sheet-api";
20
+ import { TabApi } from "./tab/tab-api";
21
+ import { ThemeApi } from "./theme/theme-api";
22
+ import { TraversalApi } from "./traversal/traversal-api";
23
+ import { ShellTabsApi } from "./shell-tabs/shell-tabs-api";
24
+ import { InitApi } from "./init";
25
+ /**
26
+ * Common API Functions.
27
+ */
28
+ export interface SviCommonApi {
29
+ component: ComponentApi;
30
+ currentUser: CurrentUserApi;
31
+ event: EventApi;
32
+ file: FileApi;
33
+ http: HttpApi;
34
+ localization: LocalizationApi;
35
+ metadata: MetadataApi;
36
+ pageAdmin: PageAdminApi;
37
+ pageModel: PageModelApi;
38
+ pageState: PageStateApi;
39
+ property: PropertyApi;
40
+ refData: RefDataApi;
41
+ /** @deprecated Use window.sas.viInit.registerResourceBundle to register resources before the rest of the Visual Investigator API is ready. */
42
+ resource: ResourceApi;
43
+ search: SearchApi;
44
+ theme: ThemeApi;
45
+ traversal: TraversalApi;
46
+ config: ConfigApi;
47
+ shellTabs: ShellTabsApi;
48
+ }
49
+ /**
50
+ * The Client API.
51
+ */
52
+ export interface SviClientApi extends SviCommonApi {
53
+ object: ObjectApi;
54
+ search: ClientSearchApi;
55
+ sheet: SheetApi;
56
+ tab: TabApi;
57
+ }
58
+ /**
59
+ * The Admin API.
60
+ */
61
+ export interface SviAdminApi extends SviCommonApi {
62
+ metadata: AdminMetadataApi;
63
+ }
64
+ export declare type SviApi = SviClientApi | SviAdminApi;
65
+ export declare type SviWindow = typeof window & {
66
+ sas: {
67
+ vi: SviApi;
68
+ viInit: InitApi;
69
+ };
70
+ };
package/index.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,54 @@
1
+ export declare const APP_INIT_TIMEOUT_MS: number;
2
+ export declare const ERR_EXISTING_APP_DECLARED: (appName: string) => string;
3
+ export declare const ERR_EXISTING_RESOURCE_BUNDLE_DECLARED: (appName: string) => string;
4
+ export declare const ERR_INIT_TIMEOUT: (name: string, timeout?: number) => string;
5
+ /**
6
+ * An API to manage the asynchronous initialisation of solution applications
7
+ * before the Visual Investigator application is fully initialised.
8
+ */
9
+ export interface InitApi {
10
+ /**
11
+ * Declare an application.
12
+ * Visual Investigator will await whenReady for each before continuing its own app initialisation.
13
+ * notifyAppReady should be called to indicate when the app initialisation is complete.
14
+ * if provided, registerResourceBundle should be called to indicate when the I18n resource bundle is ready.
15
+ * @param appName appName of the app configuration.
16
+ * @param i18nResourceBundleName I18n resource bundle name of the app configuration.
17
+ */
18
+ declareApp(appName: string, i18nResourceBundleName?: string): void;
19
+ /**
20
+ * Notify listeners that the app has been initialised.
21
+ * @param appName appName of the app configuration.
22
+ */
23
+ notifyAppReady(appName: string): void;
24
+ /**
25
+ * Resolves once notifyAppReady has been called for the given app name,
26
+ * or once the given {@link SviInitEvent} is ready.
27
+ * Will reject with an error if timeout elapses before notifyAppReady is called.
28
+ * @param name name of the app configuration or init event.
29
+ * @param timeout max wait (milliseconds) before the promise is rejected (defaults to {@link APP_INIT_TIMEOUT_MS}).
30
+ */
31
+ whenAppReady(name: SviInitEvent | string, timeout?: number): Promise<void>;
32
+ /**
33
+ * Register a resource bundle with the Resource Service.
34
+ * @param bundleName {string} Name for the bundle to be stored in the resource cache.
35
+ * @param resources {I18nResources} Object containing the resources to be added for the bundle
36
+ * specified by the bundleName parameter.
37
+ */
38
+ registerResourceBundle(bundleName: string, resources: I18nResources): void;
39
+ }
40
+ /**
41
+ * Initialisation events for the Visual Investigator application.
42
+ * These can be awaited using window.sas.viInit.whenReady
43
+ */
44
+ export declare enum SviInitEvent {
45
+ /** all apps which were declared through window.sas.viInit */
46
+ AllDeclaredApps = "viInit::all-apps",
47
+ /** all I18n resource bundles which were declared through window.sas.viInit */
48
+ AllDeclaredI18nResourceBundles = "viInit::all-i18n-resources",
49
+ /** the full window.sas.vi API, depends on {@link AllDeclaredI18nResourceBundles} */
50
+ SviClientApi = "viInit::sas-vi-api"
51
+ }
52
+ export interface I18nResources {
53
+ [key: string]: string | I18nResources;
54
+ }
package/init/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export const APP_INIT_TIMEOUT_MS = 120 * 1000;
2
+ export const ERR_EXISTING_APP_DECLARED = (appName) => `App: '${appName}' has already been declared.`;
3
+ export const ERR_EXISTING_RESOURCE_BUNDLE_DECLARED = (appName) => `I18n resource bundle: '${appName}' has already been declared.`;
4
+ export const ERR_INIT_TIMEOUT = (name, timeout) => `Ready check for '${name}' timed out after ${timeout ?? APP_INIT_TIMEOUT_MS}ms.`;
5
+ /**
6
+ * Initialisation events for the Visual Investigator application.
7
+ * These can be awaited using window.sas.viInit.whenReady
8
+ */
9
+ export var SviInitEvent;
10
+ (function (SviInitEvent) {
11
+ /** all apps which were declared through window.sas.viInit */
12
+ SviInitEvent["AllDeclaredApps"] = "viInit::all-apps";
13
+ /** all I18n resource bundles which were declared through window.sas.viInit */
14
+ SviInitEvent["AllDeclaredI18nResourceBundles"] = "viInit::all-i18n-resources";
15
+ /** the full window.sas.vi API, depends on {@link AllDeclaredI18nResourceBundles} */
16
+ SviInitEvent["SviClientApi"] = "viInit::sas-vi-api";
17
+ })(SviInitEvent || (SviInitEvent = {}));
@@ -0,0 +1,26 @@
1
+ import { I18nResources, SviInitEvent, InitApi } from ".";
2
+ export interface ResourceApi {
3
+ registerResourceBundle(bundleName: string, resources: I18nResources): void;
4
+ }
5
+ export declare class SviInitApi implements InitApi {
6
+ private globalI18nResources;
7
+ private appReadyStates;
8
+ private resourceReadyStates;
9
+ private resourceServiceSubject;
10
+ private resourceService$;
11
+ private defaultTimeout;
12
+ constructor(globalI18nResources: I18nResources);
13
+ declareApp(appName: string, i18nResourceBundleName?: string): void;
14
+ whenAppReady(appName: SviInitEvent | string, timeout?: number): Promise<void>;
15
+ notifyAppReady(appName: SviInitEvent | string): void;
16
+ registerResourceBundle(bundleName: string, resources: I18nResources): void;
17
+ checkAllDeclaredAppsReady(): void;
18
+ checkAllDeclaredResourcesReady(): void;
19
+ setResourceApi(resourceService: ResourceApi): void;
20
+ private isAppDeclared;
21
+ private isResourceBundleDeclared;
22
+ private notifyReady;
23
+ private whenReady;
24
+ private whenAllDeclaredReady;
25
+ private initReadyState;
26
+ }