@monimesl/dot-dash 0.1.0-alpha.2 → 0.1.0-alpha.23

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