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

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,37 +1,383 @@
1
- import { HostCallOptions, HostError, HostErrorCode, HostRequest } from "@monimesl/dot-core";
2
- //#region src/ui/dialogs.d.ts
3
- interface AlertAction {
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/files.d.ts
3
+ interface DotFile {
4
4
  id: string;
5
- label: string;
6
- role?: 'default' | 'cancel' | 'destructive' | undefined;
5
+ name: string;
6
+ size: number;
7
+ contentType: string;
8
+ url: string;
7
9
  }
8
- interface AlertOptions {
9
- title: string;
10
- message?: string | undefined;
11
- actions?: AlertAction[] | undefined;
10
+ //#endregion
11
+ //#region src/media/pick-photo.d.ts
12
+ type PhotoSource = 'library' | 'camera';
13
+ interface PickPhotoOptions {
14
+ source: PhotoSource;
12
15
  }
13
- interface AlertResult {
14
- action: string;
16
+ interface PickPhotoMethods {
17
+ 'dash.media.pickPhoto': {
18
+ params: {
19
+ source: PhotoSource;
20
+ };
21
+ result: DotFile;
22
+ };
15
23
  }
16
- interface DialogMethods {
17
- 'dash.ui.alert': {
18
- params: AlertOptions;
19
- result: AlertResult;
24
+ declare function pickPhoto(options: PickPhotoOptions, callOptions?: CallOptions): DashRequest<DotFile>;
25
+ //#endregion
26
+ //#region src/media/scan-code.d.ts
27
+ type CodeFormat = 'qr';
28
+ interface ScannedCode {
29
+ text: string;
30
+ format: CodeFormat;
31
+ }
32
+ interface ScanCodeMethods {
33
+ 'dash.media.scanCode': {
34
+ params: Record<string, never>;
35
+ result: ScannedCode;
20
36
  };
21
37
  }
22
- declare function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult>;
23
- declare namespace index_d_exports$1 {
24
- export { AlertAction, AlertOptions, AlertResult, UIMethods, alert };
38
+ declare function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode>;
39
+ declare namespace index_d_exports$5 {
40
+ export { CodeFormat, MediaMethods, PhotoSource, PickPhotoOptions, ScannedCode, pickPhoto, scanCode };
41
+ }
42
+ type MediaMethods = PickPhotoMethods & ScanCodeMethods;
43
+ declare namespace http_d_exports {
44
+ export { HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpMethods, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, download, request, upload };
45
+ }
46
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
47
+ type HttpRequestBody = string | object;
48
+ interface HttpRequest<Body extends HttpRequestBody = HttpRequestBody> {
49
+ url: string;
50
+ method?: HttpMethod;
51
+ headers?: Record<string, string>;
52
+ body?: Body;
53
+ }
54
+ interface HttpResponse<Body = string> {
55
+ ok: boolean;
56
+ status: number;
57
+ statusText: string;
58
+ headers: Record<string, string>;
59
+ body: Body;
60
+ }
61
+ type HttpReadOptions<Body> = [Body] extends [string] ? {
62
+ as?: 'text';
63
+ } : {
64
+ as: 'json';
65
+ };
66
+ interface HttpDownloadRequest extends HttpRequest {
67
+ name?: string;
25
68
  }
26
- type UIMethods = DialogMethods;
69
+ type HttpDownloadResponse = (Omit<HttpResponse, 'ok' | 'body'> & {
70
+ ok: true;
71
+ file: DotFile;
72
+ }) | (Omit<HttpResponse, 'ok'> & {
73
+ ok: false;
74
+ });
75
+ interface HttpUploadFile {
76
+ field: string;
77
+ file: DotFile | string;
78
+ name?: string;
79
+ }
80
+ interface HttpUploadRequest {
81
+ url: string;
82
+ method?: 'POST' | 'PUT' | 'PATCH';
83
+ headers?: Record<string, string>;
84
+ fields?: Record<string, string>;
85
+ files: HttpUploadFile[];
86
+ }
87
+ type WireRequest<Request extends HttpRequest> = Omit<Request, 'headers' | 'body'> & {
88
+ headers?: Record<string, string> | undefined;
89
+ body?: string | undefined;
90
+ };
91
+ interface HttpMethods {
92
+ 'dash.network.http.request': {
93
+ params: WireRequest<HttpRequest>;
94
+ result: HttpResponse;
95
+ };
96
+ 'dash.network.http.download': {
97
+ params: WireRequest<HttpDownloadRequest>;
98
+ result: HttpDownloadResponse;
99
+ };
100
+ 'dash.network.http.upload': {
101
+ params: Omit<HttpUploadRequest, 'files'> & {
102
+ files: {
103
+ field: string;
104
+ file: string;
105
+ name?: string;
106
+ }[];
107
+ };
108
+ result: HttpResponse;
109
+ };
110
+ }
111
+ declare function request<ResponseBody = string, RequestBody extends HttpRequestBody = HttpRequestBody>(options: HttpRequest<RequestBody> & HttpReadOptions<ResponseBody>, callOptions?: CallOptions): DashRequest<HttpResponse<ResponseBody>>;
112
+ declare function download(options: HttpDownloadRequest, callOptions?: CallOptions): DashRequest<HttpDownloadResponse>;
113
+ declare function upload<ResponseBody = string>(options: HttpUploadRequest & HttpReadOptions<ResponseBody>, callOptions?: CallOptions): DashRequest<HttpResponse<ResponseBody>>;
27
114
  //#endregion
28
- //#region src/methods.d.ts
29
- type DashMethods = UIMethods & SystemMethods;
30
- type DashMethod = keyof DashMethods;
115
+ //#region src/network/status.d.ts
116
+ type ConnectionType = 'wifi' | 'cellular' | 'other' | 'none';
117
+ interface NetworkStatus {
118
+ online: boolean;
119
+ type: ConnectionType;
120
+ }
121
+ interface StatusMethods {
122
+ 'dash.network.status': {
123
+ params: Record<string, never>;
124
+ result: NetworkStatus;
125
+ };
126
+ }
127
+ declare function status(callOptions?: CallOptions): DashRequest<NetworkStatus>;
128
+ declare namespace index_d_exports$4 {
129
+ export { ConnectionType, HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, NetworkMethods, NetworkStatus, http_d_exports as http, status };
130
+ }
131
+ type NetworkMethods = HttpMethods & StatusMethods;
132
+ declare namespace cache_d_exports {
133
+ export { CacheMethods, CacheSetOptions, CacheValue, clear$1 as clear, exists, get$1 as get, keys, remove$2 as remove, set$1 as set };
134
+ }
135
+ type CacheValue = string | number | boolean | CacheValue[] | {
136
+ [key: string]: CacheValue;
137
+ };
138
+ interface CacheMethods {
139
+ 'dash.storage.cache.get': {
140
+ params: {
141
+ key: string;
142
+ };
143
+ result: CacheValue | null;
144
+ };
145
+ 'dash.storage.cache.set': {
146
+ params: {
147
+ key: string;
148
+ value: CacheValue;
149
+ ttl?: number | undefined;
150
+ };
151
+ result: void;
152
+ };
153
+ 'dash.storage.cache.remove': {
154
+ params: {
155
+ key: string;
156
+ };
157
+ result: void;
158
+ };
159
+ 'dash.storage.cache.exists': {
160
+ params: {
161
+ key: string;
162
+ };
163
+ result: boolean;
164
+ };
165
+ 'dash.storage.cache.keys': {
166
+ params: Record<string, never>;
167
+ result: string[];
168
+ };
169
+ 'dash.storage.cache.clear': {
170
+ params: Record<string, never>;
171
+ result: void;
172
+ };
173
+ }
174
+ interface CacheSetOptions {
175
+ ttl?: number | undefined;
176
+ }
177
+ declare function get$1<Value extends CacheValue = CacheValue>(key: string, callOptions?: CallOptions): DashRequest<Value | null>;
178
+ declare function set$1(key: string, value: CacheValue, options?: CacheSetOptions, callOptions?: CallOptions): DashRequest<void>;
179
+ declare function remove$2(key: string, callOptions?: CallOptions): DashRequest<void>;
180
+ declare function exists(key: string, callOptions?: CallOptions): DashRequest<boolean>;
181
+ declare function keys(callOptions?: CallOptions): DashRequest<string[]>;
182
+ declare function clear$1(callOptions?: CallOptions): DashRequest<void>;
183
+ declare namespace file_d_exports {
184
+ export { FileEncoding, FileEntry, FileMethods, PickFileOptions, ReadOptions, ReplaceOptions, StorageUsage, WriteOptions, copy, createFolder, list, move, open, pick, read, remove$1 as remove, save, stat, usage, write };
185
+ }
186
+ interface FileEntry {
187
+ name: string;
188
+ path: string;
189
+ size: number;
190
+ kind: 'file' | 'folder';
191
+ modifiedAt: number;
192
+ contentType?: string;
193
+ }
194
+ type FileEncoding = 'text' | 'base64';
195
+ interface StorageUsage {
196
+ used: number;
197
+ quota: number;
198
+ }
199
+ interface FileMethods {
200
+ 'dash.storage.file.read': {
201
+ params: {
202
+ path: string;
203
+ as?: FileEncoding;
204
+ };
205
+ result: string;
206
+ };
207
+ 'dash.storage.file.write': {
208
+ params: {
209
+ path: string;
210
+ data: string;
211
+ as?: FileEncoding;
212
+ append?: boolean;
213
+ };
214
+ result: FileEntry;
215
+ };
216
+ 'dash.storage.file.stat': {
217
+ params: {
218
+ path: string;
219
+ };
220
+ result: FileEntry | null;
221
+ };
222
+ 'dash.storage.file.list': {
223
+ params: {
224
+ path: string;
225
+ recursive?: boolean;
226
+ };
227
+ result: FileEntry[];
228
+ };
229
+ 'dash.storage.file.createFolder': {
230
+ params: {
231
+ path: string;
232
+ };
233
+ result: FileEntry;
234
+ };
235
+ 'dash.storage.file.move': {
236
+ params: {
237
+ from: string;
238
+ to: string;
239
+ overwrite?: boolean;
240
+ };
241
+ result: FileEntry;
242
+ };
243
+ 'dash.storage.file.copy': {
244
+ params: {
245
+ from: string;
246
+ to: string;
247
+ overwrite?: boolean;
248
+ };
249
+ result: FileEntry;
250
+ };
251
+ 'dash.storage.file.remove': {
252
+ params: {
253
+ path: string;
254
+ recursive?: boolean;
255
+ };
256
+ result: void;
257
+ };
258
+ 'dash.storage.file.save': {
259
+ params: {
260
+ file: string;
261
+ path: string;
262
+ overwrite?: boolean;
263
+ };
264
+ result: FileEntry;
265
+ };
266
+ 'dash.storage.file.open': {
267
+ params: {
268
+ path: string;
269
+ };
270
+ result: DotFile;
271
+ };
272
+ 'dash.storage.file.usage': {
273
+ params: Record<string, never>;
274
+ result: StorageUsage;
275
+ };
276
+ 'dash.storage.file.pick': {
277
+ params: {
278
+ types?: string[];
279
+ };
280
+ result: DotFile;
281
+ };
282
+ }
283
+ interface PickFileOptions {
284
+ types?: string[];
285
+ }
286
+ interface ReadOptions {
287
+ as?: FileEncoding;
288
+ }
289
+ interface WriteOptions {
290
+ as?: FileEncoding;
291
+ append?: boolean;
292
+ }
293
+ interface ReplaceOptions {
294
+ overwrite?: boolean;
295
+ }
296
+ declare function read(path: string, options?: ReadOptions, callOptions?: CallOptions): DashRequest<string>;
297
+ declare function write(path: string, data: string, options?: WriteOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
298
+ declare function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null>;
299
+ declare function list(path?: string, options?: {
300
+ recursive?: boolean;
301
+ }, callOptions?: CallOptions): DashRequest<FileEntry[]>;
302
+ declare function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry>;
303
+ declare function move(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
304
+ declare function copy(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
305
+ declare function remove$1(path: string, options?: {
306
+ recursive?: boolean;
307
+ }, callOptions?: CallOptions): DashRequest<void>;
308
+ declare function save(file: DotFile | string, path: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
309
+ declare function open(path: string, callOptions?: CallOptions): DashRequest<DotFile>;
310
+ declare function usage(callOptions?: CallOptions): DashRequest<StorageUsage>;
311
+ declare function pick(options?: PickFileOptions, callOptions?: CallOptions): DashRequest<DotFile>;
312
+ declare namespace secret_d_exports {
313
+ export { SecretMethods, clear, get, remove, set };
314
+ }
315
+ interface SecretMethods {
316
+ 'dash.storage.secret.get': {
317
+ params: {
318
+ key: string;
319
+ };
320
+ result: string | null;
321
+ };
322
+ 'dash.storage.secret.set': {
323
+ params: {
324
+ key: string;
325
+ value: string;
326
+ };
327
+ result: void;
328
+ };
329
+ 'dash.storage.secret.remove': {
330
+ params: {
331
+ key: string;
332
+ };
333
+ result: void;
334
+ };
335
+ 'dash.storage.secret.clear': {
336
+ params: Record<string, never>;
337
+ result: void;
338
+ };
339
+ }
340
+ declare function get(key: string, callOptions?: CallOptions): DashRequest<string | null>;
341
+ declare function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void>;
342
+ declare function remove(key: string, callOptions?: CallOptions): DashRequest<void>;
343
+ declare function clear(callOptions?: CallOptions): DashRequest<void>;
344
+ declare namespace index_d_exports$3 {
345
+ export { CacheSetOptions, CacheValue, FileEncoding, FileEntry, PickFileOptions, ReadOptions, ReplaceOptions, StorageMethods, StorageUsage, WriteOptions, cache_d_exports as cache, file_d_exports as file, secret_d_exports as secret };
346
+ }
347
+ type StorageMethods = FileMethods & CacheMethods & SecretMethods;
31
348
  //#endregion
32
- //#region src/call.d.ts
33
- type CallOptions = HostCallOptions;
34
- type DashRequest<Result> = HostRequest<Result>;
349
+ //#region src/system/clipboard.d.ts
350
+ interface ClipboardMethods {
351
+ 'dash.system.copyText': {
352
+ params: {
353
+ text: string;
354
+ };
355
+ result: void;
356
+ };
357
+ }
358
+ declare function copyText(text: string, callOptions?: CallOptions): DashRequest<void>;
359
+ //#endregion
360
+ //#region src/system/delay.d.ts
361
+ interface DelayMethods {
362
+ 'dash.system.delay': {
363
+ params: {
364
+ milliseconds: number;
365
+ };
366
+ result: void;
367
+ };
368
+ }
369
+ declare function delay(milliseconds: number, callOptions?: CallOptions): DashRequest<void>;
370
+ //#endregion
371
+ //#region src/system/dial.d.ts
372
+ interface DialMethods {
373
+ 'dash.system.dial': {
374
+ params: {
375
+ number: string;
376
+ };
377
+ result: void;
378
+ };
379
+ }
380
+ declare function dial(number: string, callOptions?: CallOptions): DashRequest<void>;
35
381
  //#endregion
36
382
  //#region src/system/haptics.d.ts
37
383
  type VibrationStyle = 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';
@@ -46,6 +392,75 @@ interface HapticsMethods {
46
392
  }
47
393
  declare function vibrate(options?: VibrateOptions, callOptions?: CallOptions): DashRequest<void>;
48
394
  //#endregion
395
+ //#region src/system/info.d.ts
396
+ type Platform = 'ios' | 'android' | 'simulator';
397
+ interface SystemInfo {
398
+ platform: Platform;
399
+ osVersion: string;
400
+ language: string;
401
+ region: string | null;
402
+ timeZone: string;
403
+ dashVersion: string;
404
+ hostVersion: string;
405
+ }
406
+ interface InfoMethods {
407
+ 'dash.system.info': {
408
+ params: Record<string, never>;
409
+ result: SystemInfo;
410
+ };
411
+ }
412
+ declare function info(callOptions?: CallOptions): DashRequest<SystemInfo>;
413
+ //#endregion
414
+ //#region src/system/open-url.d.ts
415
+ interface OpenUrlMethods {
416
+ 'dash.system.openUrl': {
417
+ params: {
418
+ url: string;
419
+ };
420
+ result: void;
421
+ };
422
+ }
423
+ declare function openUrl(url: string, callOptions?: CallOptions): DashRequest<void>;
424
+ //#endregion
425
+ //#region src/system/screen.d.ts
426
+ type BrightnessLevel = 'max' | 'normal';
427
+ interface ScreenMethods {
428
+ 'dash.system.keepAwake': {
429
+ params: {
430
+ on: boolean;
431
+ };
432
+ result: void;
433
+ };
434
+ 'dash.system.brightness': {
435
+ params: {
436
+ level: BrightnessLevel;
437
+ };
438
+ result: void;
439
+ };
440
+ }
441
+ declare function keepAwake(on: boolean, callOptions?: CallOptions): DashRequest<void>;
442
+ declare function brightness(level: BrightnessLevel, callOptions?: CallOptions): DashRequest<void>;
443
+ //#endregion
444
+ //#region src/system/share.d.ts
445
+ interface ShareOptions {
446
+ title?: string;
447
+ text?: string;
448
+ url?: string;
449
+ file?: DotFile | string;
450
+ }
451
+ interface ShareMethods {
452
+ 'dash.system.share': {
453
+ params: {
454
+ title?: string;
455
+ text?: string;
456
+ url?: string;
457
+ file?: string;
458
+ };
459
+ result: void;
460
+ };
461
+ }
462
+ declare function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void>;
463
+ //#endregion
49
464
  //#region src/system/torch.d.ts
50
465
  type TorchState = 'on' | 'off';
51
466
  interface TorchMethods {
@@ -57,16 +472,117 @@ interface TorchMethods {
57
472
  };
58
473
  }
59
474
  declare function torch(state: TorchState, callOptions?: CallOptions): DashRequest<void>;
475
+ declare namespace index_d_exports$2 {
476
+ export { BrightnessLevel, Platform, ShareOptions, SystemInfo, SystemMethods, TorchState, VibrateOptions, VibrationStyle, brightness, copyText, delay, dial, info, keepAwake, openUrl, share, torch, vibrate };
477
+ }
478
+ type SystemMethods = ClipboardMethods & DelayMethods & DialMethods & HapticsMethods & InfoMethods & OpenUrlMethods & ScreenMethods & ShareMethods & TorchMethods;
479
+ //#endregion
480
+ //#region src/ui/dialogs.d.ts
481
+ interface AlertAction {
482
+ id: string;
483
+ label: string;
484
+ role?: 'default' | 'cancel' | 'destructive' | undefined;
485
+ }
486
+ interface AlertOptions {
487
+ title: string;
488
+ message?: string | undefined;
489
+ actions?: AlertAction[] | undefined;
490
+ }
491
+ interface AlertResult {
492
+ action: string;
493
+ }
494
+ interface DialogMethods {
495
+ 'dash.ui.alert': {
496
+ params: AlertOptions;
497
+ result: AlertResult;
498
+ };
499
+ }
500
+ declare function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult>;
501
+ //#endregion
502
+ //#region src/ui/pickers.d.ts
503
+ interface PickDateOptions {
504
+ title?: string | undefined;
505
+ value?: string | undefined;
506
+ min?: string | undefined;
507
+ max?: string | undefined;
508
+ }
509
+ interface PickTimeOptions {
510
+ title?: string | undefined;
511
+ value?: string | undefined;
512
+ }
513
+ interface PickerMethods {
514
+ 'dash.ui.pickDate': {
515
+ params: PickDateOptions;
516
+ result: string;
517
+ };
518
+ 'dash.ui.pickTime': {
519
+ params: PickTimeOptions;
520
+ result: string;
521
+ };
522
+ }
523
+ declare function pickDate(options?: PickDateOptions, callOptions?: CallOptions): DashRequest<string>;
524
+ declare function pickTime(options?: PickTimeOptions, callOptions?: CallOptions): DashRequest<string>;
525
+ declare namespace index_d_exports$1 {
526
+ export { AlertAction, AlertOptions, AlertResult, PickDateOptions, PickTimeOptions, UIMethods, alert, pickDate, pickTime };
527
+ }
528
+ type UIMethods = DialogMethods & PickerMethods;
529
+ //#endregion
530
+ //#region src/methods.d.ts
531
+ type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods;
532
+ type DashMethod = keyof DashMethods;
533
+ //#endregion
534
+ //#region src/call.d.ts
535
+ type CallOptions = HostCallOptions;
536
+ type DashRequest<Result> = HostRequest<Result>;
537
+ //#endregion
538
+ //#region src/contacts/pick-phone.d.ts
539
+ interface PickedContact {
540
+ name: string;
541
+ phone: string;
542
+ }
543
+ interface PickPhoneMethods {
544
+ 'dash.contacts.pickPhone': {
545
+ params: Record<string, never>;
546
+ result: PickedContact;
547
+ };
548
+ }
549
+ declare function pickPhone(callOptions?: CallOptions): DashRequest<PickedContact>;
60
550
  declare namespace index_d_exports {
61
- export { SystemMethods, TorchState, VibrateOptions, VibrationStyle, torch, vibrate };
551
+ export { ContactsMethods, PickedContact, pickPhone };
62
552
  }
63
- type SystemMethods = HapticsMethods & TorchMethods;
553
+ type ContactsMethods = PickPhoneMethods;
554
+ //#endregion
555
+ //#region src/tracked.d.ts
556
+ export declare function tracked<Group extends object>(group: Group, track: (request: DashRequest<unknown>) => void): Group;
557
+ //#endregion
558
+ //#region src/errors.d.ts
559
+ type DashErrorWith<Code extends HostErrorCode$1> = HostError$1 & {
560
+ readonly code: Code;
561
+ };
562
+ export declare function isDashError<Code extends HostErrorCode$1>(error: unknown, ...codes: Code[]): error is DashErrorWith<Code>;
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'>;
569
+ export declare function errorMessage(error: unknown): string;
570
+ export declare function unlessCancelled<Result>(call: PromiseLike<Result>): Promise<Result | undefined>;
571
+ //#endregion
572
+ //#region src/latest.d.ts
573
+ export declare function latest(): <Result>(call: DashRequest<Result>) => DashRequest<Result>;
574
+ export declare function debounce(milliseconds: number): (dash: Dash) => Promise<boolean>;
64
575
  //#endregion
65
576
  //#region src/index.d.ts
66
577
  export declare const dash: {
67
578
  ui: typeof index_d_exports$1;
68
- system: typeof index_d_exports;
579
+ system: typeof index_d_exports$2;
580
+ network: typeof index_d_exports$4;
581
+ storage: typeof index_d_exports$3;
582
+ media: typeof index_d_exports$5;
583
+ contacts: typeof index_d_exports;
69
584
  };
585
+ export type Dash = typeof dash;
70
586
  //#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 };
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, 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 ReplaceOptions, type ScannedCode, type ShareOptions, type StorageMethods, type StorageUsage, type SystemInfo, type SystemMethods, type TorchState, type UIMethods, type VibrateOptions, type VibrationStyle, type WriteOptions };
72
588
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/ui/dialogs.ts","../src/ui/index.ts","../src/methods.ts","../src/call.ts","../src/system/haptics.ts","../src/system/torch.ts","../src/system/index.ts","../src/index.ts"],"mappings":";;UAGiB;EACf;EACA;EAEA;;UAGe;EACf;EACA;EAEA,UAAU;;UAGK;EAEf;;UAGe;EACf;IAAmB,QAAQ;IAAc,QAAQ;;;iBAInC,MAAM,SAAS,cAAc,cAAc,cAAc,YAAY;;;;KCtBzE,YAAY;;;KCAZ,cAAc,YAAY;KAE1B,mBAAmB;;;KCFnB,cAAc;KAGd,YAAY,UAAU,YAAY;;;KCLlC;UAEK;EAEf,QAAQ;;UAGO;EACf;IAAyB,QAAQ;IAAgB;;;iBAInC,QACd,UAAS,gBACT,cAAc,cACb;;;KCfS;UAEK;EACf;IAAuB;MAAU,OAAO;;IAAc;;;iBAIxC,MAAM,OAAO,YAAY,cAAc,cAAc;;;;KCFzD,gBAAgB,iBAAiB;;;qBCJhC;aAAA;iBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/files.ts","../src/media/pick-photo.ts","../src/media/scan-code.ts","../src/media/index.ts","../src/network/http.ts","../src/network/status.ts","../src/network/index.ts","../src/storage/cache.ts","../src/storage/file.ts","../src/storage/secret.ts","../src/storage/index.ts","../src/system/clipboard.ts","../src/system/delay.ts","../src/system/dial.ts","../src/system/haptics.ts","../src/system/info.ts","../src/system/open-url.ts","../src/system/screen.ts","../src/system/share.ts","../src/system/torch.ts","../src/system/index.ts","../src/ui/dialogs.ts","../src/ui/pickers.ts","../src/ui/index.ts","../src/methods.ts","../src/call.ts","../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"mappings":";;UACiB;EACf;EACA;EACA;EACA;EACA;;;;KCFU;UAEK;EAEf,QAAQ;;UAGO;EACf;IAA0B;MAAU,QAAQ;;IAAe,QAAQ;;;iBAOrD,UACd,SAAS,kBACT,cAAc,cACb,YAAY;;;KClBH;UAEK;EACf;EACA,QAAQ;;UAGO;EACf;IAAyB,QAAQ;IAAuB,QAAQ;;;iBAKlD,SAAS,cAAc,cAAc,YAAY;;;;KCTrD,eAAe,mBAAmB;;;;KCDlC;KAEA;UAEK,YAAY,aAAa,kBAAkB;EAC1D;EACA,SAAS;EACT,UAAU;EACV,OAAO;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Ge;EACf;EACA;EAEA,UAAU;;UAGK;EAEf;;UAGe;EACf;IAAmB,QAAQ;IAAc,QAAQ;;;iBAInC,MAAM,SAAS,cAAc,cAAc,cAAc,YAAY;;;UCxBpE;EACf;EAEA;EACA;EACA;;UAGe;EACf;EAEA;;UAGe;EACf;IAAsB,QAAQ;IAAiB;;EAC/C;IAAsB,QAAQ;IAAiB;;;iBAKjC,SACd,UAAS,iBACT,cAAc,cACb;iBAMa,SACd,UAAS,iBACT,cAAc,cACb;;;;KC5BS,YAAY,gBAAgB;;;KCC5B,cAAc,YACxB,gBACA,iBACA,iBACA,eACA;KAEU,mBAAmB;;;KCXnB,cAAc;KAGd,YAAY,UAAU,YAAY;;;UCL7B;EACf;EAEA;;UAGe;EACf;IAA6B,QAAQ;IAAuB,QAAQ;;;iBAMtD,UAAU,cAAc,cAAc,YAAY;;;;KCXtD,kBAAkB;;;wBCFd,QAAQ,sBACtB,OAAO,OACP,QAAQ,SAAS,gCAChB;;;KCHE,cAAc,aAAa,mBAAiB;WAAuB,MAAM;;wBAE9D,YAAY,aAAa,iBACvC,mBACG,OAAO,SACT,SAAS,cAAc;wBAOV,gBAAgB,iBAAiB,SAAS;wBAI1C,cAAc,iBAAiB,SAAS;wBAIxC,aAAa,iBAAiB,SAAS;wBAIvC,cAAc,iBAAiB,SAAS;wBAIxC,kBAAkB,iBAAiB,SAAS;wBAI5C,aAAa,iBAAiB,SAAS;wBAKvC,aAAa;wBAYP,gBAAgB,QACpC,MAAM,YAAY,UACjB,QAAQ;;;wBChDK,WAAW,QAAQ,MAAM,YAAY,YAAY,YAAY;wBAW7D,SAAS,wBAAwB,MAAM,SAAS;;;qBCRnD;;;;;;;;YAED,cAAc"}
package/dist/index.js CHANGED
@@ -1,15 +1,305 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { HostError, callHost } from "@monimesl/dot-core";
2
+ import { HostError, HostError as DashError, HostError as HostError$1, callHost, createHostRequest } from "@monimesl/dot-core";
3
3
  //#region src/call.ts
4
4
  function call(method, params, options = {}) {
5
5
  return callHost(method, params, options);
6
6
  }
7
7
  //#endregion
8
+ //#region src/contacts/pick-phone.ts
9
+ function pickPhone(callOptions) {
10
+ return call("dash.contacts.pickPhone", {}, callOptions);
11
+ }
12
+ //#endregion
13
+ //#region src/contacts/index.ts
14
+ var contacts_exports = /* @__PURE__ */ __exportAll({ pickPhone: () => pickPhone });
15
+ //#endregion
16
+ //#region src/media/pick-photo.ts
17
+ function pickPhoto(options, callOptions) {
18
+ return call("dash.media.pickPhoto", { source: options.source }, callOptions);
19
+ }
20
+ //#endregion
21
+ //#region src/media/scan-code.ts
22
+ function scanCode(callOptions) {
23
+ return call("dash.media.scanCode", {}, callOptions);
24
+ }
25
+ //#endregion
26
+ //#region src/media/index.ts
27
+ var media_exports = /* @__PURE__ */ __exportAll({
28
+ pickPhoto: () => pickPhoto,
29
+ scanCode: () => scanCode
30
+ });
31
+ //#endregion
32
+ //#region src/files.ts
33
+ function fileId(file) {
34
+ return typeof file === "string" ? file : file.id;
35
+ }
36
+ //#endregion
37
+ //#region src/network/http.ts
38
+ var http_exports = /* @__PURE__ */ __exportAll({
39
+ download: () => download,
40
+ request: () => request,
41
+ upload: () => upload
42
+ });
43
+ function request(options, callOptions) {
44
+ const { as, ...request } = options;
45
+ return readBody(call("dash.network.http.request", wireRequest(request, as), callOptions), as);
46
+ }
47
+ function download(options, callOptions) {
48
+ return call("dash.network.http.download", wireRequest(options), callOptions);
49
+ }
50
+ function upload(options, callOptions) {
51
+ const { as, ...request } = options;
52
+ const files = request.files.map(({ file, ...rest }) => ({
53
+ ...rest,
54
+ file: fileId(file)
55
+ }));
56
+ const params = {
57
+ ...request,
58
+ files
59
+ };
60
+ if (as === "json") params.headers = withDefaultHeader(request.headers, "Accept", "application/json");
61
+ return readBody(call("dash.network.http.upload", params, callOptions), as);
62
+ }
63
+ function wireRequest(request, as) {
64
+ let headers = request.headers;
65
+ let body;
66
+ if (as === "json") headers = withDefaultHeader(headers, "Accept", "application/json");
67
+ if (typeof request.body === "string") body = request.body;
68
+ else if (request.body !== void 0) {
69
+ headers = withDefaultHeader(headers, "Content-Type", "application/json");
70
+ body = JSON.stringify(request.body);
71
+ }
72
+ return {
73
+ ...request,
74
+ headers,
75
+ body
76
+ };
77
+ }
78
+ function withDefaultHeader(headers, name, value) {
79
+ const lowerName = name.toLowerCase();
80
+ if (headers && Object.keys(headers).some((existing) => existing.toLowerCase() === lowerName)) return headers;
81
+ return {
82
+ ...headers,
83
+ [name]: value
84
+ };
85
+ }
86
+ function readBody(response, as) {
87
+ if (as !== "json") return response;
88
+ const parsed = response.then((result) => ({
89
+ ...result,
90
+ body: parseJson(result)
91
+ }));
92
+ return createHostRequest(parsed, () => response.cancel());
93
+ }
94
+ function parseJson({ status, statusText, body }) {
95
+ try {
96
+ return JSON.parse(body);
97
+ } catch (error) {
98
+ const message = error instanceof Error ? error.message : String(error);
99
+ throw new HostError$1("failed", `The response (${status} ${statusText}) isn't JSON: ${message}`);
100
+ }
101
+ }
102
+ //#endregion
103
+ //#region src/network/status.ts
104
+ function status(callOptions) {
105
+ return call("dash.network.status", {}, callOptions);
106
+ }
107
+ //#endregion
108
+ //#region src/network/index.ts
109
+ var network_exports = /* @__PURE__ */ __exportAll({
110
+ http: () => http_exports,
111
+ status: () => status
112
+ });
113
+ //#endregion
114
+ //#region src/storage/cache.ts
115
+ var cache_exports = /* @__PURE__ */ __exportAll({
116
+ clear: () => clear$1,
117
+ exists: () => exists,
118
+ get: () => get$1,
119
+ keys: () => keys,
120
+ remove: () => remove$2,
121
+ set: () => set$1
122
+ });
123
+ function get$1(key, callOptions) {
124
+ return call("dash.storage.cache.get", { key }, callOptions);
125
+ }
126
+ function set$1(key, value, options = {}, callOptions) {
127
+ return call("dash.storage.cache.set", {
128
+ key,
129
+ value,
130
+ ...options
131
+ }, callOptions);
132
+ }
133
+ function remove$2(key, callOptions) {
134
+ return call("dash.storage.cache.remove", { key }, callOptions);
135
+ }
136
+ function exists(key, callOptions) {
137
+ return call("dash.storage.cache.exists", { key }, callOptions);
138
+ }
139
+ function keys(callOptions) {
140
+ return call("dash.storage.cache.keys", {}, callOptions);
141
+ }
142
+ function clear$1(callOptions) {
143
+ return call("dash.storage.cache.clear", {}, callOptions);
144
+ }
145
+ //#endregion
146
+ //#region src/storage/file.ts
147
+ var file_exports = /* @__PURE__ */ __exportAll({
148
+ copy: () => copy,
149
+ createFolder: () => createFolder,
150
+ list: () => list,
151
+ move: () => move,
152
+ open: () => open,
153
+ pick: () => pick,
154
+ read: () => read,
155
+ remove: () => remove$1,
156
+ save: () => save,
157
+ stat: () => stat,
158
+ usage: () => usage,
159
+ write: () => write
160
+ });
161
+ function read(path, options = {}, callOptions) {
162
+ return call("dash.storage.file.read", {
163
+ path,
164
+ ...options
165
+ }, callOptions);
166
+ }
167
+ function write(path, data, options = {}, callOptions) {
168
+ return call("dash.storage.file.write", {
169
+ path,
170
+ data,
171
+ ...options
172
+ }, callOptions);
173
+ }
174
+ function stat(path, callOptions) {
175
+ return call("dash.storage.file.stat", { path }, callOptions);
176
+ }
177
+ function list(path = "", options = {}, callOptions) {
178
+ return call("dash.storage.file.list", {
179
+ path,
180
+ ...options
181
+ }, callOptions);
182
+ }
183
+ function createFolder(path, callOptions) {
184
+ return call("dash.storage.file.createFolder", { path }, callOptions);
185
+ }
186
+ function move(from, to, options = {}, callOptions) {
187
+ return call("dash.storage.file.move", {
188
+ from,
189
+ to,
190
+ ...options
191
+ }, callOptions);
192
+ }
193
+ function copy(from, to, options = {}, callOptions) {
194
+ return call("dash.storage.file.copy", {
195
+ from,
196
+ to,
197
+ ...options
198
+ }, callOptions);
199
+ }
200
+ function remove$1(path, options = {}, callOptions) {
201
+ return call("dash.storage.file.remove", {
202
+ path,
203
+ ...options
204
+ }, callOptions);
205
+ }
206
+ function save(file, path, options = {}, callOptions) {
207
+ return call("dash.storage.file.save", {
208
+ file: fileId(file),
209
+ path,
210
+ ...options
211
+ }, callOptions);
212
+ }
213
+ function open(path, callOptions) {
214
+ return call("dash.storage.file.open", { path }, callOptions);
215
+ }
216
+ function usage(callOptions) {
217
+ return call("dash.storage.file.usage", {}, callOptions);
218
+ }
219
+ function pick(options = {}, callOptions) {
220
+ const params = {};
221
+ if (options.types) params.types = options.types;
222
+ return call("dash.storage.file.pick", params, callOptions);
223
+ }
224
+ //#endregion
225
+ //#region src/storage/secret.ts
226
+ var secret_exports = /* @__PURE__ */ __exportAll({
227
+ clear: () => clear,
228
+ get: () => get,
229
+ remove: () => remove,
230
+ set: () => set
231
+ });
232
+ function get(key, callOptions) {
233
+ return call("dash.storage.secret.get", { key }, callOptions);
234
+ }
235
+ function set(key, value, callOptions) {
236
+ return call("dash.storage.secret.set", {
237
+ key,
238
+ value
239
+ }, callOptions);
240
+ }
241
+ function remove(key, callOptions) {
242
+ return call("dash.storage.secret.remove", { key }, callOptions);
243
+ }
244
+ function clear(callOptions) {
245
+ return call("dash.storage.secret.clear", {}, callOptions);
246
+ }
247
+ //#endregion
248
+ //#region src/storage/index.ts
249
+ var storage_exports = /* @__PURE__ */ __exportAll({
250
+ cache: () => cache_exports,
251
+ file: () => file_exports,
252
+ secret: () => secret_exports
253
+ });
254
+ //#endregion
255
+ //#region src/system/clipboard.ts
256
+ function copyText(text, callOptions) {
257
+ return call("dash.system.copyText", { text }, callOptions);
258
+ }
259
+ //#endregion
260
+ //#region src/system/delay.ts
261
+ function delay(milliseconds, callOptions) {
262
+ return call("dash.system.delay", { milliseconds }, callOptions);
263
+ }
264
+ //#endregion
265
+ //#region src/system/dial.ts
266
+ function dial(number, callOptions) {
267
+ return call("dash.system.dial", { number }, callOptions);
268
+ }
269
+ //#endregion
8
270
  //#region src/system/haptics.ts
9
271
  function vibrate(options = {}, callOptions) {
10
272
  return call("dash.system.vibrate", { style: options.style ?? "medium" }, callOptions);
11
273
  }
12
274
  //#endregion
275
+ //#region src/system/info.ts
276
+ function info(callOptions) {
277
+ return call("dash.system.info", {}, callOptions);
278
+ }
279
+ //#endregion
280
+ //#region src/system/open-url.ts
281
+ function openUrl(url, callOptions) {
282
+ return call("dash.system.openUrl", { url }, callOptions);
283
+ }
284
+ //#endregion
285
+ //#region src/system/screen.ts
286
+ function keepAwake(on, callOptions) {
287
+ return call("dash.system.keepAwake", { on }, callOptions);
288
+ }
289
+ function brightness(level, callOptions) {
290
+ return call("dash.system.brightness", { level }, callOptions);
291
+ }
292
+ //#endregion
293
+ //#region src/system/share.ts
294
+ function share(options, callOptions) {
295
+ const { file, ...rest } = options;
296
+ if (file === void 0) return call("dash.system.share", rest, callOptions);
297
+ return call("dash.system.share", {
298
+ ...rest,
299
+ file: fileId(file)
300
+ }, callOptions);
301
+ }
302
+ //#endregion
13
303
  //#region src/system/torch.ts
14
304
  function torch(state, callOptions) {
15
305
  return call("dash.system.torch", { state }, callOptions);
@@ -17,6 +307,14 @@ function torch(state, callOptions) {
17
307
  //#endregion
18
308
  //#region src/system/index.ts
19
309
  var system_exports = /* @__PURE__ */ __exportAll({
310
+ brightness: () => brightness,
311
+ copyText: () => copyText,
312
+ delay: () => delay,
313
+ dial: () => dial,
314
+ info: () => info,
315
+ keepAwake: () => keepAwake,
316
+ openUrl: () => openUrl,
317
+ share: () => share,
20
318
  torch: () => torch,
21
319
  vibrate: () => vibrate
22
320
  });
@@ -33,12 +331,104 @@ function alert(options, callOptions) {
33
331
  }, callOptions);
34
332
  }
35
333
  //#endregion
334
+ //#region src/ui/pickers.ts
335
+ function pickDate(options = {}, callOptions) {
336
+ return call("dash.ui.pickDate", options, callOptions);
337
+ }
338
+ function pickTime(options = {}, callOptions) {
339
+ return call("dash.ui.pickTime", options, callOptions);
340
+ }
341
+ //#endregion
342
+ //#region src/ui/index.ts
343
+ var ui_exports = /* @__PURE__ */ __exportAll({
344
+ alert: () => alert,
345
+ pickDate: () => pickDate,
346
+ pickTime: () => pickTime
347
+ });
348
+ //#endregion
349
+ //#region src/tracked.ts
350
+ function tracked(group, track) {
351
+ const copy = {};
352
+ for (const [name, member] of Object.entries(group)) if (typeof member === "function") {
353
+ const start = member;
354
+ copy[name] = (...args) => {
355
+ const request = start(...args);
356
+ track(request);
357
+ return request;
358
+ };
359
+ } else copy[name] = tracked(member, track);
360
+ return copy;
361
+ }
362
+ //#endregion
363
+ //#region src/errors.ts
364
+ function isDashError(error, ...codes) {
365
+ if (error instanceof HostError$1) return codes.length === 0 || codes.includes(error.code);
366
+ return false;
367
+ }
368
+ function isDashCancelled(error) {
369
+ return isDashError(error, "cancelled");
370
+ }
371
+ function isDashTimeout(error) {
372
+ return isDashError(error, "timeout");
373
+ }
374
+ function isDashDenied(error) {
375
+ return isDashError(error, "denied");
376
+ }
377
+ function isDashInvalid(error) {
378
+ return isDashError(error, "invalid");
379
+ }
380
+ function isDashUnsupported(error) {
381
+ return isDashError(error, "unsupported");
382
+ }
383
+ function isDashFailed(error) {
384
+ return isDashError(error, "failed");
385
+ }
386
+ function errorMessage(error) {
387
+ if (error instanceof Error) return error.message;
388
+ if (typeof error === "string" && error) return error;
389
+ return "Something went wrong. Try again.";
390
+ }
391
+ async function unlessCancelled(call) {
392
+ try {
393
+ return await call;
394
+ } catch (error) {
395
+ if (isDashCancelled(error)) return;
396
+ throw error;
397
+ }
398
+ }
399
+ //#endregion
400
+ //#region src/latest.ts
401
+ function latest() {
402
+ let running;
403
+ return (call) => {
404
+ running?.cancel();
405
+ running = call;
406
+ return call;
407
+ };
408
+ }
409
+ function debounce(milliseconds) {
410
+ const wait = latest();
411
+ return async (dash) => {
412
+ try {
413
+ await wait(dash.system.delay(milliseconds));
414
+ return true;
415
+ } catch (error) {
416
+ if (isDashCancelled(error)) return false;
417
+ throw error;
418
+ }
419
+ };
420
+ }
421
+ //#endregion
36
422
  //#region src/index.ts
37
423
  const dash = {
38
- ui: /* @__PURE__ */ __exportAll({ alert: () => alert }),
39
- system: system_exports
424
+ ui: ui_exports,
425
+ system: system_exports,
426
+ network: network_exports,
427
+ storage: storage_exports,
428
+ media: media_exports,
429
+ contacts: contacts_exports
40
430
  };
41
431
  //#endregion
42
- export { HostError, dash };
432
+ export { DashError, HostError, dash, debounce, errorMessage, isDashCancelled, isDashDenied, isDashError, isDashFailed, isDashInvalid, isDashTimeout, isDashUnsupported, latest, tracked, unlessCancelled };
43
433
 
44
434
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/call.ts","../src/system/haptics.ts","../src/system/torch.ts","../src/system/index.ts","../src/ui/dialogs.ts","../src/ui/index.ts","../src/index.ts"],"sourcesContent":["import type { HostCallOptions, HostRequest } from '@monimesl/dot-core';\nimport { callHost } from '@monimesl/dot-core';\n\nimport type { DashMethod, DashMethods } from './methods';\n\nexport type CallOptions = HostCallOptions;\n\n// A Dash call in flight: await it for the result, or cancel it.\nexport type DashRequest<Result> = HostRequest<Result>;\n\nexport function call<Method extends DashMethod>(\n method: Method,\n params: DashMethods[Method]['params'],\n options: CallOptions = {},\n): DashRequest<DashMethods[Method]['result']> {\n return callHost(method, params, options);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type VibrationStyle = 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';\n\nexport interface VibrateOptions {\n // Defaults to `medium`.\n style?: VibrationStyle | undefined;\n}\n\nexport interface HapticsMethods {\n 'dash.system.vibrate': { params: VibrateOptions; result: void };\n}\n\n// Plays a short vibration, and resolves once it has.\nexport function vibrate(\n options: VibrateOptions = {},\n callOptions?: CallOptions,\n): DashRequest<void> {\n return call('dash.system.vibrate', { style: options.style ?? 'medium' }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type TorchState = 'on' | 'off';\n\nexport interface TorchMethods {\n 'dash.system.torch': { params: { state: TorchState }; result: void };\n}\n\n// Turns the torch on or off. Rejects with `unsupported` on a device without one.\nexport function torch(state: TorchState, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.torch', { state }, callOptions);\n}\n","import type { HapticsMethods } from './haptics';\nimport type { TorchMethods } from './torch';\n\nexport { vibrate } from './haptics';\nexport { torch } from './torch';\nexport type { VibrateOptions, VibrationStyle } from './haptics';\nexport type { TorchState } from './torch';\n\nexport type SystemMethods = HapticsMethods & TorchMethods;\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface AlertAction {\n id: string;\n label: string;\n // `cancel` dismisses the alert; `destructive` marks something that cannot be undone.\n role?: 'default' | 'cancel' | 'destructive' | undefined;\n}\n\nexport interface AlertOptions {\n title: string;\n message?: string | undefined;\n // Defaults to a single OK.\n actions?: AlertAction[] | undefined;\n}\n\nexport interface AlertResult {\n // The `id` of the action the user chose.\n action: string;\n}\n\nexport interface DialogMethods {\n 'dash.ui.alert': { params: AlertOptions; result: AlertResult };\n}\n\n// Shows a native alert, and resolves with the action the user chose.\nexport function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult> {\n const actions = options.actions ?? [{ id: 'ok', label: 'OK' }];\n return call('dash.ui.alert', { ...options, actions }, callOptions);\n}\n","import type { DialogMethods } from './dialogs';\n\nexport { alert } from './dialogs';\nexport type { AlertAction, AlertOptions, AlertResult } from './dialogs';\n\nexport type UIMethods = DialogMethods;\n","import * as system from './system';\nimport * as ui from './ui';\n\n// Dash's features for a dot's service, grouped by use: `dash.ui.alert(...)`, `dash.system.torch(...)`.\nexport const dash = { ui, system };\n\nexport { HostError } from '@monimesl/dot-core';\nexport type { HostErrorCode } from '@monimesl/dot-core';\nexport type { CallOptions, DashRequest } from './call';\nexport type { DashMethod, DashMethods } from './methods';\nexport type { SystemMethods, TorchState, VibrateOptions, VibrationStyle } from './system';\nexport type { AlertAction, AlertOptions, AlertResult, UIMethods } from './ui';\n"],"mappings":";;;AAUA,SAAgB,KACd,QACA,QACA,UAAuB,CAAC,GACoB;CAC5C,OAAO,SAAS,QAAQ,QAAQ,OAAO;AACzC;;;ACDA,SAAgB,QACd,UAA0B,CAAC,GAC3B,aACmB;CACnB,OAAO,KAAK,uBAAuB,EAAE,OAAO,QAAQ,SAAS,SAAS,GAAG,WAAW;AACtF;;;ACVA,SAAgB,MAAM,OAAmB,aAA8C;CACrF,OAAO,KAAK,qBAAqB,EAAE,MAAM,GAAG,WAAW;AACzD;;;;;;;;;AEeA,SAAgB,MAAM,SAAuB,aAAqD;CAChG,MAAM,UAAU,QAAQ,WAAW,CAAC;EAAE,IAAI;EAAM,OAAO;CAAK,CAAC;CAC7D,OAAO,KAAK,iBAAiB;EAAE,GAAG;EAAS;CAAQ,GAAG,WAAW;AACnE;;;AE1BA,MAAa,OAAO;CAAE,IAAA,kDAAA;CAAI,QAAA;AAAO"}
1
+ {"version":3,"file":"index.js","names":["HostError","get","set","remove","clear","remove","HostError"],"sources":["../src/call.ts","../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/media/pick-photo.ts","../src/media/scan-code.ts","../src/media/index.ts","../src/files.ts","../src/network/http.ts","../src/network/status.ts","../src/network/index.ts","../src/storage/cache.ts","../src/storage/file.ts","../src/storage/secret.ts","../src/storage/index.ts","../src/system/clipboard.ts","../src/system/delay.ts","../src/system/dial.ts","../src/system/haptics.ts","../src/system/info.ts","../src/system/open-url.ts","../src/system/screen.ts","../src/system/share.ts","../src/system/torch.ts","../src/system/index.ts","../src/ui/dialogs.ts","../src/ui/pickers.ts","../src/ui/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"sourcesContent":["import type { HostCallOptions, HostRequest } from '@monimesl/dot-core';\nimport { callHost } from '@monimesl/dot-core';\n\nimport type { DashMethod, DashMethods } from './methods';\n\nexport type CallOptions = HostCallOptions;\n\n// A running Dash call. Await it for the result, or cancel it.\nexport type DashRequest<Result> = HostRequest<Result>;\n\nexport function call<Method extends DashMethod>(\n method: Method,\n params: DashMethods[Method]['params'],\n options: CallOptions = {},\n): DashRequest<DashMethods[Method]['result']> {\n return callHost(method, params, options);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface PickedContact {\n name: string;\n // As the contact has it, such as \"+232 76 123456\" or \"076 123456\".\n phone: string;\n}\n\nexport interface PickPhoneMethods {\n 'dash.contacts.pickPhone': { params: Record<string, never>; result: PickedContact };\n}\n\n// Shows the phone's contacts so the person chooses one phone number, such as who to send money to.\n// Needs the `contacts` permission. The dot sees only the chosen contact. Rejects with `cancelled` if\n// the person closes it.\nexport function pickPhone(callOptions?: CallOptions): DashRequest<PickedContact> {\n return call('dash.contacts.pickPhone', {}, callOptions);\n}\n","import type { PickPhoneMethods } from './pick-phone';\n\nexport { pickPhone } from './pick-phone';\nexport type { PickedContact } from './pick-phone';\n\nexport type ContactsMethods = PickPhoneMethods;\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\n\nexport type PhotoSource = 'library' | 'camera';\n\nexport interface PickPhotoOptions {\n // `library` needs the `photoLibrary` permission, and `camera` the `camera` permission.\n source: PhotoSource;\n}\n\nexport interface PickPhotoMethods {\n 'dash.media.pickPhoto': { params: { source: PhotoSource }; result: DotFile };\n}\n\n// Lets the person choose a photo or take one. Resolves with it as a JPEG of at most 2048 pixels on its\n// longest side, without its location or other details. Rejects with `cancelled` if they close the\n// picker, and with `unsupported` on a device without a camera. Save it with `dash.storage.file.save`\n// to keep it after the dot closes.\nexport function pickPhoto(\n options: PickPhotoOptions,\n callOptions?: CallOptions,\n): DashRequest<DotFile> {\n return call('dash.media.pickPhoto', { source: options.source }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\n// Only QR codes for now. More formats can come later without changing what a dot gets.\nexport type CodeFormat = 'qr';\n\nexport interface ScannedCode {\n text: string;\n format: CodeFormat;\n}\n\nexport interface ScanCodeMethods {\n 'dash.media.scanCode': { params: Record<string, never>; result: ScannedCode };\n}\n\n// Opens Dash's scanner until it reads a QR code. Needs the `camera` permission. Rejects with\n// `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.\nexport function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode> {\n return call('dash.media.scanCode', {}, callOptions);\n}\n","import type { PickPhotoMethods } from './pick-photo';\nimport type { ScanCodeMethods } from './scan-code';\n\nexport { pickPhoto } from './pick-photo';\nexport { scanCode } from './scan-code';\nexport type { PhotoSource, PickPhotoOptions } from './pick-photo';\nexport type { CodeFormat, ScannedCode } from './scan-code';\n\nexport type MediaMethods = PickPhotoMethods & ScanCodeMethods;\n","// A file the host keeps for the dot until it closes, such as a download. Show it with its `url`.\nexport interface DotFile {\n id: string;\n name: string;\n size: number;\n contentType: string;\n url: string;\n}\n\nexport function fileId(file: DotFile | string): string {\n return typeof file === 'string' ? file : file.id;\n}\n","import { createHostRequest, HostError } from '@monimesl/dot-core';\n\nimport type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\nimport { fileId } from '../files';\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';\n\nexport type HttpRequestBody = string | object;\n\nexport interface HttpRequest<Body extends HttpRequestBody = HttpRequestBody> {\n url: string;\n method?: HttpMethod;\n headers?: Record<string, string>;\n body?: Body;\n}\n\nexport interface HttpResponse<Body = string> {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n body: Body;\n}\n\n// Any body type other than string needs `as: 'json'`.\nexport type HttpReadOptions<Body> = [Body] extends [string] ? { as?: 'text' } : { as: 'json' };\n\nexport interface HttpDownloadRequest extends HttpRequest {\n name?: string;\n}\n\nexport type HttpDownloadResponse =\n | (Omit<HttpResponse, 'ok' | 'body'> & { ok: true; file: DotFile })\n | (Omit<HttpResponse, 'ok'> & { ok: false });\n\nexport interface HttpUploadFile {\n field: string;\n file: DotFile | string;\n name?: string;\n}\n\nexport interface HttpUploadRequest {\n url: string;\n // Defaults to POST.\n method?: 'POST' | 'PUT' | 'PATCH';\n headers?: Record<string, string>;\n fields?: Record<string, string>;\n files: HttpUploadFile[];\n}\n\ntype WireRequest<Request extends HttpRequest> = Omit<Request, 'headers' | 'body'> & {\n headers?: Record<string, string> | undefined;\n body?: string | undefined;\n};\n\ntype ReadAs = 'text' | 'json';\n\nexport interface HttpMethods {\n 'dash.network.http.request': { params: WireRequest<HttpRequest>; result: HttpResponse };\n 'dash.network.http.download': {\n params: WireRequest<HttpDownloadRequest>;\n result: HttpDownloadResponse;\n };\n 'dash.network.http.upload': {\n params: Omit<HttpUploadRequest, 'files'> & {\n files: { field: string; file: string; name?: string }[];\n };\n result: HttpResponse;\n };\n}\n\n// Like fetch, resolves with any response, even a 404. An object body is sent as JSON.\nexport function request<\n ResponseBody = string,\n RequestBody extends HttpRequestBody = HttpRequestBody,\n>(\n options: HttpRequest<RequestBody> & HttpReadOptions<ResponseBody>,\n callOptions?: CallOptions,\n): DashRequest<HttpResponse<ResponseBody>> {\n const { as, ...request } = options as HttpRequest & { as?: ReadAs };\n const response = call('dash.network.http.request', wireRequest(request, as), callOptions);\n return readBody(response, as);\n}\n\n// Saves a 2xx response's body, up to 100 MB, to a temporary file.\nexport function download(\n options: HttpDownloadRequest,\n callOptions?: CallOptions,\n): DashRequest<HttpDownloadResponse> {\n return call('dash.network.http.download', wireRequest(options), callOptions);\n}\n\n// Sends the dot's files as a multipart form.\nexport function upload<ResponseBody = string>(\n options: HttpUploadRequest & HttpReadOptions<ResponseBody>,\n callOptions?: CallOptions,\n): DashRequest<HttpResponse<ResponseBody>> {\n const { as, ...request } = options as HttpUploadRequest & { as?: ReadAs };\n const files = request.files.map(({ file, ...rest }) => ({ ...rest, file: fileId(file) }));\n const params = { ...request, files };\n if (as === 'json') {\n params.headers = withDefaultHeader(request.headers, 'Accept', 'application/json');\n }\n const response = call('dash.network.http.upload', params, callOptions);\n return readBody(response, as);\n}\n\nfunction wireRequest<Request extends HttpRequest>(\n request: Request,\n as?: ReadAs,\n): WireRequest<Request> {\n let headers = request.headers;\n let body: string | undefined;\n if (as === 'json') {\n headers = withDefaultHeader(headers, 'Accept', 'application/json');\n }\n if (typeof request.body === 'string') {\n body = request.body;\n } else if (request.body !== undefined) {\n headers = withDefaultHeader(headers, 'Content-Type', 'application/json');\n body = JSON.stringify(request.body);\n }\n return { ...request, headers, body };\n}\n\nfunction withDefaultHeader(\n headers: Record<string, string> | undefined,\n name: string,\n value: string,\n): Record<string, string> {\n const lowerName = name.toLowerCase();\n if (headers && Object.keys(headers).some((existing) => existing.toLowerCase() === lowerName)) {\n return headers;\n }\n return { ...headers, [name]: value };\n}\n\nfunction readBody<Body>(\n response: DashRequest<HttpResponse>,\n as: ReadAs | undefined,\n): DashRequest<HttpResponse<Body>> {\n if (as !== 'json') {\n return response as DashRequest<HttpResponse<Body>>;\n }\n const parsed = response.then((result) => ({ ...result, body: parseJson<Body>(result) }));\n return createHostRequest(parsed, () => response.cancel());\n}\n\nfunction parseJson<Body>({ status, statusText, body }: HttpResponse): Body {\n try {\n return JSON.parse(body) as Body;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new HostError('failed', `The response (${status} ${statusText}) isn't JSON: ${message}`);\n }\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type ConnectionType = 'wifi' | 'cellular' | 'other' | 'none';\n\nexport interface NetworkStatus {\n online: boolean;\n type: ConnectionType;\n}\n\nexport interface StatusMethods {\n 'dash.network.status': { params: Record<string, never>; result: NetworkStatus };\n}\n\n// Whether the phone is online now, and how. It can still be online without reaching a server.\nexport function status(callOptions?: CallOptions): DashRequest<NetworkStatus> {\n return call('dash.network.status', {}, callOptions);\n}\n","import type { HttpMethods } from './http';\nimport * as http from './http';\nimport type { StatusMethods } from './status';\n\nexport { http };\nexport { status } from './status';\nexport type { ConnectionType, NetworkStatus } from './status';\nexport type {\n HttpDownloadRequest,\n HttpDownloadResponse,\n HttpMethod,\n HttpReadOptions,\n HttpRequest,\n HttpRequestBody,\n HttpResponse,\n HttpUploadFile,\n HttpUploadRequest,\n} from './http';\n\nexport type NetworkMethods = HttpMethods & StatusMethods;\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\n// A dot's own key-value cache, apart from its files. It holds up to 64 MB of JSON values, each kept\n// until removed or until its `ttl` runs out.\n\nexport type CacheValue = string | number | boolean | CacheValue[] | { [key: string]: CacheValue };\n\nexport interface CacheMethods {\n 'dash.storage.cache.get': { params: { key: string }; result: CacheValue | null };\n 'dash.storage.cache.set': {\n params: { key: string; value: CacheValue; ttl?: number | undefined };\n result: void;\n };\n 'dash.storage.cache.remove': { params: { key: string }; result: void };\n 'dash.storage.cache.exists': { params: { key: string }; result: boolean };\n 'dash.storage.cache.keys': { params: Record<string, never>; result: string[] };\n 'dash.storage.cache.clear': { params: Record<string, never>; result: void };\n}\n\nexport interface CacheSetOptions {\n // How many seconds the entry lasts. Without it, or with 0 or less, it lasts until removed.\n ttl?: number | undefined;\n}\n\n// Resolves with null for a missing or expired key.\nexport function get<Value extends CacheValue = CacheValue>(\n key: string,\n callOptions?: CallOptions,\n): DashRequest<Value | null> {\n return call('dash.storage.cache.get', { key }, callOptions) as DashRequest<Value | null>;\n}\n\nexport function set(\n key: string,\n value: CacheValue,\n options: CacheSetOptions = {},\n callOptions?: CallOptions,\n): DashRequest<void> {\n return call('dash.storage.cache.set', { key, value, ...options }, callOptions);\n}\n\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.cache.remove', { key }, callOptions);\n}\n\nexport function exists(key: string, callOptions?: CallOptions): DashRequest<boolean> {\n return call('dash.storage.cache.exists', { key }, callOptions);\n}\n\n// The keys, sorted.\nexport function keys(callOptions?: CallOptions): DashRequest<string[]> {\n return call('dash.storage.cache.keys', {}, callOptions);\n}\n\nexport function clear(callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.cache.clear', {}, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\nimport { fileId } from '../files';\n\n// A dot's own files, in a folder no other dot sees. Paths are relative to it, such as\n// \"receipts/42.pdf\", and '' is the folder itself.\n\nexport interface FileEntry {\n name: string;\n path: string;\n size: number;\n kind: 'file' | 'folder';\n modifiedAt: number;\n contentType?: string;\n}\n\nexport type FileEncoding = 'text' | 'base64';\n\nexport interface StorageUsage {\n used: number;\n quota: number;\n}\n\nexport interface FileMethods {\n 'dash.storage.file.read': { params: { path: string; as?: FileEncoding }; result: string };\n 'dash.storage.file.write': {\n params: { path: string; data: string; as?: FileEncoding; append?: boolean };\n result: FileEntry;\n };\n 'dash.storage.file.stat': { params: { path: string }; result: FileEntry | null };\n 'dash.storage.file.list': { params: { path: string; recursive?: boolean }; result: FileEntry[] };\n 'dash.storage.file.createFolder': { params: { path: string }; result: FileEntry };\n 'dash.storage.file.move': {\n params: { from: string; to: string; overwrite?: boolean };\n result: FileEntry;\n };\n 'dash.storage.file.copy': {\n params: { from: string; to: string; overwrite?: boolean };\n result: FileEntry;\n };\n 'dash.storage.file.remove': { params: { path: string; recursive?: boolean }; result: void };\n 'dash.storage.file.save': {\n params: { file: string; path: string; overwrite?: boolean };\n result: FileEntry;\n };\n 'dash.storage.file.open': { params: { path: string }; result: DotFile };\n 'dash.storage.file.usage': { params: Record<string, never>; result: StorageUsage };\n 'dash.storage.file.pick': { params: { types?: string[] }; result: DotFile };\n}\n\nexport interface PickFileOptions {\n // Content types the person may choose, such as 'application/pdf' or 'image/*'. Any file without them.\n types?: string[];\n}\n\nexport interface ReadOptions {\n as?: FileEncoding;\n}\n\nexport interface WriteOptions {\n as?: FileEncoding;\n append?: boolean;\n}\n\nexport interface ReplaceOptions {\n overwrite?: boolean;\n}\n\n// Reads a file of up to 5 MB.\nexport function read(\n path: string,\n options: ReadOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.storage.file.read', { path, ...options }, callOptions);\n}\n\n// Creates any missing folders above the file.\nexport function write(\n path: string,\n data: string,\n options: WriteOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.write', { path, data, ...options }, callOptions);\n}\n\nexport function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null> {\n return call('dash.storage.file.stat', { path }, callOptions);\n}\n\n// Sorted by path.\nexport function list(\n path = '',\n options: { recursive?: boolean } = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry[]> {\n return call('dash.storage.file.list', { path, ...options }, callOptions);\n}\n\nexport function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry> {\n return call('dash.storage.file.createFolder', { path }, callOptions);\n}\n\nexport function move(\n from: string,\n to: string,\n options: ReplaceOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.move', { from, to, ...options }, callOptions);\n}\n\nexport function copy(\n from: string,\n to: string,\n options: ReplaceOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.copy', { from, to, ...options }, callOptions);\n}\n\n// Removing a folder that isn't empty needs `recursive`.\nexport function remove(\n path: string,\n options: { recursive?: boolean } = {},\n callOptions?: CallOptions,\n): DashRequest<void> {\n return call('dash.storage.file.remove', { path, ...options }, callOptions);\n}\n\n// Keeps a temporary file, such as a download, at `path`.\nexport function save(\n file: DotFile | string,\n path: string,\n options: ReplaceOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.save', { file: fileId(file), path, ...options }, callOptions);\n}\n\n// A stored file as a DotFile, to show with its `url` or send with `http.upload`.\nexport function open(path: string, callOptions?: CallOptions): DashRequest<DotFile> {\n return call('dash.storage.file.open', { path }, callOptions);\n}\n\nexport function usage(callOptions?: CallOptions): DashRequest<StorageUsage> {\n return call('dash.storage.file.usage', {}, callOptions);\n}\n\n// Lets the person choose a file from their phone, of at most 25 MB. Needs the `files` permission.\n// Rejects with `cancelled` if they close the picker, and with `invalid` for a larger file. Like a\n// download, it lasts until the dot closes, so `save` it to keep it.\nexport function pick(\n options: PickFileOptions = {},\n callOptions?: CallOptions,\n): DashRequest<DotFile> {\n const params: { types?: string[] } = {};\n if (options.types) {\n params.types = options.types;\n }\n return call('dash.storage.file.pick', params, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\n// A dot's secrets, such as tokens its own API gives the person. Holds up to 8 strings of up to 4 KB\n// each, encrypted with a key that never leaves the device. Don't keep the dot's own API keys here:\n// they would ship in its bundle, which anyone can read.\n\nexport interface SecretMethods {\n 'dash.storage.secret.get': { params: { key: string }; result: string | null };\n 'dash.storage.secret.set': { params: { key: string; value: string }; result: void };\n 'dash.storage.secret.remove': { params: { key: string }; result: void };\n 'dash.storage.secret.clear': { params: Record<string, never>; result: void };\n}\n\nexport function get(key: string, callOptions?: CallOptions): DashRequest<string | null> {\n return call('dash.storage.secret.get', { key }, callOptions);\n}\n\nexport function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.set', { key, value }, callOptions);\n}\n\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.remove', { key }, callOptions);\n}\n\nexport function clear(callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.clear', {}, callOptions);\n}\n","// A dot's own data, kept on this device for the signed-in Dash user only. It's never backed up or\n// moved to a new phone, and another user who signs in sees none of it. Keep what matters on the\n// dot's server, and treat this as a copy you can fetch again.\n\nimport type { CacheMethods } from './cache';\nimport * as cache from './cache';\nimport type { FileMethods } from './file';\nimport * as file from './file';\nimport type { SecretMethods } from './secret';\nimport * as secret from './secret';\n\nexport { cache, file, secret };\nexport type { CacheSetOptions, CacheValue } from './cache';\nexport type {\n FileEncoding,\n FileEntry,\n PickFileOptions,\n ReadOptions,\n ReplaceOptions,\n StorageUsage,\n WriteOptions,\n} from './file';\n\nexport type StorageMethods = FileMethods & CacheMethods & SecretMethods;\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface ClipboardMethods {\n 'dash.system.copyText': { params: { text: string }; result: void };\n}\n\nexport function copyText(text: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.copyText', { text }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface DelayMethods {\n 'dash.system.delay': { params: { milliseconds: number }; result: void };\n}\n\n// Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.\nexport function delay(milliseconds: number, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.delay', { milliseconds }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface DialMethods {\n 'dash.system.dial': { params: { number: string }; result: void };\n}\n\n// Opens the phone's dialer with `number` ready, such as \"+232 76 123456\" or a USSD code such as\n// \"*144#\". The person taps Call. Spaces and dashes are fine; anything else but digits, +, * and #\n// rejects with `invalid`.\nexport function dial(number: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.dial', { number }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type VibrationStyle = 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';\n\nexport interface VibrateOptions {\n // Defaults to `medium`.\n style?: VibrationStyle | undefined;\n}\n\nexport interface HapticsMethods {\n 'dash.system.vibrate': { params: VibrateOptions; result: void };\n}\n\n// Plays a short vibration. Resolves once it's done.\nexport function vibrate(\n options: VibrateOptions = {},\n callOptions?: CallOptions,\n): DashRequest<void> {\n return call('dash.system.vibrate', { style: options.style ?? 'medium' }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type Platform = 'ios' | 'android' | 'simulator';\n\nexport interface SystemInfo {\n platform: Platform;\n // Such as \"18.2\" on iOS or \"15\" on Android.\n osVersion: string;\n // The person's language, such as \"en\", and their region, such as \"SL\", or null if unknown.\n language: string;\n region: string | null;\n // Such as \"Africa/Freetown\".\n timeZone: string;\n // The version of Dash the dot runs in, such as \"2.4.0\", and of DotHost inside it.\n dashVersion: string;\n hostVersion: string;\n}\n\nexport interface InfoMethods {\n 'dash.system.info': { params: Record<string, never>; result: SystemInfo };\n}\n\n// The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.\nexport function info(callOptions?: CallOptions): DashRequest<SystemInfo> {\n return call('dash.system.info', {}, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface OpenUrlMethods {\n 'dash.system.openUrl': { params: { url: string }; result: void };\n}\n\n// Opens an https address in the device's browser. Any other address rejects with `invalid`.\nexport function openUrl(url: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.openUrl', { url }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type BrightnessLevel = 'max' | 'normal';\n\nexport interface ScreenMethods {\n 'dash.system.keepAwake': { params: { on: boolean }; result: void };\n 'dash.system.brightness': { params: { level: BrightnessLevel }; result: void };\n}\n\n// Keeps the screen from dimming and locking while the dot shows, such as while a ticket's QR code is\n// up. Dash undoes it when the dot closes.\nexport function keepAwake(on: boolean, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.keepAwake', { on }, callOptions);\n}\n\n// `max` makes the screen as bright as it goes, so a scanner can read a QR code on it, and `normal`\n// puts it back. Dash puts it back too when the dot closes or the person leaves the app.\nexport function brightness(level: BrightnessLevel, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.brightness', { level }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\nimport { fileId } from '../files';\n\n// Give at least one of `text`, `url` and `file`.\nexport interface ShareOptions {\n // A subject, for apps that use one, such as email.\n title?: string;\n text?: string;\n url?: string;\n file?: DotFile | string;\n}\n\nexport interface ShareMethods {\n 'dash.system.share': {\n params: { title?: string; text?: string; url?: string; file?: string };\n result: void;\n };\n}\n\n// Opens the device's share sheet. Resolves once it shows.\nexport function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void> {\n const { file, ...rest } = options;\n if (file === undefined) {\n return call('dash.system.share', rest, callOptions);\n }\n return call('dash.system.share', { ...rest, file: fileId(file) }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type TorchState = 'on' | 'off';\n\nexport interface TorchMethods {\n 'dash.system.torch': { params: { state: TorchState }; result: void };\n}\n\n// Turns the torch on or off. Rejects with `unsupported` on a device without one.\nexport function torch(state: TorchState, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.torch', { state }, callOptions);\n}\n","import type { ClipboardMethods } from './clipboard';\nimport type { DelayMethods } from './delay';\nimport type { DialMethods } from './dial';\nimport type { HapticsMethods } from './haptics';\nimport type { InfoMethods } from './info';\nimport type { OpenUrlMethods } from './open-url';\nimport type { ScreenMethods } from './screen';\nimport type { ShareMethods } from './share';\nimport type { TorchMethods } from './torch';\n\nexport { copyText } from './clipboard';\nexport { delay } from './delay';\nexport { dial } from './dial';\nexport { vibrate } from './haptics';\nexport { info } from './info';\nexport { openUrl } from './open-url';\nexport { brightness, keepAwake } from './screen';\nexport { share } from './share';\nexport { torch } from './torch';\nexport type { VibrateOptions, VibrationStyle } from './haptics';\nexport type { Platform, SystemInfo } from './info';\nexport type { BrightnessLevel } from './screen';\nexport type { ShareOptions } from './share';\nexport type { TorchState } from './torch';\n\nexport type SystemMethods = ClipboardMethods &\n DelayMethods &\n DialMethods &\n HapticsMethods &\n InfoMethods &\n OpenUrlMethods &\n ScreenMethods &\n ShareMethods &\n TorchMethods;\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface AlertAction {\n id: string;\n label: string;\n // `cancel` dismisses the alert. `destructive` marks something that can't be undone.\n role?: 'default' | 'cancel' | 'destructive' | undefined;\n}\n\nexport interface AlertOptions {\n title: string;\n message?: string | undefined;\n // Defaults to one OK button.\n actions?: AlertAction[] | undefined;\n}\n\nexport interface AlertResult {\n // The `id` of the action the person chose.\n action: string;\n}\n\nexport interface DialogMethods {\n 'dash.ui.alert': { params: AlertOptions; result: AlertResult };\n}\n\n// Shows a native alert. Resolves with the action the person chose.\nexport function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult> {\n const actions = options.actions ?? [{ id: 'ok', label: 'OK' }];\n return call('dash.ui.alert', { ...options, actions }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface PickDateOptions {\n title?: string | undefined;\n // Dates such as \"2026-10-24\". `value` is the one chosen when the picker opens.\n value?: string | undefined;\n min?: string | undefined;\n max?: string | undefined;\n}\n\nexport interface PickTimeOptions {\n title?: string | undefined;\n // A time of day in 24 hours, such as \"19:30\", chosen when the picker opens.\n value?: string | undefined;\n}\n\nexport interface PickerMethods {\n 'dash.ui.pickDate': { params: PickDateOptions; result: string };\n 'dash.ui.pickTime': { params: PickTimeOptions; result: string };\n}\n\n// Opens the phone's own calendar. Resolves with the chosen date, such as \"2026-10-24\", or rejects\n// with `cancelled` if the person closes it.\nexport function pickDate(\n options: PickDateOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.ui.pickDate', options, callOptions);\n}\n\n// Opens the phone's own clock. Resolves with the chosen time in 24 hours, such as \"19:30\", or\n// rejects with `cancelled` if the person closes it.\nexport function pickTime(\n options: PickTimeOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.ui.pickTime', options, callOptions);\n}\n","import type { DialogMethods } from './dialogs';\nimport type { PickerMethods } from './pickers';\n\nexport { alert } from './dialogs';\nexport { pickDate, pickTime } from './pickers';\nexport type { AlertAction, AlertOptions, AlertResult } from './dialogs';\nexport type { PickDateOptions, PickTimeOptions } from './pickers';\n\nexport type UIMethods = DialogMethods & PickerMethods;\n","import type { DashRequest } from './call';\n\n// A copy of `group`, such as `dash`, that passes each request it starts to `track`.\nexport function tracked<Group extends object>(\n group: Group,\n track: (request: DashRequest<unknown>) => void,\n): Group {\n const copy: Record<string, unknown> = {};\n for (const [name, member] of Object.entries(group)) {\n if (typeof member === 'function') {\n const start = member as (...args: unknown[]) => DashRequest<unknown>;\n copy[name] = (...args: unknown[]) => {\n const request = start(...args);\n track(request);\n return request;\n };\n } else {\n copy[name] = tracked(member as object, track);\n }\n }\n return copy as Group;\n}\n","import type { HostErrorCode } from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\ntype DashErrorWith<Code extends HostErrorCode> = HostError & { readonly code: Code };\n\nexport function isDashError<Code extends HostErrorCode>(\n error: unknown,\n ...codes: Code[]\n): error is DashErrorWith<Code> {\n if (error instanceof HostError) {\n return codes.length === 0 || codes.includes(error.code as Code);\n }\n return false;\n}\n\nexport function isDashCancelled(error: unknown): error is DashErrorWith<'cancelled'> {\n return isDashError(error, 'cancelled');\n}\n\nexport function isDashTimeout(error: unknown): error is DashErrorWith<'timeout'> {\n return isDashError(error, 'timeout');\n}\n\nexport function isDashDenied(error: unknown): error is DashErrorWith<'denied'> {\n return isDashError(error, 'denied');\n}\n\nexport function isDashInvalid(error: unknown): error is DashErrorWith<'invalid'> {\n return isDashError(error, 'invalid');\n}\n\nexport function isDashUnsupported(error: unknown): error is DashErrorWith<'unsupported'> {\n return isDashError(error, 'unsupported');\n}\n\nexport function isDashFailed(error: unknown): error is DashErrorWith<'failed'> {\n return isDashError(error, 'failed');\n}\n\n// The message to show for anything a call threw, even if it isn't an Error.\nexport function errorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'string' && error) {\n return error;\n }\n return 'Something went wrong. Try again.';\n}\n\n// Waits for a call, such as a picker, and gives undefined if the person closed it or it was\n// cancelled. Other errors still throw.\nexport async function unlessCancelled<Result>(\n call: PromiseLike<Result>,\n): Promise<Result | undefined> {\n try {\n return await call;\n } catch (error) {\n if (isDashCancelled(error)) {\n return undefined;\n }\n throw error;\n }\n}\n","import type { DashRequest } from './call';\nimport { isDashCancelled } from './errors';\nimport type { Dash } from './index';\n\n// Each call given to it cancels the one before, so an older answer can't arrive after a newer one.\n// The cancelled call rejects with `cancelled`, which unlessCancelled turns into undefined.\nexport function latest(): <Result>(call: DashRequest<Result>) => DashRequest<Result> {\n let running: DashRequest<unknown> | undefined;\n return (call) => {\n running?.cancel();\n running = call;\n return call;\n };\n}\n\n// Resolves true once `milliseconds` pass without another call, such as a pause in typing, and false\n// for a wait a newer call cut short. It waits through the page's `this.dash`, since a dot has no timers.\nexport function debounce(milliseconds: number): (dash: Dash) => Promise<boolean> {\n const wait = latest();\n return async (dash) => {\n try {\n await wait(dash.system.delay(milliseconds));\n return true;\n } catch (error) {\n if (isDashCancelled(error)) {\n return false;\n }\n throw error;\n }\n };\n}\n","import * as contacts from './contacts';\nimport * as media from './media';\nimport * as network from './network';\nimport * as storage from './storage';\nimport * as system from './system';\nimport * as ui from './ui';\n\n// Dash's features for a dot's logic, in groups: `dash.ui.alert(...)`, `dash.system.torch(...)`,\n// `dash.network.http.request(...)`.\nexport const dash = { ui, system, network, storage, media, contacts };\n\nexport type Dash = typeof dash;\n\nexport { tracked } from './tracked';\n\nexport { HostError } from '@monimesl/dot-core';\nexport type { HostErrorCode } from '@monimesl/dot-core';\n// The error a Dash call fails with, by the name a dot knows it from `this.dash`. It's HostError\n// itself, so `instanceof` and `code` work the same with either name.\nexport { HostError as DashError } from '@monimesl/dot-core';\nexport type { HostErrorCode as DashErrorCode } from '@monimesl/dot-core';\nexport {\n errorMessage,\n isDashCancelled,\n isDashDenied,\n isDashError,\n isDashFailed,\n isDashInvalid,\n isDashTimeout,\n isDashUnsupported,\n unlessCancelled,\n} from './errors';\nexport { debounce, latest } from './latest';\nexport type { CallOptions, DashRequest } from './call';\nexport type { DashMethod, DashMethods } from './methods';\nexport type {\n CacheSetOptions,\n CacheValue,\n FileEncoding,\n FileEntry,\n PickFileOptions,\n ReadOptions,\n ReplaceOptions,\n StorageMethods,\n StorageUsage,\n WriteOptions,\n} from './storage';\nexport type { DotFile } from './files';\nexport type { CodeFormat, MediaMethods, PhotoSource, PickPhotoOptions, ScannedCode } from './media';\nexport type { ContactsMethods, PickedContact } from './contacts';\nexport type {\n ConnectionType,\n HttpDownloadRequest,\n HttpDownloadResponse,\n HttpMethod,\n HttpReadOptions,\n HttpRequest,\n HttpRequestBody,\n HttpResponse,\n HttpUploadFile,\n HttpUploadRequest,\n NetworkMethods,\n NetworkStatus,\n} from './network';\nexport type {\n BrightnessLevel,\n Platform,\n ShareOptions,\n SystemInfo,\n SystemMethods,\n TorchState,\n VibrateOptions,\n VibrationStyle,\n} from './system';\nexport type {\n AlertAction,\n AlertOptions,\n AlertResult,\n PickDateOptions,\n PickTimeOptions,\n UIMethods,\n} from './ui';\n"],"mappings":";;;AAUA,SAAgB,KACd,QACA,QACA,UAAuB,CAAC,GACoB;CAC5C,OAAO,SAAS,QAAQ,QAAQ,OAAO;AACzC;;;ACAA,SAAgB,UAAU,aAAuD;CAC/E,OAAO,KAAK,2BAA2B,CAAC,GAAG,WAAW;AACxD;;;;;;AECA,SAAgB,UACd,SACA,aACsB;CACtB,OAAO,KAAK,wBAAwB,EAAE,QAAQ,QAAQ,OAAO,GAAG,WAAW;AAC7E;;;ACPA,SAAgB,SAAS,aAAqD;CAC5E,OAAO,KAAK,uBAAuB,CAAC,GAAG,WAAW;AACpD;;;;;;;;;AEVA,SAAgB,OAAO,MAAgC;CACrD,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK;AAChD;;;;;;;;AC+DA,SAAgB,QAId,SACA,aACyC;CACzC,MAAM,EAAE,IAAI,GAAG,YAAY;CAE3B,OAAO,SADU,KAAK,6BAA6B,YAAY,SAAS,EAAE,GAAG,WACtD,GAAG,EAAE;AAC9B;AAGA,SAAgB,SACd,SACA,aACmC;CACnC,OAAO,KAAK,8BAA8B,YAAY,OAAO,GAAG,WAAW;AAC7E;AAGA,SAAgB,OACd,SACA,aACyC;CACzC,MAAM,EAAE,IAAI,GAAG,YAAY;CAC3B,MAAM,QAAQ,QAAQ,MAAM,KAAK,EAAE,MAAM,GAAG,YAAY;EAAE,GAAG;EAAM,MAAM,OAAO,IAAI;CAAE,EAAE;C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AAgB,KAAK,GACvB;EAEF,MAAM;CACR;AACF;;;ACzDA,SAAgB,SAAqE;CACnF,IAAI;CACJ,QAAQ,SAAS;EACf,SAAS,OAAO;EAChB,UAAU;EACV,OAAO;CACT;AACF;AAIA,SAAgB,SAAS,cAAwD;CAC/E,MAAM,OAAO,OAAO;CACpB,OAAO,OAAO,SAAS;EACrB,IAAI;GACF,MAAM,KAAK,KAAK,OAAO,MAAM,YAAY,CAAC;GAC1C,OAAO;EACT,SAAS,OAAO;GACd,IAAI,gBAAgB,KAAK,GACvB,OAAO;GAET,MAAM;EACR;CACF;AACF;;;ACrBA,MAAa,OAAO;CAAE,IAAA;CAAI,QAAA;CAAQ,SAAA;CAAS,SAAA;CAAS,OAAA;CAAO,UAAA;AAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-dash",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.21",
4
4
  "description": "Dash features for dots: native UI, system and more, called from the service",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "main": "./dist/index.js",
25
25
  "types": "./dist/index.d.ts",
26
26
  "dependencies": {
27
- "@monimesl/dot-core": "0.1.0-alpha.2"
27
+ "@monimesl/dot-core": "0.1.0-alpha.21"
28
28
  },
29
29
  "devDependencies": {
30
30
  "publint": "^0.3.24",