@ekhein/lamda-node-sdk 2.1.8 → 2.2.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/main.d.ts +1 -15
- package/dist/main.js +4 -73
- package/package.json +1 -2
package/dist/main.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class Device {
|
|
|
16
16
|
readonly Settings: SettingsClient;
|
|
17
17
|
private channel;
|
|
18
18
|
private client;
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(lamdaURL?: string);
|
|
20
20
|
click(selector: Partial<Selector>, corner?: Corner): Promise<import("./rpc/types").Boolean>;
|
|
21
21
|
clickEx(keys: string, keyboard: Record<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9", Partial<Selector>>): Promise<void>;
|
|
22
22
|
waitFor(selector: Partial<Selector>, timeout?: number): Promise<true>;
|
|
@@ -33,17 +33,3 @@ export declare class Device {
|
|
|
33
33
|
};
|
|
34
34
|
}): Promise<any>;
|
|
35
35
|
}
|
|
36
|
-
export declare class Storage {
|
|
37
|
-
private readonly $;
|
|
38
|
-
private readonly container;
|
|
39
|
-
constructor($: Device, container: string);
|
|
40
|
-
set(key: string, data: any): Promise<boolean>;
|
|
41
|
-
setex(key: string, data: any, ttl: number): Promise<boolean>;
|
|
42
|
-
setnx(key: string, data: any): Promise<boolean>;
|
|
43
|
-
expire(key: string, ttl: number): Promise<boolean>;
|
|
44
|
-
get<T = any>(key: string, defaultValue?: T): Promise<T>;
|
|
45
|
-
ttl(key: string): Promise<number>;
|
|
46
|
-
exists(key: string): Promise<boolean>;
|
|
47
|
-
delete(key: string): Promise<boolean>;
|
|
48
|
-
clear(): Promise<boolean>;
|
|
49
|
-
}
|
package/dist/main.js
CHANGED
|
@@ -9,8 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const msgpackr_1 = require("msgpackr");
|
|
12
|
+
exports.Device = void 0;
|
|
14
13
|
const nice_grpc_1 = require("nice-grpc");
|
|
15
14
|
const inject_decorator_1 = require("./decorators/inject.decorator");
|
|
16
15
|
const android_intent_1 = require("./constants/android.intent");
|
|
@@ -21,12 +20,12 @@ const services_1 = require("./rpc/services");
|
|
|
21
20
|
class Device {
|
|
22
21
|
channel;
|
|
23
22
|
client;
|
|
24
|
-
constructor(
|
|
25
|
-
const address =
|
|
23
|
+
constructor(lamdaURL = process.env.lamda || "http://127.0.0.1:65000") {
|
|
24
|
+
const address = new URL(lamdaURL);
|
|
26
25
|
const credentials = nice_grpc_1.ChannelCredentials.createInsecure();
|
|
27
26
|
this.client = (0, nice_grpc_1.createClientFactory)()
|
|
28
27
|
.use((0, remoteException_Interceptor_1.RemoteExceptionInterceptor)());
|
|
29
|
-
this.channel = (0, nice_grpc_1.createChannel)(address, credentials, {
|
|
28
|
+
this.channel = (0, nice_grpc_1.createChannel)(address.host, credentials, {
|
|
30
29
|
["grpc.max_send_message_length"]: 64 * 1024 * 1024,
|
|
31
30
|
["grpc.max_receive_message_length"]: 128 * 1024 * 1024,
|
|
32
31
|
["grpc.keepalive_time_ms"]: 60 * 1000,
|
|
@@ -154,71 +153,3 @@ __decorate([
|
|
|
154
153
|
(0, inject_decorator_1.Inject)(services_1.SettingsDefinition),
|
|
155
154
|
__metadata("design:type", Object)
|
|
156
155
|
], Device.prototype, "Settings", void 0);
|
|
157
|
-
class Storage {
|
|
158
|
-
$;
|
|
159
|
-
container;
|
|
160
|
-
constructor($, container) {
|
|
161
|
-
this.$ = $;
|
|
162
|
-
this.container = container;
|
|
163
|
-
for (const method in $.Storage) {
|
|
164
|
-
if (method != "clearAll") {
|
|
165
|
-
const origin = $.Storage[method];
|
|
166
|
-
$.Storage[method] = function (params) {
|
|
167
|
-
Object.assign(params, { container });
|
|
168
|
-
return origin.call(this, params);
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async set(key, data) {
|
|
174
|
-
const value = (0, msgpackr_1.pack)(data);
|
|
175
|
-
const result = await this.$.Storage
|
|
176
|
-
.set({ key, value });
|
|
177
|
-
return result.value;
|
|
178
|
-
}
|
|
179
|
-
async setex(key, data, ttl) {
|
|
180
|
-
const value = (0, msgpackr_1.pack)(data);
|
|
181
|
-
const result = await this.$.Storage
|
|
182
|
-
.setex({ key, value, ttl });
|
|
183
|
-
return result.value;
|
|
184
|
-
}
|
|
185
|
-
async setnx(key, data) {
|
|
186
|
-
const value = (0, msgpackr_1.pack)(data);
|
|
187
|
-
const result = await this.$.Storage
|
|
188
|
-
.setnx({ key, value });
|
|
189
|
-
return result.value;
|
|
190
|
-
}
|
|
191
|
-
async expire(key, ttl) {
|
|
192
|
-
const result = await this.$.Storage
|
|
193
|
-
.expire({ key, ttl });
|
|
194
|
-
return result.value;
|
|
195
|
-
}
|
|
196
|
-
async get(key, defaultValue) {
|
|
197
|
-
const result = await this.$.Storage
|
|
198
|
-
.get({ key });
|
|
199
|
-
if (result.value.length == 0)
|
|
200
|
-
return defaultValue;
|
|
201
|
-
return (0, msgpackr_1.unpack)(result.value);
|
|
202
|
-
}
|
|
203
|
-
async ttl(key) {
|
|
204
|
-
const result = await this.$.Storage
|
|
205
|
-
.ttl({ key });
|
|
206
|
-
return result.value;
|
|
207
|
-
}
|
|
208
|
-
async exists(key) {
|
|
209
|
-
const result = await this.$.Storage
|
|
210
|
-
.exists({ key });
|
|
211
|
-
return result.value;
|
|
212
|
-
}
|
|
213
|
-
async delete(key) {
|
|
214
|
-
const result = await this.$.Storage
|
|
215
|
-
.delete({ key });
|
|
216
|
-
return result.value;
|
|
217
|
-
}
|
|
218
|
-
async clear() {
|
|
219
|
-
const result = await this.$.Storage
|
|
220
|
-
.clearContainer({ container: this.container });
|
|
221
|
-
return result.value;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.Storage = Storage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekhein/lamda-node-sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"author": "ekhein",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/main.js",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bufbuild/protobuf": "^2.4.0",
|
|
19
19
|
"long": "^5.3.2",
|
|
20
|
-
"msgpackr": "^1.11.5",
|
|
21
20
|
"nice-grpc": "^2.1.12",
|
|
22
21
|
"nice-grpc-common": "^2.0.2",
|
|
23
22
|
"protobufjs": "^7.5.2"
|