@ekhein/lamda-node-sdk 2.0.1 → 2.0.3

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 (56) hide show
  1. package/dist/exceptions/remoteRpc.exception.d.ts +12 -0
  2. package/dist/exceptions/remoteRpc.exception.js +10 -0
  3. package/dist/interceptor/remoteException.Interceptor.js +19 -0
  4. package/dist/{src/main.d.ts → main.d.ts} +7 -0
  5. package/dist/{src/main.js → main.js} +16 -8
  6. package/package.json +1 -1
  7. package/dist/src/interceptor/remoteException.Interceptor.js +0 -13
  8. /package/dist/{src/constants → constants}/activity.flag.d.ts +0 -0
  9. /package/dist/{src/constants → constants}/activity.flag.js +0 -0
  10. /package/dist/{src/constants → constants}/android.intent.d.ts +0 -0
  11. /package/dist/{src/constants → constants}/android.intent.js +0 -0
  12. /package/dist/{src/constants → constants}/android.permission.d.ts +0 -0
  13. /package/dist/{src/constants → constants}/android.permission.js +0 -0
  14. /package/dist/{src/constants → constants}/index.d.ts +0 -0
  15. /package/dist/{src/constants → constants}/index.js +0 -0
  16. /package/dist/{src/decorators → decorators}/inject.decorator.d.ts +0 -0
  17. /package/dist/{src/decorators → decorators}/inject.decorator.js +0 -0
  18. /package/dist/{src/exceptions → exceptions}/remoteCall.exception.d.ts +0 -0
  19. /package/dist/{src/exceptions → exceptions}/remoteCall.exception.js +0 -0
  20. /package/dist/{src/exceptions → exceptions}/timeout.exception.d.ts +0 -0
  21. /package/dist/{src/exceptions → exceptions}/timeout.exception.js +0 -0
  22. /package/dist/{src/interceptor → interceptor}/remoteException.Interceptor.d.ts +0 -0
  23. /package/dist/{src/rpc → rpc}/application.d.ts +0 -0
  24. /package/dist/{src/rpc → rpc}/application.js +0 -0
  25. /package/dist/{src/rpc → rpc}/debug.d.ts +0 -0
  26. /package/dist/{src/rpc → rpc}/debug.js +0 -0
  27. /package/dist/{src/rpc → rpc}/file.d.ts +0 -0
  28. /package/dist/{src/rpc → rpc}/file.js +0 -0
  29. /package/dist/{src/rpc → rpc}/google/protobuf/any.d.ts +0 -0
  30. /package/dist/{src/rpc → rpc}/google/protobuf/any.js +0 -0
  31. /package/dist/{src/rpc → rpc}/google/protobuf/empty.d.ts +0 -0
  32. /package/dist/{src/rpc → rpc}/google/protobuf/empty.js +0 -0
  33. /package/dist/{src/rpc → rpc}/google/protobuf/struct.d.ts +0 -0
  34. /package/dist/{src/rpc → rpc}/google/protobuf/struct.js +0 -0
  35. /package/dist/{src/rpc → rpc}/policy.d.ts +0 -0
  36. /package/dist/{src/rpc → rpc}/policy.js +0 -0
  37. /package/dist/{src/rpc → rpc}/proxy.d.ts +0 -0
  38. /package/dist/{src/rpc → rpc}/proxy.js +0 -0
  39. /package/dist/{src/rpc → rpc}/services.d.ts +0 -0
  40. /package/dist/{src/rpc → rpc}/services.js +0 -0
  41. /package/dist/{src/rpc → rpc}/settings.d.ts +0 -0
  42. /package/dist/{src/rpc → rpc}/settings.js +0 -0
  43. /package/dist/{src/rpc → rpc}/shell.d.ts +0 -0
  44. /package/dist/{src/rpc → rpc}/shell.js +0 -0
  45. /package/dist/{src/rpc → rpc}/status.d.ts +0 -0
  46. /package/dist/{src/rpc → rpc}/status.js +0 -0
  47. /package/dist/{src/rpc → rpc}/storage.d.ts +0 -0
  48. /package/dist/{src/rpc → rpc}/storage.js +0 -0
  49. /package/dist/{src/rpc → rpc}/types.d.ts +0 -0
  50. /package/dist/{src/rpc → rpc}/types.js +0 -0
  51. /package/dist/{src/rpc → rpc}/uiautomator.d.ts +0 -0
  52. /package/dist/{src/rpc → rpc}/uiautomator.js +0 -0
  53. /package/dist/{src/rpc → rpc}/util.d.ts +0 -0
  54. /package/dist/{src/rpc → rpc}/util.js +0 -0
  55. /package/dist/{src/rpc → rpc}/wifi.d.ts +0 -0
  56. /package/dist/{src/rpc → rpc}/wifi.js +0 -0
@@ -0,0 +1,12 @@
1
+ import { ClientMiddlewareCall } from "nice-grpc";
2
+ export declare class RemoteRPCException<Request, Response> extends Error {
3
+ readonly call: ClientMiddlewareCall<Request, Response>;
4
+ readonly error: {
5
+ code: number;
6
+ details: string;
7
+ };
8
+ constructor(call: ClientMiddlewareCall<Request, Response>, error: {
9
+ code: number;
10
+ details: string;
11
+ });
12
+ }
@@ -0,0 +1,10 @@
1
+ import { format } from 'util';
2
+ export class RemoteRPCException extends Error {
3
+ call;
4
+ error;
5
+ constructor(call, error) {
6
+ super(format("%s %s::%s", RemoteRPCException.name, call.method.path, error.details));
7
+ this.call = call;
8
+ this.error = error;
9
+ }
10
+ }
@@ -0,0 +1,19 @@
1
+ import { RemoteRPCException } from "../exceptions/remoteRpc.exception";
2
+ import { RemoteCallException } from "../exceptions/remoteCall.exception";
3
+ export function RemoteExceptionInterceptor() {
4
+ return async function* (call, options) {
5
+ try {
6
+ return yield* call.next(call.request, options);
7
+ }
8
+ catch (error) {
9
+ try {
10
+ const { exception } = JSON.parse(error.details);
11
+ const { name, args } = JSON.parse(exception);
12
+ throw new RemoteCallException(call, name, args);
13
+ }
14
+ catch (_) {
15
+ throw new RemoteRPCException(call, error);
16
+ }
17
+ }
18
+ };
19
+ }
@@ -22,4 +22,11 @@ export declare class Device {
22
22
  passwd(pwd: string, keyboard: Record<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9", Parameters<typeof this.UiAutomator["selectorClick"]>[0]>): Promise<void>;
23
23
  open(data: string): Promise<import("./rpc/types").Boolean>;
24
24
  stop(...args: Parameters<typeof this.Application["stopApplication"]>): Promise<import("./rpc/types").Boolean>;
25
+ call(args: {
26
+ package: string;
27
+ callinfo: {
28
+ method: string;
29
+ args: Array<any>;
30
+ };
31
+ }): Promise<any>;
25
32
  }
@@ -32,15 +32,15 @@ export class Device {
32
32
  ["grpc.enable_http_proxy"]: 0,
33
33
  ["grpc.service_config"]: JSON.stringify({
34
34
  ["methodConfig"]: [{
35
- ["name"]: [{}]
35
+ ["name"]: [{}],
36
+ ["retryPolicy"]: {
37
+ ["maxAttempts"]: 5,
38
+ ["retryableStatusCodes"]: ["UNAVAILABLE"],
39
+ ["backoffMultiplier"]: 2,
40
+ ["initialBackoff"]: "0.5s",
41
+ ["maxBackoff"]: "15s",
42
+ }
36
43
  }],
37
- ["retryPolicy"]: {
38
- ["maxAttempts"]: 5,
39
- ["retryableStatusCodes"]: ["UNAVAILABLE"],
40
- ["backoffMultiplier"]: 2,
41
- ["initialBackoff"]: "0.5s",
42
- ["maxBackoff"]: "15s",
43
- }
44
44
  })
45
45
  });
46
46
  }
@@ -80,6 +80,14 @@ export class Device {
80
80
  return this.Application
81
81
  .stopApplication(...args);
82
82
  }
83
+ async call(args) {
84
+ const callinfo = JSON.stringify(args.callinfo);
85
+ return this.Application
86
+ .callScript({ ...args, callinfo })
87
+ .then(async (call) => {
88
+ return JSON.parse(call.callresult);
89
+ });
90
+ }
83
91
  }
84
92
  __decorate([
85
93
  Inject(UtilDefinition),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekhein/lamda-node-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "author": "ekhein",
6
6
  "license": "MIT",
@@ -1,13 +0,0 @@
1
- import { RemoteCallException } from "../exceptions/remoteCall.exception";
2
- export function RemoteExceptionInterceptor() {
3
- return async function* (call, options) {
4
- try {
5
- return yield* call.next(call.request, options);
6
- }
7
- catch (error) {
8
- const { exception } = JSON.parse(error.details);
9
- const { name, args } = JSON.parse(exception);
10
- throw new RemoteCallException(call, name, args);
11
- }
12
- };
13
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes