lavva.exalushome 2.0.230 → 2.0.231

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 (146) hide show
  1. package/build/js/Api.js +129 -129
  2. package/build/js/Api.js.map +1 -1
  3. package/build/js/AsyncLock.js +15 -15
  4. package/build/js/AsyncSemaphore.js +44 -44
  5. package/build/js/AsyncSemaphore.js.map +1 -1
  6. package/build/js/CancelationTokenSource.js +18 -18
  7. package/build/js/DataFrame.js +86 -86
  8. package/build/js/DependencyContainer.js +126 -126
  9. package/build/js/DependencyContainer.js.map +1 -1
  10. package/build/js/Event.js +24 -24
  11. package/build/js/Event.js.map +1 -1
  12. package/build/js/Guid.js +8 -8
  13. package/build/js/Helpers.js +150 -150
  14. package/build/js/Helpers.js.map +1 -1
  15. package/build/js/IDIService.js +1 -1
  16. package/build/js/INetworkService.js +41 -41
  17. package/build/js/Services/AndroidLocationService.js +21 -21
  18. package/build/js/Services/AndroidLocationService.js.map +1 -1
  19. package/build/js/Services/AndroidNotificationService.js +33 -33
  20. package/build/js/Services/AndroidNotificationService.js.map +1 -1
  21. package/build/js/Services/AppRateService.js +28 -28
  22. package/build/js/Services/AppRateService.js.map +1 -1
  23. package/build/js/Services/AppStateService.js +221 -221
  24. package/build/js/Services/AppStateService.js.map +1 -1
  25. package/build/js/Services/Chat/ChatImplementations/ControllerChat/ControllerChat.js +225 -225
  26. package/build/js/Services/Chat/ChatImplementations/ControllerChat/ControllerChat.js.map +1 -1
  27. package/build/js/Services/Chat/ChatImplementations/ControllerChat/IControllerChat.js +33 -33
  28. package/build/js/Services/Chat/ChatImplementations/FamillyChat/FamillyChat.js +148 -148
  29. package/build/js/Services/Chat/ChatImplementations/FamillyChat/FamillyChat.js.map +1 -1
  30. package/build/js/Services/Chat/ChatImplementations/FamillyChat/IFamillyChat.js +1 -1
  31. package/build/js/Services/Chat/ChatImplementations/GptChat/GptChat.js +186 -186
  32. package/build/js/Services/Chat/ChatImplementations/GptChat/GptChat.js.map +1 -1
  33. package/build/js/Services/Chat/ChatImplementations/GptChat/IGptChat.js +26 -26
  34. package/build/js/Services/Chat/ChatService.js +43 -43
  35. package/build/js/Services/Chat/ChatService.js.map +1 -1
  36. package/build/js/Services/Chat/IChatService.js +6 -6
  37. package/build/js/Services/Controller/ConnectedAppsService.js +117 -117
  38. package/build/js/Services/Controller/ConnectedAppsService.js.map +1 -1
  39. package/build/js/Services/Controller/ControllerConfigurationService.js +465 -465
  40. package/build/js/Services/Controller/ControllerConfigurationService.js.map +1 -1
  41. package/build/js/Services/Controller/ControllerExtensionsService.js +151 -151
  42. package/build/js/Services/Controller/ControllerExtensionsService.js.map +1 -1
  43. package/build/js/Services/Controller/FindControllerService.js +154 -154
  44. package/build/js/Services/Controller/FindControllerService.js.map +1 -1
  45. package/build/js/Services/Controller/GeolocationService.js +110 -110
  46. package/build/js/Services/Controller/GeolocationService.js.map +1 -1
  47. package/build/js/Services/Controller/IConnectedAppsService.js +24 -24
  48. package/build/js/Services/Controller/IControllerConfigurationService.js +4 -4
  49. package/build/js/Services/Controller/IControllerExtensionsService.js +1 -1
  50. package/build/js/Services/Controller/IGeolocationService.js +20 -20
  51. package/build/js/Services/DataMigrationService.js +225 -225
  52. package/build/js/Services/DataMigrationService.js.map +1 -1
  53. package/build/js/Services/Devices/ChannelsGroupsService.js +688 -688
  54. package/build/js/Services/Devices/ChannelsGroupsService.js.map +1 -1
  55. package/build/js/Services/Devices/Device.js +249 -249
  56. package/build/js/Services/Devices/Device.js.map +1 -1
  57. package/build/js/Services/Devices/DeviceChannel.js +303 -303
  58. package/build/js/Services/Devices/DeviceChannel.js.map +1 -1
  59. package/build/js/Services/Devices/DevicesService.js +1288 -1288
  60. package/build/js/Services/Devices/DevicesService.js.map +1 -1
  61. package/build/js/Services/Devices/IChannelsGroupsService.js +109 -109
  62. package/build/js/Services/Devices/IChannelsGroupsService.js.map +1 -1
  63. package/build/js/Services/Devices/IDevice.js +201 -201
  64. package/build/js/Services/Devices/IDeviceChannel.js +48 -48
  65. package/build/js/Services/Devices/IDeviceConfigService.js +1 -1
  66. package/build/js/Services/Devices/IDeviceState.js +1027 -1027
  67. package/build/js/Services/Devices/IDeviceState.js.map +1 -1
  68. package/build/js/Services/Devices/IDeviceTask.js +36 -36
  69. package/build/js/Services/Devices/IDevicesService.js +9 -9
  70. package/build/js/Services/Devices/IManuallyPairedDevicesProtocolService.js +1 -1
  71. package/build/js/Services/Devices/IManuallyPairedDevicesService.js +1 -1
  72. package/build/js/Services/Devices/ManuallyPairedDevicesService.js +67 -67
  73. package/build/js/Services/Devices/ManuallyPairedDevicesService.js.map +1 -1
  74. package/build/js/Services/Devices/TaskExecutionResult.js +9 -9
  75. package/build/js/Services/Devices/Tasks/DeviceTask.js +42 -42
  76. package/build/js/Services/Devices/Tasks/Tasks.js +216 -216
  77. package/build/js/Services/ExalusConnectionService.js +679 -679
  78. package/build/js/Services/ExalusConnectionService.js.map +1 -1
  79. package/build/js/Services/FieldChangeResult.js +51 -51
  80. package/build/js/Services/IAppStateService.js +66 -66
  81. package/build/js/Services/IExalusConnectionService.js +38 -38
  82. package/build/js/Services/ILocalStorageService.js +1 -1
  83. package/build/js/Services/IRemoteStorageService.js +8 -8
  84. package/build/js/Services/LocalNetworkExalusConnectionService.js +337 -337
  85. package/build/js/Services/LocalNetworkExalusConnectionService.js.map +1 -1
  86. package/build/js/Services/LocalStorageService.js +38 -38
  87. package/build/js/Services/LocalStorageService.js.map +1 -1
  88. package/build/js/Services/Logging/ILoggerService.js +8 -8
  89. package/build/js/Services/Logging/LoggerService.js +132 -132
  90. package/build/js/Services/Logging/LoggerService.js.map +1 -1
  91. package/build/js/Services/Notifications/ControllerNotificationsService.js +475 -475
  92. package/build/js/Services/Notifications/ControllerNotificationsService.js.map +1 -1
  93. package/build/js/Services/Notifications/IControllerNotificationsService.js +44 -44
  94. package/build/js/Services/PictureInPicture.js +28 -28
  95. package/build/js/Services/PictureInPicture.js.map +1 -1
  96. package/build/js/Services/Pictures/IPicture.js +6 -6
  97. package/build/js/Services/Pictures/IPicturesService.js +1 -1
  98. package/build/js/Services/Pictures/Picture.js +50 -50
  99. package/build/js/Services/Pictures/PicturesService.js +441 -441
  100. package/build/js/Services/Pictures/PicturesService.js.map +1 -1
  101. package/build/js/Services/RemoteStorageService.js +122 -122
  102. package/build/js/Services/RemoteStorageService.js.map +1 -1
  103. package/build/js/Services/Scenes/IScenesService.js +7 -7
  104. package/build/js/Services/Scenes/LeftArgumentTypes.js +166 -166
  105. package/build/js/Services/Scenes/LeftArgumentTypes.js.map +1 -1
  106. package/build/js/Services/Scenes/SceneTaskTypes.js +36 -36
  107. package/build/js/Services/Scenes/Scenes.js +142 -142
  108. package/build/js/Services/Scenes/ScenesBuilder.js +1350 -1350
  109. package/build/js/Services/Scenes/ScenesBuilder.js.map +1 -1
  110. package/build/js/Services/Scenes/ScenesService.js +1208 -1208
  111. package/build/js/Services/Scenes/ScenesService.js.map +1 -1
  112. package/build/js/Services/Session/ISessionService.js +8 -8
  113. package/build/js/Services/Session/SessionService.js +246 -246
  114. package/build/js/Services/Session/SessionService.js.map +1 -1
  115. package/build/js/Services/StatesHistory/IStatesHistoryService.js +12 -12
  116. package/build/js/Services/StatesHistory/StatesHistory.js +89 -89
  117. package/build/js/Services/StatesHistory/StatesHistoryHelper.js +37 -37
  118. package/build/js/Services/StatesHistory/StatesHistoryService.js +470 -470
  119. package/build/js/Services/StatesHistory/StatesHistoryService.js.map +1 -1
  120. package/build/js/Services/SupportedDevices/ISupportedDevicesService.d.ts +65 -65
  121. package/build/js/Services/SupportedDevices/ISupportedDevicesService.js +115 -115
  122. package/build/js/Services/SupportedDevices/SupportedDevicesService.d.ts +6 -6
  123. package/build/js/Services/SupportedDevices/SupportedDevicesService.js +26 -26
  124. package/build/js/Services/Updates/CustomUpdateActions/ICustomUpdateActions.js +1 -1
  125. package/build/js/Services/Updates/IUpdateInfo.js +69 -69
  126. package/build/js/Services/Updates/IUpdatesProvider.js +48 -48
  127. package/build/js/Services/Updates/IUpdatesService.js +174 -174
  128. package/build/js/Services/Updates/UpdateProviderServices/IControllerModulesUpdatesProviderService.js +1 -1
  129. package/build/js/Services/Updates/UpdateProviderServices/IDeviceUpdateProviderService.js +1 -1
  130. package/build/js/Services/Updates/UpdateProviderServices/IUpdateProviderService.js +1 -1
  131. package/build/js/Services/Updates/UpdatesProvider.js +219 -219
  132. package/build/js/Services/Updates/UpdatesProvider.js.map +1 -1
  133. package/build/js/Services/Updates/UpdatesService.js +2118 -2118
  134. package/build/js/Services/Updates/UpdatesService.js.map +1 -1
  135. package/build/js/Services/Users/IUser.js +21 -21
  136. package/build/js/Services/Users/IUsersService.js +1 -1
  137. package/build/js/Services/Users/User.js +111 -111
  138. package/build/js/Services/Users/UsersService.js +302 -302
  139. package/build/js/Services/Users/UsersService.js.map +1 -1
  140. package/build/js/Services/WebApi/IWebApiCacheService.js +1 -1
  141. package/build/js/Services/WebApi/WebApiCacheService.js +42 -42
  142. package/build/js/Services/WebApi/WebApiCacheService.js.map +1 -1
  143. package/build/js/TypedEvent.js +23 -23
  144. package/build/js/TypedEvent.js.map +1 -1
  145. package/build/tsconfig.tsbuildinfo +1 -1
  146. package/package.json +1 -1
package/build/js/Api.js CHANGED
@@ -1,130 +1,130 @@
1
- import { DependencyContainer } from './DependencyContainer';
2
- import { LocalStorageService } from "./Services/LocalStorageService";
3
- import { ExalusConnectionService } from './Services/ExalusConnectionService';
4
- import { WebApiCacheService } from "./Services/WebApi/WebApiCacheService";
5
- import { UsersService } from "./Services/Users/UsersService";
6
- import { DevicesService } from "./Services/Devices/DevicesService";
7
- import { SessionService } from "./Services/Session/SessionService";
8
- import { GeolocationService } from "./Services/Controller/GeolocationService";
9
- import { ControllerConfigurationService } from "./Services/Controller/ControllerConfigurationService";
10
- // 0. Import Module
11
- import { initializeLinq } from "linq-to-typescript";
12
- import { ChannelsGroupsService } from "./Services/Devices/ChannelsGroupsService";
13
- import { AppStateService } from "./Services/AppStateService";
14
- import { PicturesService } from './Services/Pictures/PicturesService';
15
- import { UpdatesService } from './Services/Updates/UpdatesService';
16
- import { ManuallyPairedDevicesService } from './Services/Devices/ManuallyPairedDevicesService';
17
- import { ControllerExtensionsService } from './Services/Controller/ControllerExtensionsService';
18
- import { UpdatesProvider } from './Services/Updates/UpdatesProvider';
19
- import { RemoteStorageService } from './Services/RemoteStorageService';
20
- import { StatesHistoryService } from './Services/StatesHistory/StatesHistoryService';
21
- import { ScenesService } from './Services/Scenes/ScenesService';
22
- import { ChatService } from './Services/Chat/ChatService';
23
- import { ConnectedAppsService } from './Services/Controller/ConnectedAppsService';
24
- import { DataMigrationService } from './Services/DataMigrationService';
25
- import { FindControllerService } from './Services/Controller/FindControllerService';
26
- import { LocalNetworkExalusConnectionService } from './Services/LocalNetworkExalusConnectionService';
27
- import { PictureInPictureService } from './Services/PictureInPicture';
28
- import { ControllerNotificationsService } from './Services/Notifications/ControllerNotificationsService';
29
- import { AndroidLocationService } from './Services/AndroidLocationService';
30
- import { AndroidNotificationsService } from './Services/AndroidNotificationService';
31
- // 2. Bind Linq Functions to Array, Map, etc
32
- initializeLinq();
33
- export function GetDependencyContainer() {
34
- return DependencyContainer.Instance;
35
- }
36
- export class Api {
37
- static Init() {
38
- if (DependencyContainer.IsInitialized)
39
- return;
40
- let dep = DependencyContainer.Instance;
41
- try {
42
- dep.RegisterService(new DataMigrationService());
43
- dep.RegisterService(new LocalStorageService());
44
- dep.RegisterService(new AppStateService());
45
- dep.RegisterService(new WebApiCacheService());
46
- dep.RegisterService(new SessionService());
47
- dep.RegisterService(new PictureInPictureService());
48
- if (Api.IsRunningFromLocalNetwork()) {
49
- console.log("\n\nRunning from local network!\n\n");
50
- dep.RegisterService(new LocalNetworkExalusConnectionService());
51
- }
52
- else
53
- dep.RegisterService(new ExalusConnectionService());
54
- dep.RegisterService(new AndroidLocationService());
55
- dep.RegisterService(new AndroidNotificationsService());
56
- dep.RegisterService(new RemoteStorageService());
57
- dep.RegisterService(new RemoteStorageService());
58
- dep.RegisterService(new GeolocationService());
59
- dep.RegisterService(new ControllerConfigurationService());
60
- dep.RegisterService(new FindControllerService());
61
- dep.RegisterService(new ManuallyPairedDevicesService());
62
- dep.RegisterService(new ControllerExtensionsService());
63
- dep.RegisterService(new PicturesService());
64
- dep.RegisterService(new UsersService());
65
- dep.RegisterService(new DevicesService());
66
- dep.RegisterService(new ChannelsGroupsService());
67
- dep.RegisterService(new UpdatesProvider());
68
- dep.RegisterService(new UpdatesService());
69
- dep.RegisterService(new ConnectedAppsService());
70
- dep.RegisterService(new StatesHistoryService());
71
- dep.RegisterService(new ScenesService());
72
- dep.RegisterService(new ChatService());
73
- dep.RegisterService(new ControllerNotificationsService());
74
- }
75
- catch (ex) {
76
- console.error(ex);
77
- }
78
- }
79
- static IsAppServedFromControllerAsync() {
80
- // http reuqest to controller
81
- const url = `http://${window.location.hostname}/controller_info`;
82
- return fetch(url, { method: 'GET' })
83
- .then(response => {
84
- if (response.ok) {
85
- return true;
86
- }
87
- return false;
88
- })
89
- .catch(error => {
90
- return false;
91
- });
92
- }
93
- static IsRunningFromLocalNetwork(hostname = window.location.hostname) {
94
- return (
95
- //(['localhost', '127.0.0.1', '', '::1'].includes(hostname))
96
- //|| (hostname.startsWith('192.168.'))
97
- (hostname.startsWith('192.168.'))
98
- || (hostname.startsWith('10.'))
99
- //|| (hostname.endsWith('.local'))
100
- );
101
- }
102
- static GetAsync(classType, cancelationToken) {
103
- return DependencyContainer.Instance.GetServiceAsync(classType, cancelationToken);
104
- }
105
- static GetWithTimeoutAsync(classType, timeout) {
106
- return DependencyContainer.Instance.GetServiceWithTimeoutAsync(classType, timeout);
107
- }
108
- static Get(classType) {
109
- return DependencyContainer.Instance.GetService(classType);
110
- }
111
- static SleepForAsync(miliseconds) {
112
- return new Promise(resolve => setTimeout(resolve, miliseconds));
113
- }
114
- static ExportStringAsFileToDownload(filename, content) {
115
- // Create a Blob from the string content
116
- const blob = new Blob([content], { type: 'text/plain' });
117
- // Create a link element
118
- const link = document.createElement('a');
119
- // Create a URL for the Blob and set it as the href attribute of the link
120
- const url = window.URL.createObjectURL(blob);
121
- link.href = url;
122
- // Set the download attribute with the desired filename
123
- link.download = filename;
124
- // Return the link element so the user can click it
125
- return link;
126
- }
127
- }
128
- Api.WorksInContextOf = "";
129
- Api.Version = 1.0;
1
+ import { DependencyContainer } from './DependencyContainer';
2
+ import { LocalStorageService } from "./Services/LocalStorageService";
3
+ import { ExalusConnectionService } from './Services/ExalusConnectionService';
4
+ import { WebApiCacheService } from "./Services/WebApi/WebApiCacheService";
5
+ import { UsersService } from "./Services/Users/UsersService";
6
+ import { DevicesService } from "./Services/Devices/DevicesService";
7
+ import { SessionService } from "./Services/Session/SessionService";
8
+ import { GeolocationService } from "./Services/Controller/GeolocationService";
9
+ import { ControllerConfigurationService } from "./Services/Controller/ControllerConfigurationService";
10
+ // 0. Import Module
11
+ import { initializeLinq } from "linq-to-typescript";
12
+ import { ChannelsGroupsService } from "./Services/Devices/ChannelsGroupsService";
13
+ import { AppStateService } from "./Services/AppStateService";
14
+ import { PicturesService } from './Services/Pictures/PicturesService';
15
+ import { UpdatesService } from './Services/Updates/UpdatesService';
16
+ import { ManuallyPairedDevicesService } from './Services/Devices/ManuallyPairedDevicesService';
17
+ import { ControllerExtensionsService } from './Services/Controller/ControllerExtensionsService';
18
+ import { UpdatesProvider } from './Services/Updates/UpdatesProvider';
19
+ import { RemoteStorageService } from './Services/RemoteStorageService';
20
+ import { StatesHistoryService } from './Services/StatesHistory/StatesHistoryService';
21
+ import { ScenesService } from './Services/Scenes/ScenesService';
22
+ import { ChatService } from './Services/Chat/ChatService';
23
+ import { ConnectedAppsService } from './Services/Controller/ConnectedAppsService';
24
+ import { DataMigrationService } from './Services/DataMigrationService';
25
+ import { FindControllerService } from './Services/Controller/FindControllerService';
26
+ import { LocalNetworkExalusConnectionService } from './Services/LocalNetworkExalusConnectionService';
27
+ import { PictureInPictureService } from './Services/PictureInPicture';
28
+ import { ControllerNotificationsService } from './Services/Notifications/ControllerNotificationsService';
29
+ import { AndroidLocationService } from './Services/AndroidLocationService';
30
+ import { AndroidNotificationsService } from './Services/AndroidNotificationService';
31
+ // 2. Bind Linq Functions to Array, Map, etc
32
+ initializeLinq();
33
+ export function GetDependencyContainer() {
34
+ return DependencyContainer.Instance;
35
+ }
36
+ export class Api {
37
+ static Init() {
38
+ if (DependencyContainer.IsInitialized)
39
+ return;
40
+ let dep = DependencyContainer.Instance;
41
+ try {
42
+ dep.RegisterService(new DataMigrationService());
43
+ dep.RegisterService(new LocalStorageService());
44
+ dep.RegisterService(new AppStateService());
45
+ dep.RegisterService(new WebApiCacheService());
46
+ dep.RegisterService(new SessionService());
47
+ dep.RegisterService(new PictureInPictureService());
48
+ if (Api.IsRunningFromLocalNetwork()) {
49
+ console.log("\n\nRunning from local network!\n\n");
50
+ dep.RegisterService(new LocalNetworkExalusConnectionService());
51
+ }
52
+ else
53
+ dep.RegisterService(new ExalusConnectionService());
54
+ dep.RegisterService(new AndroidLocationService());
55
+ dep.RegisterService(new AndroidNotificationsService());
56
+ dep.RegisterService(new RemoteStorageService());
57
+ dep.RegisterService(new RemoteStorageService());
58
+ dep.RegisterService(new GeolocationService());
59
+ dep.RegisterService(new ControllerConfigurationService());
60
+ dep.RegisterService(new FindControllerService());
61
+ dep.RegisterService(new ManuallyPairedDevicesService());
62
+ dep.RegisterService(new ControllerExtensionsService());
63
+ dep.RegisterService(new PicturesService());
64
+ dep.RegisterService(new UsersService());
65
+ dep.RegisterService(new DevicesService());
66
+ dep.RegisterService(new ChannelsGroupsService());
67
+ dep.RegisterService(new UpdatesProvider());
68
+ dep.RegisterService(new UpdatesService());
69
+ dep.RegisterService(new ConnectedAppsService());
70
+ dep.RegisterService(new StatesHistoryService());
71
+ dep.RegisterService(new ScenesService());
72
+ dep.RegisterService(new ChatService());
73
+ dep.RegisterService(new ControllerNotificationsService());
74
+ }
75
+ catch (ex) {
76
+ console.error(ex);
77
+ }
78
+ }
79
+ static IsAppServedFromControllerAsync() {
80
+ // http reuqest to controller
81
+ const url = `http://${window.location.hostname}/controller_info`;
82
+ return fetch(url, { method: 'GET' })
83
+ .then(response => {
84
+ if (response.ok) {
85
+ return true;
86
+ }
87
+ return false;
88
+ })
89
+ .catch(error => {
90
+ return false;
91
+ });
92
+ }
93
+ static IsRunningFromLocalNetwork(hostname = window.location.hostname) {
94
+ return (
95
+ //(['localhost', '127.0.0.1', '', '::1'].includes(hostname))
96
+ //|| (hostname.startsWith('192.168.'))
97
+ (hostname.startsWith('192.168.'))
98
+ || (hostname.startsWith('10.'))
99
+ //|| (hostname.endsWith('.local'))
100
+ );
101
+ }
102
+ static GetAsync(classType, cancelationToken) {
103
+ return DependencyContainer.Instance.GetServiceAsync(classType, cancelationToken);
104
+ }
105
+ static GetWithTimeoutAsync(classType, timeout) {
106
+ return DependencyContainer.Instance.GetServiceWithTimeoutAsync(classType, timeout);
107
+ }
108
+ static Get(classType) {
109
+ return DependencyContainer.Instance.GetService(classType);
110
+ }
111
+ static SleepForAsync(miliseconds) {
112
+ return new Promise(resolve => setTimeout(resolve, miliseconds));
113
+ }
114
+ static ExportStringAsFileToDownload(filename, content) {
115
+ // Create a Blob from the string content
116
+ const blob = new Blob([content], { type: 'text/plain' });
117
+ // Create a link element
118
+ const link = document.createElement('a');
119
+ // Create a URL for the Blob and set it as the href attribute of the link
120
+ const url = window.URL.createObjectURL(blob);
121
+ link.href = url;
122
+ // Set the download attribute with the desired filename
123
+ link.download = filename;
124
+ // Return the link element so the user can click it
125
+ return link;
126
+ }
127
+ }
128
+ Api.WorksInContextOf = "";
129
+ Api.Version = 1.0;
130
130
  //# sourceMappingURL=Api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Api.js","sourceRoot":"","sources":["../../src/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC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,mDAAmD;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;;AA3GM,oBAAgB,GAAW,EAAE,CAAC;AAC9B,WAAO,GAAW,GAAG,CAAC"}
@@ -1,16 +1,16 @@
1
- export class AsyncLock {
2
- constructor() {
3
- this._promise = Promise.resolve();
4
- this._disable = () => { };
5
- }
6
- Lock() {
7
- this._promise = new Promise(resolve => this._disable = resolve);
8
- }
9
- Unlock() {
10
- this._disable();
11
- }
12
- WaitForLockAsync() {
13
- return this._promise;
14
- }
15
- }
1
+ export class AsyncLock {
2
+ constructor() {
3
+ this._promise = Promise.resolve();
4
+ this._disable = () => { };
5
+ }
6
+ Lock() {
7
+ this._promise = new Promise(resolve => this._disable = resolve);
8
+ }
9
+ Unlock() {
10
+ this._disable();
11
+ }
12
+ WaitForLockAsync() {
13
+ return this._promise;
14
+ }
15
+ }
16
16
  //# sourceMappingURL=AsyncLock.js.map
@@ -1,45 +1,45 @@
1
- export class AsyncSemaphore {
2
- constructor(initialCount) {
3
- this.initialCount = initialCount;
4
- this._running = 0;
5
- this._waiting = [];
6
- this.Take = () => {
7
- if (this._waiting.length > 0 && this._running < this.initialCount) {
8
- this._running++;
9
- const task = this._waiting.shift();
10
- task === null || task === void 0 ? void 0 : task.Resolve({ Release: this.Release });
11
- }
12
- };
13
- /**
14
- * Acquire a lock on the target resource.
15
- * @returns a function to release the lock, it is critical that this function is called when the task is finished with the resource.
16
- */
17
- this.AcquireAsync = () => {
18
- if (this._running < this.initialCount) {
19
- this._running++;
20
- return Promise.resolve({ Release: this.Release });
21
- }
22
- return new Promise((resolve, reject) => {
23
- this._waiting.push({ Resolve: resolve, Reject: reject });
24
- });
25
- };
26
- this.Release = () => {
27
- this._running--;
28
- this.Take();
29
- };
30
- /**
31
- * Purge all waiting tasks from the Semaphore instance
32
- */
33
- this.Purge = () => {
34
- this._waiting.forEach(task => {
35
- task.Reject(new Error('The semaphore was purged and as a result this task has been cancelled'));
36
- });
37
- this._running = 0;
38
- this._waiting = [];
39
- };
40
- if (initialCount < 1) {
41
- throw new Error(`The semaphore was created with a max value of ${initialCount} but the max value cannot be less than 1`);
42
- }
43
- }
44
- }
1
+ export class AsyncSemaphore {
2
+ constructor(initialCount) {
3
+ this.initialCount = initialCount;
4
+ this._running = 0;
5
+ this._waiting = [];
6
+ this.Take = () => {
7
+ if (this._waiting.length > 0 && this._running < this.initialCount) {
8
+ this._running++;
9
+ const task = this._waiting.shift();
10
+ task === null || task === void 0 ? void 0 : task.Resolve({ Release: this.Release });
11
+ }
12
+ };
13
+ /**
14
+ * Acquire a lock on the target resource.
15
+ * @returns a function to release the lock, it is critical that this function is called when the task is finished with the resource.
16
+ */
17
+ this.AcquireAsync = () => {
18
+ if (this._running < this.initialCount) {
19
+ this._running++;
20
+ return Promise.resolve({ Release: this.Release });
21
+ }
22
+ return new Promise((resolve, reject) => {
23
+ this._waiting.push({ Resolve: resolve, Reject: reject });
24
+ });
25
+ };
26
+ this.Release = () => {
27
+ this._running--;
28
+ this.Take();
29
+ };
30
+ /**
31
+ * Purge all waiting tasks from the Semaphore instance
32
+ */
33
+ this.Purge = () => {
34
+ this._waiting.forEach(task => {
35
+ task.Reject(new Error('The semaphore was purged and as a result this task has been cancelled'));
36
+ });
37
+ this._running = 0;
38
+ this._waiting = [];
39
+ };
40
+ if (initialCount < 1) {
41
+ throw new Error(`The semaphore was created with a max value of ${initialCount} but the max value cannot be less than 1`);
42
+ }
43
+ }
44
+ }
45
45
  //# sourceMappingURL=AsyncSemaphore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncSemaphore.js","sourceRoot":"","sources":["../../src/AsyncSemaphore.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,cAAc;IAKzB,YAAmB,YAAoB;QAApB,iBAAY,GAAZ,YAAY,CAAQ;QAH/B,aAAQ,GAAG,CAAC,CAAA;QACZ,aAAQ,GAAqB,EAAE,CAAA;QAU/B,SAAI,GAAG,GAAG,EAAE;YAClB,IAAI,IAAI,CAAC,QAAQ,C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AI,CAAC,QAAQ,EAAE,CAAA;YACf,IAAI,CAAC,IAAI,EAAE,CAAA;QACb,CAAC,CAAA;QAED;;WAEG;QACI,UAAK,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC3B,IAAI,CAAC,MAAM,CACT,IAAI,KAAK,CAAC,uEAAuE,CAAC,CACnF,CAAA;YACH,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;YACjB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QACpB,CAAC,CAAA;QA9CC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,iDAAiD,YAAY,0CAA0C,CACxG,CAAA;QACH,CAAC;IACH,CAAC;CA0CF"}
@@ -1,19 +1,19 @@
1
- import { TypedEvent } from './TypedEvent';
2
- export class CancelationTokenSource {
3
- constructor() {
4
- this._canceled = false;
5
- this._cancellationRequested = false;
6
- this.CancellationEvent = new TypedEvent();
7
- }
8
- Cancel() {
9
- if (this._cancellationRequested)
10
- throw Error("Cancelation has already been requested.");
11
- this._cancellationRequested = true;
12
- this.CancellationEvent.Invoke();
13
- this._canceled = true;
14
- }
15
- get IsCancelled() {
16
- return this._canceled;
17
- }
18
- }
1
+ import { TypedEvent } from './TypedEvent';
2
+ export class CancelationTokenSource {
3
+ constructor() {
4
+ this._canceled = false;
5
+ this._cancellationRequested = false;
6
+ this.CancellationEvent = new TypedEvent();
7
+ }
8
+ Cancel() {
9
+ if (this._cancellationRequested)
10
+ throw Error("Cancelation has already been requested.");
11
+ this._cancellationRequested = true;
12
+ this.CancellationEvent.Invoke();
13
+ this._canceled = true;
14
+ }
15
+ get IsCancelled() {
16
+ return this._canceled;
17
+ }
18
+ }
19
19
  //# sourceMappingURL=CancelationTokenSource.js.map
@@ -1,87 +1,87 @@
1
- import { Helpers } from "./Helpers";
2
- export class DataFrame {
3
- constructor() {
4
- this.TransactionId = Helpers.GenerateUUID();
5
- }
6
- }
7
- export var Status;
8
- (function (Status) {
9
- /// <summary>
10
- /// Gdy zapytanie się powiodło i nie wystąpiły błędy
11
- /// </summary>
12
- Status[Status["OK"] = 0] = "OK";
13
- /// <summary>
14
- /// Gdy wystąpił nieznany błąd podczas wykonywania zapytania
15
- /// </summary>
16
- Status[Status["UnknownError"] = 1] = "UnknownError";
17
- /// <summary>
18
- /// Gdy wystąpił błąd którego oprogramowanie kontrolera nie mogło rozwiązać
19
- /// </summary>
20
- Status[Status["FatalError"] = 2] = "FatalError";
21
- /// <summary>
22
- /// Gdy zapytanie zostało wykonane z niepoprawnymi danymi
23
- /// </summary>
24
- Status[Status["WrongData"] = 3] = "WrongData";
25
- /// <summary>
26
- /// Gdy zostało wykonane zapytanie do zasobu który nie istnieje
27
- /// </summary>
28
- Status[Status["ResourceDoesNotExists"] = 4] = "ResourceDoesNotExists";
29
- /// <summary>
30
- /// Gdy zostało wykonane zapytanie o wykonanie operacji do której zalogowany użytkownik nie ma uprawnień (np. gdy próbuje zmienić dane użytkownika o uprawnieniach wyższych od siebie)
31
- /// </summary>
32
- Status[Status["NoPermissionToPerformThisOperation"] = 5] = "NoPermissionToPerformThisOperation";
33
- /// <summary>
34
- /// Gdy zostanie dokonana próba ponownego logowania dla już zalogowanej sesji
35
- /// </summary>
36
- Status[Status["SessionHasAlreadyLoggedOnUser"] = 6] = "SessionHasAlreadyLoggedOnUser";
37
- /// <summary>
38
- /// Gdy żądana operacja jest niedozwolona
39
- /// </summary>
40
- Status[Status["OperationNotPermitted"] = 7] = "OperationNotPermitted";
41
- /// <summary>
42
- /// Gdy zostanie wykonane zapytanie do zasobu do którego użytkownik nie ma uprawnień
43
- /// </summary>
44
- Status[Status["NoPermissionsToCallGivenResource"] = 8] = "NoPermissionsToCallGivenResource";
45
- /// <summary>
46
- /// Gdy zostanie wykonane zapytanie do zasobu aktualnie nie dostępnego (gdy np. zasób został wyłączony)
47
- /// </summary>
48
- Status[Status["ResourceIsNotAvailable"] = 9] = "ResourceIsNotAvailable";
49
- /// <summary>
50
- /// Gdy zapytanie do zasobu zakończyło się okreslonym błędem
51
- /// </summary>
52
- Status[Status["Error"] = 10] = "Error";
53
- /// <summary>
54
- /// Gdy w ramach odpowiedzi na zapytanie nie są zwracane dane
55
- /// </summary>
56
- Status[Status["NoData"] = 11] = "NoData";
57
- /// <summary>
58
- /// Gdy zostanie wykonane zapytanie do nie wspieranego zasobu (np. dotyczącego okreslonego systemu operacyjnego)
59
- /// </summary>
60
- Status[Status["NotSupportedMethod"] = 12] = "NotSupportedMethod";
61
- /// <summary>
62
- /// Gdy zostanie wykonane zapytanie do dowolnego zasobu a żaden użytkownik nie jest zalogowany w ramach sesji
63
- /// </summary>
64
- Status[Status["UserIsNotLoggedIn"] = 13] = "UserIsNotLoggedIn";
65
- /// <summary>
66
- /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu
67
- /// </summary>
68
- Status[Status["MultiDataResponseStart"] = 14] = "MultiDataResponseStart";
69
- /// <summary>
70
- /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest jedną z odpowiedzi
71
- /// </summary>
72
- Status[Status["MultiDataResponse"] = 15] = "MultiDataResponse";
73
- /// <summary>
74
- /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest ostatnią odpowiedzią danego zasobu
75
- /// </summary>
76
- Status[Status["MultiDataResponseStop"] = 16] = "MultiDataResponseStop";
77
- })(Status || (Status = {}));
78
- export var Method;
79
- (function (Method) {
80
- Method[Method["Get"] = 0] = "Get";
81
- Method[Method["Post"] = 1] = "Post";
82
- Method[Method["Delete"] = 2] = "Delete";
83
- Method[Method["Put"] = 3] = "Put";
84
- Method[Method["Options"] = 4] = "Options";
85
- Method[Method["Head"] = 5] = "Head";
86
- })(Method || (Method = {}));
1
+ import { Helpers } from "./Helpers";
2
+ export class DataFrame {
3
+ constructor() {
4
+ this.TransactionId = Helpers.GenerateUUID();
5
+ }
6
+ }
7
+ export var Status;
8
+ (function (Status) {
9
+ /// <summary>
10
+ /// Gdy zapytanie się powiodło i nie wystąpiły błędy
11
+ /// </summary>
12
+ Status[Status["OK"] = 0] = "OK";
13
+ /// <summary>
14
+ /// Gdy wystąpił nieznany błąd podczas wykonywania zapytania
15
+ /// </summary>
16
+ Status[Status["UnknownError"] = 1] = "UnknownError";
17
+ /// <summary>
18
+ /// Gdy wystąpił błąd którego oprogramowanie kontrolera nie mogło rozwiązać
19
+ /// </summary>
20
+ Status[Status["FatalError"] = 2] = "FatalError";
21
+ /// <summary>
22
+ /// Gdy zapytanie zostało wykonane z niepoprawnymi danymi
23
+ /// </summary>
24
+ Status[Status["WrongData"] = 3] = "WrongData";
25
+ /// <summary>
26
+ /// Gdy zostało wykonane zapytanie do zasobu który nie istnieje
27
+ /// </summary>
28
+ Status[Status["ResourceDoesNotExists"] = 4] = "ResourceDoesNotExists";
29
+ /// <summary>
30
+ /// Gdy zostało wykonane zapytanie o wykonanie operacji do której zalogowany użytkownik nie ma uprawnień (np. gdy próbuje zmienić dane użytkownika o uprawnieniach wyższych od siebie)
31
+ /// </summary>
32
+ Status[Status["NoPermissionToPerformThisOperation"] = 5] = "NoPermissionToPerformThisOperation";
33
+ /// <summary>
34
+ /// Gdy zostanie dokonana próba ponownego logowania dla już zalogowanej sesji
35
+ /// </summary>
36
+ Status[Status["SessionHasAlreadyLoggedOnUser"] = 6] = "SessionHasAlreadyLoggedOnUser";
37
+ /// <summary>
38
+ /// Gdy żądana operacja jest niedozwolona
39
+ /// </summary>
40
+ Status[Status["OperationNotPermitted"] = 7] = "OperationNotPermitted";
41
+ /// <summary>
42
+ /// Gdy zostanie wykonane zapytanie do zasobu do którego użytkownik nie ma uprawnień
43
+ /// </summary>
44
+ Status[Status["NoPermissionsToCallGivenResource"] = 8] = "NoPermissionsToCallGivenResource";
45
+ /// <summary>
46
+ /// Gdy zostanie wykonane zapytanie do zasobu aktualnie nie dostępnego (gdy np. zasób został wyłączony)
47
+ /// </summary>
48
+ Status[Status["ResourceIsNotAvailable"] = 9] = "ResourceIsNotAvailable";
49
+ /// <summary>
50
+ /// Gdy zapytanie do zasobu zakończyło się okreslonym błędem
51
+ /// </summary>
52
+ Status[Status["Error"] = 10] = "Error";
53
+ /// <summary>
54
+ /// Gdy w ramach odpowiedzi na zapytanie nie są zwracane dane
55
+ /// </summary>
56
+ Status[Status["NoData"] = 11] = "NoData";
57
+ /// <summary>
58
+ /// Gdy zostanie wykonane zapytanie do nie wspieranego zasobu (np. dotyczącego okreslonego systemu operacyjnego)
59
+ /// </summary>
60
+ Status[Status["NotSupportedMethod"] = 12] = "NotSupportedMethod";
61
+ /// <summary>
62
+ /// Gdy zostanie wykonane zapytanie do dowolnego zasobu a żaden użytkownik nie jest zalogowany w ramach sesji
63
+ /// </summary>
64
+ Status[Status["UserIsNotLoggedIn"] = 13] = "UserIsNotLoggedIn";
65
+ /// <summary>
66
+ /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu
67
+ /// </summary>
68
+ Status[Status["MultiDataResponseStart"] = 14] = "MultiDataResponseStart";
69
+ /// <summary>
70
+ /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest jedną z odpowiedzi
71
+ /// </summary>
72
+ Status[Status["MultiDataResponse"] = 15] = "MultiDataResponse";
73
+ /// <summary>
74
+ /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest ostatnią odpowiedzią danego zasobu
75
+ /// </summary>
76
+ Status[Status["MultiDataResponseStop"] = 16] = "MultiDataResponseStop";
77
+ })(Status || (Status = {}));
78
+ export var Method;
79
+ (function (Method) {
80
+ Method[Method["Get"] = 0] = "Get";
81
+ Method[Method["Post"] = 1] = "Post";
82
+ Method[Method["Delete"] = 2] = "Delete";
83
+ Method[Method["Put"] = 3] = "Put";
84
+ Method[Method["Options"] = 4] = "Options";
85
+ Method[Method["Head"] = 5] = "Head";
86
+ })(Method || (Method = {}));
87
87
  //# sourceMappingURL=DataFrame.js.map