lavva.exalushome 1.0.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 (97) hide show
  1. package/build/exalushome-library-bundle.js +2 -0
  2. package/build/exalushome-library-bundle.js.map +1 -0
  3. package/build/js/Api.d.ts +15 -0
  4. package/build/js/Api.js +35 -0
  5. package/build/js/Api.js.map +1 -0
  6. package/build/js/CancelationTokenSource.d.ts +8 -0
  7. package/build/js/CancelationTokenSource.js +25 -0
  8. package/build/js/CancelationTokenSource.js.map +1 -0
  9. package/build/js/DataFrame.d.ts +41 -0
  10. package/build/js/DataFrame.js +38 -0
  11. package/build/js/DataFrame.js.map +1 -0
  12. package/build/js/DependencyContainer.d.ts +19 -0
  13. package/build/js/DependencyContainer.js +83 -0
  14. package/build/js/DependencyContainer.js.map +1 -0
  15. package/build/js/Event.d.ts +19 -0
  16. package/build/js/Event.js +28 -0
  17. package/build/js/Event.js.map +1 -0
  18. package/build/js/ExalusConnectionService.d.ts +35 -0
  19. package/build/js/ExalusConnectionService.js +316 -0
  20. package/build/js/ExalusConnectionService.js.map +1 -0
  21. package/build/js/Helpers.d.ts +3 -0
  22. package/build/js/Helpers.js +23 -0
  23. package/build/js/Helpers.js.map +1 -0
  24. package/build/js/IDIService.d.ts +3 -0
  25. package/build/js/IDIService.js +2 -0
  26. package/build/js/IDIService.js.map +1 -0
  27. package/build/js/IExalusConnector.d.ts +44 -0
  28. package/build/js/IExalusConnector.js +33 -0
  29. package/build/js/IExalusConnector.js.map +1 -0
  30. package/build/js/Services/Devices/Device.d.ts +33 -0
  31. package/build/js/Services/Devices/Device.js +130 -0
  32. package/build/js/Services/Devices/Device.js.map +1 -0
  33. package/build/js/Services/Devices/DevicesService.d.ts +23 -0
  34. package/build/js/Services/Devices/DevicesService.js +47 -0
  35. package/build/js/Services/Devices/DevicesService.js.map +1 -0
  36. package/build/js/Services/Devices/IDevice.d.ts +53 -0
  37. package/build/js/Services/Devices/IDevice.js +33 -0
  38. package/build/js/Services/Devices/IDevice.js.map +1 -0
  39. package/build/js/Services/Devices/IDeviceChannel.d.ts +28 -0
  40. package/build/js/Services/Devices/IDeviceChannel.js +9 -0
  41. package/build/js/Services/Devices/IDeviceChannel.js.map +1 -0
  42. package/build/js/Services/Devices/IDeviceState.d.ts +3 -0
  43. package/build/js/Services/Devices/IDeviceState.js +2 -0
  44. package/build/js/Services/Devices/IDeviceState.js.map +1 -0
  45. package/build/js/Services/Devices/IDeviceTask.d.ts +8 -0
  46. package/build/js/Services/Devices/IDeviceTask.js +2 -0
  47. package/build/js/Services/Devices/IDeviceTask.js.map +1 -0
  48. package/build/js/Services/Devices/IDevicesService.d.ts +16 -0
  49. package/build/js/Services/Devices/IDevicesService.js +2 -0
  50. package/build/js/Services/Devices/IDevicesService.js.map +1 -0
  51. package/build/js/Services/Devices/TaskExecutionResult.d.ts +8 -0
  52. package/build/js/Services/Devices/TaskExecutionResult.js +10 -0
  53. package/build/js/Services/Devices/TaskExecutionResult.js.map +1 -0
  54. package/build/js/Services/FieldChangeResult.d.ts +17 -0
  55. package/build/js/Services/FieldChangeResult.js +39 -0
  56. package/build/js/Services/FieldChangeResult.js.map +1 -0
  57. package/build/js/Services/ILocalStorageService.d.ts +15 -0
  58. package/build/js/Services/ILocalStorageService.js +2 -0
  59. package/build/js/Services/ILocalStorageService.js.map +1 -0
  60. package/build/js/Services/LocalStorageService.d.ts +9 -0
  61. package/build/js/Services/LocalStorageService.js +33 -0
  62. package/build/js/Services/LocalStorageService.js.map +1 -0
  63. package/build/js/Services/Logging/ILoggerService.d.ts +29 -0
  64. package/build/js/Services/Logging/ILoggerService.js +8 -0
  65. package/build/js/Services/Logging/ILoggerService.js.map +1 -0
  66. package/build/js/Services/Logging/LoggerService.d.ts +21 -0
  67. package/build/js/Services/Logging/LoggerService.js +88 -0
  68. package/build/js/Services/Logging/LoggerService.js.map +1 -0
  69. package/build/js/Services/Session/ISessionService.d.ts +10 -0
  70. package/build/js/Services/Session/ISessionService.js +2 -0
  71. package/build/js/Services/Session/ISessionService.js.map +1 -0
  72. package/build/js/Services/Session/SessionService.d.ts +15 -0
  73. package/build/js/Services/Session/SessionService.js +35 -0
  74. package/build/js/Services/Session/SessionService.js.map +1 -0
  75. package/build/js/Services/Users/IUser.d.ts +33 -0
  76. package/build/js/Services/Users/IUser.js +22 -0
  77. package/build/js/Services/Users/IUser.js.map +1 -0
  78. package/build/js/Services/Users/IUsersService.d.ts +9 -0
  79. package/build/js/Services/Users/IUsersService.js +2 -0
  80. package/build/js/Services/Users/IUsersService.js.map +1 -0
  81. package/build/js/Services/Users/User.d.ts +42 -0
  82. package/build/js/Services/Users/User.js +151 -0
  83. package/build/js/Services/Users/User.js.map +1 -0
  84. package/build/js/Services/Users/UsersService.d.ts +10 -0
  85. package/build/js/Services/Users/UsersService.js +36 -0
  86. package/build/js/Services/Users/UsersService.js.map +1 -0
  87. package/build/js/Services/WebApi/IWebApiCacheService.d.ts +8 -0
  88. package/build/js/Services/WebApi/IWebApiCacheService.js +2 -0
  89. package/build/js/Services/WebApi/IWebApiCacheService.js.map +1 -0
  90. package/build/js/Services/WebApi/WebApiCacheService.d.ts +13 -0
  91. package/build/js/Services/WebApi/WebApiCacheService.js +39 -0
  92. package/build/js/Services/WebApi/WebApiCacheService.js.map +1 -0
  93. package/build/js/TypedEvent.d.ts +19 -0
  94. package/build/js/TypedEvent.js +28 -0
  95. package/build/js/TypedEvent.js.map +1 -0
  96. package/build/tsconfig.tsbuildinfo +1 -0
  97. package/package.json +37 -0
@@ -0,0 +1,15 @@
1
+ import { IDIService } from "./IDIService";
2
+ import { CancelationTokenSource } from './CancelationTokenSource';
3
+ export declare class Api {
4
+ static Version: number;
5
+ static Init(): void;
6
+ static GetAsync<T extends IDIService>(classType: {
7
+ new (...params: any[]): T;
8
+ }, cancelationToken?: CancelationTokenSource): Promise<T>;
9
+ static GetWithTimeoutAsync<T extends IDIService>(classType: {
10
+ new (...params: any[]): T;
11
+ }, timeout: number): Promise<T>;
12
+ static Get<T extends IDIService>(classType: {
13
+ new (...params: any[]): T;
14
+ }): T;
15
+ }
@@ -0,0 +1,35 @@
1
+ import { DependencyContainer } from "./DependencyContainer";
2
+ import { LoggerService } from './Services/Logging/LoggerService';
3
+ import { nameof } from "ts-simple-nameof";
4
+ import { LocalStorageService } from "./Services/LocalStorageService";
5
+ import { ExalusConnectionService } from './ExalusConnectionService';
6
+ import { WebApiCacheService } from "./Services/WebApi/WebApiCacheService";
7
+ import { UsersService } from "./Services/Users/UsersService";
8
+ import { DevicesService } from "./Services/Devices/DevicesService";
9
+ var Api = (function () {
10
+ function Api() {
11
+ }
12
+ Api.Init = function () {
13
+ DependencyContainer.Instance.RegisterService(new LocalStorageService());
14
+ DependencyContainer.Instance.RegisterService(new WebApiCacheService());
15
+ DependencyContainer.Instance.RegisterService(new ExalusConnectionService());
16
+ DependencyContainer.Instance.RegisterService(new UsersService());
17
+ DependencyContainer.Instance.RegisterService(new DevicesService());
18
+ };
19
+ Api.GetAsync = function (classType, cancelationToken) {
20
+ DependencyContainer.Instance.GetService(LoggerService).Log(Api, "[DI] [API] Get<".concat(nameof(classType), ">"));
21
+ return DependencyContainer.Instance.GetServiceAsync(classType, cancelationToken);
22
+ };
23
+ Api.GetWithTimeoutAsync = function (classType, timeout) {
24
+ DependencyContainer.Instance.GetService(LoggerService).Log(Api, "[DI] [API] Get<".concat(nameof(classType), ">"));
25
+ return DependencyContainer.Instance.GetServiceWithTimeoutAsync(classType, timeout);
26
+ };
27
+ Api.Get = function (classType) {
28
+ DependencyContainer.Instance.GetService(LoggerService).Log(Api, "[DI] [API] Get<".concat(nameof(classType), ">"));
29
+ return DependencyContainer.Instance.GetService(classType);
30
+ };
31
+ Api.Version = 1.0;
32
+ return Api;
33
+ }());
34
+ export { Api };
35
+ //# sourceMappingURL=Api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Api.js","sourceRoot":"","sources":["../../src/Api.ts"],"names":[],"mappings":"AAAA,O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AiB,aAAa,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAkB,MAAM,CAAC,SAAS,CAAC,MAAG,CAAC,CAAC;QACxH,OAAO,mBAAmB,CAAC,QAAQ,CAAC,0BAA0B,CAAI,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;IAEM,OAAG,GAAV,UAAiC,SAAwC;QACrE,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAkB,MAAM,CAAC,SAAS,CAAC,MAAG,CAAC,CAAC;QACxH,OAAO,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAI,SAAS,CAAC,CAAC;IACjE,CAAC;IAxBM,WAAO,GAAW,GAAG,CAAC;IAyBjC,UAAC;CAAA,AA1BD,IA0BC;SA1BY,GAAG"}
@@ -0,0 +1,8 @@
1
+ import { ITypedEvent } from './TypedEvent';
2
+ export declare class CancelationTokenSource {
3
+ private _canceled;
4
+ private _cancellationRequested;
5
+ readonly CancellationEvent: ITypedEvent<void>;
6
+ Cancel(): void;
7
+ get IsCancelled(): boolean;
8
+ }
@@ -0,0 +1,25 @@
1
+ import { TypedEvent } from './TypedEvent';
2
+ var CancelationTokenSource = (function () {
3
+ function CancelationTokenSource() {
4
+ this._canceled = false;
5
+ this._cancellationRequested = false;
6
+ this.CancellationEvent = new TypedEvent();
7
+ }
8
+ CancelationTokenSource.prototype.Cancel = function () {
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
+ Object.defineProperty(CancelationTokenSource.prototype, "IsCancelled", {
16
+ get: function () {
17
+ return this._canceled;
18
+ },
19
+ enumerable: false,
20
+ configurable: true
21
+ });
22
+ return CancelationTokenSource;
23
+ }());
24
+ export { CancelationTokenSource };
25
+ //# sourceMappingURL=CancelationTokenSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CancelationTokenSource.js","sourceRoot":"","sources":["../../src/CancelationTokenSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;AAEvD;IAAA;QACY,cAAS,GAAY,KAAK,CAAC;QAC3B,2BAAsB,GAAY,KAAK,CAAC;QAChC,sBAAiB,GAAsB,IAAI,UAAU,EAAQ,CAAC;IAclF,CAAC;IAZU,uCAAM,GAAb;QACI,IAAI,IAAI,CAAC,sBAAsB;YAC3B,MAAM,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAE3D,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,iBAAsC,CAAC,MAAM,EAAE,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,sBAAW,+CAAW;aAAtB;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,6BAAC;AAAD,CAAC,AAjBD,IAiBC"}
@@ -0,0 +1,41 @@
1
+ export interface IDataFrame<T> {
2
+ Resource?: string;
3
+ TransactionId?: string;
4
+ Data?: T;
5
+ Status?: Status;
6
+ Method?: Method;
7
+ }
8
+ export declare class DataFrame<T> implements IDataFrame<T> {
9
+ Resource?: string;
10
+ TransactionId?: string;
11
+ Data?: T;
12
+ Status?: Status;
13
+ Method?: Method;
14
+ }
15
+ export declare enum Status {
16
+ OK = 0,
17
+ UnknownError = 1,
18
+ FatalError = 2,
19
+ WrongData = 3,
20
+ ResourceDoesNotExists = 4,
21
+ NoPermissionToPerformThisOperation = 5,
22
+ SessionHasAlreadyLoggedOnUser = 6,
23
+ OperationNotPermitted = 7,
24
+ NoPermissionsToCallGivenResource = 8,
25
+ ResourceIsNotAvailable = 9,
26
+ Error = 10,
27
+ NoData = 11,
28
+ NotSupportedMethod = 12,
29
+ UserIsNotLoggedIn = 13,
30
+ MultiDataResponseStart = 14,
31
+ MultiDataResponse = 15,
32
+ MultiDataResponseStop = 16
33
+ }
34
+ export declare enum Method {
35
+ Get = 0,
36
+ Post = 1,
37
+ Delete = 2,
38
+ Put = 3,
39
+ Options = 4,
40
+ Head = 5
41
+ }
@@ -0,0 +1,38 @@
1
+ import { Helpers } from "./Helpers";
2
+ var DataFrame = (function () {
3
+ function DataFrame() {
4
+ this.TransactionId = Helpers.GenerateUUID();
5
+ }
6
+ return DataFrame;
7
+ }());
8
+ export { DataFrame };
9
+ export var Status;
10
+ (function (Status) {
11
+ Status[Status["OK"] = 0] = "OK";
12
+ Status[Status["UnknownError"] = 1] = "UnknownError";
13
+ Status[Status["FatalError"] = 2] = "FatalError";
14
+ Status[Status["WrongData"] = 3] = "WrongData";
15
+ Status[Status["ResourceDoesNotExists"] = 4] = "ResourceDoesNotExists";
16
+ Status[Status["NoPermissionToPerformThisOperation"] = 5] = "NoPermissionToPerformThisOperation";
17
+ Status[Status["SessionHasAlreadyLoggedOnUser"] = 6] = "SessionHasAlreadyLoggedOnUser";
18
+ Status[Status["OperationNotPermitted"] = 7] = "OperationNotPermitted";
19
+ Status[Status["NoPermissionsToCallGivenResource"] = 8] = "NoPermissionsToCallGivenResource";
20
+ Status[Status["ResourceIsNotAvailable"] = 9] = "ResourceIsNotAvailable";
21
+ Status[Status["Error"] = 10] = "Error";
22
+ Status[Status["NoData"] = 11] = "NoData";
23
+ Status[Status["NotSupportedMethod"] = 12] = "NotSupportedMethod";
24
+ Status[Status["UserIsNotLoggedIn"] = 13] = "UserIsNotLoggedIn";
25
+ Status[Status["MultiDataResponseStart"] = 14] = "MultiDataResponseStart";
26
+ Status[Status["MultiDataResponse"] = 15] = "MultiDataResponse";
27
+ Status[Status["MultiDataResponseStop"] = 16] = "MultiDataResponseStop";
28
+ })(Status || (Status = {}));
29
+ export var Method;
30
+ (function (Method) {
31
+ Method[Method["Get"] = 0] = "Get";
32
+ Method[Method["Post"] = 1] = "Post";
33
+ Method[Method["Delete"] = 2] = "Delete";
34
+ Method[Method["Put"] = 3] = "Put";
35
+ Method[Method["Options"] = 4] = "Options";
36
+ Method[Method["Head"] = 5] = "Head";
37
+ })(Method || (Method = {}));
38
+ //# sourceMappingURL=DataFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataFrame.js","sourceRoot":"","sources":["../../src/DataFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC;IAAA;QAGI,kBAAa,GAAY,OAAO,CAAC,YAAY,EAAE,CAAC;IAIpD,CAAC;IAAD,gBAAC;AAAD,CAAC,AAPD,IAOC;;AAED,MAAM,CAAN,IAAY,MAmFX;AAnFD,WAAY,MAAM;IAKd,+BAAM,CAAA;IAKN,mDAAgB,CAAA;IAKhB,+CAAc,CAAA;IAKd,6CAAa,CAAA;IAKb,qEAAyB,CAAA;IAKzB,+FAAsC,CAAA;IAKtC,qFAAiC,CAAA;IAKjC,qEAAyB,CAAA;IAKzB,2FAAoC,CAAA;IAKpC,uEAA0B,CAAA;IAK1B,sCAAU,CAAA;IAKV,wCAAW,CAAA;IAKX,gEAAuB,CAAA;IAKvB,8DAAsB,CAAA;IAItB,wEAA2B,CAAA;IAI3B,8DAAsB,CAAA;IAItB,sEAA0B,CAAA;AAC9B,CAAC,EAnFW,MAAM,KAAN,MAAM,QAmFjB;AAGD,MAAM,CAAN,IAAY,MAQX;AARD,WAAY,MAAM;IAEd,iCAAO,CAAA;IACP,mCAAQ,CAAA;IACR,uCAAU,CAAA;IACV,iCAAO,CAAA;IACP,yCAAW,CAAA;IACX,mCAAQ,CAAA;AACZ,CAAC,EARW,MAAM,KAAN,MAAM,QAQjB"}
@@ -0,0 +1,19 @@
1
+ import { IDIService } from "./IDIService";
2
+ import { CancelationTokenSource } from './CancelationTokenSource';
3
+ export declare class DependencyContainer {
4
+ private static _instance;
5
+ private _services;
6
+ private _serviceRegistrationEvent;
7
+ private static _log?;
8
+ static get Instance(): DependencyContainer;
9
+ RegisterService(service: IDIService): void;
10
+ GetService<T extends IDIService>(classType: {
11
+ new (...params: any[]): T;
12
+ }): T;
13
+ GetServiceAsync<T extends IDIService>(classType: {
14
+ new (...params: any[]): T;
15
+ }, token?: CancelationTokenSource): Promise<T>;
16
+ GetServiceWithTimeoutAsync<T extends IDIService>(classType: {
17
+ new (...params: any[]): T;
18
+ }, timeout: number): Promise<T>;
19
+ }
@@ -0,0 +1,83 @@
1
+ import { nameof } from 'ts-simple-nameof';
2
+ import { TypedEvent } from './TypedEvent';
3
+ import { LoggerService } from './Services/Logging/LoggerService';
4
+ var DependencyContainer = (function () {
5
+ function DependencyContainer() {
6
+ this._services = {};
7
+ this._serviceRegistrationEvent = new TypedEvent();
8
+ }
9
+ Object.defineProperty(DependencyContainer, "Instance", {
10
+ get: function () {
11
+ if (!DependencyContainer._instance)
12
+ DependencyContainer._instance = new DependencyContainer();
13
+ this._log = new LoggerService();
14
+ DependencyContainer._instance.RegisterService(this._log);
15
+ return DependencyContainer._instance;
16
+ },
17
+ enumerable: false,
18
+ configurable: true
19
+ });
20
+ DependencyContainer.prototype.RegisterService = function (service) {
21
+ var _a;
22
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Registering new service: ".concat(service.GetServiceName()));
23
+ this._services[service.GetServiceName()] = service;
24
+ };
25
+ DependencyContainer.prototype.GetService = function (classType) {
26
+ var _a;
27
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Getting service for GetService<".concat(nameof(classType), ">"));
28
+ return this._services[nameof(classType)];
29
+ };
30
+ DependencyContainer.prototype.GetServiceAsync = function (classType, token) {
31
+ var _this = this;
32
+ var _a;
33
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Waiting for service availability for GetServiceAsync<".concat(nameof(classType), ">"));
34
+ return new Promise(function (resolve, reject) {
35
+ var sub = function (service) {
36
+ var _a;
37
+ if ((service === null || service === void 0 ? void 0 : service.GetServiceName()) === nameof(classType)) {
38
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Got service for GetServiceAsync<".concat(nameof(classType), ">"));
39
+ _this._serviceRegistrationEvent.Unsubscribe(sub);
40
+ resolve(service);
41
+ }
42
+ };
43
+ var onCancel = function () {
44
+ var _a;
45
+ _this._serviceRegistrationEvent.Unsubscribe(sub);
46
+ token === null || token === void 0 ? void 0 : token.CancellationEvent.Unsubscribe(onCancel);
47
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Cancelled service retrieval for GetServiceAsync<".concat(nameof(classType), ">"));
48
+ reject(new Error("Operation cancelled!"));
49
+ };
50
+ token === null || token === void 0 ? void 0 : token.CancellationEvent.Subscribe(onCancel);
51
+ _this._serviceRegistrationEvent.Subscribe(sub);
52
+ });
53
+ };
54
+ DependencyContainer.prototype.GetServiceWithTimeoutAsync = function (classType, timeout) {
55
+ var _this = this;
56
+ var _a;
57
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Waiting for service availability for GetServiceWithTimeoutAsync<".concat(nameof(classType), ">"));
58
+ return new Promise(function (resolve, reject) {
59
+ var timeoutId = 0;
60
+ var sub = function (service) {
61
+ var _a;
62
+ if ((service === null || service === void 0 ? void 0 : service.GetClassName()) === nameof(classType)) {
63
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Debug(DependencyContainer, "[DI] Got service for GetServiceWithTimeoutAsync<".concat(nameof(classType), ">"));
64
+ window.clearTimeout(timeoutId);
65
+ _this._serviceRegistrationEvent.Unsubscribe(sub);
66
+ resolve(service);
67
+ }
68
+ };
69
+ var onTimeout = function () {
70
+ var _a;
71
+ window.clearTimeout(timeoutId);
72
+ _this._serviceRegistrationEvent.Unsubscribe(sub);
73
+ (_a = DependencyContainer._log) === null || _a === void 0 ? void 0 : _a.Error(DependencyContainer, "[DI] Failed to get service in time for GetServiceWithTimeoutAsync<".concat(nameof(classType), ">"));
74
+ reject(new Error("Operation cancelled!"));
75
+ };
76
+ timeoutId = window.setTimeout(onTimeout, timeout);
77
+ _this._serviceRegistrationEvent.Subscribe(sub);
78
+ });
79
+ };
80
+ return DependencyContainer;
81
+ }());
82
+ export { DependencyContainer };
83
+ //# sourceMappingURL=DependencyContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependencyContainer.js","sourceRoot":"","sources":["../../src/DependencyContainer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE;IAAA;QAEY,cAAS,GAAkC,EAAE,CAAC;QAC9C,8BAAyB,GAA4B,IAAI,UAAU,EAAc,CAAC;IAsE9F,CAAC;IAnEG,sBAAkB,+BAAQ;aAA1B;YACI,IAAI,CAAC,mBAAmB,CAAC,SAAS;gBAC9B,mBAAmB,CAAC,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC;YAE1D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAa,EAAE,CAAC;YACpC,mBAAmB,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,OAAO,mBAAmB,CAAC,SAAS,CAAC;QACzC,CAAC;;;OAAA;IAEM,6CAAe,GAAtB,UAAuB,OAAmB;;QACtC,MAAA,mBAAmB,CAAC,IAAI,0CAAE,KAAK,CAAC,mBAAmB,EAAE,wCAAiC,OAAO,CAAC,cAAc,EAAE,CAAE,CAAC,CAAC;QAClH,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,GAAG,OAAO,CAAC;IACvD,CAAC;IAEM,wCAAU,GAAjB,UAAwC,SAAwC;;QAC5E,MAAA,mBAAmB,CAAC,IAAI,0CAAE,KAAK,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,CAAC,CAAC;YAClD,KAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC;IACL,0BAAC;AAAD,CAAC,AAzED,IAyEC"}
@@ -0,0 +1,19 @@
1
+ export interface IEvent {
2
+ Subscribe(handler: {
3
+ (): void;
4
+ }): void;
5
+ Unsubscribe(handler: {
6
+ (): void;
7
+ }): void;
8
+ }
9
+ export declare class Event implements IEvent {
10
+ private _log;
11
+ private handlers;
12
+ Subscribe(handler: {
13
+ (): void;
14
+ }): void;
15
+ Unsubscribe(handler: {
16
+ (): void;
17
+ }): void;
18
+ Invoke(): void;
19
+ }
@@ -0,0 +1,28 @@
1
+ import { Api } from './Api';
2
+ import { LoggerService } from './Services/Logging/LoggerService';
3
+ var Event = (function () {
4
+ function Event() {
5
+ this._log = Api.Get(LoggerService);
6
+ this.handlers = [];
7
+ }
8
+ Event.prototype.Subscribe = function (handler) {
9
+ this.handlers.push(handler);
10
+ };
11
+ Event.prototype.Unsubscribe = function (handler) {
12
+ this.handlers = this.handlers.filter(function (h) { return h !== handler; });
13
+ };
14
+ Event.prototype.Invoke = function () {
15
+ var _this = this;
16
+ this.handlers.slice(0).forEach(function (h) {
17
+ try {
18
+ h();
19
+ }
20
+ catch (ex) {
21
+ _this._log.Error(ex);
22
+ }
23
+ });
24
+ };
25
+ return Event;
26
+ }());
27
+ export { Event };
28
+ //# sourceMappingURL=Event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/Event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAOjE;IAAA;QACY,SAAI,GAAmB,GAAG,CAAC,GAAG,CAAiB,aAAa,CAAC,CAAC;QAE9D,aAAQ,GAAoB,EAAE,CAAC;IAoB3C,CAAC;IAlBU,yBAAS,GAAhB,UAAiB,OAAqB;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAEM,2BAAW,GAAlB,UAAmB,OAAqB;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,OAAO,EAAb,CAAa,CAAC,CAAC;IAC7D,CAAC;IAEM,sBAAM,GAAb;QAAA,iBASC;QARG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC;YAC5B,IAAI;gBACA,CAAC,EAAE,CAAC;aACP;YACD,OAAO,EAAO,EAAE;gBACZ,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACvB;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IACL,YAAC;AAAD,CAAC,AAvBD,IAuBC"}
@@ -0,0 +1,35 @@
1
+ import { IDataFrame } from "./DataFrame";
2
+ import { ConnectionResult, IExalusConnectionService, AuthorizationInfo, ConnectionState } from "./IExalusConnector";
3
+ import { ITypedEvent } from "./TypedEvent";
4
+ export declare class ExalusConnectionService implements IExalusConnectionService {
5
+ private _connection?;
6
+ private _defaultPacketsBrokerAddress?;
7
+ private _serversBrokerAddress?;
8
+ private _address?;
9
+ private _serialId?;
10
+ private _PIN?;
11
+ private readonly _timeout;
12
+ private _dataReceivedEvent;
13
+ private _pongReceivedEvent;
14
+ private _authorizationReceivedEvent;
15
+ private _registrationReceivedEvent;
16
+ private _connectionStateChangedEvent;
17
+ private _errorOccuredEvent;
18
+ private _log;
19
+ private InitializeConnection;
20
+ GetServiceName(): string;
21
+ SetServersBrokerAddress(address: string): void;
22
+ SetDefaultPacketsBrokerAddress(address: string): void;
23
+ GetServerAddressAsync(): Promise<[IsAddressKnown: boolean, ServerUri: string]>;
24
+ ConnectAsync(address: string): Promise<ConnectionResult>;
25
+ AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean>;
26
+ ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult>;
27
+ private connectAsync;
28
+ DisconnectAsync(): Promise<void>;
29
+ IsConnected(): boolean;
30
+ SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean): Promise<IDataFrame<T>>;
31
+ SendAsync(dataFrame: IDataFrame<any>): Promise<boolean>;
32
+ OnDataReceivedEvent(): ITypedEvent<any>;
33
+ OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState>;
34
+ OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]>;
35
+ }