@ricado/api-client 2.1.1 → 2.3.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.
- package/dist/ricado.api.client.js +1 -1
- package/lib/Controllers/Packhouse/Site/BinTipBinController.js +622 -0
- package/lib/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/lib/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +657 -0
- package/lib/Controllers/Packhouse/Site/PackingLineController.js +29 -1
- package/lib/Controllers/Packhouse/Site/PackrunController.js +42 -0
- package/lib/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/lib/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +661 -0
- package/lib/Controllers/Packhouse/Site/ShiftTaskController.js +628 -0
- package/lib/Controllers/Packhouse/Site/index.js +12 -0
- package/lib/DataItems/PointValueItem.js +3 -3
- package/lib/Models/AccountPolicyModel.js +7 -7
- package/lib/Models/ApiAccountModel.js +7 -7
- package/lib/Models/CompanyModel.js +5 -5
- package/lib/Models/FirebaseTokenModel.js +8 -8
- package/lib/Models/Packhouse/Site/BinTipBinModel.js +367 -0
- package/lib/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/lib/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/lib/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/lib/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/lib/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/lib/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/lib/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +481 -0
- package/lib/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/lib/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/lib/Models/Packhouse/Site/PackingLineModel.js +583 -16
- package/lib/Models/Packhouse/Site/PackrunModel.js +81 -15
- package/lib/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/lib/Models/Packhouse/Site/RejectBinScaleModel.js +23 -23
- package/lib/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/lib/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/lib/Models/Packhouse/Site/ShiftHourlyEntryModel.js +204 -38
- package/lib/Models/Packhouse/Site/ShiftModel.js +26 -19
- package/lib/Models/Packhouse/Site/ShiftQualitySummaryModel.js +599 -0
- package/lib/Models/Packhouse/Site/ShiftTaskModel.js +373 -0
- package/lib/Models/Packhouse/Site/SoftSortBeltModel.js +7 -7
- package/lib/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/lib/Models/Packhouse/Site/index.js +12 -0
- package/lib/Models/RTUModel.js +6 -6
- package/lib/Models/RTUPluginModel.js +5 -5
- package/lib/Models/Site/AlarmGroupModel.js +7 -7
- package/lib/Models/Site/AlarmModel.js +17 -17
- package/lib/Models/Site/DefinitionModel.js +6 -6
- package/lib/Models/Site/PermanentObjectDataModel.js +8 -8
- package/lib/Models/Site/PermanentObjectModel.js +7 -7
- package/lib/Models/Site/PointModel.js +11 -11
- package/lib/Models/Site/TemporaryObjectModel.js +6 -6
- package/lib/Models/SiteModel.js +6 -6
- package/lib/Models/TokenModel.js +10 -10
- package/lib/Models/UserAccountActionTokenModel.js +11 -11
- package/lib/Models/UserAccountModel.js +10 -10
- package/lib/PackageVersion.js +1 -1
- package/lib/Points.js +22 -12
- package/lib/WebSocketHelper.js +29 -13
- package/lib/index.d.ts +2473 -348
- package/lib/index.js +3 -3
- package/package.json +1 -1
- package/src/Controllers/Packhouse/Site/BinTipBinController.js +665 -0
- package/src/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/src/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +700 -0
- package/src/Controllers/Packhouse/Site/PackingLineController.js +29 -1
- package/src/Controllers/Packhouse/Site/PackrunController.js +52 -0
- package/src/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/src/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +704 -0
- package/src/Controllers/Packhouse/Site/ShiftTaskController.js +671 -0
- package/src/Controllers/Packhouse/Site/index.js +8 -0
- package/src/DataItems/PointValueItem.js +3 -3
- package/src/Models/AccountPolicyModel.js +7 -7
- package/src/Models/ApiAccountModel.js +7 -7
- package/src/Models/CompanyModel.js +5 -5
- package/src/Models/FirebaseTokenModel.js +8 -8
- package/src/Models/Packhouse/Site/BinTipBinModel.js +365 -0
- package/src/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/src/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/src/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/src/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/src/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/src/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/src/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +523 -0
- package/src/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/src/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/src/Models/Packhouse/Site/PackingLineModel.js +770 -16
- package/src/Models/Packhouse/Site/PackrunModel.js +90 -15
- package/src/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/src/Models/Packhouse/Site/RejectBinScaleModel.js +23 -23
- package/src/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/src/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/src/Models/Packhouse/Site/ShiftHourlyEntryModel.js +229 -38
- package/src/Models/Packhouse/Site/ShiftModel.js +29 -19
- package/src/Models/Packhouse/Site/ShiftQualitySummaryModel.js +664 -0
- package/src/Models/Packhouse/Site/ShiftTaskModel.js +369 -0
- package/src/Models/Packhouse/Site/SoftSortBeltModel.js +7 -7
- package/src/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/src/Models/Packhouse/Site/index.js +8 -0
- package/src/Models/RTUModel.js +6 -6
- package/src/Models/RTUPluginModel.js +5 -5
- package/src/Models/Site/AlarmGroupModel.js +7 -7
- package/src/Models/Site/AlarmModel.js +17 -17
- package/src/Models/Site/DefinitionModel.js +6 -6
- package/src/Models/Site/PermanentObjectDataModel.js +8 -8
- package/src/Models/Site/PermanentObjectModel.js +7 -7
- package/src/Models/Site/PointModel.js +11 -11
- package/src/Models/Site/TemporaryObjectModel.js +6 -6
- package/src/Models/SiteModel.js +6 -6
- package/src/Models/TokenModel.js +10 -10
- package/src/Models/UserAccountActionTokenModel.js +11 -11
- package/src/Models/UserAccountModel.js +10 -10
- package/src/PackageVersion.js +1 -1
- package/src/Points.js +24 -12
- package/src/WebSocketHelper.js +34 -13
- package/src/index.js +3 -3
- package/types/tslint.json +2 -1
|
@@ -61,7 +61,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
_this.id =
|
|
64
|
+
_this.id = "";
|
|
65
65
|
/**
|
|
66
66
|
* The Account this Action Token belongs to
|
|
67
67
|
*
|
|
@@ -69,7 +69,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
69
69
|
* @public
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
_this.accountId =
|
|
72
|
+
_this.accountId = "";
|
|
73
73
|
/**
|
|
74
74
|
* The Company this Action Token belongs to
|
|
75
75
|
*
|
|
@@ -77,7 +77,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
-
_this.companyId =
|
|
80
|
+
_this.companyId = "";
|
|
81
81
|
/**
|
|
82
82
|
* The Action that can be Performed using this Action Token
|
|
83
83
|
*
|
|
@@ -85,7 +85,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
85
85
|
* @public
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
_this.action =
|
|
88
|
+
_this.action = "";
|
|
89
89
|
/**
|
|
90
90
|
* When the Action Token was issued
|
|
91
91
|
*
|
|
@@ -93,7 +93,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
93
93
|
* @public
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
_this.issueTimestamp =
|
|
96
|
+
_this.issueTimestamp = new Date();
|
|
97
97
|
/**
|
|
98
98
|
* When the Action Token will expire
|
|
99
99
|
*
|
|
@@ -101,7 +101,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
101
101
|
* @public
|
|
102
102
|
*/
|
|
103
103
|
|
|
104
|
-
_this.expireTimestamp =
|
|
104
|
+
_this.expireTimestamp = new Date();
|
|
105
105
|
/**
|
|
106
106
|
* When the last API call using this Action Token was made
|
|
107
107
|
*
|
|
@@ -109,7 +109,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
109
109
|
* @public
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
|
-
_this.activityTimestamp =
|
|
112
|
+
_this.activityTimestamp = null;
|
|
113
113
|
/**
|
|
114
114
|
* When the Action was Completed
|
|
115
115
|
*
|
|
@@ -117,7 +117,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
117
|
* @public
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
|
-
_this.completedTimestamp =
|
|
120
|
+
_this.completedTimestamp = null;
|
|
121
121
|
/**
|
|
122
122
|
* When the Action Email was Sent
|
|
123
123
|
*
|
|
@@ -125,7 +125,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
125
125
|
* @public
|
|
126
126
|
*/
|
|
127
127
|
|
|
128
|
-
_this.emailTimestamp =
|
|
128
|
+
_this.emailTimestamp = null;
|
|
129
129
|
/**
|
|
130
130
|
* Whether the User Account Action Token has been deleted
|
|
131
131
|
*
|
|
@@ -133,7 +133,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
133
133
|
* @public
|
|
134
134
|
*/
|
|
135
135
|
|
|
136
|
-
_this.deleted =
|
|
136
|
+
_this.deleted = false;
|
|
137
137
|
/**
|
|
138
138
|
* When the User Account Action Token was last updated
|
|
139
139
|
*
|
|
@@ -141,7 +141,7 @@ var UserAccountActionTokenModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
141
|
* @public
|
|
142
142
|
*/
|
|
143
143
|
|
|
144
|
-
_this.updateTimestamp =
|
|
144
|
+
_this.updateTimestamp = new Date();
|
|
145
145
|
return _this;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
@@ -61,7 +61,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
_this.id =
|
|
64
|
+
_this.id = "";
|
|
65
65
|
/**
|
|
66
66
|
* The User's Email Address
|
|
67
67
|
*
|
|
@@ -69,7 +69,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
69
69
|
* @public
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
_this.email =
|
|
72
|
+
_this.email = "";
|
|
73
73
|
/**
|
|
74
74
|
* The User's First Name
|
|
75
75
|
*
|
|
@@ -77,7 +77,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
-
_this.firstName =
|
|
80
|
+
_this.firstName = null;
|
|
81
81
|
/**
|
|
82
82
|
* The User's Last Name
|
|
83
83
|
*
|
|
@@ -85,7 +85,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
85
85
|
* @public
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
_this.lastName =
|
|
88
|
+
_this.lastName = null;
|
|
89
89
|
/**
|
|
90
90
|
* The Company this User belongs to
|
|
91
91
|
*
|
|
@@ -93,7 +93,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
93
93
|
* @public
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
_this.companyId =
|
|
96
|
+
_this.companyId = "";
|
|
97
97
|
/**
|
|
98
98
|
* The Policies that apply to this User Account
|
|
99
99
|
*
|
|
@@ -101,7 +101,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
101
101
|
* @public
|
|
102
102
|
*/
|
|
103
103
|
|
|
104
|
-
_this.policies =
|
|
104
|
+
_this.policies = [];
|
|
105
105
|
/**
|
|
106
106
|
* Whether a Password has been Set for the User Account
|
|
107
107
|
*
|
|
@@ -109,7 +109,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
109
109
|
* @public
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
|
-
_this.hasPassword =
|
|
112
|
+
_this.hasPassword = false;
|
|
113
113
|
/**
|
|
114
114
|
* Whether a Pin Code has been Set for the User Account
|
|
115
115
|
*
|
|
@@ -117,7 +117,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
117
|
* @public
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
|
-
_this.hasPinCode =
|
|
120
|
+
_this.hasPinCode = false;
|
|
121
121
|
/**
|
|
122
122
|
* Whether the User Account has been deleted
|
|
123
123
|
*
|
|
@@ -125,7 +125,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
125
125
|
* @public
|
|
126
126
|
*/
|
|
127
127
|
|
|
128
|
-
_this.deleted =
|
|
128
|
+
_this.deleted = false;
|
|
129
129
|
/**
|
|
130
130
|
* When the User Account was last updated
|
|
131
131
|
*
|
|
@@ -133,7 +133,7 @@ var UserAccountModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
133
133
|
* @public
|
|
134
134
|
*/
|
|
135
135
|
|
|
136
|
-
_this.updateTimestamp =
|
|
136
|
+
_this.updateTimestamp = new Date();
|
|
137
137
|
return _this;
|
|
138
138
|
}
|
|
139
139
|
/**
|
package/lib/PackageVersion.js
CHANGED
package/lib/Points.js
CHANGED
|
@@ -50,7 +50,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
50
50
|
* An EventEmitter Instance
|
|
51
51
|
*
|
|
52
52
|
* @private
|
|
53
|
-
* @type {EventEmitter}
|
|
53
|
+
* @type {EventEmitter|undefined}
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -101,7 +101,12 @@ var Points = /*#__PURE__*/function () {
|
|
|
101
101
|
Points._values = {};
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
_WebSocketHelper.default.on('readpoints',
|
|
104
|
+
_WebSocketHelper.default.on('readpoints',
|
|
105
|
+
/**
|
|
106
|
+
* @param {string} key
|
|
107
|
+
* @param {Array<{id: number, timestamp: string, value: any}>} readPoints
|
|
108
|
+
*/
|
|
109
|
+
function (key, readPoints) {
|
|
105
110
|
if ((0, _index.isDefined)(key) && key.includes('.') && readPoints.length > 0) {
|
|
106
111
|
var keyId = key.split('.')[1];
|
|
107
112
|
var siteId = undefined;
|
|
@@ -114,7 +119,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
114
119
|
siteId = _this.getDefaultSiteId();
|
|
115
120
|
}
|
|
116
121
|
|
|
117
|
-
if ((0, _index.isDefined)(siteId) && siteId > 0) {
|
|
122
|
+
if ((0, _index.isDefined)(siteId) && siteId !== undefined && siteId > 0) {
|
|
118
123
|
if (siteId in Points._values != true) {
|
|
119
124
|
Points._values[siteId] = {};
|
|
120
125
|
}
|
|
@@ -139,7 +144,9 @@ var Points = /*#__PURE__*/function () {
|
|
|
139
144
|
}
|
|
140
145
|
});
|
|
141
146
|
|
|
142
|
-
Points._emitter
|
|
147
|
+
if (Points._emitter !== undefined) {
|
|
148
|
+
Points._emitter.emit('readpoints', siteId, pointValueItems);
|
|
149
|
+
}
|
|
143
150
|
}
|
|
144
151
|
}
|
|
145
152
|
});
|
|
@@ -299,7 +306,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
299
306
|
}, {
|
|
300
307
|
key: "on",
|
|
301
308
|
value: function on(event, handler) {
|
|
302
|
-
if ((0, _index.isDefined)(Points._emitter) != true) {
|
|
309
|
+
if ((0, _index.isDefined)(Points._emitter) != true || Points._emitter === undefined) {
|
|
303
310
|
Points._emitter = new _events.EventEmitter();
|
|
304
311
|
}
|
|
305
312
|
|
|
@@ -317,7 +324,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
317
324
|
}, {
|
|
318
325
|
key: "off",
|
|
319
326
|
value: function off(event, handler) {
|
|
320
|
-
if ((0, _index.isDefined)(Points._emitter)) {
|
|
327
|
+
if ((0, _index.isDefined)(Points._emitter) && Points._emitter !== undefined) {
|
|
321
328
|
Points._emitter.off(event, handler);
|
|
322
329
|
}
|
|
323
330
|
}
|
|
@@ -410,16 +417,19 @@ var Points = /*#__PURE__*/function () {
|
|
|
410
417
|
return new Promise(function (resolve, reject) {
|
|
411
418
|
if (siteId <= 0) {
|
|
412
419
|
reject(new Error("Invalid Site ID `" + siteId + "`"));
|
|
420
|
+
return;
|
|
413
421
|
}
|
|
414
422
|
|
|
415
423
|
if (pointId <= 0) {
|
|
416
424
|
reject(new Error("Invalid Point ID `" + pointId + "`"));
|
|
425
|
+
return;
|
|
417
426
|
}
|
|
418
427
|
|
|
419
428
|
var pointDefinition = Points.getDefinition(siteId, pointId);
|
|
420
429
|
|
|
421
|
-
if ((0, _index.isDefined)(pointDefinition) != true || pointDefinition.id != pointId) {
|
|
430
|
+
if ((0, _index.isDefined)(pointDefinition) != true || pointDefinition === undefined || pointDefinition.id != pointId) {
|
|
422
431
|
reject(new Error("Unknown Point ID `" + pointId + "` for Site ID `" + siteId + "`"));
|
|
432
|
+
return;
|
|
423
433
|
}
|
|
424
434
|
|
|
425
435
|
_WebSocketHelper.default.emit('createWritePoint', siteId, pointId, value, pointDefinition.valueType, false, function (guid) {
|
|
@@ -492,7 +502,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
492
502
|
}
|
|
493
503
|
});
|
|
494
504
|
|
|
495
|
-
if (changedPoints.length > 0) {
|
|
505
|
+
if (changedPoints.length > 0 && Points._emitter !== undefined) {
|
|
496
506
|
Points._emitter.emit('readpoints', siteId, changedPoints);
|
|
497
507
|
}
|
|
498
508
|
|
|
@@ -531,7 +541,7 @@ var Points = /*#__PURE__*/function () {
|
|
|
531
541
|
* The Events Callback
|
|
532
542
|
*
|
|
533
543
|
* @callback Points.eventCallback
|
|
534
|
-
* @param {...any
|
|
544
|
+
* @param {...any} args - The Callback Arguments
|
|
535
545
|
* @return {void}
|
|
536
546
|
*/
|
|
537
547
|
|
|
@@ -558,11 +568,11 @@ _defineProperty(Points, "_initialized", false);
|
|
|
558
568
|
|
|
559
569
|
_defineProperty(Points, "_emitter", undefined);
|
|
560
570
|
|
|
561
|
-
_defineProperty(Points, "_subscriptions",
|
|
571
|
+
_defineProperty(Points, "_subscriptions", {});
|
|
562
572
|
|
|
563
|
-
_defineProperty(Points, "_definitions",
|
|
573
|
+
_defineProperty(Points, "_definitions", {});
|
|
564
574
|
|
|
565
|
-
_defineProperty(Points, "_values",
|
|
575
|
+
_defineProperty(Points, "_values", {});
|
|
566
576
|
|
|
567
577
|
var _default = Points;
|
|
568
578
|
exports.default = _default;
|
package/lib/WebSocketHelper.js
CHANGED
|
@@ -38,7 +38,7 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
38
38
|
* An Event Emitter Instance
|
|
39
39
|
*
|
|
40
40
|
* @private
|
|
41
|
-
* @type {EventEmitter}
|
|
41
|
+
* @type {EventEmitter|undefined}
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -52,7 +52,7 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
52
52
|
* The Socket.IO WebSocket Instance
|
|
53
53
|
*
|
|
54
54
|
* @private
|
|
55
|
-
* @type {SocketIOClient.Socket}
|
|
55
|
+
* @type {SocketIOClient.Socket|undefined}
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -91,6 +91,10 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
91
91
|
WebSocketHelper._socket.on('reconnect_attempt', function (attempt) {
|
|
92
92
|
// Fired every time we attempt to reconnect.
|
|
93
93
|
// `attempt` holds the count of attempts so far
|
|
94
|
+
if (WebSocketHelper._socket === undefined) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
WebSocketHelper._socket.io.opts.transports = ['websocket'];
|
|
95
99
|
WebSocketHelper._socket.io.opts.query = {
|
|
96
100
|
token: _index.JWT
|
|
@@ -104,7 +108,9 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
104
108
|
|
|
105
109
|
if ((0, _index.isDefined)(WebSocketHelper._subscriptions)) {
|
|
106
110
|
WebSocketHelper._subscriptions.forEach(function (subscription) {
|
|
107
|
-
WebSocketHelper._socket
|
|
111
|
+
if (WebSocketHelper._socket !== undefined) {
|
|
112
|
+
WebSocketHelper._socket.emit('subscribe', subscription);
|
|
113
|
+
}
|
|
108
114
|
});
|
|
109
115
|
}
|
|
110
116
|
});
|
|
@@ -122,7 +128,9 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
122
128
|
|
|
123
129
|
if (reason == 'io server disconnect') {
|
|
124
130
|
setTimeout(function () {
|
|
125
|
-
WebSocketHelper._socket
|
|
131
|
+
if (WebSocketHelper._socket !== undefined) {
|
|
132
|
+
WebSocketHelper._socket.connect();
|
|
133
|
+
}
|
|
126
134
|
}, 5000);
|
|
127
135
|
}
|
|
128
136
|
});
|
|
@@ -151,6 +159,10 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
151
159
|
WebSocketHelper._socket.on('*', function (event) {
|
|
152
160
|
var _WebSocketHelper$_emi;
|
|
153
161
|
|
|
162
|
+
if (WebSocketHelper._emitter === undefined) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
154
166
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
155
167
|
args[_key - 1] = arguments[_key];
|
|
156
168
|
}
|
|
@@ -201,14 +213,14 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
201
213
|
}, {
|
|
202
214
|
key: "subscribe",
|
|
203
215
|
value: function subscribe() {
|
|
204
|
-
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
216
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
205
217
|
|
|
206
218
|
// TODO: Re-Write as Async (Use a Promise) and set up an "Ack" callback so we know the WebSocket Server has Subscribed us
|
|
207
219
|
if ((0, _index.isDefined)(WebSocketHelper._subscriptions) != true) {
|
|
208
220
|
WebSocketHelper._subscriptions = [];
|
|
209
221
|
}
|
|
210
222
|
|
|
211
|
-
if ((0, _index.isDefined)(key) != true) {
|
|
223
|
+
if ((0, _index.isDefined)(key) != true || key === undefined) {
|
|
212
224
|
key = 'all';
|
|
213
225
|
}
|
|
214
226
|
|
|
@@ -216,7 +228,7 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
216
228
|
WebSocketHelper._subscriptions.push(key);
|
|
217
229
|
}
|
|
218
230
|
|
|
219
|
-
if ((0, _index.isDefined)(WebSocketHelper._socket)) {
|
|
231
|
+
if ((0, _index.isDefined)(WebSocketHelper._socket) && WebSocketHelper._socket !== undefined) {
|
|
220
232
|
WebSocketHelper._socket.emit('subscribe', key);
|
|
221
233
|
}
|
|
222
234
|
}
|
|
@@ -231,14 +243,14 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
231
243
|
}, {
|
|
232
244
|
key: "unsubscribe",
|
|
233
245
|
value: function unsubscribe() {
|
|
234
|
-
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
246
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
235
247
|
|
|
236
248
|
// TODO: Re-Write as Async (Use a Promise) and set up an "Ack" callback so we know the WebSocket Server has Unsubscribed us
|
|
237
249
|
if ((0, _index.isDefined)(WebSocketHelper._subscriptions) != true) {
|
|
238
250
|
WebSocketHelper._subscriptions = [];
|
|
239
251
|
}
|
|
240
252
|
|
|
241
|
-
if ((0, _index.isDefined)(key) != true) {
|
|
253
|
+
if ((0, _index.isDefined)(key) != true || key === undefined) {
|
|
242
254
|
key = 'all';
|
|
243
255
|
}
|
|
244
256
|
|
|
@@ -246,7 +258,7 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
246
258
|
WebSocketHelper._subscriptions.splice(WebSocketHelper._subscriptions.indexOf(key), 1);
|
|
247
259
|
}
|
|
248
260
|
|
|
249
|
-
if ((0, _index.isDefined)(WebSocketHelper._socket)) {
|
|
261
|
+
if ((0, _index.isDefined)(WebSocketHelper._socket) && WebSocketHelper._socket !== undefined) {
|
|
250
262
|
WebSocketHelper._socket.emit('unsubscribe', key);
|
|
251
263
|
}
|
|
252
264
|
}
|
|
@@ -262,7 +274,7 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
262
274
|
}, {
|
|
263
275
|
key: "on",
|
|
264
276
|
value: function on(event, handler) {
|
|
265
|
-
if ((0, _index.isDefined)(WebSocketHelper._emitter) != true) {
|
|
277
|
+
if ((0, _index.isDefined)(WebSocketHelper._emitter) != true || WebSocketHelper._emitter === undefined) {
|
|
266
278
|
WebSocketHelper._emitter = new _events.EventEmitter();
|
|
267
279
|
}
|
|
268
280
|
|
|
@@ -282,6 +294,10 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
282
294
|
value: function emit(event) {
|
|
283
295
|
var _WebSocketHelper$_soc;
|
|
284
296
|
|
|
297
|
+
if (WebSocketHelper._socket === undefined) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
285
301
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
286
302
|
args[_key2 - 1] = arguments[_key2];
|
|
287
303
|
}
|
|
@@ -296,14 +312,14 @@ var WebSocketHelper = /*#__PURE__*/function () {
|
|
|
296
312
|
* The Events Callback
|
|
297
313
|
*
|
|
298
314
|
* @callback WebSocketHelper.eventCallback
|
|
299
|
-
* @param {...any
|
|
315
|
+
* @param {...any} args - The Callback Arguments
|
|
300
316
|
* @return {void}
|
|
301
317
|
*/
|
|
302
318
|
|
|
303
319
|
|
|
304
320
|
_defineProperty(WebSocketHelper, "_emitter", undefined);
|
|
305
321
|
|
|
306
|
-
_defineProperty(WebSocketHelper, "_subscriptions",
|
|
322
|
+
_defineProperty(WebSocketHelper, "_subscriptions", []);
|
|
307
323
|
|
|
308
324
|
_defineProperty(WebSocketHelper, "_socket", undefined);
|
|
309
325
|
|