o2g-node-sdk 2.5.6 → 2.5.8
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/README.md +31 -1
- package/dist/o2g-node-sdk.js +59 -21
- package/dist/o2g-node-sdk.js.map +1 -1
- package/dist/types/o2g-node-sdk.d.ts +1 -0
- package/dist/types/o2g-node-sdk.d.ts.map +1 -1
- package/dist/types/types/users/user.d.ts +6 -0
- package/dist/types/types/users/user.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,32 @@ await O2G.telephony.makeCall("1234", "5678");
|
|
|
54
54
|
await O2G.shutdown();
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
## What's New in 2.5.8
|
|
58
|
+
|
|
59
|
+
### Service instance caching — fixes listeners silenced after recovery
|
|
60
|
+
|
|
61
|
+
Service getters (`O2G.eventSummary`, `O2G.telephony`, …) now return the **same
|
|
62
|
+
instance** for the lifetime of a session. Previously every call created a new
|
|
63
|
+
object, and because each constructor silently overwrites the shared `EventSink`
|
|
64
|
+
registration, any listener attached to an earlier instance would stop receiving
|
|
65
|
+
events — a particularly subtle failure after session recovery.
|
|
66
|
+
|
|
67
|
+
The instances are automatically invalidated on `O2G_SESSION_LOST` and
|
|
68
|
+
`O2G_RECONNECTED`, so the first access after recovery always binds to the new
|
|
69
|
+
session. Re-attach your listeners once in the `O2G_RECONNECTED` handler and they
|
|
70
|
+
will keep working across any number of recovery cycles.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
O2G.on(O2G.O2G_RECONNECTED, () => {
|
|
74
|
+
// Re-attach — O2G.eventSummary now returns a fresh instance
|
|
75
|
+
O2G.eventSummary.on(EventSummary.ON_EVENT_SUMMARY_UPDATED, onEventSummary);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## What's New in 2.5.7
|
|
80
|
+
|
|
81
|
+
- Add new field `emailAddress` in object `User`
|
|
82
|
+
|
|
57
83
|
## What's New in 2.5.6
|
|
58
84
|
|
|
59
85
|
- Fixed a syntax error in the `UserManagement` service that prevented compiling `createUsers`
|
|
@@ -244,6 +270,10 @@ O2G.on(O2G.O2G_SESSION_LOST, ({ reason }) => {
|
|
|
244
270
|
|
|
245
271
|
O2G.on(O2G.O2G_RECONNECTED, () => {
|
|
246
272
|
console.log("Session recovered — resuming activity.");
|
|
273
|
+
// Re-attach service listeners here: each service getter returns a fresh
|
|
274
|
+
// instance after recovery, so listeners registered before the outage must
|
|
275
|
+
// be re-registered (see "Service instance caching" in What's New 2.5.8).
|
|
276
|
+
O2G.eventSummary.on(EventSummary.ON_EVENT_SUMMARY_UPDATED, onEventSummary);
|
|
247
277
|
});
|
|
248
278
|
|
|
249
279
|
O2G.on(O2G.O2G_SERVER_SWITCHED, ({ from, to }) => {
|
|
@@ -535,7 +565,7 @@ This SDK follows the O2G API version it targets:
|
|
|
535
565
|
- **Minor**: O2G API patch version (currently 7.5 → 5)
|
|
536
566
|
- **Patch**: SDK release number
|
|
537
567
|
|
|
538
|
-
For example, `2.5.
|
|
568
|
+
For example, `2.5.0` targets O2G API version 2.7.5.
|
|
539
569
|
|
|
540
570
|
## License
|
|
541
571
|
|
package/dist/o2g-node-sdk.js
CHANGED
|
@@ -11420,6 +11420,34 @@ class O2G {
|
|
|
11420
11420
|
throw new Error('O2G has already been initialized.');
|
|
11421
11421
|
}
|
|
11422
11422
|
this._application = new o2g_application_1.default(appName, servers, apiVersion);
|
|
11423
|
+
// Service instances are cached per session (see getters below).
|
|
11424
|
+
// On O2G_SESSION_LOST the cache is cleared so stale references are dropped
|
|
11425
|
+
// immediately. On O2G_RECONNECTED the cache is cleared again so that the
|
|
11426
|
+
// first post-recovery access always creates a fresh instance bound to the
|
|
11427
|
+
// new Session — regardless of any transient access that may have occurred
|
|
11428
|
+
// during the outage. Both listeners are registered first so they run before
|
|
11429
|
+
// any application-level handlers (EventEmitter preserves registration order).
|
|
11430
|
+
this._application.on(o2g_application_1.O2G_SESSION_LOST, () => this._clearServiceCache());
|
|
11431
|
+
this._application.on(o2g_application_1.O2G_RECONNECTED, () => this._clearServiceCache());
|
|
11432
|
+
}
|
|
11433
|
+
static _clearServiceCache() {
|
|
11434
|
+
this._routing = null;
|
|
11435
|
+
this._eventSummary = null;
|
|
11436
|
+
this._users = null;
|
|
11437
|
+
this._usersManagement = null;
|
|
11438
|
+
this._telephony = null;
|
|
11439
|
+
this._directory = null;
|
|
11440
|
+
this._comlog = null;
|
|
11441
|
+
this._analytics = null;
|
|
11442
|
+
this._callCenterAgent = null;
|
|
11443
|
+
this._callCenterPilot = null;
|
|
11444
|
+
this._callCenterRealtime = null;
|
|
11445
|
+
this._callCenterStatistics = null;
|
|
11446
|
+
this._callCenterManagement = null;
|
|
11447
|
+
this._maintenance = null;
|
|
11448
|
+
this._pbxManagement = null;
|
|
11449
|
+
this._phoneSetProgramming = null;
|
|
11450
|
+
this._messaging = null;
|
|
11423
11451
|
}
|
|
11424
11452
|
/**
|
|
11425
11453
|
* Sets a custom {@link SessionMonitoringPolicy} to control how the SDK
|
|
@@ -11533,7 +11561,7 @@ class O2G {
|
|
|
11533
11561
|
static get routing() {
|
|
11534
11562
|
if (!this._application)
|
|
11535
11563
|
throw new Error('Routing service not available.');
|
|
11536
|
-
return this._application.getRoutingService();
|
|
11564
|
+
return this._routing ?? (this._routing = this._application.getRoutingService());
|
|
11537
11565
|
}
|
|
11538
11566
|
/**
|
|
11539
11567
|
* Returns the {@link EventSummary} service, which provides access to event summary counters.
|
|
@@ -11542,7 +11570,7 @@ class O2G {
|
|
|
11542
11570
|
static get eventSummary() {
|
|
11543
11571
|
if (!this._application)
|
|
11544
11572
|
throw new Error('EventSummary service not available.');
|
|
11545
|
-
return this._application.getEventSummaryService();
|
|
11573
|
+
return this._eventSummary ?? (this._eventSummary = this._application.getEventSummaryService());
|
|
11546
11574
|
}
|
|
11547
11575
|
/**
|
|
11548
11576
|
* Returns the {@link Users} service, which provides user profile and preference management.
|
|
@@ -11551,7 +11579,7 @@ class O2G {
|
|
|
11551
11579
|
static get users() {
|
|
11552
11580
|
if (!this._application)
|
|
11553
11581
|
throw new Error('Users service not available.');
|
|
11554
|
-
return this._application.getUsersService();
|
|
11582
|
+
return this._users ?? (this._users = this._application.getUsersService());
|
|
11555
11583
|
}
|
|
11556
11584
|
/**
|
|
11557
11585
|
* Returns the {@link UsersManagement} service, which provides administrator-level user management.
|
|
@@ -11560,7 +11588,7 @@ class O2G {
|
|
|
11560
11588
|
static get usersManagement() {
|
|
11561
11589
|
if (!this._application)
|
|
11562
11590
|
throw new Error('UsersManagement service not available.');
|
|
11563
|
-
return this._application.getUserManagementService();
|
|
11591
|
+
return this._usersManagement ?? (this._usersManagement = this._application.getUserManagementService());
|
|
11564
11592
|
}
|
|
11565
11593
|
/**
|
|
11566
11594
|
* Returns the {@link Telephony} service, which provides call control and telephony operations.
|
|
@@ -11569,7 +11597,7 @@ class O2G {
|
|
|
11569
11597
|
static get telephony() {
|
|
11570
11598
|
if (!this._application)
|
|
11571
11599
|
throw new Error('Telephony service not available.');
|
|
11572
|
-
return this._application.getTelephonyService();
|
|
11600
|
+
return this._telephony ?? (this._telephony = this._application.getTelephonyService());
|
|
11573
11601
|
}
|
|
11574
11602
|
/**
|
|
11575
11603
|
* Returns the {@link Directory} service, which provides enterprise directory search.
|
|
@@ -11578,7 +11606,7 @@ class O2G {
|
|
|
11578
11606
|
static get directory() {
|
|
11579
11607
|
if (!this._application)
|
|
11580
11608
|
throw new Error('Directory service not available.');
|
|
11581
|
-
return this._application.getDirectoryService();
|
|
11609
|
+
return this._directory ?? (this._directory = this._application.getDirectoryService());
|
|
11582
11610
|
}
|
|
11583
11611
|
/**
|
|
11584
11612
|
* Returns the {@link CommunicationLog} service, which provides access to communication history records.
|
|
@@ -11587,7 +11615,7 @@ class O2G {
|
|
|
11587
11615
|
static get comlog() {
|
|
11588
11616
|
if (!this._application)
|
|
11589
11617
|
throw new Error('CommunicationLog service not available.');
|
|
11590
|
-
return this._application.getCommunicationLogService();
|
|
11618
|
+
return this._comlog ?? (this._comlog = this._application.getCommunicationLogService());
|
|
11591
11619
|
}
|
|
11592
11620
|
/**
|
|
11593
11621
|
* Returns the {@link Analytics} service, which provides access to charging and incident data.
|
|
@@ -11596,7 +11624,7 @@ class O2G {
|
|
|
11596
11624
|
static get analytics() {
|
|
11597
11625
|
if (!this._application)
|
|
11598
11626
|
throw new Error('Analytics service not available.');
|
|
11599
|
-
return this._application.getAnalyticsService();
|
|
11627
|
+
return this._analytics ?? (this._analytics = this._application.getAnalyticsService());
|
|
11600
11628
|
}
|
|
11601
11629
|
/**
|
|
11602
11630
|
* Returns the {@link CallCenterAgent} service, which provides ACD agent state and skill management.
|
|
@@ -11605,7 +11633,7 @@ class O2G {
|
|
|
11605
11633
|
static get callCenterAgent() {
|
|
11606
11634
|
if (!this._application)
|
|
11607
11635
|
throw new Error('CallCenterAgent service not available.');
|
|
11608
|
-
return this._application.getCallCenterAgentService();
|
|
11636
|
+
return this._callCenterAgent ?? (this._callCenterAgent = this._application.getCallCenterAgentService());
|
|
11609
11637
|
}
|
|
11610
11638
|
/**
|
|
11611
11639
|
* Returns the {@link CallCenterPilot} service, which provides CCD pilot monitoring.
|
|
@@ -11614,7 +11642,7 @@ class O2G {
|
|
|
11614
11642
|
static get callCenterPilot() {
|
|
11615
11643
|
if (!this._application)
|
|
11616
11644
|
throw new Error('CallCenterPilot service not available.');
|
|
11617
|
-
return this._application.getCallCenterPilotService();
|
|
11645
|
+
return this._callCenterPilot ?? (this._callCenterPilot = this._application.getCallCenterPilotService());
|
|
11618
11646
|
}
|
|
11619
11647
|
/**
|
|
11620
11648
|
* Returns the {@link CallCenterRealtime} service, which provides real-time ACD statistics and RTI data.
|
|
@@ -11623,7 +11651,7 @@ class O2G {
|
|
|
11623
11651
|
static get callCenterRealtime() {
|
|
11624
11652
|
if (!this._application)
|
|
11625
11653
|
throw new Error('CallCenterRealtime service not available.');
|
|
11626
|
-
return this._application.getCallCenterRealtimeService();
|
|
11654
|
+
return this._callCenterRealtime ?? (this._callCenterRealtime = this._application.getCallCenterRealtimeService());
|
|
11627
11655
|
}
|
|
11628
11656
|
/**
|
|
11629
11657
|
* Returns the {@link CallCenterStatistics} service, which provides historical ACD statistics and reporting.
|
|
@@ -11632,7 +11660,7 @@ class O2G {
|
|
|
11632
11660
|
static get callCenterStatistics() {
|
|
11633
11661
|
if (!this._application)
|
|
11634
11662
|
throw new Error('CallCenterStatistics service not available.');
|
|
11635
|
-
return this._application.getCallCenterStatisticsService();
|
|
11663
|
+
return this._callCenterStatistics ?? (this._callCenterStatistics = this._application.getCallCenterStatisticsService());
|
|
11636
11664
|
}
|
|
11637
11665
|
/**
|
|
11638
11666
|
* Returns the {@link CallCenterManagement} service, which provides CCD pilot and calendar management.
|
|
@@ -11641,7 +11669,7 @@ class O2G {
|
|
|
11641
11669
|
static get callCenterManagement() {
|
|
11642
11670
|
if (!this._application)
|
|
11643
11671
|
throw new Error('CallCenterManagement service not available.');
|
|
11644
|
-
return this._application.getCallCenterManagementService();
|
|
11672
|
+
return this._callCenterManagement ?? (this._callCenterManagement = this._application.getCallCenterManagementService());
|
|
11645
11673
|
}
|
|
11646
11674
|
/**
|
|
11647
11675
|
* Returns the {@link Maintenance} service, which provides system status and PBX health information.
|
|
@@ -11650,7 +11678,7 @@ class O2G {
|
|
|
11650
11678
|
static get maintenance() {
|
|
11651
11679
|
if (!this._application)
|
|
11652
11680
|
throw new Error('Maintenance service not available.');
|
|
11653
|
-
return this._application.getMaintenanceService();
|
|
11681
|
+
return this._maintenance ?? (this._maintenance = this._application.getMaintenanceService());
|
|
11654
11682
|
}
|
|
11655
11683
|
/**
|
|
11656
11684
|
* Returns the {@link PbxManagement} service, which provides PBX object model access and configuration.
|
|
@@ -11659,7 +11687,7 @@ class O2G {
|
|
|
11659
11687
|
static get pbxManagement() {
|
|
11660
11688
|
if (!this._application)
|
|
11661
11689
|
throw new Error('PbxManagement service not available.');
|
|
11662
|
-
return this._application.getPbxManagementService();
|
|
11690
|
+
return this._pbxManagement ?? (this._pbxManagement = this._application.getPbxManagementService());
|
|
11663
11691
|
}
|
|
11664
11692
|
/**
|
|
11665
11693
|
* Returns the {@link PhoneSetProgramming} service, which provides phone device key and pin management.
|
|
@@ -11668,7 +11696,7 @@ class O2G {
|
|
|
11668
11696
|
static get phoneSetProgramming() {
|
|
11669
11697
|
if (!this._application)
|
|
11670
11698
|
throw new Error('PhoneSetProgramming service not available.');
|
|
11671
|
-
return this._application.getPhoneSetProgrammingService();
|
|
11699
|
+
return this._phoneSetProgramming ?? (this._phoneSetProgramming = this._application.getPhoneSetProgrammingService());
|
|
11672
11700
|
}
|
|
11673
11701
|
/**
|
|
11674
11702
|
* Returns the {@link Messaging} service, which provides voicemail and mailbox management.
|
|
@@ -11677,7 +11705,7 @@ class O2G {
|
|
|
11677
11705
|
static get messaging() {
|
|
11678
11706
|
if (!this._application)
|
|
11679
11707
|
throw new Error('Messaging service not available.');
|
|
11680
|
-
return this._application.getMessagingService();
|
|
11708
|
+
return this._messaging ?? (this._messaging = this._application.getMessagingService());
|
|
11681
11709
|
}
|
|
11682
11710
|
}
|
|
11683
11711
|
exports.O2G = O2G;
|
|
@@ -39846,7 +39874,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
39846
39874
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
39847
39875
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
39848
39876
|
};
|
|
39849
|
-
var _User_companyPhone, _User_firstName, _User_lastName, _User_loginName, _User_voicemail, _User_devices, _User_nodeId, _User_externalLogin;
|
|
39877
|
+
var _User_companyPhone, _User_firstName, _User_lastName, _User_loginName, _User_voicemail, _User_devices, _User_nodeId, _User_externalLogin, _User_emailaddress;
|
|
39850
39878
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
39851
39879
|
exports.User = void 0;
|
|
39852
39880
|
const device_1 = __webpack_require__(/*! ../common/device */ "./src/types/common/device.ts");
|
|
@@ -39869,9 +39897,10 @@ class User {
|
|
|
39869
39897
|
* @param devices - The user's devices, or undefined if none
|
|
39870
39898
|
* @param nodeId - The OmniPCX Enterprise node ID
|
|
39871
39899
|
* @param externalLogin - The user's external login, or undefined if none
|
|
39900
|
+
* @param emailAddress - The user's email address, or undefined if none
|
|
39872
39901
|
* @private
|
|
39873
39902
|
*/
|
|
39874
|
-
constructor(companyPhone, firstName, lastName, loginName, voicemail, devices, nodeId, externalLogin) {
|
|
39903
|
+
constructor(companyPhone, firstName, lastName, loginName, voicemail, devices, nodeId, externalLogin, emailAddess) {
|
|
39875
39904
|
_User_companyPhone.set(this, void 0);
|
|
39876
39905
|
_User_firstName.set(this, void 0);
|
|
39877
39906
|
_User_lastName.set(this, void 0);
|
|
@@ -39880,6 +39909,7 @@ class User {
|
|
|
39880
39909
|
_User_devices.set(this, void 0);
|
|
39881
39910
|
_User_nodeId.set(this, void 0);
|
|
39882
39911
|
_User_externalLogin.set(this, void 0);
|
|
39912
|
+
_User_emailaddress.set(this, void 0);
|
|
39883
39913
|
__classPrivateFieldSet(this, _User_companyPhone, companyPhone, "f");
|
|
39884
39914
|
__classPrivateFieldSet(this, _User_firstName, firstName, "f");
|
|
39885
39915
|
__classPrivateFieldSet(this, _User_lastName, lastName, "f");
|
|
@@ -39888,6 +39918,7 @@ class User {
|
|
|
39888
39918
|
__classPrivateFieldSet(this, _User_devices, devices, "f");
|
|
39889
39919
|
__classPrivateFieldSet(this, _User_nodeId, nodeId, "f");
|
|
39890
39920
|
__classPrivateFieldSet(this, _User_externalLogin, externalLogin, "f");
|
|
39921
|
+
__classPrivateFieldSet(this, _User_emailaddress, emailAddess, "f");
|
|
39891
39922
|
}
|
|
39892
39923
|
/**
|
|
39893
39924
|
* Returns the user's company phone number.
|
|
@@ -39946,6 +39977,13 @@ class User {
|
|
|
39946
39977
|
get externalLogin() {
|
|
39947
39978
|
return __classPrivateFieldGet(this, _User_externalLogin, "f") ?? null;
|
|
39948
39979
|
}
|
|
39980
|
+
/**
|
|
39981
|
+
* Returns the user's email address.
|
|
39982
|
+
* @returns The email address, or null if none
|
|
39983
|
+
*/
|
|
39984
|
+
get emailAddress() {
|
|
39985
|
+
return __classPrivateFieldGet(this, _User_emailaddress, "f") ?? null;
|
|
39986
|
+
}
|
|
39949
39987
|
/**
|
|
39950
39988
|
* Creates a new {@link User} instance from JSON data.
|
|
39951
39989
|
*
|
|
@@ -39957,11 +39995,11 @@ class User {
|
|
|
39957
39995
|
*/
|
|
39958
39996
|
/** @internal */
|
|
39959
39997
|
static fromJson(json) {
|
|
39960
|
-
return new User(json.companyPhone, json.firstName, json.lastName, json.loginName, json.voicemail ? voicemail_1.Voicemail.fromJson(json.voicemail) : null, json.devices?.map((d) => device_1.Device.fromJson(d)), Number(json.nodeId), json.externalLogin);
|
|
39998
|
+
return new User(json.companyPhone, json.firstName, json.lastName, json.loginName, json.voicemail ? voicemail_1.Voicemail.fromJson(json.voicemail) : null, json.devices?.map((d) => device_1.Device.fromJson(d)), Number(json.nodeId), json.externalLogin, json.eMailAddress);
|
|
39961
39999
|
}
|
|
39962
40000
|
}
|
|
39963
40001
|
exports.User = User;
|
|
39964
|
-
_User_companyPhone = new WeakMap(), _User_firstName = new WeakMap(), _User_lastName = new WeakMap(), _User_loginName = new WeakMap(), _User_voicemail = new WeakMap(), _User_devices = new WeakMap(), _User_nodeId = new WeakMap(), _User_externalLogin = new WeakMap();
|
|
40002
|
+
_User_companyPhone = new WeakMap(), _User_firstName = new WeakMap(), _User_lastName = new WeakMap(), _User_loginName = new WeakMap(), _User_voicemail = new WeakMap(), _User_devices = new WeakMap(), _User_nodeId = new WeakMap(), _User_externalLogin = new WeakMap(), _User_emailaddress = new WeakMap();
|
|
39965
40003
|
|
|
39966
40004
|
|
|
39967
40005
|
/***/ },
|