appium-ios-remotexpc 0.1.0 → 0.2.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 (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/src/base-plist-service.d.ts +6 -6
  3. package/build/src/base-plist-service.d.ts.map +1 -1
  4. package/build/src/base-plist-service.js +8 -8
  5. package/build/src/lib/tunnel/index.d.ts +1 -1
  6. package/build/src/lib/tunnel/index.d.ts.map +1 -1
  7. package/build/src/lib/tunnel/index.js +1 -1
  8. package/build/src/lib/tunnel/packet-stream-client.d.ts +1 -1
  9. package/build/src/lib/tunnel/packet-stream-client.d.ts.map +1 -1
  10. package/build/src/lib/tunnel/packet-stream-server.d.ts +1 -1
  11. package/build/src/lib/tunnel/packet-stream-server.d.ts.map +1 -1
  12. package/build/src/lib/types.d.ts +46 -1
  13. package/build/src/lib/types.d.ts.map +1 -1
  14. package/build/src/lib/types.js +0 -3
  15. package/build/src/services/ios/notification-proxy/index.d.ts +59 -0
  16. package/build/src/services/ios/notification-proxy/index.d.ts.map +1 -0
  17. package/build/src/services/ios/notification-proxy/index.js +134 -0
  18. package/build/src/services/ios/syslog-service/index.d.ts +1 -1
  19. package/build/src/services/ios/syslog-service/index.d.ts.map +1 -1
  20. package/build/src/services.d.ts +2 -1
  21. package/build/src/services.d.ts.map +1 -1
  22. package/build/src/services.js +12 -0
  23. package/package.json +3 -2
  24. package/src/base-plist-service.ts +9 -9
  25. package/src/lib/tunnel/index.ts +4 -1
  26. package/src/lib/tunnel/packet-stream-client.ts +1 -1
  27. package/src/lib/tunnel/packet-stream-server.ts +1 -1
  28. package/src/lib/types.ts +48 -1
  29. package/src/services/ios/notification-proxy/index.ts +180 -0
  30. package/src/services/ios/syslog-service/index.ts +1 -1
  31. package/src/services.ts +18 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [0.2.0](https://github.com/appium/appium-ios-remotexpc/compare/v0.1.1...v0.2.0) (2025-08-14)
2
+
3
+ ### Features
4
+
5
+ * implement notification proxy ([#59](https://github.com/appium/appium-ios-remotexpc/issues/59)) ([aede9f5](https://github.com/appium/appium-ios-remotexpc/commit/aede9f55d7c94657b15a5fe20cc221686a941596))
6
+
7
+ ## [0.1.1](https://github.com/appium/appium-ios-remotexpc/compare/v0.1.0...v0.1.1) (2025-07-23)
8
+
9
+ ### Bug Fixes
10
+
11
+ * change tuntap dependency to appium-ios-tuntap ([#55](https://github.com/appium/appium-ios-remotexpc/issues/55)) ([dad93be](https://github.com/appium/appium-ios-remotexpc/commit/dad93be92c73ab67a028878777d42d31c799288c))
12
+
1
13
  ## [0.1.0](https://github.com/appium/appium-ios-remotexpc/compare/v0.0.6...v0.1.0) (2025-07-05)
2
14
 
3
15
  ### Features
@@ -20,6 +20,12 @@ export declare abstract class BasePlistService {
20
20
  * Closes the underlying connection
21
21
  */
22
22
  close(): void;
23
+ /**
24
+ * Waits for a message
25
+ * @param timeout Timeout in milliseconds
26
+ * @returns Promise resolving to the received message
27
+ */
28
+ receive(timeout?: number): Promise<PlistMessage>;
23
29
  /**
24
30
  * Gets the PlistService instance
25
31
  * @returns The PlistService instance
@@ -40,12 +46,6 @@ export declare abstract class BasePlistService {
40
46
  * @param message The message to send
41
47
  */
42
48
  protected send(message: PlistMessage): void;
43
- /**
44
- * Waits for a message
45
- * @param timeout Timeout in milliseconds
46
- * @returns Promise resolving to the received message
47
- */
48
- protected receive(timeout?: number): Promise<PlistMessage>;
49
49
  }
50
50
  export {};
51
51
  //# sourceMappingURL=base-plist-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-plist-service.d.ts","sourceRoot":"","sources":["../../src/base-plist-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,M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e,IAAI,YAAY;IAIzC;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC;IAEtC;;;;OAIG;IACH,SAAS,aACP,oBAAoB,EAAE,YAAY,GAAG,MAAM,EAC3C,OAAO,GAAE,mBAAwB;IASnC;;;OAGG;IACH,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;CAG5C"}
@@ -19,6 +19,14 @@ export class BasePlistService {
19
19
  close() {
20
20
  this._plistService.close();
21
21
  }
22
+ /**
23
+ * Waits for a message
24
+ * @param timeout Timeout in milliseconds
25
+ * @returns Promise resolving to the received message
26
+ */
27
+ async receive(timeout) {
28
+ return this._plistService.receivePlist(timeout);
29
+ }
22
30
  /**
23
31
  * Gets the PlistService instance
24
32
  * @returns The PlistService instance
@@ -50,12 +58,4 @@ export class BasePlistService {
50
58
  send(message) {
51
59
  this._plistService.sendPlist(message);
52
60
  }
53
- /**
54
- * Waits for a message
55
- * @param timeout Timeout in milliseconds
56
- * @returns Promise resolving to the received message
57
- */
58
- async receive(timeout) {
59
- return this._plistService.receivePlist(timeout);
60
- }
61
61
  }
@@ -1,5 +1,5 @@
1
+ import { type TunnelConnection } from 'appium-ios-tuntap';
1
2
  import type { TLSSocket } from 'tls';
2
- import { type TunnelConnection } from 'tuntap-bridge';
3
3
  import { RemoteXpcConnection } from '../remote-xpc/remote-xpc-connection.js';
4
4
  /**
5
5
  * A wrapper around the tunnel connection that
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/tunnel/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,KAAK,gBAAgB,EAA2B,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAsB7E;;;GAGG;AACH,cAAM,oBAAoB;IAExB,OAAO,CAAC,cAAc,CAA+C;IAErE;;;;;OA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,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC;IA2C/B;;;;;;OAMG;IACG,SAAS,CAAC,mBAAmB,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmD1E;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAU5D;;;;;OAKG;IACG,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC1D;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAatC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC;AAGD,eAAO,MAAM,aAAa,sBAA6B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { logger } from '@appium/support';
2
- import { connectToTunnelLockdown } from 'tuntap-bridge';
2
+ import { connectToTunnelLockdown, } from 'appium-ios-tuntap';
3
3
  import { RemoteXpcConnection } from '../remote-xpc/remote-xpc-connection.js';
4
4
  const log = logger.getLogger('TunnelManager');
5
5
  /**
@@ -1,5 +1,5 @@
1
+ import type { PacketConsumer } from 'appium-ios-tuntap';
1
2
  import { EventEmitter } from 'events';
2
- import type { PacketConsumer } from 'tuntap-bridge';
3
3
  /**
4
4
  * Client that connects to a PacketStreamServer to receive packet data
5
5
  * Implements the PacketSource interface required by SyslogService
@@ -1 +1 @@
1
- {"version":3,"file":"packet-stream-client.d.ts","sourceRoot":"","sources":["../../../../src/lib/tunnel/packet-stream-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,eAAe,CAAC;AAShE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAOhD,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,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC9B,WAAW,IAAI,OAAO;IAIhB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIjD,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIpD;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;OAEG;IACH,OAAO,CAAC,aAAa;IA2BrB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,WAAW;IAWnB;;OAEG;IACH,OAAO,CAAC,eAAe;CASxB"}
@@ -1,5 +1,5 @@
1
+ import type { PacketConsumer } from 'appium-ios-tuntap';
1
2
  import { EventEmitter } from 'events';
2
- import type { PacketConsumer } from 'tuntap-bridge';
3
3
  /**
4
4
  * Server that exposes packet streaming from a tunnel over TCP
5
5
  * This allows cross-process access to tunnel packet streams
@@ -1 +1 @@
1
- {"version":3,"file":"packet-stream-server.d.ts","sourceRoot":"","sources":["../../../../src/lib/tunnel/packet-stream-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,eAAe,CAAC;AAYhE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAKtC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,cAAc,CAA+B;gBAExB,IAAI,EAAE,MAAM;IAIzC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB3B,iBAAiB,IAAI,cAAc,GAAG,IAAI;IAI1C;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAoBvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAItB"}
1
+ {"version":3,"file":"packet-stream-server.d.ts","sourceRoot":"","sources":["../../../../src/lib/tunnel/packet-stream-server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAatC;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAKtC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,cAAc,CAA+B;gBAExB,IAAI,EAAE,MAAM;IAIzC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB3B,iBAAiB,IAAI,cAAc,GAAG,IAAI;IAI1C;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAoBvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAItB"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Common type definitions for the appium-ios-remotexpc library
3
3
  */
4
+ import type { PacketData } from 'appium-ios-tuntap';
4
5
  import { EventEmitter } from 'events';
5
- import type { PacketData } from 'tuntap-bridge';
6
+ import type { ServiceConnection } from '../service-connection.js';
6
7
  import type { BaseService, Service } from '../services/ios/base-service.js';
7
8
  import type { RemoteXpcConnection } from './remote-xpc/remote-xpc-connection.js';
8
9
  import type { Device } from './usbmux/index.js';
@@ -139,6 +140,40 @@ export interface DiagnosticsService extends BaseService {
139
140
  timeout?: number;
140
141
  }): Promise<PlistDictionary[] | Record<string, any>>;
141
142
  }
143
+ /**
144
+ * Represents the static side of DiagnosticsService
145
+ */
146
+ export interface NotificationProxyService extends BaseService {
147
+ /**
148
+ * Connect to the notification proxy service
149
+ * @returns Promise resolving to the ServiceConnection instance
150
+ */
151
+ connectToNotificationProxyService(): Promise<ServiceConnection>;
152
+ /**
153
+ * Observe a notification
154
+ * @param notification The notification name to subscribe to
155
+ * @returns Promise that resolves when the subscription request is sent
156
+ */
157
+ observe(notification: string): Promise<PlistDictionary>;
158
+ /**
159
+ * Post a notification
160
+ * @param notification The notification name to post
161
+ * @returns Promise that resolves when the post request is sent
162
+ */
163
+ post(notification: string): Promise<PlistDictionary>;
164
+ /**
165
+ * Expect notifications as an async generator
166
+ * @param timeout Timeout in milliseconds
167
+ * @returns AsyncGenerator yielding PlistMessage objects
168
+ */
169
+ expectNotifications(timeout?: number): AsyncGenerator<PlistMessage>;
170
+ /**
171
+ * Expect a single notification
172
+ * @param timeout Timeout in milliseconds
173
+ * @returns Promise resolving to the expected notification
174
+ */
175
+ expectNotification(timeout?: number): Promise<PlistMessage>;
176
+ }
142
177
  /**
143
178
  * Represents the static side of DiagnosticsService
144
179
  */
@@ -163,6 +198,16 @@ export interface DiagnosticsServiceWithConnection {
163
198
  /** The RemoteXPC connection that can be used to close the connection */
164
199
  remoteXPC: RemoteXpcConnection;
165
200
  }
201
+ /**
202
+ * Represents a NotificationProxyService instance with its associated RemoteXPC connection
203
+ * This allows callers to properly manage the connection lifecycle
204
+ */
205
+ export interface NotificationProxyServiceWithConnection {
206
+ /** The NotificationProxyService instance */
207
+ notificationProxyService: NotificationProxyService;
208
+ /** The RemoteXPC connection that can be used to close the connection */
209
+ remoteXPC: RemoteXpcConnection;
210
+ }
166
211
  /**
167
212
  * Options for configuring syslog capture
168
213
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAA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EjB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAE5D;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAE9C;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAEhE;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IAExD;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAE3D;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC;CAChD"}
@@ -1,4 +1 @@
1
- /**
2
- * Common type definitions for the appium-ios-remotexpc library
3
- */
4
1
  import { EventEmitter } from 'events';
@@ -0,0 +1,59 @@
1
+ import type { NotificationProxyService as NotificationProxyServiceInterface, PlistDictionary, PlistMessage } from '../../../lib/types.js';
2
+ import { ServiceConnection } from '../../../service-connection.js';
3
+ import { BaseService } from '../base-service.js';
4
+ export interface ObserveNotificationRequest extends PlistDictionary {
5
+ Command: 'ObserveNotification';
6
+ Name: string;
7
+ }
8
+ export interface PostNotificationRequest extends PlistDictionary {
9
+ Command: 'PostNotification';
10
+ Name: string;
11
+ }
12
+ /**
13
+ * NotificationProxyService provides an API to:
14
+ * - Observe notifications
15
+ * - Post notifications
16
+ * - Expects notifications
17
+ */
18
+ declare class NotificationProxyService extends BaseService implements NotificationProxyServiceInterface {
19
+ static readonly RSD_SERVICE_NAME = "com.apple.mobile.notification_proxy.shim.remote";
20
+ private readonly timeout;
21
+ private _conn;
22
+ private _pendingNotificationsObservationSet;
23
+ constructor(address: [string, number], timeout?: number);
24
+ /**
25
+ * Observe a notification
26
+ * @param notification The notification name to subscribe to
27
+ * @returns Promise that resolves when the subscription request is sent
28
+ */
29
+ observe(notification: string): Promise<PlistDictionary>;
30
+ /**
31
+ * Post a notification
32
+ * @param notification The notification name to post
33
+ * @returns Promise that resolves when the post request is sent
34
+ */
35
+ post(notification: string): Promise<PlistDictionary>;
36
+ /**
37
+ * Expect notifications as an async generator
38
+ * @param timeout Timeout in milliseconds
39
+ * @returns AsyncGenerator yielding PlistMessage objects
40
+ */
41
+ expectNotifications(timeout?: number): AsyncGenerator<PlistMessage>;
42
+ /**
43
+ * Expect a single notification
44
+ * @param timeout Timeout in milliseconds
45
+ * @returns Promise resolving to the expected notification
46
+ */
47
+ expectNotification(timeout?: number): Promise<PlistMessage>;
48
+ /**
49
+ * Connect to the notification proxy service
50
+ * @returns Promise resolving to the ServiceConnection instance
51
+ */
52
+ connectToNotificationProxyService(): Promise<ServiceConnection>;
53
+ private createObserveNotificationRequest;
54
+ private createPostNotificationRequest;
55
+ private getServiceConfig;
56
+ private sendPlistDictionary;
57
+ }
58
+ export { NotificationProxyService };
59
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/ios/notification-proxy/index.ts"],"names":[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AwB,EAAE,CAAC"}
@@ -0,0 +1,134 @@
1
+ import { logger } from '@appium/support';
2
+ import { ServiceConnection } from '../../../service-connection.js';
3
+ import { BaseService } from '../base-service.js';
4
+ const log = logger.getLogger('NotificationProxyService');
5
+ /**
6
+ * NotificationProxyService provides an API to:
7
+ * - Observe notifications
8
+ * - Post notifications
9
+ * - Expects notifications
10
+ */
11
+ class NotificationProxyService extends BaseService {
12
+ static RSD_SERVICE_NAME = 'com.apple.mobile.notification_proxy.shim.remote';
13
+ timeout;
14
+ _conn = null;
15
+ _pendingNotificationsObservationSet = new Set();
16
+ constructor(address, timeout = 10000) {
17
+ super(address);
18
+ this.timeout = timeout;
19
+ }
20
+ /**
21
+ * Observe a notification
22
+ * @param notification The notification name to subscribe to
23
+ * @returns Promise that resolves when the subscription request is sent
24
+ */
25
+ async observe(notification) {
26
+ if (!this._conn) {
27
+ this._conn = await this.connectToNotificationProxyService();
28
+ }
29
+ const request = this.createObserveNotificationRequest(notification);
30
+ const result = await this.sendPlistDictionary(request);
31
+ this._pendingNotificationsObservationSet.add(notification);
32
+ return result;
33
+ }
34
+ /**
35
+ * Post a notification
36
+ * @param notification The notification name to post
37
+ * @returns Promise that resolves when the post request is sent
38
+ */
39
+ async post(notification) {
40
+ if (!this._pendingNotificationsObservationSet.has(notification)) {
41
+ log.error('Posting notifications without observing them may not yield any results. ' +
42
+ 'Consider calling observe() first.');
43
+ throw new Error('You must call observe() before posting notifications.');
44
+ }
45
+ this._conn = await this.connectToNotificationProxyService();
46
+ const request = this.createPostNotificationRequest(notification);
47
+ const result = await this.sendPlistDictionary(request);
48
+ this._pendingNotificationsObservationSet.delete(notification);
49
+ return result;
50
+ }
51
+ /**
52
+ * Expect notifications as an async generator
53
+ * @param timeout Timeout in milliseconds
54
+ * @returns AsyncGenerator yielding PlistMessage objects
55
+ */
56
+ async *expectNotifications(timeout = 120000) {
57
+ if (!this._conn) {
58
+ this._conn = await this.connectToNotificationProxyService();
59
+ }
60
+ while (true) {
61
+ try {
62
+ const notification = await this._conn.receive(timeout);
63
+ const notificationStr = JSON.stringify(notification);
64
+ const truncatedStr = notificationStr.length > 500
65
+ ? `${notificationStr.substring(0, 500)}...`
66
+ : notificationStr;
67
+ log.info(`received response: ${truncatedStr}`);
68
+ yield notification;
69
+ }
70
+ catch (error) {
71
+ log.error(`Error receiving notification: ${error.message}`);
72
+ throw error;
73
+ }
74
+ }
75
+ }
76
+ /**
77
+ * Expect a single notification
78
+ * @param timeout Timeout in milliseconds
79
+ * @returns Promise resolving to the expected notification
80
+ */
81
+ async expectNotification(timeout = 120000) {
82
+ const generator = this.expectNotifications(timeout);
83
+ const { value, done } = await generator.next();
84
+ if (done || !value) {
85
+ throw new Error('No notification received');
86
+ }
87
+ return value;
88
+ }
89
+ /**
90
+ * Connect to the notification proxy service
91
+ * @returns Promise resolving to the ServiceConnection instance
92
+ */
93
+ async connectToNotificationProxyService() {
94
+ if (this._conn) {
95
+ return this._conn;
96
+ }
97
+ const service = this.getServiceConfig();
98
+ this._conn = await this.startLockdownService(service);
99
+ return this._conn;
100
+ }
101
+ createObserveNotificationRequest(notification) {
102
+ return {
103
+ Command: 'ObserveNotification',
104
+ Name: notification,
105
+ };
106
+ }
107
+ createPostNotificationRequest(notification) {
108
+ return {
109
+ Command: 'PostNotification',
110
+ Name: notification,
111
+ };
112
+ }
113
+ getServiceConfig() {
114
+ return {
115
+ serviceName: NotificationProxyService.RSD_SERVICE_NAME,
116
+ port: this.address[1].toString(),
117
+ options: { createConnectionTimeout: this.timeout },
118
+ };
119
+ }
120
+ async sendPlistDictionary(request) {
121
+ if (!this._conn) {
122
+ this._conn = await this.connectToNotificationProxyService();
123
+ }
124
+ const response = await this._conn.sendPlistRequest(request, this.timeout);
125
+ if (!response) {
126
+ return {};
127
+ }
128
+ if (Array.isArray(response)) {
129
+ return response.length > 0 ? response[0] : {};
130
+ }
131
+ return response;
132
+ }
133
+ }
134
+ export { NotificationProxyService };
@@ -1,5 +1,5 @@
1
+ import type { PacketData } from 'appium-ios-tuntap';
1
2
  import { EventEmitter } from 'events';
2
- import type { PacketData } from 'tuntap-bridge';
3
3
  import type { PacketSource, SyslogOptions, SyslogService as SyslogServiceInterface } from '../../../lib/types.js';
4
4
  import { type Service } from '../base-service.js';
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/ios/syslog-service/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,aAAa,IAAI,sBAAsB,EACxC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAqB/D;;;GAGG;AACH,cAAM,aAAc,SAAQ,YAAa,YAAW,sBAAsB;IACxE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,mBAAmB,CAA8B;IACzD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,oBAAoB,CAAS;IAErC;;;OAGG;gBACS,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAKrC;;;;;;OAMG;IACG,KAAK,CACT,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,EACtD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAgChB;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9C,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,cAAc;YASR,mBAAmB;IAejC,OAA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a,CAAC,UAAU,CAAC,EACtD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAgChB;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9C,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,cAAc;YASR,mBAAmB;IAejC,OAAO,CAAC,aAAa;IAQrB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,WAAW;IAOnB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAqCpB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;CA2B1B;AAED,eAAe,aAAa,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { RemoteXpcConnection } from './lib/remote-xpc/remote-xpc-connection.js';
2
- import type { DiagnosticsServiceWithConnection, SyslogService as SyslogServiceType } from './lib/types.js';
2
+ import type { DiagnosticsServiceWithConnection, NotificationProxyServiceWithConnection, SyslogService as SyslogServiceType } from './lib/types.js';
3
3
  export declare function startDiagnosticsService(udid: string): Promise<DiagnosticsServiceWithConnection>;
4
+ export declare function startNotificationProxyService(udid: string): Promise<NotificationProxyServiceWithConnection>;
4
5
  export declare function startSyslogService(udid: string): Promise<SyslogServiceType>;
5
6
  export declare function createRemoteXPCConnection(udid: string): Promise<{
6
7
  remoteXPC: RemoteXpcConnection;
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,KAAK,EACV,gCAAgC,EAChC,aAAa,IAAI,iBAAiB,EACnC,MAAM,gBAAgB,CAAC;AAOxB,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM;;;;;;;;GAO3D"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,KAAK,EACV,gCAAgC,EAChC,sCAAsC,EACtC,aAAa,IAAI,iBAAiB,EACnC,MAAM,gBAAgB,CAAC;AAQxB,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,sCAAsC,CAAC,CAYjD;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM;;;;;;;;GAO3D"}
@@ -3,6 +3,7 @@ import { RemoteXpcConnection } from './lib/remote-xpc/remote-xpc-connection.js';
3
3
  import { TunnelManager } from './lib/tunnel/index.js';
4
4
  import { TunnelApiClient } from './lib/tunnel/tunnel-api-client.js';
5
5
  import DiagnosticsService from './services/ios/diagnostic-service/index.js';
6
+ import { NotificationProxyService } from './services/ios/notification-proxy/index.js';
6
7
  import SyslogService from './services/ios/syslog-service/index.js';
7
8
  const APPIUM_XCUITEST_DRIVER_NAME = 'appium-xcuitest-driver';
8
9
  const TUNNEL_REGISTRY_PORT = 'tunnelRegistryPort';
@@ -17,6 +18,17 @@ export async function startDiagnosticsService(udid) {
17
18
  ]),
18
19
  };
19
20
  }
21
+ export async function startNotificationProxyService(udid) {
22
+ const { remoteXPC, tunnelConnection } = await createRemoteXPCConnection(udid);
23
+ const notificationProxyService = remoteXPC.findService(NotificationProxyService.RSD_SERVICE_NAME);
24
+ return {
25
+ remoteXPC: remoteXPC,
26
+ notificationProxyService: new NotificationProxyService([
27
+ tunnelConnection.host,
28
+ parseInt(notificationProxyService.port, 10),
29
+ ]),
30
+ };
31
+ }
20
32
  export async function startSyslogService(udid) {
21
33
  const { tunnelConnection } = await createRemoteXPCConnection(udid);
22
34
  return new SyslogService([tunnelConnection.host, tunnelConnection.port]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-ios-remotexpc",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "main": "build/src/index.js",
5
5
  "types": "build/src/index.d.ts",
6
6
  "type": "module",
@@ -27,6 +27,7 @@
27
27
  "test:tunnel": "mocha test/integration/tunnel-test.ts --exit --timeout 1m",
28
28
  "test:pair-record": "mocha test/integration/read-pair-record-test.ts --exit --timeout 1m",
29
29
  "test:diagnostics": "mocha test/integration/diagnostics-test.ts --exit --timeout 1m",
30
+ "test:notification": "mocha test/integration/notification-proxy-test.ts --exit --timeout 1m",
30
31
  "test:unit": "mocha 'test/unit/**/*.ts' --exit --timeout 2m",
31
32
  "test:tunnel-creation": "sudo tsx scripts/test-tunnel-creation.ts",
32
33
  "test:tunnel-creation:lsof": "sudo tsx scripts/test-tunnel-creation.ts --keep-open"
@@ -74,7 +75,7 @@
74
75
  "@types/node": "^24.0.10",
75
76
  "@xmldom/xmldom": "^0.9.8",
76
77
  "npm-run-all2": "^7.0.2",
77
- "tuntap-bridge": "^0.x"
78
+ "appium-ios-tuntap": "^0.x"
78
79
  },
79
80
  "files": [
80
81
  "src",
@@ -35,6 +35,15 @@ export abstract class BasePlistService {
35
35
  this._plistService.close();
36
36
  }
37
37
 
38
+ /**
39
+ * Waits for a message
40
+ * @param timeout Timeout in milliseconds
41
+ * @returns Promise resolving to the received message
42
+ */
43
+ public async receive(timeout?: number): Promise<PlistMessage> {
44
+ return this._plistService.receivePlist(timeout);
45
+ }
46
+
38
47
  /**
39
48
  * Gets the PlistService instance
40
49
  * @returns The PlistService instance
@@ -71,13 +80,4 @@ export abstract class BasePlistService {
71
80
  protected send(message: PlistMessage): void {
72
81
  this._plistService.sendPlist(message);
73
82
  }
74
-
75
- /**
76
- * Waits for a message
77
- * @param timeout Timeout in milliseconds
78
- * @returns Promise resolving to the received message
79
- */
80
- protected async receive(timeout?: number): Promise<PlistMessage> {
81
- return this._plistService.receivePlist(timeout);
82
- }
83
83
  }
@@ -1,6 +1,9 @@
1
1
  import { logger } from '@appium/support';
2
+ import {
3
+ type TunnelConnection,
4
+ connectToTunnelLockdown,
5
+ } from 'appium-ios-tuntap';
2
6
  import type { TLSSocket } from 'tls';
3
- import { type TunnelConnection, connectToTunnelLockdown } from 'tuntap-bridge';
4
7
 
5
8
  import { RemoteXpcConnection } from '../remote-xpc/remote-xpc-connection.js';
6
9
 
@@ -1,7 +1,7 @@
1
1
  import { logger } from '@appium/support';
2
+ import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
2
3
  import { EventEmitter } from 'events';
3
4
  import { type Socket, createConnection } from 'net';
4
- import type { PacketConsumer, PacketData } from 'tuntap-bridge';
5
5
 
6
6
  const log = logger.getLogger('PacketStreamClient');
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { logger } from '@appium/support';
2
+ import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
2
3
  import { EventEmitter } from 'events';
3
4
  import { type Server, type Socket, createServer } from 'net';
4
- import type { PacketConsumer, PacketData } from 'tuntap-bridge';
5
5
 
6
6
  const log = logger.getLogger('PacketStreamServer');
7
7
 
package/src/lib/types.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Common type definitions for the appium-ios-remotexpc library
3
3
  */
4
+ import type { PacketData } from 'appium-ios-tuntap';
4
5
  import { EventEmitter } from 'events';
5
- import type { PacketData } from 'tuntap-bridge';
6
6
 
7
+ import type { ServiceConnection } from '../service-connection.js';
7
8
  import type { BaseService, Service } from '../services/ios/base-service.js';
8
9
  import type { RemoteXpcConnection } from './remote-xpc/remote-xpc-connection.js';
9
10
  import type { Device } from './usbmux/index.js';
@@ -176,6 +177,41 @@ export interface DiagnosticsService extends BaseService {
176
177
  }): Promise<PlistDictionary[] | Record<string, any>>;
177
178
  }
178
179
 
180
+ /**
181
+ * Represents the static side of DiagnosticsService
182
+ */
183
+ export interface NotificationProxyService extends BaseService {
184
+ /**
185
+ * Connect to the notification proxy service
186
+ * @returns Promise resolving to the ServiceConnection instance
187
+ */
188
+ connectToNotificationProxyService(): Promise<ServiceConnection>;
189
+ /**
190
+ * Observe a notification
191
+ * @param notification The notification name to subscribe to
192
+ * @returns Promise that resolves when the subscription request is sent
193
+ */
194
+ observe(notification: string): Promise<PlistDictionary>;
195
+ /**
196
+ * Post a notification
197
+ * @param notification The notification name to post
198
+ * @returns Promise that resolves when the post request is sent
199
+ */
200
+ post(notification: string): Promise<PlistDictionary>;
201
+ /**
202
+ * Expect notifications as an async generator
203
+ * @param timeout Timeout in milliseconds
204
+ * @returns AsyncGenerator yielding PlistMessage objects
205
+ */
206
+ expectNotifications(timeout?: number): AsyncGenerator<PlistMessage>;
207
+ /**
208
+ * Expect a single notification
209
+ * @param timeout Timeout in milliseconds
210
+ * @returns Promise resolving to the expected notification
211
+ */
212
+ expectNotification(timeout?: number): Promise<PlistMessage>;
213
+ }
214
+
179
215
  /**
180
216
  * Represents the static side of DiagnosticsService
181
217
  */
@@ -202,6 +238,17 @@ export interface DiagnosticsServiceWithConnection {
202
238
  remoteXPC: RemoteXpcConnection;
203
239
  }
204
240
 
241
+ /**
242
+ * Represents a NotificationProxyService instance with its associated RemoteXPC connection
243
+ * This allows callers to properly manage the connection lifecycle
244
+ */
245
+ export interface NotificationProxyServiceWithConnection {
246
+ /** The NotificationProxyService instance */
247
+ notificationProxyService: NotificationProxyService;
248
+ /** The RemoteXPC connection that can be used to close the connection */
249
+ remoteXPC: RemoteXpcConnection;
250
+ }
251
+
205
252
  /**
206
253
  * Options for configuring syslog capture
207
254
  */
@@ -0,0 +1,180 @@
1
+ import { logger } from '@appium/support';
2
+
3
+ import type {
4
+ NotificationProxyService as NotificationProxyServiceInterface,
5
+ PlistDictionary,
6
+ PlistMessage,
7
+ } from '../../../lib/types.js';
8
+ import { ServiceConnection } from '../../../service-connection.js';
9
+ import { BaseService } from '../base-service.js';
10
+
11
+ const log = logger.getLogger('NotificationProxyService');
12
+
13
+ export interface ObserveNotificationRequest extends PlistDictionary {
14
+ Command: 'ObserveNotification';
15
+ Name: string;
16
+ }
17
+
18
+ export interface PostNotificationRequest extends PlistDictionary {
19
+ Command: 'PostNotification';
20
+ Name: string;
21
+ }
22
+
23
+ /**
24
+ * NotificationProxyService provides an API to:
25
+ * - Observe notifications
26
+ * - Post notifications
27
+ * - Expects notifications
28
+ */
29
+ class NotificationProxyService
30
+ extends BaseService
31
+ implements NotificationProxyServiceInterface
32
+ {
33
+ static readonly RSD_SERVICE_NAME =
34
+ 'com.apple.mobile.notification_proxy.shim.remote';
35
+ private readonly timeout: number;
36
+ private _conn: ServiceConnection | null = null;
37
+ private _pendingNotificationsObservationSet: Set<string> = new Set();
38
+
39
+ constructor(address: [string, number], timeout: number = 10000) {
40
+ super(address);
41
+ this.timeout = timeout;
42
+ }
43
+
44
+ /**
45
+ * Observe a notification
46
+ * @param notification The notification name to subscribe to
47
+ * @returns Promise that resolves when the subscription request is sent
48
+ */
49
+ async observe(notification: string): Promise<PlistDictionary> {
50
+ if (!this._conn) {
51
+ this._conn = await this.connectToNotificationProxyService();
52
+ }
53
+ const request = this.createObserveNotificationRequest(notification);
54
+ const result = await this.sendPlistDictionary(request);
55
+ this._pendingNotificationsObservationSet.add(notification);
56
+ return result;
57
+ }
58
+
59
+ /**
60
+ * Post a notification
61
+ * @param notification The notification name to post
62
+ * @returns Promise that resolves when the post request is sent
63
+ */
64
+ async post(notification: string): Promise<PlistDictionary> {
65
+ if (!this._pendingNotificationsObservationSet.has(notification)) {
66
+ log.error(
67
+ 'Posting notifications without observing them may not yield any results. ' +
68
+ 'Consider calling observe() first.',
69
+ );
70
+ throw new Error('You must call observe() before posting notifications.');
71
+ }
72
+ this._conn = await this.connectToNotificationProxyService();
73
+ const request = this.createPostNotificationRequest(notification);
74
+ const result = await this.sendPlistDictionary(request);
75
+ this._pendingNotificationsObservationSet.delete(notification);
76
+ return result;
77
+ }
78
+
79
+ /**
80
+ * Expect notifications as an async generator
81
+ * @param timeout Timeout in milliseconds
82
+ * @returns AsyncGenerator yielding PlistMessage objects
83
+ */
84
+ async *expectNotifications(
85
+ timeout: number = 120000,
86
+ ): AsyncGenerator<PlistMessage> {
87
+ if (!this._conn) {
88
+ this._conn = await this.connectToNotificationProxyService();
89
+ }
90
+ while (true) {
91
+ try {
92
+ const notification = await this._conn.receive(timeout);
93
+ const notificationStr = JSON.stringify(notification);
94
+ const truncatedStr =
95
+ notificationStr.length > 500
96
+ ? `${notificationStr.substring(0, 500)}...`
97
+ : notificationStr;
98
+ log.info(`received response: ${truncatedStr}`);
99
+ yield notification;
100
+ } catch (error) {
101
+ log.error(`Error receiving notification: ${(error as Error).message}`);
102
+ throw error;
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Expect a single notification
109
+ * @param timeout Timeout in milliseconds
110
+ * @returns Promise resolving to the expected notification
111
+ */
112
+ async expectNotification(timeout: number = 120000): Promise<PlistMessage> {
113
+ const generator = this.expectNotifications(timeout);
114
+ const { value, done } = await generator.next();
115
+ if (done || !value) {
116
+ throw new Error('No notification received');
117
+ }
118
+ return value;
119
+ }
120
+
121
+ /**
122
+ * Connect to the notification proxy service
123
+ * @returns Promise resolving to the ServiceConnection instance
124
+ */
125
+ async connectToNotificationProxyService(): Promise<ServiceConnection> {
126
+ if (this._conn) {
127
+ return this._conn;
128
+ }
129
+ const service = this.getServiceConfig();
130
+ this._conn = await this.startLockdownService(service);
131
+ return this._conn;
132
+ }
133
+
134
+ private createObserveNotificationRequest(
135
+ notification: string,
136
+ ): ObserveNotificationRequest {
137
+ return {
138
+ Command: 'ObserveNotification',
139
+ Name: notification,
140
+ };
141
+ }
142
+
143
+ private createPostNotificationRequest(
144
+ notification: string,
145
+ ): PostNotificationRequest {
146
+ return {
147
+ Command: 'PostNotification',
148
+ Name: notification,
149
+ };
150
+ }
151
+
152
+ private getServiceConfig(): {
153
+ serviceName: string;
154
+ port: string;
155
+ options: { createConnectionTimeout: number };
156
+ } {
157
+ return {
158
+ serviceName: NotificationProxyService.RSD_SERVICE_NAME,
159
+ port: this.address[1].toString(),
160
+ options: { createConnectionTimeout: this.timeout },
161
+ };
162
+ }
163
+ private async sendPlistDictionary(
164
+ request: PlistDictionary,
165
+ ): Promise<PlistDictionary> {
166
+ if (!this._conn) {
167
+ this._conn = await this.connectToNotificationProxyService();
168
+ }
169
+ const response = await this._conn.sendPlistRequest(request, this.timeout);
170
+ if (!response) {
171
+ return {};
172
+ }
173
+ if (Array.isArray(response)) {
174
+ return response.length > 0 ? (response[0] as PlistDictionary) : {};
175
+ }
176
+ return response as PlistDictionary;
177
+ }
178
+ }
179
+
180
+ export { NotificationProxyService };
@@ -1,6 +1,6 @@
1
1
  import { logger } from '@appium/support';
2
+ import type { PacketConsumer, PacketData } from 'appium-ios-tuntap';
2
3
  import { EventEmitter } from 'events';
3
- import type { PacketConsumer, PacketData } from 'tuntap-bridge';
4
4
 
5
5
  import { isBinaryPlist } from '../../../lib/plist/binary-plist-parser.js';
6
6
  import { parsePlist } from '../../../lib/plist/unified-plist-parser.js';
package/src/services.ts CHANGED
@@ -5,9 +5,11 @@ import { TunnelManager } from './lib/tunnel/index.js';
5
5
  import { TunnelApiClient } from './lib/tunnel/tunnel-api-client.js';
6
6
  import type {
7
7
  DiagnosticsServiceWithConnection,
8
+ NotificationProxyServiceWithConnection,
8
9
  SyslogService as SyslogServiceType,
9
10
  } from './lib/types.js';
10
11
  import DiagnosticsService from './services/ios/diagnostic-service/index.js';
12
+ import { NotificationProxyService } from './services/ios/notification-proxy/index.js';
11
13
  import SyslogService from './services/ios/syslog-service/index.js';
12
14
 
13
15
  const APPIUM_XCUITEST_DRIVER_NAME = 'appium-xcuitest-driver';
@@ -29,6 +31,22 @@ export async function startDiagnosticsService(
29
31
  };
30
32
  }
31
33
 
34
+ export async function startNotificationProxyService(
35
+ udid: string,
36
+ ): Promise<NotificationProxyServiceWithConnection> {
37
+ const { remoteXPC, tunnelConnection } = await createRemoteXPCConnection(udid);
38
+ const notificationProxyService = remoteXPC.findService(
39
+ NotificationProxyService.RSD_SERVICE_NAME,
40
+ );
41
+ return {
42
+ remoteXPC: remoteXPC as RemoteXpcConnection,
43
+ notificationProxyService: new NotificationProxyService([
44
+ tunnelConnection.host,
45
+ parseInt(notificationProxyService.port, 10),
46
+ ]),
47
+ };
48
+ }
49
+
32
50
  export async function startSyslogService(
33
51
  udid: string,
34
52
  ): Promise<SyslogServiceType> {