@unboundcx/sdk-internal 1.0.5 → 1.0.7

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 (2) hide show
  1. package/index.js +25 -26
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -11,51 +11,53 @@ export class InternalSDK {
11
11
  constructor(sdk, buildMasterApiAuthFn) {
12
12
  this.sdk = sdk;
13
13
  this.buildMasterApiAuthFn = buildMasterApiAuthFn;
14
-
15
- // Internal services under 'internal' namespace to avoid conflicts
16
- this.internal = {
17
- sip: new InternalSipService(sdk),
18
- email: new InternalEmailService(sdk),
19
- programmableVoice: new InternalProgrammableVoiceService(sdk),
20
- servers: new InternalServersService(sdk),
21
- socket: new InternalSocketService(sdk),
22
- };
23
-
14
+
15
+ // Internal services as direct properties for your setup
16
+ this.sip = new InternalSipService(sdk);
17
+ this.email = new InternalEmailService(sdk);
18
+ this.programmableVoice = new InternalProgrammableVoiceService(sdk);
19
+ this.servers = new InternalServersService(sdk);
20
+ this.socket = new InternalSocketService(sdk);
21
+
24
22
  // Proxy all base SDK properties and methods
25
23
  this._proxyBaseSDK();
26
24
  }
27
-
25
+
28
26
  _proxyBaseSDK() {
29
27
  // Get all properties from the base SDK
30
28
  const baseSdkProto = Object.getPrototypeOf(this.sdk);
31
29
  const baseSdkProps = Object.getOwnPropertyNames(this.sdk);
32
30
  const baseSdkMethods = Object.getOwnPropertyNames(baseSdkProto);
33
-
31
+
34
32
  // Proxy all instance properties (services like storage, messaging, etc.)
35
- baseSdkProps.forEach(prop => {
33
+ baseSdkProps.forEach((prop) => {
36
34
  if (prop !== 'constructor' && !this.hasOwnProperty(prop)) {
37
35
  Object.defineProperty(this, prop, {
38
36
  get: () => this.sdk[prop],
39
- set: (value) => { this.sdk[prop] = value; },
37
+ set: (value) => {
38
+ this.sdk[prop] = value;
39
+ },
40
40
  enumerable: true,
41
- configurable: true
41
+ configurable: true,
42
42
  });
43
43
  }
44
44
  });
45
-
45
+
46
46
  // Proxy all prototype methods, but don't override methods that already exist in InternalSDK
47
- baseSdkMethods.forEach(method => {
48
- if (method !== 'constructor' &&
49
- typeof this.sdk[method] === 'function' &&
50
- !this.hasOwnProperty(method) &&
51
- !InternalSDK.prototype.hasOwnProperty(method)) {
47
+ baseSdkMethods.forEach((method) => {
48
+ if (
49
+ method !== 'constructor' &&
50
+ typeof this.sdk[method] === 'function' &&
51
+ !this.hasOwnProperty(method) &&
52
+ !InternalSDK.prototype.hasOwnProperty(method)
53
+ ) {
52
54
  this[method] = (...args) => this.sdk[method](...args);
53
55
  }
54
56
  });
55
-
57
+
56
58
  // Explicitly proxy critical methods that might be missed
57
59
  const criticalMethods = ['setToken', 'setNamespace', 'use', 'extend'];
58
- criticalMethods.forEach(method => {
60
+ criticalMethods.forEach((method) => {
59
61
  if (typeof this.sdk[method] === 'function' && !this[method]) {
60
62
  this[method] = (...args) => this.sdk[method](...args);
61
63
  }
@@ -97,9 +99,6 @@ export function install(sdk, buildMasterApiAuthFn) {
97
99
 
98
100
  // Add buildMasterAuth to the main SDK instance
99
101
  sdk.buildMasterAuth = internal.buildMasterAuth.bind(internal);
100
-
101
- // Add internal services
102
- sdk.internal = internal.internal;
103
102
  }
104
103
 
105
104
  // Default export for ease of use
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk-internal",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Internal SDK extension for Unbound - Provides access to internal APIs and administrative functions",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -53,11 +53,11 @@
53
53
  },
54
54
  "dependencies": {},
55
55
  "peerDependencies": {
56
- "@unboundcx/sdk": "^1.0.0"
56
+ "@unboundcx/sdk": "^2.0.0"
57
57
  },
58
58
  "devDependencies": {},
59
59
  "publishConfig": {
60
60
  "registry": "https://registry.npmjs.org/",
61
61
  "access": "restricted"
62
62
  }
63
- }
63
+ }