@monimesl/dot-dash 0.1.0-alpha.21 → 0.1.0-alpha.24
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/index.d.ts +384 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +487 -60
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,112 @@
|
|
|
1
|
-
import { HostCallOptions, HostError, HostError as DashError,
|
|
1
|
+
import { HostCallOptions, HostError, HostError as DashError, HostErrorCode, HostErrorCode as DashErrorCode, HostRequest } from "@monimesl/dot-core";
|
|
2
|
+
//#region src/contacts/pick-phone.d.ts
|
|
3
|
+
interface PickedContact {
|
|
4
|
+
name: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
}
|
|
7
|
+
interface PickPhoneMethods {
|
|
8
|
+
'dash.contacts.pickPhone': {
|
|
9
|
+
params: Record<string, never>;
|
|
10
|
+
result: PickedContact;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Shows the phone's contacts so the person chooses one phone number, such as who to send money to.
|
|
15
|
+
* Needs the `contacts` permission. The dot sees only the chosen contact. Rejects with `cancelled` if
|
|
16
|
+
* the person closes it.
|
|
17
|
+
* @since 1.0
|
|
18
|
+
*/
|
|
19
|
+
declare function pickPhone(callOptions?: CallOptions): DashRequest<PickedContact>;
|
|
20
|
+
declare namespace index_d_exports$9 {
|
|
21
|
+
export { ContactsMethods, PickedContact, pickPhone };
|
|
22
|
+
}
|
|
23
|
+
type ContactsMethods = PickPhoneMethods;
|
|
24
|
+
declare namespace index_d_exports$8 {
|
|
25
|
+
export { CryptoInput, CryptoMethods, CryptoOutputOptions, HmacAlgorithm, HmacOptions, hmac, randomBytes, randomUUID, sha256, sha512 };
|
|
26
|
+
}
|
|
27
|
+
type CryptoInput = string | {
|
|
28
|
+
base64: string;
|
|
29
|
+
};
|
|
30
|
+
interface CryptoOutputOptions {
|
|
31
|
+
as?: 'hex' | 'base64';
|
|
32
|
+
}
|
|
33
|
+
type HmacAlgorithm = 'sha256' | 'sha512';
|
|
34
|
+
interface HmacOptions extends CryptoOutputOptions {
|
|
35
|
+
algorithm: HmacAlgorithm;
|
|
36
|
+
key: CryptoInput;
|
|
37
|
+
data: CryptoInput;
|
|
38
|
+
}
|
|
39
|
+
type InputEncoding = 'text' | 'base64';
|
|
40
|
+
type OutputEncoding = 'hex' | 'base64';
|
|
41
|
+
interface WireInput {
|
|
42
|
+
data: string;
|
|
43
|
+
dataEncoding: InputEncoding;
|
|
44
|
+
as: OutputEncoding;
|
|
45
|
+
}
|
|
46
|
+
interface CryptoMethods {
|
|
47
|
+
'dash.crypto.sha256': {
|
|
48
|
+
params: WireInput;
|
|
49
|
+
result: string;
|
|
50
|
+
};
|
|
51
|
+
'dash.crypto.sha512': {
|
|
52
|
+
params: WireInput;
|
|
53
|
+
result: string;
|
|
54
|
+
};
|
|
55
|
+
'dash.crypto.hmac': {
|
|
56
|
+
params: WireInput & {
|
|
57
|
+
algorithm: HmacAlgorithm;
|
|
58
|
+
key: string;
|
|
59
|
+
keyEncoding: InputEncoding;
|
|
60
|
+
};
|
|
61
|
+
result: string;
|
|
62
|
+
};
|
|
63
|
+
'dash.crypto.randomBytes': {
|
|
64
|
+
params: {
|
|
65
|
+
count: number;
|
|
66
|
+
as: OutputEncoding;
|
|
67
|
+
};
|
|
68
|
+
result: string;
|
|
69
|
+
};
|
|
70
|
+
'dash.crypto.randomUUID': {
|
|
71
|
+
params: Record<string, never>;
|
|
72
|
+
result: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** @since 1.0 */
|
|
76
|
+
declare function sha256(data: CryptoInput, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
77
|
+
/** @since 1.0 */
|
|
78
|
+
declare function sha512(data: CryptoInput, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Signs `data` with `key`, as HMAC-SHA256 or HMAC-SHA512, such as
|
|
81
|
+
* `hmac({ algorithm: 'sha256', key, data })`.
|
|
82
|
+
* @since 1.0
|
|
83
|
+
*/
|
|
84
|
+
declare function hmac(options: HmacOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
85
|
+
/**
|
|
86
|
+
* `count` secure random bytes, from 1 to 1024, such as for a nonce.
|
|
87
|
+
* @since 1.0
|
|
88
|
+
*/
|
|
89
|
+
declare function randomBytes(count: number, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
90
|
+
/**
|
|
91
|
+
* A random version 4 UUID, such as "3f0e5c3a-6d1b-4c8e-9a2f-1b7d4e6a9c05".
|
|
92
|
+
* @since 1.0
|
|
93
|
+
*/
|
|
94
|
+
declare function randomUUID(callOptions?: CallOptions): DashRequest<string>;
|
|
95
|
+
declare namespace index_d_exports$7 {
|
|
96
|
+
export { DotMethods, close };
|
|
97
|
+
}
|
|
98
|
+
interface DotMethods {
|
|
99
|
+
'dash.dot.close': {
|
|
100
|
+
params: Record<string, never>;
|
|
101
|
+
result: void;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Closes the dot, as going back from its first page does. Calls still running are cancelled.
|
|
106
|
+
* @since 1.0
|
|
107
|
+
*/
|
|
108
|
+
declare function close(callOptions?: CallOptions): DashRequest<void>;
|
|
109
|
+
//#endregion
|
|
2
110
|
//#region src/files.d.ts
|
|
3
111
|
interface DotFile {
|
|
4
112
|
id: string;
|
|
@@ -8,6 +116,26 @@ interface DotFile {
|
|
|
8
116
|
url: string;
|
|
9
117
|
}
|
|
10
118
|
//#endregion
|
|
119
|
+
//#region src/media/pick-file.d.ts
|
|
120
|
+
interface PickFileOptions {
|
|
121
|
+
types?: string[];
|
|
122
|
+
}
|
|
123
|
+
interface PickFileMethods {
|
|
124
|
+
'dash.media.pickFile': {
|
|
125
|
+
params: {
|
|
126
|
+
types?: string[];
|
|
127
|
+
};
|
|
128
|
+
result: DotFile;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Lets the person choose a file from their phone, of at most 25 MB. Needs the `files` permission.
|
|
133
|
+
* Rejects with `cancelled` if they close the picker, and with `invalid` for a larger file. Like a
|
|
134
|
+
* download, it lasts until the dot closes, so `dash.storage.file.save` it to keep it.
|
|
135
|
+
* @since 1.0
|
|
136
|
+
*/
|
|
137
|
+
declare function pickFile(options?: PickFileOptions, callOptions?: CallOptions): DashRequest<DotFile>;
|
|
138
|
+
//#endregion
|
|
11
139
|
//#region src/media/pick-photo.d.ts
|
|
12
140
|
type PhotoSource = 'library' | 'camera';
|
|
13
141
|
interface PickPhotoOptions {
|
|
@@ -21,6 +149,13 @@ interface PickPhotoMethods {
|
|
|
21
149
|
result: DotFile;
|
|
22
150
|
};
|
|
23
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Lets the person choose a photo or take one. Resolves with it as a JPEG of at most 2048 pixels on its
|
|
154
|
+
* longest side, without its location or other details. Rejects with `cancelled` if they close the
|
|
155
|
+
* picker, and with `unsupported` on a device without a camera. Save it with `dash.storage.file.save`
|
|
156
|
+
* to keep it after the dot closes.
|
|
157
|
+
* @since 1.0
|
|
158
|
+
*/
|
|
24
159
|
declare function pickPhoto(options: PickPhotoOptions, callOptions?: CallOptions): DashRequest<DotFile>;
|
|
25
160
|
//#endregion
|
|
26
161
|
//#region src/media/scan-code.d.ts
|
|
@@ -35,11 +170,16 @@ interface ScanCodeMethods {
|
|
|
35
170
|
result: ScannedCode;
|
|
36
171
|
};
|
|
37
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Opens Dash's scanner until it reads a QR code. Needs the `camera` permission. Rejects with
|
|
175
|
+
* `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.
|
|
176
|
+
* @since 1.0
|
|
177
|
+
*/
|
|
38
178
|
declare function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode>;
|
|
39
|
-
declare namespace index_d_exports$
|
|
40
|
-
export { CodeFormat, MediaMethods, PhotoSource, PickPhotoOptions, ScannedCode, pickPhoto, scanCode };
|
|
179
|
+
declare namespace index_d_exports$6 {
|
|
180
|
+
export { CodeFormat, MediaMethods, PhotoSource, PickFileOptions, PickPhotoOptions, ScannedCode, pickFile, pickPhoto, scanCode };
|
|
41
181
|
}
|
|
42
|
-
type MediaMethods = PickPhotoMethods & ScanCodeMethods;
|
|
182
|
+
type MediaMethods = PickFileMethods & PickPhotoMethods & ScanCodeMethods;
|
|
43
183
|
declare namespace http_d_exports {
|
|
44
184
|
export { HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpMethods, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, download, request, upload };
|
|
45
185
|
}
|
|
@@ -74,7 +214,7 @@ type HttpDownloadResponse = (Omit<HttpResponse, 'ok' | 'body'> & {
|
|
|
74
214
|
});
|
|
75
215
|
interface HttpUploadFile {
|
|
76
216
|
field: string;
|
|
77
|
-
file: DotFile
|
|
217
|
+
file: DotFile;
|
|
78
218
|
name?: string;
|
|
79
219
|
}
|
|
80
220
|
interface HttpUploadRequest {
|
|
@@ -108,8 +248,20 @@ interface HttpMethods {
|
|
|
108
248
|
result: HttpResponse;
|
|
109
249
|
};
|
|
110
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Like fetch, resolves with any response, even a 404. An object body is sent as JSON.
|
|
253
|
+
* @since 1.0
|
|
254
|
+
*/
|
|
111
255
|
declare function request<ResponseBody = string, RequestBody extends HttpRequestBody = HttpRequestBody>(options: HttpRequest<RequestBody> & HttpReadOptions<ResponseBody>, callOptions?: CallOptions): DashRequest<HttpResponse<ResponseBody>>;
|
|
256
|
+
/**
|
|
257
|
+
* Saves a 2xx response's body, up to 256 MB, to a temporary file.
|
|
258
|
+
* @since 1.0
|
|
259
|
+
*/
|
|
112
260
|
declare function download(options: HttpDownloadRequest, callOptions?: CallOptions): DashRequest<HttpDownloadResponse>;
|
|
261
|
+
/**
|
|
262
|
+
* Sends the dot's files as a multipart form.
|
|
263
|
+
* @since 1.0
|
|
264
|
+
*/
|
|
113
265
|
declare function upload<ResponseBody = string>(options: HttpUploadRequest & HttpReadOptions<ResponseBody>, callOptions?: CallOptions): DashRequest<HttpResponse<ResponseBody>>;
|
|
114
266
|
//#endregion
|
|
115
267
|
//#region src/network/status.d.ts
|
|
@@ -124,8 +276,12 @@ interface StatusMethods {
|
|
|
124
276
|
result: NetworkStatus;
|
|
125
277
|
};
|
|
126
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Whether the phone is online now, and how. It can still be online without reaching a server.
|
|
281
|
+
* @since 1.0
|
|
282
|
+
*/
|
|
127
283
|
declare function status(callOptions?: CallOptions): DashRequest<NetworkStatus>;
|
|
128
|
-
declare namespace index_d_exports$
|
|
284
|
+
declare namespace index_d_exports$5 {
|
|
129
285
|
export { ConnectionType, HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, NetworkMethods, NetworkStatus, http_d_exports as http, status };
|
|
130
286
|
}
|
|
131
287
|
type NetworkMethods = HttpMethods & StatusMethods;
|
|
@@ -174,14 +330,26 @@ interface CacheMethods {
|
|
|
174
330
|
interface CacheSetOptions {
|
|
175
331
|
ttl?: number | undefined;
|
|
176
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Resolves with null for a missing or expired key.
|
|
335
|
+
* @since 1.0
|
|
336
|
+
*/
|
|
177
337
|
declare function get$1<Value extends CacheValue = CacheValue>(key: string, callOptions?: CallOptions): DashRequest<Value | null>;
|
|
338
|
+
/** @since 1.0 */
|
|
178
339
|
declare function set$1(key: string, value: CacheValue, options?: CacheSetOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
340
|
+
/** @since 1.0 */
|
|
179
341
|
declare function remove$2(key: string, callOptions?: CallOptions): DashRequest<void>;
|
|
342
|
+
/** @since 1.0 */
|
|
180
343
|
declare function exists(key: string, callOptions?: CallOptions): DashRequest<boolean>;
|
|
344
|
+
/**
|
|
345
|
+
* The keys, sorted.
|
|
346
|
+
* @since 1.0
|
|
347
|
+
*/
|
|
181
348
|
declare function keys(callOptions?: CallOptions): DashRequest<string[]>;
|
|
349
|
+
/** @since 1.0 */
|
|
182
350
|
declare function clear$1(callOptions?: CallOptions): DashRequest<void>;
|
|
183
351
|
declare namespace file_d_exports {
|
|
184
|
-
export { FileEncoding, FileEntry, FileMethods,
|
|
352
|
+
export { FileEncoding, FileEntry, FileMethods, ReadOptions, ReplaceOptions, StorageUsage, WriteOptions, copy, createFolder, list, move, open, read, remove$1 as remove, save, stat, usage, write };
|
|
185
353
|
}
|
|
186
354
|
interface FileEntry {
|
|
187
355
|
name: string;
|
|
@@ -273,15 +441,6 @@ interface FileMethods {
|
|
|
273
441
|
params: Record<string, never>;
|
|
274
442
|
result: StorageUsage;
|
|
275
443
|
};
|
|
276
|
-
'dash.storage.file.pick': {
|
|
277
|
-
params: {
|
|
278
|
-
types?: string[];
|
|
279
|
-
};
|
|
280
|
-
result: DotFile;
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
interface PickFileOptions {
|
|
284
|
-
types?: string[];
|
|
285
444
|
}
|
|
286
445
|
interface ReadOptions {
|
|
287
446
|
as?: FileEncoding;
|
|
@@ -293,22 +452,50 @@ interface WriteOptions {
|
|
|
293
452
|
interface ReplaceOptions {
|
|
294
453
|
overwrite?: boolean;
|
|
295
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* Reads a file of up to 5 MB.
|
|
457
|
+
* @since 1.0
|
|
458
|
+
*/
|
|
296
459
|
declare function read(path: string, options?: ReadOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
460
|
+
/**
|
|
461
|
+
* Creates any missing folders above the file.
|
|
462
|
+
* @since 1.0
|
|
463
|
+
*/
|
|
297
464
|
declare function write(path: string, data: string, options?: WriteOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
465
|
+
/** @since 1.0 */
|
|
298
466
|
declare function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null>;
|
|
467
|
+
/**
|
|
468
|
+
* Sorted by path.
|
|
469
|
+
* @since 1.0
|
|
470
|
+
*/
|
|
299
471
|
declare function list(path?: string, options?: {
|
|
300
472
|
recursive?: boolean;
|
|
301
473
|
}, callOptions?: CallOptions): DashRequest<FileEntry[]>;
|
|
474
|
+
/** @since 1.0 */
|
|
302
475
|
declare function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
476
|
+
/** @since 1.0 */
|
|
303
477
|
declare function move(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
478
|
+
/** @since 1.0 */
|
|
304
479
|
declare function copy(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
480
|
+
/**
|
|
481
|
+
* Removing a folder that isn't empty needs `recursive`.
|
|
482
|
+
* @since 1.0
|
|
483
|
+
*/
|
|
305
484
|
declare function remove$1(path: string, options?: {
|
|
306
485
|
recursive?: boolean;
|
|
307
486
|
}, callOptions?: CallOptions): DashRequest<void>;
|
|
308
|
-
|
|
487
|
+
/**
|
|
488
|
+
* Keeps a temporary file, such as a download, at `path`.
|
|
489
|
+
* @since 1.0
|
|
490
|
+
*/
|
|
491
|
+
declare function save(file: DotFile, path: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
492
|
+
/**
|
|
493
|
+
* A stored file as a DotFile, to show with its `url` or send with `http.upload`.
|
|
494
|
+
* @since 1.0
|
|
495
|
+
*/
|
|
309
496
|
declare function open(path: string, callOptions?: CallOptions): DashRequest<DotFile>;
|
|
497
|
+
/** @since 1.0 */
|
|
310
498
|
declare function usage(callOptions?: CallOptions): DashRequest<StorageUsage>;
|
|
311
|
-
declare function pick(options?: PickFileOptions, callOptions?: CallOptions): DashRequest<DotFile>;
|
|
312
499
|
declare namespace secret_d_exports {
|
|
313
500
|
export { SecretMethods, clear, get, remove, set };
|
|
314
501
|
}
|
|
@@ -337,12 +524,16 @@ interface SecretMethods {
|
|
|
337
524
|
result: void;
|
|
338
525
|
};
|
|
339
526
|
}
|
|
527
|
+
/** @since 1.0 */
|
|
340
528
|
declare function get(key: string, callOptions?: CallOptions): DashRequest<string | null>;
|
|
529
|
+
/** @since 1.0 */
|
|
341
530
|
declare function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void>;
|
|
531
|
+
/** @since 1.0 */
|
|
342
532
|
declare function remove(key: string, callOptions?: CallOptions): DashRequest<void>;
|
|
533
|
+
/** @since 1.0 */
|
|
343
534
|
declare function clear(callOptions?: CallOptions): DashRequest<void>;
|
|
344
|
-
declare namespace index_d_exports$
|
|
345
|
-
export { CacheSetOptions, CacheValue, FileEncoding, FileEntry,
|
|
535
|
+
declare namespace index_d_exports$4 {
|
|
536
|
+
export { CacheSetOptions, CacheValue, FileEncoding, FileEntry, ReadOptions, ReplaceOptions, StorageMethods, StorageUsage, WriteOptions, cache_d_exports as cache, file_d_exports as file, secret_d_exports as secret };
|
|
346
537
|
}
|
|
347
538
|
type StorageMethods = FileMethods & CacheMethods & SecretMethods;
|
|
348
539
|
//#endregion
|
|
@@ -355,6 +546,7 @@ interface ClipboardMethods {
|
|
|
355
546
|
result: void;
|
|
356
547
|
};
|
|
357
548
|
}
|
|
549
|
+
/** @since 1.0 */
|
|
358
550
|
declare function copyText(text: string, callOptions?: CallOptions): DashRequest<void>;
|
|
359
551
|
//#endregion
|
|
360
552
|
//#region src/system/delay.d.ts
|
|
@@ -366,6 +558,10 @@ interface DelayMethods {
|
|
|
366
558
|
result: void;
|
|
367
559
|
};
|
|
368
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.
|
|
563
|
+
* @since 1.0
|
|
564
|
+
*/
|
|
369
565
|
declare function delay(milliseconds: number, callOptions?: CallOptions): DashRequest<void>;
|
|
370
566
|
//#endregion
|
|
371
567
|
//#region src/system/dial.d.ts
|
|
@@ -377,6 +573,12 @@ interface DialMethods {
|
|
|
377
573
|
result: void;
|
|
378
574
|
};
|
|
379
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Opens the phone's dialer with `number` ready, such as "+232 76 123456" or a USSD code such as
|
|
578
|
+
* "*715#". The person taps Call. Spaces and dashes are fine; anything else but digits, +, * and #
|
|
579
|
+
* rejects with `invalid`.
|
|
580
|
+
* @since 1.0
|
|
581
|
+
*/
|
|
380
582
|
declare function dial(number: string, callOptions?: CallOptions): DashRequest<void>;
|
|
381
583
|
//#endregion
|
|
382
584
|
//#region src/system/haptics.d.ts
|
|
@@ -390,6 +592,10 @@ interface HapticsMethods {
|
|
|
390
592
|
result: void;
|
|
391
593
|
};
|
|
392
594
|
}
|
|
595
|
+
/**
|
|
596
|
+
* Plays a short vibration. Resolves once it's done.
|
|
597
|
+
* @since 1.0
|
|
598
|
+
*/
|
|
393
599
|
declare function vibrate(options?: VibrateOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
394
600
|
//#endregion
|
|
395
601
|
//#region src/system/info.d.ts
|
|
@@ -401,7 +607,7 @@ interface SystemInfo {
|
|
|
401
607
|
region: string | null;
|
|
402
608
|
timeZone: string;
|
|
403
609
|
dashVersion: string;
|
|
404
|
-
|
|
610
|
+
apiVersions: string[];
|
|
405
611
|
}
|
|
406
612
|
interface InfoMethods {
|
|
407
613
|
'dash.system.info': {
|
|
@@ -409,6 +615,10 @@ interface InfoMethods {
|
|
|
409
615
|
result: SystemInfo;
|
|
410
616
|
};
|
|
411
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.
|
|
620
|
+
* @since 1.0
|
|
621
|
+
*/
|
|
412
622
|
declare function info(callOptions?: CallOptions): DashRequest<SystemInfo>;
|
|
413
623
|
//#endregion
|
|
414
624
|
//#region src/system/open-url.d.ts
|
|
@@ -420,6 +630,10 @@ interface OpenUrlMethods {
|
|
|
420
630
|
result: void;
|
|
421
631
|
};
|
|
422
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Opens an https address in the device's browser. Any other address rejects with `invalid`.
|
|
635
|
+
* @since 1.0
|
|
636
|
+
*/
|
|
423
637
|
declare function openUrl(url: string, callOptions?: CallOptions): DashRequest<void>;
|
|
424
638
|
//#endregion
|
|
425
639
|
//#region src/system/screen.d.ts
|
|
@@ -438,7 +652,17 @@ interface ScreenMethods {
|
|
|
438
652
|
result: void;
|
|
439
653
|
};
|
|
440
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Keeps the screen from dimming and locking while the dot shows, such as while a ticket's QR code is
|
|
657
|
+
* up. Dash undoes it when the dot closes.
|
|
658
|
+
* @since 1.0
|
|
659
|
+
*/
|
|
441
660
|
declare function keepAwake(on: boolean, callOptions?: CallOptions): DashRequest<void>;
|
|
661
|
+
/**
|
|
662
|
+
* `max` makes the screen as bright as it goes, so a scanner can read a QR code on it, and `normal`
|
|
663
|
+
* puts it back. Dash puts it back too when the dot closes or the person leaves the app.
|
|
664
|
+
* @since 1.0
|
|
665
|
+
*/
|
|
442
666
|
declare function brightness(level: BrightnessLevel, callOptions?: CallOptions): DashRequest<void>;
|
|
443
667
|
//#endregion
|
|
444
668
|
//#region src/system/share.d.ts
|
|
@@ -446,7 +670,7 @@ interface ShareOptions {
|
|
|
446
670
|
title?: string;
|
|
447
671
|
text?: string;
|
|
448
672
|
url?: string;
|
|
449
|
-
file?: DotFile
|
|
673
|
+
file?: DotFile;
|
|
450
674
|
}
|
|
451
675
|
interface ShareMethods {
|
|
452
676
|
'dash.system.share': {
|
|
@@ -459,21 +683,28 @@ interface ShareMethods {
|
|
|
459
683
|
result: void;
|
|
460
684
|
};
|
|
461
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* Opens the device's share sheet. Resolves once it shows.
|
|
688
|
+
* @since 1.0
|
|
689
|
+
*/
|
|
462
690
|
declare function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
463
691
|
//#endregion
|
|
464
692
|
//#region src/system/torch.d.ts
|
|
465
|
-
type TorchState = 'on' | 'off';
|
|
466
693
|
interface TorchMethods {
|
|
467
694
|
'dash.system.torch': {
|
|
468
695
|
params: {
|
|
469
|
-
|
|
696
|
+
on: boolean;
|
|
470
697
|
};
|
|
471
698
|
result: void;
|
|
472
699
|
};
|
|
473
700
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
701
|
+
/**
|
|
702
|
+
* Turns the torch on or off. Rejects with `unsupported` on a device without one.
|
|
703
|
+
* @since 1.0
|
|
704
|
+
*/
|
|
705
|
+
declare function torch(on: boolean, callOptions?: CallOptions): DashRequest<void>;
|
|
706
|
+
declare namespace index_d_exports$3 {
|
|
707
|
+
export { BrightnessLevel, Platform, ShareOptions, SystemInfo, SystemMethods, VibrateOptions, VibrationStyle, brightness, copyText, delay, dial, info, keepAwake, openUrl, share, torch, vibrate };
|
|
477
708
|
}
|
|
478
709
|
type SystemMethods = ClipboardMethods & DelayMethods & DialMethods & HapticsMethods & InfoMethods & OpenUrlMethods & ScreenMethods & ShareMethods & TorchMethods;
|
|
479
710
|
//#endregion
|
|
@@ -497,6 +728,10 @@ interface DialogMethods {
|
|
|
497
728
|
result: AlertResult;
|
|
498
729
|
};
|
|
499
730
|
}
|
|
731
|
+
/**
|
|
732
|
+
* Shows a native alert. Resolves with the action the person chose.
|
|
733
|
+
* @since 1.0
|
|
734
|
+
*/
|
|
500
735
|
declare function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult>;
|
|
501
736
|
//#endregion
|
|
502
737
|
//#region src/ui/pickers.d.ts
|
|
@@ -520,52 +755,140 @@ interface PickerMethods {
|
|
|
520
755
|
result: string;
|
|
521
756
|
};
|
|
522
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* Opens the phone's own calendar. Resolves with the chosen date, such as "2026-10-24", or rejects
|
|
760
|
+
* with `cancelled` if the person closes it.
|
|
761
|
+
* @since 1.0
|
|
762
|
+
*/
|
|
523
763
|
declare function pickDate(options?: PickDateOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
764
|
+
/**
|
|
765
|
+
* Opens the phone's own clock. Resolves with the chosen time in 24 hours, such as "19:30", or
|
|
766
|
+
* rejects with `cancelled` if the person closes it.
|
|
767
|
+
* @since 1.0
|
|
768
|
+
*/
|
|
524
769
|
declare function pickTime(options?: PickTimeOptions, callOptions?: CallOptions): DashRequest<string>;
|
|
525
|
-
declare namespace index_d_exports$
|
|
770
|
+
declare namespace index_d_exports$2 {
|
|
526
771
|
export { AlertAction, AlertOptions, AlertResult, PickDateOptions, PickTimeOptions, UIMethods, alert, pickDate, pickTime };
|
|
527
772
|
}
|
|
528
773
|
type UIMethods = DialogMethods & PickerMethods;
|
|
529
774
|
//#endregion
|
|
530
775
|
//#region src/methods.d.ts
|
|
531
|
-
type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods;
|
|
776
|
+
type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods & DotMethods & AccountMethods & CryptoMethods;
|
|
532
777
|
type DashMethod = keyof DashMethods;
|
|
533
778
|
//#endregion
|
|
534
779
|
//#region src/call.d.ts
|
|
535
780
|
type CallOptions = HostCallOptions;
|
|
536
781
|
type DashRequest<Result> = HostRequest<Result>;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
interface PickedContact {
|
|
540
|
-
name: string;
|
|
541
|
-
phone: string;
|
|
782
|
+
declare namespace index_d_exports$1 {
|
|
783
|
+
export { AccountMethods, AccountProfile, ReadProfileOptions, readProfile };
|
|
542
784
|
}
|
|
543
|
-
interface
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
785
|
+
interface ReadProfileOptions {
|
|
786
|
+
nonce: string;
|
|
787
|
+
}
|
|
788
|
+
interface AccountProfile {
|
|
789
|
+
accountIdToken: string;
|
|
790
|
+
fullName: string;
|
|
791
|
+
}
|
|
792
|
+
interface AccountMethods {
|
|
793
|
+
'dash.account.readProfile': {
|
|
794
|
+
params: {
|
|
795
|
+
nonce: string;
|
|
796
|
+
};
|
|
797
|
+
result: AccountProfile;
|
|
547
798
|
};
|
|
548
799
|
}
|
|
549
|
-
|
|
800
|
+
/**
|
|
801
|
+
* The person signed in to Dash: their full name, and a token that names them in this dot. Needs the
|
|
802
|
+
* `account` permission. Rejects with `invalid` for a nonce that's empty or longer than 128
|
|
803
|
+
* characters, and with `failed` when no one is signed in.
|
|
804
|
+
* @since 1.0
|
|
805
|
+
*/
|
|
806
|
+
declare function readProfile(options: ReadProfileOptions, callOptions?: CallOptions): DashRequest<AccountProfile>;
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/api-versions.d.ts
|
|
809
|
+
export declare const DASH_API_VERSION = "1.0";
|
|
810
|
+
export declare const DASH_API_SINCE: {
|
|
811
|
+
readonly 'account.readProfile': "1.0";
|
|
812
|
+
readonly 'contacts.pickPhone': "1.0";
|
|
813
|
+
readonly 'crypto.hmac': "1.0";
|
|
814
|
+
readonly 'crypto.randomBytes': "1.0";
|
|
815
|
+
readonly 'crypto.randomUUID': "1.0";
|
|
816
|
+
readonly 'crypto.sha256': "1.0";
|
|
817
|
+
readonly 'crypto.sha512': "1.0";
|
|
818
|
+
readonly 'dot.close': "1.0";
|
|
819
|
+
readonly 'media.pickFile': "1.0";
|
|
820
|
+
readonly 'media.pickPhoto': "1.0";
|
|
821
|
+
readonly 'media.scanCode': "1.0";
|
|
822
|
+
readonly 'network.http.download': "1.0";
|
|
823
|
+
readonly 'network.http.request': "1.0";
|
|
824
|
+
readonly 'network.http.upload': "1.0";
|
|
825
|
+
readonly 'network.status': "1.0";
|
|
826
|
+
readonly 'storage.cache.clear': "1.0";
|
|
827
|
+
readonly 'storage.cache.exists': "1.0";
|
|
828
|
+
readonly 'storage.cache.get': "1.0";
|
|
829
|
+
readonly 'storage.cache.keys': "1.0";
|
|
830
|
+
readonly 'storage.cache.remove': "1.0";
|
|
831
|
+
readonly 'storage.cache.set': "1.0";
|
|
832
|
+
readonly 'storage.file.copy': "1.0";
|
|
833
|
+
readonly 'storage.file.createFolder': "1.0";
|
|
834
|
+
readonly 'storage.file.list': "1.0";
|
|
835
|
+
readonly 'storage.file.move': "1.0";
|
|
836
|
+
readonly 'storage.file.open': "1.0";
|
|
837
|
+
readonly 'storage.file.read': "1.0";
|
|
838
|
+
readonly 'storage.file.remove': "1.0";
|
|
839
|
+
readonly 'storage.file.save': "1.0";
|
|
840
|
+
readonly 'storage.file.stat': "1.0";
|
|
841
|
+
readonly 'storage.file.usage': "1.0";
|
|
842
|
+
readonly 'storage.file.write': "1.0";
|
|
843
|
+
readonly 'storage.secret.clear': "1.0";
|
|
844
|
+
readonly 'storage.secret.get': "1.0";
|
|
845
|
+
readonly 'storage.secret.remove': "1.0";
|
|
846
|
+
readonly 'storage.secret.set': "1.0";
|
|
847
|
+
readonly 'system.brightness': "1.0";
|
|
848
|
+
readonly 'system.copyText': "1.0";
|
|
849
|
+
readonly 'system.delay': "1.0";
|
|
850
|
+
readonly 'system.dial': "1.0";
|
|
851
|
+
readonly 'system.info': "1.0";
|
|
852
|
+
readonly 'system.keepAwake': "1.0";
|
|
853
|
+
readonly 'system.openUrl': "1.0";
|
|
854
|
+
readonly 'system.share': "1.0";
|
|
855
|
+
readonly 'system.torch': "1.0";
|
|
856
|
+
readonly 'system.vibrate': "1.0";
|
|
857
|
+
readonly 'ui.alert': "1.0";
|
|
858
|
+
readonly 'ui.pickDate': "1.0";
|
|
859
|
+
readonly 'ui.pickTime': "1.0";
|
|
860
|
+
};
|
|
861
|
+
type DashFeature = keyof typeof DASH_API_SINCE;
|
|
862
|
+
export declare function useHostDashApiVersions(versions: readonly string[]): void;
|
|
863
|
+
export declare function warnAboveDashApiVersion(minApiVersion: string | undefined): void;
|
|
864
|
+
/**
|
|
865
|
+
* Whether the Dash the dot runs in has `feature`: a call, such as "contacts.pickPhone", or a field
|
|
866
|
+
* added to a call later. Check it before using one that's newer than the dot's minApiVersion.
|
|
867
|
+
* @since 1.0
|
|
868
|
+
*/
|
|
869
|
+
declare function supports(feature: DashFeature): boolean;
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region src/utils/encoding.d.ts
|
|
872
|
+
declare const base64: {
|
|
873
|
+
encode(text: string): string;
|
|
874
|
+
decode(encoded: string): string;
|
|
875
|
+
};
|
|
876
|
+
declare const hex: {
|
|
877
|
+
encode(text: string): string;
|
|
878
|
+
decode(encoded: string): string;
|
|
879
|
+
};
|
|
550
880
|
declare namespace index_d_exports {
|
|
551
|
-
export {
|
|
881
|
+
export { base64, hex };
|
|
552
882
|
}
|
|
553
|
-
type ContactsMethods = PickPhoneMethods;
|
|
554
883
|
//#endregion
|
|
555
884
|
//#region src/tracked.d.ts
|
|
556
885
|
export declare function tracked<Group extends object>(group: Group, track: (request: DashRequest<unknown>) => void): Group;
|
|
557
886
|
//#endregion
|
|
558
887
|
//#region src/errors.d.ts
|
|
559
|
-
type DashErrorWith<Code extends HostErrorCode
|
|
888
|
+
type DashErrorWith<Code extends HostErrorCode> = HostError & {
|
|
560
889
|
readonly code: Code;
|
|
561
890
|
};
|
|
562
|
-
export declare function isDashError<Code extends HostErrorCode
|
|
563
|
-
export declare function isDashCancelled(error: unknown): error is DashErrorWith<'cancelled'>;
|
|
564
|
-
export declare function isDashTimeout(error: unknown): error is DashErrorWith<'timeout'>;
|
|
565
|
-
export declare function isDashDenied(error: unknown): error is DashErrorWith<'denied'>;
|
|
566
|
-
export declare function isDashInvalid(error: unknown): error is DashErrorWith<'invalid'>;
|
|
567
|
-
export declare function isDashUnsupported(error: unknown): error is DashErrorWith<'unsupported'>;
|
|
568
|
-
export declare function isDashFailed(error: unknown): error is DashErrorWith<'failed'>;
|
|
891
|
+
export declare function isDashError<Code extends HostErrorCode>(error: unknown, ...codes: Code[]): error is DashErrorWith<Code>;
|
|
569
892
|
export declare function errorMessage(error: unknown): string;
|
|
570
893
|
export declare function unlessCancelled<Result>(call: PromiseLike<Result>): Promise<Result | undefined>;
|
|
571
894
|
//#endregion
|
|
@@ -575,14 +898,19 @@ export declare function debounce(milliseconds: number): (dash: Dash) => Promise<
|
|
|
575
898
|
//#endregion
|
|
576
899
|
//#region src/index.d.ts
|
|
577
900
|
export declare const dash: {
|
|
578
|
-
ui: typeof index_d_exports$
|
|
579
|
-
system: typeof index_d_exports$
|
|
580
|
-
network: typeof index_d_exports$
|
|
581
|
-
storage: typeof index_d_exports$
|
|
582
|
-
media: typeof index_d_exports$
|
|
583
|
-
contacts: typeof index_d_exports;
|
|
901
|
+
ui: typeof index_d_exports$2;
|
|
902
|
+
system: typeof index_d_exports$3;
|
|
903
|
+
network: typeof index_d_exports$5;
|
|
904
|
+
storage: typeof index_d_exports$4;
|
|
905
|
+
media: typeof index_d_exports$6;
|
|
906
|
+
contacts: typeof index_d_exports$9;
|
|
907
|
+
dot: typeof index_d_exports$7;
|
|
908
|
+
account: typeof index_d_exports$1;
|
|
909
|
+
crypto: typeof index_d_exports$8;
|
|
910
|
+
utils: typeof index_d_exports;
|
|
911
|
+
supports: typeof supports;
|
|
584
912
|
};
|
|
585
913
|
export type Dash = typeof dash;
|
|
586
914
|
//#endregion
|
|
587
|
-
export { type AlertAction, type AlertOptions, type AlertResult, type BrightnessLevel, type CacheSetOptions, type CacheValue, type CallOptions, type CodeFormat, type ConnectionType, type ContactsMethods, DashError, type DashErrorCode, type DashMethod, type DashMethods, type DashRequest, type DotFile, type FileEncoding, type FileEntry,
|
|
915
|
+
export { type AccountProfile, type AlertAction, type AlertOptions, type AlertResult, type BrightnessLevel, type CacheSetOptions, type CacheValue, type CallOptions, type CodeFormat, type ConnectionType, type ContactsMethods, type CryptoInput, type CryptoOutputOptions, DashError, type DashErrorCode, type DashFeature, type DashMethod, type DashMethods, type DashRequest, type DotFile, type FileEncoding, type FileEntry, type HmacAlgorithm, type HmacOptions, type HttpDownloadRequest, type HttpDownloadResponse, type HttpMethod, type HttpReadOptions, type HttpRequest, type HttpRequestBody, type HttpResponse, type HttpUploadFile, type HttpUploadRequest, type MediaMethods, type NetworkMethods, type NetworkStatus, type PhotoSource, type PickDateOptions, type PickFileOptions, type PickPhotoOptions, type PickTimeOptions, type PickedContact, type Platform, type ReadOptions, type ReadProfileOptions, type ReplaceOptions, type ScannedCode, type ShareOptions, type StorageMethods, type StorageUsage, type SystemInfo, type SystemMethods, type UIMethods, type VibrateOptions, type VibrationStyle, type WriteOptions };
|
|
588
916
|
//# sourceMappingURL=index.d.ts.map
|