@monimesl/dot-dash 1.0.0-beta.4 → 1.0.0-beta.6

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
@@ -11,17 +11,16 @@ interface PickPhoneMethods {
11
11
  };
12
12
  }
13
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.
14
+ * Shows the phone's contacts for the person to choose one phone number, such as the number to send
15
+ * money to. The dot sees only the chosen contact. Rejects with `cancelled` if the person closes it.
17
16
  * @since 1.0
18
17
  */
19
18
  declare function pickPhone(callOptions?: CallOptions): DashRequest<PickedContact>;
20
- declare namespace index_d_exports$10 {
19
+ declare namespace index_d_exports$11 {
21
20
  export { ContactsMethods, PickedContact, pickPhone };
22
21
  }
23
22
  type ContactsMethods = PickPhoneMethods;
24
- declare namespace index_d_exports$9 {
23
+ declare namespace index_d_exports$10 {
25
24
  export { CryptoInput, CryptoMethods, CryptoOutputOptions, HmacAlgorithm, HmacOptions, hmac, randomBytes, randomUUID, sha256, sha512 };
26
25
  }
27
26
  type CryptoInput = string | {
@@ -83,7 +82,7 @@ declare function sha512(data: CryptoInput, options?: CryptoOutputOptions, callOp
83
82
  */
84
83
  declare function hmac(options: HmacOptions, callOptions?: CallOptions): DashRequest<string>;
85
84
  /**
86
- * `count` secure random bytes, from 1 to 1024, such as for a nonce.
85
+ * `count` secure random bytes, from 1 to 1024.
87
86
  * @since 1.0
88
87
  */
89
88
  declare function randomBytes(count: number, options?: CryptoOutputOptions, callOptions?: CallOptions): DashRequest<string>;
@@ -92,7 +91,7 @@ declare function randomBytes(count: number, options?: CryptoOutputOptions, callO
92
91
  * @since 1.0
93
92
  */
94
93
  declare function randomUUID(callOptions?: CallOptions): DashRequest<string>;
95
- declare namespace index_d_exports$8 {
94
+ declare namespace index_d_exports$9 {
96
95
  export { DotMethods, close };
97
96
  }
98
97
  interface DotMethods {
@@ -129,9 +128,9 @@ interface PickFileMethods {
129
128
  };
130
129
  }
131
130
  /**
132
- * Lets the person choose a file from their phone, of at most 25 MB. Needs the `files` permission.
131
+ * Lets the person choose a file from their phone, of at most 25 MB.
133
132
  * Rejects with `cancelled` if they close the picker, and with `invalid` for a larger file. Like a
134
- * download, it lasts until the dot closes, so `dash.storage.file.save` it to keep it.
133
+ * download, it lasts until the dot closes unless you save it with `dash.storage.file.save`.
135
134
  * @since 1.0
136
135
  */
137
136
  declare function pickFile(options?: PickFileOptions, callOptions?: CallOptions): DashRequest<DotFile>;
@@ -171,12 +170,12 @@ interface ScanCodeMethods {
171
170
  };
172
171
  }
173
172
  /**
174
- * Opens Dash's scanner until it reads a QR code. Needs the `camera` permission. Rejects with
173
+ * Opens Dash's scanner until it reads a QR code. Rejects with
175
174
  * `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.
176
175
  * @since 1.0
177
176
  */
178
177
  declare function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode>;
179
- declare namespace index_d_exports$7 {
178
+ declare namespace index_d_exports$8 {
180
179
  export { CodeFormat, MediaMethods, PhotoSource, PickFileOptions, PickPhotoOptions, ScannedCode, pickFile, pickPhoto, scanCode };
181
180
  }
182
181
  type MediaMethods = PickFileMethods & PickPhotoMethods & ScanCodeMethods;
@@ -185,20 +184,20 @@ declare namespace http_d_exports {
185
184
  }
186
185
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
187
186
  type HttpRequestBody = string | object;
188
- interface HttpRequest<Body extends HttpRequestBody = HttpRequestBody> {
187
+ interface HttpRequest<RequestBody extends HttpRequestBody = HttpRequestBody> {
189
188
  url: string;
190
189
  method?: HttpMethod;
191
190
  headers?: Record<string, string>;
192
- body?: Body;
191
+ body?: RequestBody;
193
192
  }
194
- interface HttpResponse<Body = string> {
193
+ interface HttpResponse<ResponseBody = string> {
195
194
  ok: boolean;
196
195
  status: number;
197
196
  statusText: string;
198
197
  headers: Record<string, string>;
199
- body: Body;
198
+ body: ResponseBody;
200
199
  }
201
- type HttpReadOptions<Body> = [Body] extends [string] ? {
200
+ type HttpReadOptions<ResponseBody> = [ResponseBody] extends [string] ? {
202
201
  as?: 'text';
203
202
  } : {
204
203
  as: 'json';
@@ -281,7 +280,7 @@ interface StatusMethods {
281
280
  * @since 1.0
282
281
  */
283
282
  declare function status(callOptions?: CallOptions): DashRequest<NetworkStatus>;
284
- declare namespace index_d_exports$6 {
283
+ declare namespace index_d_exports$7 {
285
284
  export { ConnectionType, HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, NetworkMethods, NetworkStatus, http_d_exports as http, status };
286
285
  }
287
286
  type NetworkMethods = HttpMethods & StatusMethods;
@@ -304,16 +303,18 @@ interface Order {
304
303
  lineItems: OrderLineItem[];
305
304
  metadata?: Record<string, string> | undefined;
306
305
  }
306
+ type MomoProvider = 'm17' | 'm18';
307
+ type LinkProvider = 'slb001' | 'slb004' | 'slb007' | 'slb009' | 'slb013';
307
308
  interface LinkMethod {
308
309
  type: 'link';
309
- providers?: string[] | undefined;
310
+ providers?: LinkProvider[] | undefined;
310
311
  }
311
312
  interface CardMethod {
312
313
  type: 'card';
313
314
  }
314
315
  interface MomoMethod {
315
316
  type: 'momo';
316
- providers?: string[] | undefined;
317
+ providers?: MomoProvider[] | undefined;
317
318
  phoneNumber?: string | undefined;
318
319
  }
319
320
  type PaymentMethod = LinkMethod | CardMethod | MomoMethod;
@@ -359,28 +360,116 @@ interface PaymentsMethods {
359
360
  }
360
361
  /**
361
362
  * Opens Dash's payment sheet, where the person pays for `order` with one of `methods`. The money
362
- * goes to the Space that owns the dot. Needs `payments` in dot.json's permissions.
363
+ * goes to the Space that owns the dot.
364
+ *
365
+ * Before the person picks a method, it can reject with:
363
366
  *
364
- * It rejects only before the person picks a method. `invalid` is an order Monime won't take, such
365
- * as one below its smallest amount. `denied` means the dot or Space can't take payments now. `failed`
366
- * means Dash couldn't reach Monime. `cancelled` means the person closed the sheet, and `timeout`
367
- * that Dash's time ran out.
367
+ * - `invalid`: Monime won't take the order, such as one below its smallest amount.
368
+ * - `denied`: the dot or its Space can't take payments now.
369
+ * - `failed`: Dash couldn't reach Monime.
370
+ * - `cancelled`: the person closed the sheet.
371
+ * - `timeout`: the sheet waited as long as Dash allows.
368
372
  *
369
- * Once they pick one, it resolves with how the payment ended: `completed`, `pending`, `expired`,
370
- * or `cancelled` if they closed the sheet. A method that fails keeps the sheet open to try again.
371
- * `cancel()` then only stops the dot waiting. Read the payment later with `get`.
373
+ * Once they pick a method, it resolves with the payment's `status`: `completed`, `pending`,
374
+ * `expired`, or `cancelled` if they closed the sheet. If a method fails, the sheet stays open for
375
+ * them to try again. From then on, `cancel()` only stops your code waiting; the payment goes on.
376
+ * Read it again later with `get`.
372
377
  * @since 1.0
373
378
  */
374
379
  declare function request(options: PaymentOptions, callOptions?: PaymentCallOptions): DashRequest<PaymentResult>;
375
380
  /**
376
- * The payment for the order with this reference, such as to check a pending one later, or after
377
- * the dot opens again. Undefined if this dot never asked for it, or the person never picked a
378
- * method. Needs `payments` in dot.json's permissions.
381
+ * The payment for the order with this reference, to check a pending one later or after the dot
382
+ * opens again. Undefined if this dot never asked for it, or the person never picked a method.
379
383
  * @since 1.0
380
384
  */
381
385
  declare function get$2(reference: string, callOptions?: CallOptions): DashRequest<PaymentResult | undefined>;
386
+ declare namespace index_d_exports$6 {
387
+ export { CardMethod, CardPaymentResult, LinkMethod, LinkPaymentResult, LinkProvider, MomoMethod, MomoPaymentResult, MomoProvider, Money, Order, OrderLineItem, PaymentCallOptions, PaymentMethod, PaymentOptions, PaymentResult, PaymentStatus, PaymentsMethods, get$2 as get, request };
388
+ }
389
+ //#endregion
390
+ //#region src/reminders/reminders.d.ts
391
+ type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
392
+ type ReminderRepeat = {
393
+ every: 'once';
394
+ } | {
395
+ every: 'dates';
396
+ dates: string[];
397
+ } | {
398
+ every: 'day';
399
+ interval?: number | undefined;
400
+ } | {
401
+ every: 'week';
402
+ interval?: number | undefined;
403
+ days: Weekday[];
404
+ } | {
405
+ every: 'month';
406
+ interval?: number | undefined;
407
+ days: number[];
408
+ } | {
409
+ every: 'month';
410
+ interval?: number | undefined;
411
+ nth: 1 | 2 | 3 | 4 | -1;
412
+ day: Weekday;
413
+ } | {
414
+ every: 'month';
415
+ interval?: number | undefined;
416
+ lastDay: true;
417
+ };
418
+ type ReminderEnd = {
419
+ on: string;
420
+ } | {
421
+ after: number;
422
+ };
423
+ interface ReminderSchedule {
424
+ start: string;
425
+ time?: string | undefined;
426
+ repeat?: ReminderRepeat | undefined;
427
+ end?: ReminderEnd | undefined;
428
+ }
429
+ interface Reminder {
430
+ key: string;
431
+ title: string;
432
+ message?: string | undefined;
433
+ page?: string | undefined;
434
+ schedule: ReminderSchedule;
435
+ }
436
+ interface RemindersMethods {
437
+ 'dash.reminders.set': {
438
+ params: Reminder;
439
+ result: void;
440
+ };
441
+ 'dash.reminders.cancel': {
442
+ params: {
443
+ key: string;
444
+ };
445
+ result: boolean;
446
+ };
447
+ 'dash.reminders.list': {
448
+ params: Record<string, never>;
449
+ result: Reminder[];
450
+ };
451
+ }
452
+ /**
453
+ * Sets a reminder: a notification at the times its schedule gives, which opens the dot at its page.
454
+ * Dash never acts by itself; the person taps the notification. A dot can have 5 reminders still
455
+ * to come at a time; past that, it rejects with `failed`. Needs the `reminders` permission.
456
+ * @since 1.0
457
+ */
458
+ declare function set$2(reminder: Reminder, callOptions?: CallOptions): DashRequest<void>;
459
+ /**
460
+ * Cancels the dot's reminder with `key`. Resolves to false when it had none. Needs the `reminders`
461
+ * permission declared in dot.json; Dash doesn't ask the person for it here.
462
+ * @since 1.0
463
+ */
464
+ declare function cancel(key: string, callOptions?: CallOptions): DashRequest<boolean>;
465
+ /**
466
+ * The dot's reminders, in the order it set them. The person can delete them in Dash. Needs the
467
+ * `reminders` permission declared in dot.json; Dash doesn't ask the person for it here.
468
+ * @since 1.0
469
+ */
470
+ declare function list$1(callOptions?: CallOptions): DashRequest<Reminder[]>;
382
471
  declare namespace index_d_exports$5 {
383
- export { CardMethod, CardPaymentResult, LinkMethod, LinkPaymentResult, MomoMethod, MomoPaymentResult, Money, Order, OrderLineItem, PaymentCallOptions, PaymentMethod, PaymentOptions, PaymentResult, PaymentStatus, PaymentsMethods, get$2 as get, request };
472
+ export { Reminder, ReminderEnd, ReminderRepeat, ReminderSchedule, RemindersMethods, Weekday, cancel, list$1 as list, set$2 as set };
384
473
  }
385
474
  declare namespace cache_d_exports {
386
475
  export { CacheMethods, CacheSetOptions, CacheValue, clear$1 as clear, exists, get$1 as get, keys, remove$2 as remove, set$1 as set };
@@ -555,7 +644,8 @@ interface ReplaceOptions {
555
644
  */
556
645
  declare function read(path: string, options?: ReadOptions, callOptions?: CallOptions): DashRequest<string>;
557
646
  /**
558
- * Creates any missing folders above the file.
647
+ * Writes `data` to the file at `path`, as text or base64, and creates any missing folders above
648
+ * it. Pass `{ append: true }` to add to the end of the file.
559
649
  * @since 1.0
560
650
  */
561
651
  declare function write(path: string, data: string, options?: WriteOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
@@ -575,7 +665,7 @@ declare function move(from: string, to: string, options?: ReplaceOptions, callOp
575
665
  /** @since 1.0 */
576
666
  declare function copy(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
577
667
  /**
578
- * Removing a folder that isn't empty needs `recursive`.
668
+ * Deletes the file or folder at `path`. A folder with anything in it needs `{ recursive: true }`.
579
669
  * @since 1.0
580
670
  */
581
671
  declare function remove$1(path: string, options?: {
@@ -714,7 +804,8 @@ interface InfoMethods {
714
804
  };
715
805
  }
716
806
  /**
717
- * The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.
807
+ * Facts about the phone and Dash: the platform, language, region, time zone and versions. Nothing
808
+ * in it identifies the person or the phone.
718
809
  * @since 1.0
719
810
  */
720
811
  declare function info(callOptions?: CallOptions): DashRequest<SystemInfo>;
@@ -827,7 +918,7 @@ interface DialogMethods {
827
918
  };
828
919
  }
829
920
  /**
830
- * Shows a native alert. Resolves with the action the person chose.
921
+ * Shows the phone's own alert. Resolves with the action the person chose.
831
922
  * @since 1.0
832
923
  */
833
924
  declare function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult>;
@@ -871,7 +962,7 @@ declare namespace index_d_exports$2 {
871
962
  type UIMethods = DialogMethods & PickerMethods;
872
963
  //#endregion
873
964
  //#region src/methods.d.ts
874
- type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods & DotMethods & AccountMethods & CryptoMethods & PaymentsMethods;
965
+ type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods & DotMethods & AccountMethods & CryptoMethods & PaymentsMethods & RemindersMethods;
875
966
  type DashMethod = keyof DashMethods;
876
967
  //#endregion
877
968
  //#region src/call.d.ts
@@ -953,6 +1044,9 @@ export declare const DASH_API_SINCE: {
953
1044
  readonly 'network.status': "1.0";
954
1045
  readonly 'payments.get': "1.0";
955
1046
  readonly 'payments.request': "1.0";
1047
+ readonly 'reminders.cancel': "1.0";
1048
+ readonly 'reminders.list': "1.0";
1049
+ readonly 'reminders.set': "1.0";
956
1050
  readonly 'storage.cache.clear': "1.0";
957
1051
  readonly 'storage.cache.exists': "1.0";
958
1052
  readonly 'storage.cache.get': "1.0";
@@ -992,8 +1086,8 @@ type DashFeature = keyof typeof DASH_API_SINCE;
992
1086
  export declare function useHostDashApiVersions(versions: readonly string[]): void;
993
1087
  export declare function warnAboveDashApiVersion(minApiVersion: string | undefined): void;
994
1088
  /**
995
- * Whether the Dash the dot runs in has `feature`: a call, such as "contacts.pickPhone", or a field
996
- * added to a call later. Check it before using one that's newer than the dot's minApiVersion.
1089
+ * Whether this Dash has `feature`: a call, such as `'contacts.pickPhone'`, or a field added to a
1090
+ * call later.
997
1091
  * @since 1.0
998
1092
  */
999
1093
  declare function supports(feature: DashFeature): boolean;
@@ -1030,18 +1124,19 @@ export declare function debounce(milliseconds: number): (dash: Dash) => Promise<
1030
1124
  export declare const dash: {
1031
1125
  ui: typeof index_d_exports$2;
1032
1126
  system: typeof index_d_exports$3;
1033
- network: typeof index_d_exports$6;
1127
+ network: typeof index_d_exports$7;
1034
1128
  storage: typeof index_d_exports$4;
1035
- media: typeof index_d_exports$7;
1036
- contacts: typeof index_d_exports$10;
1037
- dot: typeof index_d_exports$8;
1129
+ media: typeof index_d_exports$8;
1130
+ contacts: typeof index_d_exports$11;
1131
+ dot: typeof index_d_exports$9;
1038
1132
  account: typeof index_d_exports$1;
1039
- payments: typeof index_d_exports$5;
1040
- crypto: typeof index_d_exports$9;
1133
+ payments: typeof index_d_exports$6;
1134
+ reminders: typeof index_d_exports$5;
1135
+ crypto: typeof index_d_exports$10;
1041
1136
  utils: typeof index_d_exports;
1042
1137
  supports: typeof supports;
1043
1138
  };
1044
1139
  export type Dash = typeof dash;
1045
1140
  //#endregion
1046
- export { type AlertAction, type AlertOptions, type AlertResult, type BrightnessLevel, type CacheSetOptions, type CacheValue, type CallOptions, type CardMethod, type CardPaymentResult, type CodeFormat, type ConnectionType, type ContactsMethods, type CryptoInput, type CryptoOutputOptions, DashError, type DashErrorCode, type DashFeature, type DashMethod, type DashMethods, type DashRequest, type DotFile, type FileEncoding, type FileEntry, type HmacAlgorithm, type HmacOptions, type HttpDownloadRequest, type HttpDownloadResponse, type HttpMethod, type HttpReadOptions, type HttpRequest, type HttpRequestBody, type HttpResponse, type HttpUploadFile, type HttpUploadRequest, type LinkMethod, type LinkPaymentResult, type MediaMethods, type MomoMethod, type MomoPaymentResult, type Money, type NetworkMethods, type NetworkStatus, type OidcProfile, type OidcScope, type OidcSignIn, type OidcSignInOptions, type Order, type OrderLineItem, type PaymentCallOptions, type PaymentMethod, type PaymentOptions, type PaymentResult, type PaymentStatus, type PaymentsMethods, type PhotoSource, type PickDateOptions, type PickFileOptions, type PickPhotoOptions, type PickTimeOptions, type PickedContact, type Platform, type ReadOptions, type ReplaceOptions, type ScannedCode, type ShareOptions, type SignInMode, type SimpleSignIn, type SimpleSignInOptions, type StorageMethods, type StorageUsage, type SystemInfo, type SystemMethods, type UIMethods, type VibrateOptions, type VibrationStyle, type WriteOptions };
1141
+ export { type AlertAction, type AlertOptions, type AlertResult, type BrightnessLevel, type CacheSetOptions, type CacheValue, type CallOptions, type CardMethod, type CardPaymentResult, type CodeFormat, type ConnectionType, type ContactsMethods, type CryptoInput, type CryptoOutputOptions, DashError, type DashErrorCode, type DashFeature, type DashMethod, type DashMethods, type DashRequest, type DotFile, type FileEncoding, type FileEntry, type HmacAlgorithm, type HmacOptions, type HttpDownloadRequest, type HttpDownloadResponse, type HttpMethod, type HttpReadOptions, type HttpRequest, type HttpRequestBody, type HttpResponse, type HttpUploadFile, type HttpUploadRequest, type LinkMethod, type LinkPaymentResult, type LinkProvider, type MediaMethods, type MomoMethod, type MomoPaymentResult, type MomoProvider, type Money, type NetworkMethods, type NetworkStatus, type OidcProfile, type OidcScope, type OidcSignIn, type OidcSignInOptions, type Order, type OrderLineItem, type PaymentCallOptions, type PaymentMethod, type PaymentOptions, type PaymentResult, type PaymentStatus, type PaymentsMethods, type PhotoSource, type PickDateOptions, type PickFileOptions, type PickPhotoOptions, type PickTimeOptions, type PickedContact, type Platform, type ReadOptions, type Reminder, type ReminderEnd, type ReminderRepeat, type ReminderSchedule, type RemindersMethods, type ReplaceOptions, type ScannedCode, type ShareOptions, type SignInMode, type SimpleSignIn, type SimpleSignInOptions, type StorageMethods, type StorageUsage, type SystemInfo, type SystemMethods, type UIMethods, type VibrateOptions, type VibrationStyle, type Weekday, type WriteOptions };
1047
1142
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/crypto/index.ts","../src/dot/index.ts","../src/files.ts","../src/media/pick-file.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/payments/payments.ts","../src/payments/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/account/index.ts","../src/api-versions.ts","../src/utils/encoding.ts","../src/utils/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"mappings":";;UAGiB;EACf;EAEA;;UAGe;EACf;IAA6B,QAAQ;IAAuB,QAAQ;;;;;;;;;iBAStD,UAAU,cAAc,cAAc,YAAY;;;;KCdtD,kBAAkB;;;;KCDlB;EAAyB;;UAGpB;EACf;;KAGU;UAGK,oBAAoB;EACnC,WAAW;EACX,KAAK;EACL,MAAM;;KAGH;KACA;UAEK;EACR;EACA,cAAc;EACd,IAAI;;UAGW;EACf;IAAwB,QAAQ;IAAW;;EAC3C;IAAwB,QAAQ;IAAW;;EAC3C;IACE,QAAQ;MAAc,WAAW;MAAe;MAAa,aAAa;;IAC1E;;EAEF;IAA6B;MAAU;MAAe,IAAI;;IAAkB;;EAC5E;IAA4B,QAAQ;IAAuB;;;;iBAI7C,OACd,MAAM,aACN,UAAS,qBACT,cAAc,cACb;;iBAKa,OACd,MAAM,aACN,UAAS,qBACT,cAAc,cACb;;;;;;iBASa,KAAK,SAAS,aAAa,cAAc,cAAc;;;;;iBAevD,YACd,eACA,UAAS,qBACT,cAAc,cACb;;;;;iBAQa,WAAW,cAAc,cAAc;;;;UCvFtC;EACf;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AS,wBAAwB,MAAM,SAAS;;;qBCDnD;;;;;;;;;;;;;;YAeD,cAAc"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/crypto/index.ts","../src/dot/index.ts","../src/files.ts","../src/media/pick-file.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/payments/payments.ts","../src/payments/index.ts","../src/reminders/reminders.ts","../src/reminders/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/account/index.ts","../src/api-versions.ts","../src/utils/encoding.ts","../src/utils/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"mappings":";;UAGiB;EACf;EAEA;;UAGe;EACf;IAA6B,QAAQ;IAAuB,QAAQ;;;;;;;;iBAQtD,UAAU,cAAc,cAAc,YAAY;;;;KCbtD,kBAAkB;;;;KCDlB;EAAyB;;UAGpB;EACf;;KAGU;UAGK,oBAAoB;EACnC,WAAW;EACX,KAAK;EACL,MAAM;;KAGH;KACA;UAEK;EACR;EACA,cAAc;EACd,IAAI;;UAGW;EACf;IAAwB,QAAQ;IAAW;;EAC3C;IAAwB,QAAQ;IAAW;;EAC3C;IACE,QAAQ;MAAc,WAAW;MAAe;MAAa,aAAa;;IAC1E;;EAEF;IAA6B;MAAU;MAAe,IAAI;;IAAkB;;EAC5E;IAA4B,QAAQ;IAAuB;;;;iBAI7C,OACd,MAAM,aACN,UAAS,qBACT,cAAc,cACb;;iBAKa,OACd,MAAM,aACN,UAAS,qBACT,cAAc,cACb;;;;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AEA;EAEA;EACA,SAAS;;UAGM;EACf;IACE;MAAU,MAAM;MAAY;MAAe,SAAS;;IACpD,QAAQ,eAAe;;;;;;;;;;;;;;iBAeX,OACd,SAAS,qBACT,cAAc,cACb,YAAY;iBACC,OACd,SAAS,mBACT,cAAc,cACb,YAAY;;;qBC7EF;qBAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0DD,2BAA2B;wBAQvB,uBAAuB;wBAKvB,wBAAwB;;;;;;iBASxB,SAAS,SAAS;;;cClFrB;EAEE,OAAA;EAIG,OAAA;;cAKL;EAEE,OAAA;EAMG,OAAA;;;;;;;wBEtBF,QAAQ,sBACtB,OAAO,OACP,QAAQ,SAAS,gCAChB;;;KCHE,cAAc,aAAa,iBAAiB;WAAuB,MAAM;;wBAE9D,YAAY,aAAa,eACvC,mBACG,OAAO,SACT,SAAS,cAAc;wBAQV,aAAa;wBAYP,gBAAgB,QACpC,MAAM,YAAY,UACjB,QAAQ;;;wBCxBK,WAAW,QAAQ,MAAM,YAAY,YAAY,YAAY;wBAW7D,SAAS,wBAAwB,MAAM,SAAS;;;qBCAnD;;;;;;;;;;;;;;;YAgBD,cAAc"}
package/dist/index.js CHANGED
@@ -20,6 +20,9 @@ const DASH_API_SINCE = {
20
20
  "network.status": "1.0",
21
21
  "payments.get": "1.0",
22
22
  "payments.request": "1.0",
23
+ "reminders.cancel": "1.0",
24
+ "reminders.list": "1.0",
25
+ "reminders.set": "1.0",
23
26
  "storage.cache.clear": "1.0",
24
27
  "storage.cache.exists": "1.0",
25
28
  "storage.cache.get": "1.0",
@@ -66,8 +69,8 @@ function warnAboveDashApiVersion(minApiVersion) {
66
69
  dotMinApiVersion = minApiVersion;
67
70
  }
68
71
  /**
69
- * Whether the Dash the dot runs in has `feature`: a call, such as "contacts.pickPhone", or a field
70
- * added to a call later. Check it before using one that's newer than the dot's minApiVersion.
72
+ * Whether this Dash has `feature`: a call, such as `'contacts.pickPhone'`, or a field added to a
73
+ * call later.
71
74
  * @since 1.0
72
75
  */
73
76
  function supports(feature) {
@@ -115,9 +118,8 @@ function signIn(options, callOptions) {
115
118
  //#endregion
116
119
  //#region src/contacts/pick-phone.ts
117
120
  /**
118
- * Shows the phone's contacts so the person chooses one phone number, such as who to send money to.
119
- * Needs the `contacts` permission. The dot sees only the chosen contact. Rejects with `cancelled` if
120
- * the person closes it.
121
+ * Shows the phone's contacts for the person to choose one phone number, such as the number to send
122
+ * money to. The dot sees only the chosen contact. Rejects with `cancelled` if the person closes it.
121
123
  * @since 1.0
122
124
  */
123
125
  function pickPhone(callOptions) {
@@ -158,7 +160,7 @@ function hmac(options, callOptions) {
158
160
  }, callOptions);
159
161
  }
160
162
  /**
161
- * `count` secure random bytes, from 1 to 1024, such as for a nonce.
163
+ * `count` secure random bytes, from 1 to 1024.
162
164
  * @since 1.0
163
165
  */
164
166
  function randomBytes(count, options = {}, callOptions) {
@@ -208,9 +210,9 @@ function close(callOptions) {
208
210
  //#endregion
209
211
  //#region src/media/pick-file.ts
210
212
  /**
211
- * Lets the person choose a file from their phone, of at most 25 MB. Needs the `files` permission.
213
+ * Lets the person choose a file from their phone, of at most 25 MB.
212
214
  * Rejects with `cancelled` if they close the picker, and with `invalid` for a larger file. Like a
213
- * download, it lasts until the dot closes, so `dash.storage.file.save` it to keep it.
215
+ * download, it lasts until the dot closes unless you save it with `dash.storage.file.save`.
214
216
  * @since 1.0
215
217
  */
216
218
  function pickFile(options = {}, callOptions) {
@@ -233,7 +235,7 @@ function pickPhoto(options, callOptions) {
233
235
  //#endregion
234
236
  //#region src/media/scan-code.ts
235
237
  /**
236
- * Opens Dash's scanner until it reads a QR code. Needs the `camera` permission. Rejects with
238
+ * Opens Dash's scanner until it reads a QR code. Rejects with
237
239
  * `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.
238
240
  * @since 1.0
239
241
  */
@@ -345,16 +347,20 @@ var network_exports = /* @__PURE__ */ __exportAll({
345
347
  //#region src/payments/payments.ts
346
348
  /**
347
349
  * Opens Dash's payment sheet, where the person pays for `order` with one of `methods`. The money
348
- * goes to the Space that owns the dot. Needs `payments` in dot.json's permissions.
350
+ * goes to the Space that owns the dot.
349
351
  *
350
- * It rejects only before the person picks a method. `invalid` is an order Monime won't take, such
351
- * as one below its smallest amount. `denied` means the dot or Space can't take payments now. `failed`
352
- * means Dash couldn't reach Monime. `cancelled` means the person closed the sheet, and `timeout`
353
- * that Dash's time ran out.
352
+ * Before the person picks a method, it can reject with:
354
353
  *
355
- * Once they pick one, it resolves with how the payment ended: `completed`, `pending`, `expired`,
356
- * or `cancelled` if they closed the sheet. A method that fails keeps the sheet open to try again.
357
- * `cancel()` then only stops the dot waiting. Read the payment later with `get`.
354
+ * - `invalid`: Monime won't take the order, such as one below its smallest amount.
355
+ * - `denied`: the dot or its Space can't take payments now.
356
+ * - `failed`: Dash couldn't reach Monime.
357
+ * - `cancelled`: the person closed the sheet.
358
+ * - `timeout`: the sheet waited as long as Dash allows.
359
+ *
360
+ * Once they pick a method, it resolves with the payment's `status`: `completed`, `pending`,
361
+ * `expired`, or `cancelled` if they closed the sheet. If a method fails, the sheet stays open for
362
+ * them to try again. From then on, `cancel()` only stops your code waiting; the payment goes on.
363
+ * Read it again later with `get`.
358
364
  * @since 1.0
359
365
  */
360
366
  function request(options, callOptions) {
@@ -363,9 +369,8 @@ function request(options, callOptions) {
363
369
  return call("dash.payments.request", options, withoutTimeout);
364
370
  }
365
371
  /**
366
- * The payment for the order with this reference, such as to check a pending one later, or after
367
- * the dot opens again. Undefined if this dot never asked for it, or the person never picked a
368
- * method. Needs `payments` in dot.json's permissions.
372
+ * The payment for the order with this reference, to check a pending one later or after the dot
373
+ * opens again. Undefined if this dot never asked for it, or the person never picked a method.
369
374
  * @since 1.0
370
375
  */
371
376
  function get$2(reference, callOptions) {
@@ -380,6 +385,40 @@ var payments_exports = /* @__PURE__ */ __exportAll({
380
385
  request: () => request
381
386
  });
382
387
  //#endregion
388
+ //#region src/reminders/reminders.ts
389
+ /**
390
+ * Sets a reminder: a notification at the times its schedule gives, which opens the dot at its page.
391
+ * Dash never acts by itself; the person taps the notification. A dot can have 5 reminders still
392
+ * to come at a time; past that, it rejects with `failed`. Needs the `reminders` permission.
393
+ * @since 1.0
394
+ */
395
+ function set$2(reminder, callOptions) {
396
+ return call("dash.reminders.set", reminder, callOptions);
397
+ }
398
+ /**
399
+ * Cancels the dot's reminder with `key`. Resolves to false when it had none. Needs the `reminders`
400
+ * permission declared in dot.json; Dash doesn't ask the person for it here.
401
+ * @since 1.0
402
+ */
403
+ function cancel(key, callOptions) {
404
+ return call("dash.reminders.cancel", { key }, callOptions);
405
+ }
406
+ /**
407
+ * The dot's reminders, in the order it set them. The person can delete them in Dash. Needs the
408
+ * `reminders` permission declared in dot.json; Dash doesn't ask the person for it here.
409
+ * @since 1.0
410
+ */
411
+ function list$1(callOptions) {
412
+ return call("dash.reminders.list", {}, callOptions);
413
+ }
414
+ //#endregion
415
+ //#region src/reminders/index.ts
416
+ var reminders_exports = /* @__PURE__ */ __exportAll({
417
+ cancel: () => cancel,
418
+ list: () => list$1,
419
+ set: () => set$2
420
+ });
421
+ //#endregion
383
422
  //#region src/storage/cache.ts
384
423
  var cache_exports = /* @__PURE__ */ __exportAll({
385
424
  clear: () => clear$1,
@@ -449,7 +488,8 @@ function read(path, options = {}, callOptions) {
449
488
  }, callOptions);
450
489
  }
451
490
  /**
452
- * Creates any missing folders above the file.
491
+ * Writes `data` to the file at `path`, as text or base64, and creates any missing folders above
492
+ * it. Pass `{ append: true }` to add to the end of the file.
453
493
  * @since 1.0
454
494
  */
455
495
  function write(path, data, options = {}, callOptions) {
@@ -494,7 +534,7 @@ function copy(from, to, options = {}, callOptions) {
494
534
  }, callOptions);
495
535
  }
496
536
  /**
497
- * Removing a folder that isn't empty needs `recursive`.
537
+ * Deletes the file or folder at `path`. A folder with anything in it needs `{ recursive: true }`.
498
538
  * @since 1.0
499
539
  */
500
540
  function remove$1(path, options = {}, callOptions) {
@@ -598,7 +638,8 @@ function vibrate(options = {}, callOptions) {
598
638
  //#endregion
599
639
  //#region src/system/info.ts
600
640
  /**
601
- * The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.
641
+ * Facts about the phone and Dash: the platform, language, region, time zone and versions. Nothing
642
+ * in it identifies the person or the phone.
602
643
  * @since 1.0
603
644
  */
604
645
  function info(callOptions) {
@@ -671,7 +712,7 @@ var system_exports = /* @__PURE__ */ __exportAll({
671
712
  //#endregion
672
713
  //#region src/ui/dialogs.ts
673
714
  /**
674
- * Shows a native alert. Resolves with the action the person chose.
715
+ * Shows the phone's own alert. Resolves with the action the person chose.
675
716
  * @since 1.0
676
717
  */
677
718
  function alert(options, callOptions) {
@@ -908,6 +949,7 @@ const dash = {
908
949
  dot: dot_exports,
909
950
  account: account_exports,
910
951
  payments: payments_exports,
952
+ reminders: reminders_exports,
911
953
  crypto: crypto_exports,
912
954
  utils: utils_exports,
913
955
  supports
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["request","get","get","set","remove","clear","remove"],"sources":["../src/api-versions.ts","../src/call.ts","../src/account/index.ts","../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/crypto/index.ts","../src/dot/index.ts","../src/media/pick-file.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/payments/payments.ts","../src/payments/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/utils/encoding.ts","../src/utils/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"sourcesContent":["import { DEFAULT_DASH_API_VERSION, offersDashApiVersion } from '@monimesl/dot-core';\n\n// The newest Dash API version this library knows.\nexport const DASH_API_VERSION = '1.0';\n\n// The Dash API version each call came in, by its name in `dash`, such as \"system.dial\". A field\n// added to a call later gets its own row, such as \"ui.pickDate.title\". The `@since` tag on each call\n// says the same, and a test keeps the two in step.\nexport const DASH_API_SINCE = {\n 'account.signIn': '1.0',\n 'contacts.pickPhone': '1.0',\n 'crypto.hmac': '1.0',\n 'crypto.randomBytes': '1.0',\n 'crypto.randomUUID': '1.0',\n 'crypto.sha256': '1.0',\n 'crypto.sha512': '1.0',\n 'dot.close': '1.0',\n 'media.pickFile': '1.0',\n 'media.pickPhoto': '1.0',\n 'media.scanCode': '1.0',\n 'network.http.download': '1.0',\n 'network.http.request': '1.0',\n 'network.http.upload': '1.0',\n 'network.status': '1.0',\n 'payments.get': '1.0',\n 'payments.request': '1.0',\n 'storage.cache.clear': '1.0',\n 'storage.cache.exists': '1.0',\n 'storage.cache.get': '1.0',\n 'storage.cache.keys': '1.0',\n 'storage.cache.remove': '1.0',\n 'storage.cache.set': '1.0',\n 'storage.file.copy': '1.0',\n 'storage.file.createFolder': '1.0',\n 'storage.file.list': '1.0',\n 'storage.file.move': '1.0',\n 'storage.file.open': '1.0',\n 'storage.file.read': '1.0',\n 'storage.file.remove': '1.0',\n 'storage.file.save': '1.0',\n 'storage.file.stat': '1.0',\n 'storage.file.usage': '1.0',\n 'storage.file.write': '1.0',\n 'storage.secret.clear': '1.0',\n 'storage.secret.get': '1.0',\n 'storage.secret.remove': '1.0',\n 'storage.secret.set': '1.0',\n 'system.brightness': '1.0',\n 'system.copyText': '1.0',\n 'system.delay': '1.0',\n 'system.dial': '1.0',\n 'system.info': '1.0',\n 'system.keepAwake': '1.0',\n 'system.openUrl': '1.0',\n 'system.share': '1.0',\n 'system.torch': '1.0',\n 'system.vibrate': '1.0',\n 'ui.alert': '1.0',\n 'ui.pickDate': '1.0',\n 'ui.pickTime': '1.0',\n} as const satisfies Record<string, string>;\n\n// A call or field `dash.supports` can check, such as \"contacts.pickPhone\".\nexport type DashFeature = keyof typeof DASH_API_SINCE;\n\nlet hostApiVersions: readonly string[] = [DEFAULT_DASH_API_VERSION];\nlet dotMinApiVersion: string | undefined;\nconst checkedFeatures = new Set<string>();\nconst warnedFeatures = new Set<string>();\n\n// The service passes on the Dash API versions the host says it offers.\nexport function useHostDashApiVersions(versions: readonly string[]): void {\n hostApiVersions = versions;\n}\n\n// While developing, the service names the dot's minApiVersion, so calls newer than it are pointed out.\nexport function warnAboveDashApiVersion(minApiVersion: string | undefined): void {\n dotMinApiVersion = minApiVersion;\n}\n\n/**\n * Whether the Dash the dot runs in has `feature`: a call, such as \"contacts.pickPhone\", or a field\n * added to a call later. Check it before using one that's newer than the dot's minApiVersion.\n * @since 1.0\n */\nexport function supports(feature: DashFeature): boolean {\n checkedFeatures.add(feature);\n const since = sinceOf(feature);\n return since !== undefined && offersDashApiVersion(hostApiVersions, since);\n}\n\n// Warns once for each call, or field it sends, that's newer than the dot's minApiVersion, unless the\n// dot checked it with dash.supports first. Older Dash would answer `unsupported`.\nexport function warnIfNewerThanDot(method: string, params: unknown): void {\n if (dotMinApiVersion === undefined) {\n return;\n }\n const callName = method.replace(/^dash\\./, '');\n for (const feature of [callName, ...fieldsSent(callName, params)]) {\n const since = sinceOf(feature);\n if (since === undefined) {\n continue;\n }\n if (checkedFeatures.has(feature) || warnedFeatures.has(feature)) {\n continue;\n }\n if (offersDashApiVersion([dotMinApiVersion], since)) {\n continue;\n }\n warnedFeatures.add(feature);\n console.warn(\n `dash.${feature} came in Dash API ${since}, but this dot's minApiVersion is ${dotMinApiVersion}, ` +\n `so older Dash doesn't have it. Raise \"minApiVersion\" in dot.json, or check ` +\n `dash.supports('${feature}') first.`,\n );\n }\n}\n\nfunction sinceOf(feature: string): string | undefined {\n const table: Record<string, string> = DASH_API_SINCE;\n return Object.hasOwn(table, feature) ? table[feature] : undefined;\n}\n\n// \"ui.pickDate.title\" for a `title` sent to `dash.ui.pickDate`, when that field has its own row.\nfunction fieldsSent(callName: string, params: unknown): string[] {\n if (typeof params !== 'object' || params === null) {\n return [];\n }\n return Object.keys(params)\n .map((field) => `${callName}.${field}`)\n .filter((feature) => sinceOf(feature) !== undefined);\n}\n","import type { HostCallOptions, HostRequest } from '@monimesl/dot-core';\nimport { callHost } from '@monimesl/dot-core';\n\nimport { warnIfNewerThanDot } from './api-versions';\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 warnIfNewerThanDot(method, params);\n return callHost(method, params, options);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\n// How a dot signs the person in. `simple`: Dash says who the person is. `oidc`: OpenID Connect,\n// with an ID token the dot's server can check. `oidc` isn't ready yet, so it fails with `unsupported`.\nexport type SignInMode = 'simple' | 'oidc';\n\nexport interface SimpleSignInOptions {\n mode: 'simple';\n // Mixed into the token. The same nonce gives the same token, so leaving it out, or a fixed one,\n // names the person the same way each time in this dot, and a fresh one gives a token only for\n // this call. An empty nonce is the same as none.\n nonce?: string | undefined;\n}\n\nexport interface SimpleSignIn {\n fullName: string;\n // The phone number or email address the person uses Dash with, such as \"+232 76 123456\". It's the\n // phone number when the account has one.\n alias: string;\n // Monime makes it from the dot's id, the person and the nonce, with a key only Monime knows, so the\n // same person gets the same token on any phone. It names the person but proves nothing to the\n // dot's server: Dash hands it over as it is.\n accountIdToken: string;\n}\n\n// What the dot asks to see besides who the person is. Each needs the person's consent.\nexport type OidcScope = 'profile' | 'phone' | 'email';\n\nexport interface OidcSignInOptions {\n mode: 'oidc';\n scopes?: OidcScope[] | undefined;\n // Goes into the ID token. The dot's server should give a fresh one for each sign-in and check it.\n nonce?: string | undefined;\n}\n\n// Only what the person agreed to, by scope.\nexport interface OidcProfile {\n name?: string | undefined;\n givenName?: string | undefined;\n familyName?: string | undefined;\n phone?: string | undefined;\n email?: string | undefined;\n}\n\nexport interface OidcSignIn {\n // The person's id for this dot's publisher. The same in each of the publisher's dots.\n id: string;\n // A signed JWT the dot's server checks with Monime's keys before trusting `id`.\n idToken: string;\n // When `idToken` stops being valid, such as \"2026-10-24T10:05:00Z\".\n expiresAt: string;\n profile: OidcProfile;\n}\n\nexport interface AccountMethods {\n 'dash.account.signIn': {\n params: { mode: SignInMode; nonce: string; scopes?: OidcScope[] };\n result: SimpleSignIn | OidcSignIn;\n };\n}\n\n/**\n * Signs the person in to the dot with their Dash account. Needs the `account` permission.\n *\n * With `mode: 'simple'`, resolves with their full name, their phone number or email address, and a\n * token that names them in this dot. With `mode: 'oidc'`, OpenID Connect, it will resolve with an ID\n * token for the dot's server; until Dash has it, it rejects with `unsupported`.\n *\n * Rejects with `invalid` for a nonce longer than 128 characters, with `unsupported` for a mode this\n * Dash doesn't have, and with `failed` when no one is signed in or Dash can't reach Monime.\n * @since 1.0\n */\nexport function signIn(\n options: SimpleSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<SimpleSignIn>;\nexport function signIn(\n options: OidcSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<OidcSignIn>;\nexport function signIn(\n options: SimpleSignInOptions | OidcSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<SimpleSignIn | OidcSignIn> {\n const params: AccountMethods['dash.account.signIn']['params'] = {\n mode: options.mode,\n nonce: options.nonce ?? '',\n };\n if (options.mode === 'oidc' && options.scopes) {\n params.scopes = options.scopes;\n }\n return call('dash.account.signIn', params, callOptions);\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/**\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.\n * @since 1.0\n */\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';\n\n// Text is read as UTF-8. Binary data, such as a file's contents, comes as base64.\nexport type CryptoInput = string | { base64: string };\n\n// Hex by default.\nexport interface CryptoOutputOptions {\n as?: 'hex' | 'base64';\n}\n\nexport type HmacAlgorithm = 'sha256' | 'sha512';\n\n// Named, since key and data take the same kinds of value and a swapped pair signs wrongly.\nexport interface HmacOptions extends CryptoOutputOptions {\n algorithm: HmacAlgorithm;\n key: CryptoInput;\n data: CryptoInput;\n}\n\ntype InputEncoding = 'text' | 'base64';\ntype OutputEncoding = 'hex' | 'base64';\n\ninterface WireInput {\n data: string;\n dataEncoding: InputEncoding;\n as: OutputEncoding;\n}\n\nexport interface CryptoMethods {\n 'dash.crypto.sha256': { params: WireInput; result: string };\n 'dash.crypto.sha512': { params: WireInput; result: string };\n 'dash.crypto.hmac': {\n params: WireInput & { algorithm: HmacAlgorithm; key: string; keyEncoding: InputEncoding };\n result: string;\n };\n 'dash.crypto.randomBytes': { params: { count: number; as: OutputEncoding }; result: string };\n 'dash.crypto.randomUUID': { params: Record<string, never>; result: string };\n}\n\n/** @since 1.0 */\nexport function sha256(\n data: CryptoInput,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.sha256', wireInput(data, options), callOptions);\n}\n\n/** @since 1.0 */\nexport function sha512(\n data: CryptoInput,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.sha512', wireInput(data, options), callOptions);\n}\n\n/**\n * Signs `data` with `key`, as HMAC-SHA256 or HMAC-SHA512, such as\n * `hmac({ algorithm: 'sha256', key, data })`.\n * @since 1.0\n */\nexport function hmac(options: HmacOptions, callOptions?: CallOptions): DashRequest<string> {\n const wireKey = valueAndEncoding(options.key);\n const params = {\n ...wireInput(options.data, options),\n algorithm: options.algorithm,\n key: wireKey.value,\n keyEncoding: wireKey.encoding,\n };\n return call('dash.crypto.hmac', params, callOptions);\n}\n\n/**\n * `count` secure random bytes, from 1 to 1024, such as for a nonce.\n * @since 1.0\n */\nexport function randomBytes(\n count: number,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.randomBytes', { count, as: outputEncoding(options) }, callOptions);\n}\n\n/**\n * A random version 4 UUID, such as \"3f0e5c3a-6d1b-4c8e-9a2f-1b7d4e6a9c05\".\n * @since 1.0\n */\nexport function randomUUID(callOptions?: CallOptions): DashRequest<string> {\n return call('dash.crypto.randomUUID', {}, callOptions);\n}\n\nfunction wireInput(data: CryptoInput, options: CryptoOutputOptions): WireInput {\n const { value, encoding } = valueAndEncoding(data);\n return { data: value, dataEncoding: encoding, as: outputEncoding(options) };\n}\n\nfunction outputEncoding(options: CryptoOutputOptions): OutputEncoding {\n return options.as ?? 'hex';\n}\n\nfunction valueAndEncoding(input: CryptoInput): { value: string; encoding: InputEncoding } {\n if (typeof input === 'string') {\n return { value: input, encoding: 'text' };\n }\n return { value: input.base64, encoding: 'base64' };\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface DotMethods {\n 'dash.dot.close': { params: Record<string, never>; result: void };\n}\n\n/**\n * Closes the dot, as going back from its first page does. Calls still running are cancelled.\n * @since 1.0\n */\nexport function close(callOptions?: CallOptions): DashRequest<void> {\n return call('dash.dot.close', {}, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\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 PickFileMethods {\n 'dash.media.pickFile': { params: { types?: string[] }; result: DotFile };\n}\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 `dash.storage.file.save` it to keep it.\n * @since 1.0\n */\nexport function pickFile(\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.media.pickFile', params, callOptions);\n}\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/**\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.\n * @since 1.0\n */\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/**\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.\n * @since 1.0\n */\nexport function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode> {\n return call('dash.media.scanCode', {}, callOptions);\n}\n","import type { PickFileMethods } from './pick-file';\nimport type { PickPhotoMethods } from './pick-photo';\nimport type { ScanCodeMethods } from './scan-code';\n\nexport { pickFile } from './pick-file';\nexport { pickPhoto } from './pick-photo';\nexport { scanCode } from './scan-code';\nexport type { PickFileOptions } from './pick-file';\nexport type { PhotoSource, PickPhotoOptions } from './pick-photo';\nexport type { CodeFormat, ScannedCode } from './scan-code';\n\nexport type MediaMethods = PickFileMethods & PickPhotoMethods & ScanCodeMethods;\n","import { createHostRequest, HostError } from '@monimesl/dot-core';\n\nimport type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } 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 // Names are lowercase, such as \"content-type\". A header sent more than once comes once, with its\n // values joined by \", \".\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;\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/**\n * Like fetch, resolves with any response, even a 404. An object body is sent as JSON.\n * @since 1.0\n */\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: readAs, ...request } = options as HttpRequest & { as?: ReadAs };\n const response = call('dash.network.http.request', wireRequest(request, readAs), callOptions);\n return readBody(response, readAs);\n}\n\n/**\n * Saves a 2xx response's body, up to 256 MB, to a temporary file.\n * @since 1.0\n */\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/**\n * Sends the dot's files as a multipart form.\n * @since 1.0\n */\nexport function upload<ResponseBody = string>(\n options: HttpUploadRequest & HttpReadOptions<ResponseBody>,\n callOptions?: CallOptions,\n): DashRequest<HttpResponse<ResponseBody>> {\n const { as: readAs, ...request } = options as HttpUploadRequest & { as?: ReadAs };\n const files = request.files.map((upload) => ({ ...upload, file: upload.file.id }));\n const params = { ...request, files };\n if (readAs === '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, readAs);\n}\n\nfunction wireRequest<Request extends HttpRequest>(\n request: Request,\n readAs?: ReadAs,\n): WireRequest<Request> {\n let headers = request.headers;\n let body: string | undefined;\n if (readAs === '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 if (headers === undefined) {\n return { [name]: value };\n }\n const lowerName = name.toLowerCase();\n const alreadySet = Object.keys(headers).some((existing) => existing.toLowerCase() === lowerName);\n if (alreadySet) {\n return headers;\n }\n return { ...headers, [name]: value };\n}\n\nfunction readBody<Body>(\n response: DashRequest<HttpResponse>,\n readAs: ReadAs | undefined,\n): DashRequest<HttpResponse<Body>> {\n if (readAs !== '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/**\n * Whether the phone is online now, and how. It can still be online without reaching a server.\n * @since 1.0\n */\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 { createHostRequest } from '@monimesl/dot-core';\n\nimport type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface Money {\n currency: 'SLE' | 'USD';\n // In minor units, as in Monime's API: SLE 75.00 is 7500.\n value: number;\n}\n\nexport interface OrderLineItem {\n name: string;\n unitPrice: Money;\n // 1 to 100,000. Defaults to 1.\n quantity?: number | undefined;\n // An https picture Dash shows beside the item. Its host must be in network.hosts in dot.json.\n imageUrl?: string | undefined;\n}\n\nexport interface Order {\n // What the person is paying for, such as \"Jazz Night tickets\". 3 to 64 characters.\n name: string;\n // The dot's own ID for the order, up to 64 characters. The same reference never pays twice:\n // asking again gives back the first payment.\n reference: string;\n description?: string | undefined;\n // 1 to 16 items, all in one currency. Dash adds them up for the total.\n lineItems: OrderLineItem[];\n // Up to 64 pairs, with keys up to 48 characters and values up to 100. They stay with the payment\n // and its webhooks. Keys can't start with \"@\", \"_\" or \"monime\", which Monime keeps for itself.\n metadata?: Record<string, string> | undefined;\n}\n\n// `providers` lists the only providers that can pay, by Monime's IDs. Empty or left out means any.\n// Mobile money takes m17 (Orange Money) and m18 (Africell Money). A linked account takes those and\n// the banks slb001, slb004 and slb007.\n\nexport interface LinkMethod {\n type: 'link';\n providers?: string[] | undefined;\n}\n\nexport interface CardMethod {\n type: 'card';\n}\n\nexport interface MomoMethod {\n type: 'momo';\n providers?: string[] | undefined;\n // Only this number can pay, such as \"+23276123456\".\n phoneNumber?: string | undefined;\n}\n\nexport type PaymentMethod = LinkMethod | CardMethod | MomoMethod;\n\nexport interface PaymentOptions {\n order: Order;\n // The methods to offer, in order, each with its own settings. Leave it out for all three\n // with no limits.\n methods?: PaymentMethod[] | undefined;\n // The financial account the money goes to, such as \"fac-k6VgVTfSmLruHpiQgMg4DUeySZx\". It must\n // belong to the Space that owns the dot and hold the order's currency. Leave it out for the\n // Space's main account.\n financialAccountId?: string | undefined;\n}\n\n// A method that fails keeps the sheet open for the person to try again, so `failed` comes only\n// from `get`, for a pending payment that failed later.\nexport type PaymentStatus = 'pending' | 'completed' | 'failed' | 'expired' | 'cancelled';\n\ninterface PaymentResultBase {\n reference: string;\n // Dash's ID for the payment request. Give it to Monime's support when asking about a payment.\n requestId: string;\n status: PaymentStatus;\n // The order's total.\n amount: Money;\n // Monime's payment, such as \"pay-…\", once there is one.\n paymentId?: string | undefined;\n // Monime's number for the order, for the person's receipt and for support. Only once the\n // payment has completed.\n orderNumber?: string | undefined;\n}\n\n// A card payment goes through a Monime checkout session.\nexport interface CardPaymentResult extends PaymentResultBase {\n method: 'card';\n checkoutSessionId: string;\n}\n\n// Mobile money goes through a Monime payment code.\nexport interface MomoPaymentResult extends PaymentResultBase {\n method: 'momo';\n paymentCodeId: string;\n}\n\n// A linked account pays directly, so the payment itself is the resource.\nexport interface LinkPaymentResult extends PaymentResultBase {\n method: 'link';\n paymentId: string;\n}\n\nexport type PaymentResult = CardPaymentResult | MomoPaymentResult | LinkPaymentResult;\n\n// Dash decides how long the sheet waits, so a dot can't set a timeout.\nexport type PaymentCallOptions = Omit<CallOptions, 'timeout'>;\n\nexport interface PaymentsMethods {\n 'dash.payments.request': { params: PaymentOptions; result: PaymentResult };\n 'dash.payments.get': { params: { reference: string }; result: PaymentResult | null };\n}\n\n/**\n * Opens Dash's payment sheet, where the person pays for `order` with one of `methods`. The money\n * goes to the Space that owns the dot. Needs `payments` in dot.json's permissions.\n *\n * It rejects only before the person picks a method. `invalid` is an order Monime won't take, such\n * as one below its smallest amount. `denied` means the dot or Space can't take payments now. `failed`\n * means Dash couldn't reach Monime. `cancelled` means the person closed the sheet, and `timeout`\n * that Dash's time ran out.\n *\n * Once they pick one, it resolves with how the payment ended: `completed`, `pending`, `expired`,\n * or `cancelled` if they closed the sheet. A method that fails keeps the sheet open to try again.\n * `cancel()` then only stops the dot waiting. Read the payment later with `get`.\n * @since 1.0\n */\nexport function request(\n options: PaymentOptions,\n callOptions?: PaymentCallOptions,\n): DashRequest<PaymentResult> {\n // Plain JavaScript could still pass a timeout, so it's taken out here too.\n const withoutTimeout: CallOptions = { ...callOptions };\n delete withoutTimeout.timeout;\n return call('dash.payments.request', options, withoutTimeout);\n}\n\n/**\n * The payment for the order with this reference, such as to check a pending one later, or after\n * the dot opens again. Undefined if this dot never asked for it, or the person never picked a\n * method. Needs `payments` in dot.json's permissions.\n * @since 1.0\n */\nexport function get(\n reference: string,\n callOptions?: CallOptions,\n): DashRequest<PaymentResult | undefined> {\n const response = call('dash.payments.get', { reference }, callOptions);\n // The host answers null for none, as JSON has no undefined.\n const found = response.then((result) => result ?? undefined);\n return createHostRequest(found, () => response.cancel());\n}\n","export { get, request } from './payments';\nexport type {\n CardMethod,\n CardPaymentResult,\n LinkMethod,\n LinkPaymentResult,\n MomoMethod,\n MomoPaymentResult,\n Money,\n Order,\n OrderLineItem,\n PaymentCallOptions,\n PaymentMethod,\n PaymentOptions,\n PaymentResult,\n PaymentsMethods,\n PaymentStatus,\n} from './payments';\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 milliseconds the entry lasts. Without it, or with 0 or less, it lasts until removed.\n ttl?: number | undefined;\n}\n\n/**\n * Resolves with null for a missing or expired key.\n * @since 1.0\n */\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\n/** @since 1.0 */\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\n/** @since 1.0 */\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.cache.remove', { key }, callOptions);\n}\n\n/** @since 1.0 */\nexport function exists(key: string, callOptions?: CallOptions): DashRequest<boolean> {\n return call('dash.storage.cache.exists', { key }, callOptions);\n}\n\n/**\n * The keys, sorted.\n * @since 1.0\n */\nexport function keys(callOptions?: CallOptions): DashRequest<string[]> {\n return call('dash.storage.cache.keys', {}, callOptions);\n}\n\n/** @since 1.0 */\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';\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. A call on a path with nothing there fails with\n// `missing`, while `stat` gives null for it.\n\nexport interface FileEntry {\n name: string;\n path: string;\n // In bytes, and 0 for a folder.\n size: number;\n kind: 'file' | 'folder';\n // When it last changed, in milliseconds since 1 January 1970, as Date.now() gives.\n modifiedAt: number;\n contentType?: string;\n}\n\nexport type FileEncoding = 'text' | 'base64';\n\n// In bytes: what the dot's files take, and the most they may take.\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}\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/**\n * Reads a file of up to 5 MB.\n * @since 1.0\n */\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/**\n * Creates any missing folders above the file.\n * @since 1.0\n */\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\n/** @since 1.0 */\nexport function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null> {\n return call('dash.storage.file.stat', { path }, callOptions);\n}\n\n/**\n * Sorted by path.\n * @since 1.0\n */\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\n/** @since 1.0 */\nexport function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry> {\n return call('dash.storage.file.createFolder', { path }, callOptions);\n}\n\n/** @since 1.0 */\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\n/** @since 1.0 */\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/**\n * Removing a folder that isn't empty needs `recursive`.\n * @since 1.0\n */\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/**\n * Keeps a temporary file, such as a download, at `path`.\n * @since 1.0\n */\nexport function save(\n file: DotFile,\n path: string,\n options: ReplaceOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.save', { file: file.id, path, ...options }, callOptions);\n}\n\n/**\n * A stored file as a DotFile, to show with its `url` or send with `http.upload`.\n * @since 1.0\n */\nexport function open(path: string, callOptions?: CallOptions): DashRequest<DotFile> {\n return call('dash.storage.file.open', { path }, callOptions);\n}\n\n/** @since 1.0 */\nexport function usage(callOptions?: CallOptions): DashRequest<StorageUsage> {\n return call('dash.storage.file.usage', {}, 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 32 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\n/** @since 1.0 */\nexport function get(key: string, callOptions?: CallOptions): DashRequest<string | null> {\n return call('dash.storage.secret.get', { key }, callOptions);\n}\n\n/** @since 1.0 */\nexport function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.set', { key, value }, callOptions);\n}\n\n/** @since 1.0 */\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.remove', { key }, callOptions);\n}\n\n/** @since 1.0 */\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 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\n/** @since 1.0 */\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/**\n * Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.\n * @since 1.0\n */\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/**\n * Opens the phone's dialer with `number` ready, such as \"+232 76 123456\" or a USSD code such as\n * \"*715#\". The person taps Call. Spaces and dashes are fine; anything else but digits, +, * and #\n * rejects with `invalid`. For a code, Dash asks the person first, and rejects with `cancelled` if\n * they say no. Codes that set up call forwarding, such as \"**21*…#\", reject with `denied`.\n * @since 1.0\n */\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/**\n * Plays a short vibration. Resolves once it's done.\n * @since 1.0\n */\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\". To check for a call, use dash.supports.\n dashVersion: string;\n // The Dash API versions it offers, such as [\"1.4\"], one for each major it supports.\n apiVersions: string[];\n}\n\nexport interface InfoMethods {\n 'dash.system.info': { params: Record<string, never>; result: SystemInfo };\n}\n\n/**\n * The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.\n * @since 1.0\n */\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/**\n * Opens an https address in the device's browser. Any other address rejects with `invalid`.\n * @since 1.0\n */\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/**\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.\n * @since 1.0\n */\nexport function keepAwake(on: boolean, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.keepAwake', { on }, callOptions);\n}\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.\n * @since 1.0\n */\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';\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;\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/**\n * Opens the device's share sheet. Resolves once it shows.\n * @since 1.0\n */\nexport function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void> {\n const { file, ...content } = options;\n if (file === undefined) {\n return call('dash.system.share', content, callOptions);\n }\n return call('dash.system.share', { ...content, file: file.id }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface TorchMethods {\n 'dash.system.torch': { params: { on: boolean }; result: void };\n}\n\n/**\n * Turns the torch on or off. Rejects with `unsupported` on a device without one.\n * @since 1.0\n */\nexport function torch(on: boolean, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.torch', { on }, 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';\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. On Android, Back or a tap outside the alert chooses it too. An\n // alert without one stays until the person chooses an action. `destructive` marks something that\n // can't be undone.\n role?: 'default' | 'cancel' | 'destructive' | undefined;\n}\n\nexport interface AlertOptions {\n title: string;\n // Dash ends it with a line naming the dot, such as \"From Plasas Kitchen\".\n message?: string | undefined;\n // Defaults to one OK button. An empty list fails as `invalid`, so the person can always close it.\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/**\n * Shows a native alert. Resolves with the action the person chose.\n * @since 1.0\n */\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/**\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.\n * @since 1.0\n */\nexport function pickDate(\n options: PickDateOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.ui.pickDate', options, callOptions);\n}\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.\n * @since 1.0\n */\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","// Text to base64 or hex and back, as UTF-8. These run in the dot itself, so they need no Dash and\n// answer at once. The engines that run a dot's logic have no TextEncoder, so UTF-8 is done here.\n\nconst BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst HEX_PATTERN = /^(?:[0-9a-fA-F]{2})*$/;\n\nexport const base64 = {\n // \"Salone\" -> \"U2Fsb25l\"\n encode(text: string): string {\n return bytesToBase64(utf8Bytes(text));\n },\n // Throws for text that isn't base64.\n decode(encoded: string): string {\n return utf8Text(base64ToBytes(encoded));\n },\n};\n\nexport const hex = {\n // \"Salone\" -> \"53616c6f6e65\"\n encode(text: string): string {\n return utf8Bytes(text)\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n },\n // Throws for text that isn't hex.\n decode(encoded: string): string {\n if (!HEX_PATTERN.test(encoded)) {\n throw new Error(`\"${encoded.slice(0, 20)}\" isn't hex. Use pairs of 0-9 and a-f.`);\n }\n const bytes: number[] = [];\n for (let index = 0; index < encoded.length; index += 2) {\n bytes.push(parseInt(encoded.slice(index, index + 2), 16));\n }\n return utf8Text(bytes);\n },\n};\n\n// Each group of 3 bytes is 24 bits, written as 4 characters of 6 bits. A shorter last group writes\n// one character per byte plus one, and pads with \"=\" to 4.\nfunction bytesToBase64(bytes: number[]): string {\n let encoded = '';\n for (let index = 0; index < bytes.length; index += 3) {\n const group = bytes.slice(index, index + 3);\n const bits = ((group[0] ?? 0) << 16) | ((group[1] ?? 0) << 8) | (group[2] ?? 0);\n const sextets = [(bits >> 18) & 0x3f, (bits >> 12) & 0x3f, (bits >> 6) & 0x3f, bits & 0x3f];\n const characterCount = group.length + 1;\n for (const sextet of sextets.slice(0, characterCount)) {\n encoded += BASE64_ALPHABET[sextet];\n }\n encoded += '='.repeat(4 - characterCount);\n }\n return encoded;\n}\n\n// The reverse of bytesToBase64: each 4 characters give 3 bytes, less one for each \"=\".\nfunction base64ToBytes(encoded: string): number[] {\n if (!isBase64(encoded)) {\n throw new Error(`\"${encoded.slice(0, 20)}\" isn't base64.`);\n }\n const bytes: number[] = [];\n for (let index = 0; index < encoded.length; index += 4) {\n const characters = encoded.slice(index, index + 4);\n let bits = 0;\n let padding = 0;\n for (const character of characters) {\n bits <<= 6;\n if (character === '=') {\n padding += 1;\n } else {\n bits |= BASE64_ALPHABET.indexOf(character);\n }\n }\n bytes.push((bits >> 16) & 0xff);\n if (padding < 2) {\n bytes.push((bits >> 8) & 0xff);\n }\n if (padding < 1) {\n bytes.push(bits & 0xff);\n }\n }\n return bytes;\n}\n\n// A loop, not a regex, as a regex runs out of stack on a few megabytes.\nfunction isBase64(encoded: string): boolean {\n if (encoded.length % 4 !== 0) {\n return false;\n }\n // \"=\" only pads the end, as \"xx==\" or \"xxx=\".\n let padding = 0;\n if (encoded.endsWith('==')) {\n padding = 2;\n } else if (encoded.endsWith('=')) {\n padding = 1;\n }\n for (let index = 0; index < encoded.length - padding; index += 1) {\n if (BASE64_ALPHABET.indexOf(encoded[index]!) === -1) {\n return false;\n }\n }\n return true;\n}\n\nfunction utf8Bytes(text: string): number[] {\n const bytes: number[] = [];\n for (const character of text) {\n const codePoint = character.codePointAt(0)!;\n if (codePoint < 0x80) {\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n bytes.push(0xc0 | (codePoint >> 6), 0x80 | (codePoint & 0x3f));\n } else if (codePoint < 0x10000) {\n bytes.push(\n 0xe0 | (codePoint >> 12),\n 0x80 | ((codePoint >> 6) & 0x3f),\n 0x80 | (codePoint & 0x3f),\n );\n } else {\n bytes.push(\n 0xf0 | (codePoint >> 18),\n 0x80 | ((codePoint >> 12) & 0x3f),\n 0x80 | ((codePoint >> 6) & 0x3f),\n 0x80 | (codePoint & 0x3f),\n );\n }\n }\n return bytes;\n}\n\nconst MAX_CODE_POINT = 0x10ffff;\n// The smallest code point that needs each length, by length. A smaller one is spelled too long.\nconst MIN_CODE_POINT_FOR_LENGTH = [0, 0, 0x80, 0x800, 0x10000];\n\n// Bytes that aren't UTF-8 become \"�\", as browsers read them.\nfunction utf8Text(bytes: number[]): string {\n let text = '';\n let index = 0;\n while (index < bytes.length) {\n const first = bytes[index]!;\n const length = sequenceLength(first);\n const continuation = bytes.slice(index + 1, index + length);\n if (length === 0 || !isCompleteContinuation(continuation, length)) {\n text += '�';\n index += 1;\n continue;\n }\n let codePoint = firstByteBits(first, length);\n for (const byte of continuation) {\n codePoint = (codePoint << 6) | (byte & 0x3f);\n }\n // Four bytes can spell a number past the last character, as f7 bf bf bf does. UTF-8 also\n // refuses characters spelled with more bytes than they need, and the halves of UTF-16 pairs.\n const isPastLastCharacter = codePoint > MAX_CODE_POINT;\n const isSpelledTooLong = codePoint < MIN_CODE_POINT_FOR_LENGTH[length]!;\n const isSurrogate = codePoint >= 0xd800 && codePoint <= 0xdfff;\n if (isPastLastCharacter || isSpelledTooLong || isSurrogate) {\n text += '�';\n index += 1;\n continue;\n }\n text += String.fromCodePoint(codePoint);\n index += length;\n }\n return text;\n}\n\n// How many bytes a UTF-8 character takes, from its first byte. 0 for a byte that can't start one.\nfunction sequenceLength(first: number): number {\n if (first < 0x80) {\n return 1;\n }\n if (first >= 0xf0) {\n return 4;\n }\n if (first >= 0xe0) {\n return 3;\n }\n if (first >= 0xc0) {\n return 2;\n }\n return 0;\n}\n\n// Whether the bytes after a first byte are all there, and each is a continuation byte: 10xxxxxx.\nfunction isCompleteContinuation(continuation: number[], length: number): boolean {\n if (continuation.length !== length - 1) {\n return false;\n }\n return continuation.every((byte) => (byte & 0xc0) === 0x80);\n}\n\n// The bits of the code point that a first byte holds, after its length marker of 1s and a 0.\nfunction firstByteBits(first: number, length: number): number {\n if (length === 1) {\n return first;\n }\n return first & (0xff >> (length + 1));\n}\n","// Helpers that run in the dot itself, so they need no Dash and answer at once, without `await`.\n\n/**\n * Text to base64 and back, as UTF-8: `dash.utils.base64.encode(\"Salone\")` is `\"U2Fsb25l\"`.\n * `decode` throws for text that isn't base64.\n * @since 1.0\n */\nexport { base64 } from './encoding';\n\n/**\n * Text to hex and back, as UTF-8: `dash.utils.hex.encode(\"Salone\")` is `\"53616c6f6e65\"`.\n * `decode` throws for text that isn't hex.\n * @since 1.0\n */\nexport { hex } from './encoding';\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 startCall = member as (...args: unknown[]) => unknown;\n copy[name] = (...args: unknown[]) => {\n const result = startCall(...args);\n // Only calls return a request to track. dash.supports answers at once.\n if (result instanceof Promise) {\n track(result as DashRequest<unknown>);\n }\n return result;\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\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 (isDashError(error, 'cancelled')) {\n return undefined;\n }\n throw error;\n }\n}\n","import type { DashRequest } from './call';\nimport { isDashError } 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 (isDashError(error, 'cancelled')) {\n return false;\n }\n throw error;\n }\n };\n}\n","import * as account from './account';\nimport { supports } from './api-versions';\nimport * as contacts from './contacts';\nimport * as crypto from './crypto';\nimport * as dot from './dot';\nimport * as media from './media';\nimport * as network from './network';\nimport * as payments from './payments';\nimport * as storage from './storage';\nimport * as system from './system';\nimport * as ui from './ui';\nimport * as utils from './utils';\n\n// Dash's features for a dot's logic, in groups: `dash.ui.alert(...)`, `dash.system.torch(...)`,\n// `dash.network.http.request(...)`. `dash.supports(...)` says whether this Dash has a newer one.\n// `dash.utils` holds helpers that run in the dot and answer at once, such as `dash.utils.base64`.\nexport const dash = {\n ui,\n system,\n network,\n storage,\n media,\n contacts,\n dot,\n account,\n payments,\n crypto,\n utils,\n supports,\n};\n\nexport type Dash = typeof dash;\n\nexport { tracked } from './tracked';\nexport {\n DASH_API_SINCE,\n DASH_API_VERSION,\n useHostDashApiVersions,\n warnAboveDashApiVersion,\n} from './api-versions';\nexport type { DashFeature } from './api-versions';\n\n// The error a Dash call fails with. Inside the libraries it's core's HostError.\nexport { HostError as DashError } from '@monimesl/dot-core';\nexport type { HostErrorCode as DashErrorCode } from '@monimesl/dot-core';\nexport { errorMessage, isDashError, unlessCancelled } from './errors';\nexport { debounce, latest } from './latest';\nexport type {\n OidcProfile,\n OidcScope,\n OidcSignIn,\n OidcSignInOptions,\n SignInMode,\n SimpleSignIn,\n SimpleSignInOptions,\n} from './account';\nexport type {\n CardMethod,\n CardPaymentResult,\n LinkMethod,\n LinkPaymentResult,\n MomoMethod,\n MomoPaymentResult,\n Money,\n Order,\n OrderLineItem,\n PaymentCallOptions,\n PaymentMethod,\n PaymentOptions,\n PaymentResult,\n PaymentsMethods,\n PaymentStatus,\n} from './payments';\nexport type { CryptoInput, CryptoOutputOptions, HmacAlgorithm, HmacOptions } from './crypto';\nexport type { CallOptions, DashRequest } from './call';\nexport type { DashMethod, DashMethods } from './methods';\nexport type {\n CacheSetOptions,\n CacheValue,\n FileEncoding,\n FileEntry,\n ReadOptions,\n ReplaceOptions,\n StorageMethods,\n StorageUsage,\n WriteOptions,\n} from './storage';\nexport type { DotFile } from './files';\nexport type {\n CodeFormat,\n MediaMethods,\n PhotoSource,\n PickFileOptions,\n PickPhotoOptions,\n ScannedCode,\n} 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 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":";;;AAGA,MAAa,mBAAmB;AAKhC,MAAa,iBAAiB;CAC5B,kBAAkB;CAClB,sBAAsB;CACtB,eAAe;CACf,sBAAsB;CACtB,qBAAqB;CACrB,iBAAiB;CACjB,iBAAiB;CACjB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,kBAAkB;CAClB,yBAAyB;CACzB,wBAAwB;CACxB,uBAAuB;CACvB,kBAAkB;CAClB,gBAAgB;CAChB,oBAAoB;CACpB,uBAAuB;CACvB,wBAAwB;CACxB,qBAAqB;CACrB,sBAAsB;CACtB,wBAAwB;CACxB,qBAAqB;CACrB,qBAAqB;CACrB,6BAA6B;CAC7B,qBAAqB;CACrB,qBAAqB;CACrB,qBAAqB;CACrB,qBAAqB;CACrB,uBAAuB;CACvB,qBAAqB;CACrB,qBAAqB;CACrB,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACxB,sBAAsB;CACtB,yBAAyB;CACzB,sBAAsB;CACtB,qBAAq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,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,YAAY,OAAO,WAAW,GAChC,OAAO;GAET,MAAM;EACR;CACF;AACF;;;ACdA,MAAa,OAAO;CAClB,IAAA;CACA,QAAA;CACA,SAAA;CACA,SAAA;CACA,OAAA;CACA,UAAA;CACA,KAAA;CACA,SAAA;CACA,UAAA;CACA,QAAA;CACA,OAAA;CACA;AACF"}
1
+ {"version":3,"file":"index.js","names":["request","get","set","list","get","set","remove","clear","remove"],"sources":["../src/api-versions.ts","../src/call.ts","../src/account/index.ts","../src/contacts/pick-phone.ts","../src/contacts/index.ts","../src/crypto/index.ts","../src/dot/index.ts","../src/media/pick-file.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/payments/payments.ts","../src/payments/index.ts","../src/reminders/reminders.ts","../src/reminders/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/utils/encoding.ts","../src/utils/index.ts","../src/tracked.ts","../src/errors.ts","../src/latest.ts","../src/index.ts"],"sourcesContent":["import { DEFAULT_DASH_API_VERSION, offersDashApiVersion } from '@monimesl/dot-core';\n\n// The newest Dash API version this library knows.\nexport const DASH_API_VERSION = '1.0';\n\n// The Dash API version each call came in, by its name in `dash`, such as \"system.dial\". A field\n// added to a call later gets its own row, such as \"ui.pickDate.title\". The `@since` tag on each call\n// says the same, and a test keeps the two in step.\nexport const DASH_API_SINCE = {\n 'account.signIn': '1.0',\n 'contacts.pickPhone': '1.0',\n 'crypto.hmac': '1.0',\n 'crypto.randomBytes': '1.0',\n 'crypto.randomUUID': '1.0',\n 'crypto.sha256': '1.0',\n 'crypto.sha512': '1.0',\n 'dot.close': '1.0',\n 'media.pickFile': '1.0',\n 'media.pickPhoto': '1.0',\n 'media.scanCode': '1.0',\n 'network.http.download': '1.0',\n 'network.http.request': '1.0',\n 'network.http.upload': '1.0',\n 'network.status': '1.0',\n 'payments.get': '1.0',\n 'payments.request': '1.0',\n 'reminders.cancel': '1.0',\n 'reminders.list': '1.0',\n 'reminders.set': '1.0',\n 'storage.cache.clear': '1.0',\n 'storage.cache.exists': '1.0',\n 'storage.cache.get': '1.0',\n 'storage.cache.keys': '1.0',\n 'storage.cache.remove': '1.0',\n 'storage.cache.set': '1.0',\n 'storage.file.copy': '1.0',\n 'storage.file.createFolder': '1.0',\n 'storage.file.list': '1.0',\n 'storage.file.move': '1.0',\n 'storage.file.open': '1.0',\n 'storage.file.read': '1.0',\n 'storage.file.remove': '1.0',\n 'storage.file.save': '1.0',\n 'storage.file.stat': '1.0',\n 'storage.file.usage': '1.0',\n 'storage.file.write': '1.0',\n 'storage.secret.clear': '1.0',\n 'storage.secret.get': '1.0',\n 'storage.secret.remove': '1.0',\n 'storage.secret.set': '1.0',\n 'system.brightness': '1.0',\n 'system.copyText': '1.0',\n 'system.delay': '1.0',\n 'system.dial': '1.0',\n 'system.info': '1.0',\n 'system.keepAwake': '1.0',\n 'system.openUrl': '1.0',\n 'system.share': '1.0',\n 'system.torch': '1.0',\n 'system.vibrate': '1.0',\n 'ui.alert': '1.0',\n 'ui.pickDate': '1.0',\n 'ui.pickTime': '1.0',\n} as const satisfies Record<string, string>;\n\n// A call or field `dash.supports` can check, such as \"contacts.pickPhone\".\nexport type DashFeature = keyof typeof DASH_API_SINCE;\n\nlet hostApiVersions: readonly string[] = [DEFAULT_DASH_API_VERSION];\nlet dotMinApiVersion: string | undefined;\nconst checkedFeatures = new Set<string>();\nconst warnedFeatures = new Set<string>();\n\n// The service passes on the Dash API versions the host says it offers.\nexport function useHostDashApiVersions(versions: readonly string[]): void {\n hostApiVersions = versions;\n}\n\n// While developing, the service names the dot's minApiVersion, so calls newer than it are pointed out.\nexport function warnAboveDashApiVersion(minApiVersion: string | undefined): void {\n dotMinApiVersion = minApiVersion;\n}\n\n/**\n * Whether this Dash has `feature`: a call, such as `'contacts.pickPhone'`, or a field added to a\n * call later.\n * @since 1.0\n */\nexport function supports(feature: DashFeature): boolean {\n checkedFeatures.add(feature);\n const since = sinceOf(feature);\n return since !== undefined && offersDashApiVersion(hostApiVersions, since);\n}\n\n// Warns once for each call, or field it sends, that's newer than the dot's minApiVersion, unless the\n// dot checked it with dash.supports first. Older Dash would answer `unsupported`.\nexport function warnIfNewerThanDot(method: string, params: unknown): void {\n if (dotMinApiVersion === undefined) {\n return;\n }\n const callName = method.replace(/^dash\\./, '');\n for (const feature of [callName, ...fieldsSent(callName, params)]) {\n const since = sinceOf(feature);\n if (since === undefined) {\n continue;\n }\n if (checkedFeatures.has(feature) || warnedFeatures.has(feature)) {\n continue;\n }\n if (offersDashApiVersion([dotMinApiVersion], since)) {\n continue;\n }\n warnedFeatures.add(feature);\n console.warn(\n `dash.${feature} came in Dash API ${since}, but this dot's minApiVersion is ${dotMinApiVersion}, ` +\n `so older Dash doesn't have it. Raise \"minApiVersion\" in dot.json, or check ` +\n `dash.supports('${feature}') first.`,\n );\n }\n}\n\nfunction sinceOf(feature: string): string | undefined {\n const table: Record<string, string> = DASH_API_SINCE;\n return Object.hasOwn(table, feature) ? table[feature] : undefined;\n}\n\n// \"ui.pickDate.title\" for a `title` sent to `dash.ui.pickDate`, when that field has its own row.\nfunction fieldsSent(callName: string, params: unknown): string[] {\n if (typeof params !== 'object' || params === null) {\n return [];\n }\n return Object.keys(params)\n .map((field) => `${callName}.${field}`)\n .filter((feature) => sinceOf(feature) !== undefined);\n}\n","import type { HostCallOptions, HostRequest } from '@monimesl/dot-core';\nimport { callHost } from '@monimesl/dot-core';\n\nimport { warnIfNewerThanDot } from './api-versions';\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 warnIfNewerThanDot(method, params);\n return callHost(method, params, options);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\n// How a dot signs the person in. `simple`: Dash says who the person is. `oidc`: OpenID Connect,\n// with an ID token the dot's server can check. `oidc` isn't ready yet, so it fails with `unsupported`.\nexport type SignInMode = 'simple' | 'oidc';\n\nexport interface SimpleSignInOptions {\n mode: 'simple';\n // Mixed into the token. The same nonce gives the same token, so leaving it out, or a fixed one,\n // names the person the same way each time in this dot, and a fresh one gives a token only for\n // this call. An empty nonce is the same as none.\n nonce?: string | undefined;\n}\n\nexport interface SimpleSignIn {\n fullName: string;\n // The phone number or email address the person uses Dash with, such as \"+232 76 123456\". It's the\n // phone number when the account has one.\n alias: string;\n // Monime makes it from the dot's id, the person and the nonce, with a key only Monime knows, so the\n // same person gets the same token on any phone. It names the person but proves nothing to the\n // dot's server: Dash hands it over as it is.\n accountIdToken: string;\n}\n\n// What the dot asks to see besides who the person is. Each needs the person's consent.\nexport type OidcScope = 'profile' | 'phone' | 'email';\n\nexport interface OidcSignInOptions {\n mode: 'oidc';\n scopes?: OidcScope[] | undefined;\n // Goes into the ID token. The dot's server should give a fresh one for each sign-in and check it.\n nonce?: string | undefined;\n}\n\n// Only what the person agreed to, by scope.\nexport interface OidcProfile {\n name?: string | undefined;\n givenName?: string | undefined;\n familyName?: string | undefined;\n phone?: string | undefined;\n email?: string | undefined;\n}\n\nexport interface OidcSignIn {\n // The person's id for this dot's publisher. The same in each of the publisher's dots.\n id: string;\n // A signed JWT the dot's server checks with Monime's keys before trusting `id`.\n idToken: string;\n // When `idToken` stops being valid, such as \"2026-10-24T10:05:00Z\".\n expiresAt: string;\n profile: OidcProfile;\n}\n\nexport interface AccountMethods {\n 'dash.account.signIn': {\n params: { mode: SignInMode; nonce: string; scopes?: OidcScope[] };\n result: SimpleSignIn | OidcSignIn;\n };\n}\n\n/**\n * Signs the person in to the dot with their Dash account. Needs the `account` permission.\n *\n * With `mode: 'simple'`, resolves with their full name, their phone number or email address, and a\n * token that names them in this dot. With `mode: 'oidc'`, OpenID Connect, it will resolve with an ID\n * token for the dot's server; until Dash has it, it rejects with `unsupported`.\n *\n * Rejects with `invalid` for a nonce longer than 128 characters, with `unsupported` for a mode this\n * Dash doesn't have, and with `failed` when no one is signed in or Dash can't reach Monime.\n * @since 1.0\n */\nexport function signIn(\n options: SimpleSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<SimpleSignIn>;\nexport function signIn(\n options: OidcSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<OidcSignIn>;\nexport function signIn(\n options: SimpleSignInOptions | OidcSignInOptions,\n callOptions?: CallOptions,\n): DashRequest<SimpleSignIn | OidcSignIn> {\n const params: AccountMethods['dash.account.signIn']['params'] = {\n mode: options.mode,\n nonce: options.nonce ?? '',\n };\n if (options.mode === 'oidc' && options.scopes) {\n params.scopes = options.scopes;\n }\n return call('dash.account.signIn', params, callOptions);\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/**\n * Shows the phone's contacts for the person to choose one phone number, such as the number to send\n * money to. The dot sees only the chosen contact. Rejects with `cancelled` if the person closes it.\n * @since 1.0\n */\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';\n\n// Text is read as UTF-8. Binary data, such as a file's contents, comes as base64.\nexport type CryptoInput = string | { base64: string };\n\n// Hex by default.\nexport interface CryptoOutputOptions {\n as?: 'hex' | 'base64';\n}\n\nexport type HmacAlgorithm = 'sha256' | 'sha512';\n\n// Named, since key and data take the same kinds of value and a swapped pair signs wrongly.\nexport interface HmacOptions extends CryptoOutputOptions {\n algorithm: HmacAlgorithm;\n key: CryptoInput;\n data: CryptoInput;\n}\n\ntype InputEncoding = 'text' | 'base64';\ntype OutputEncoding = 'hex' | 'base64';\n\ninterface WireInput {\n data: string;\n dataEncoding: InputEncoding;\n as: OutputEncoding;\n}\n\nexport interface CryptoMethods {\n 'dash.crypto.sha256': { params: WireInput; result: string };\n 'dash.crypto.sha512': { params: WireInput; result: string };\n 'dash.crypto.hmac': {\n params: WireInput & { algorithm: HmacAlgorithm; key: string; keyEncoding: InputEncoding };\n result: string;\n };\n 'dash.crypto.randomBytes': { params: { count: number; as: OutputEncoding }; result: string };\n 'dash.crypto.randomUUID': { params: Record<string, never>; result: string };\n}\n\n/** @since 1.0 */\nexport function sha256(\n data: CryptoInput,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.sha256', wireInput(data, options), callOptions);\n}\n\n/** @since 1.0 */\nexport function sha512(\n data: CryptoInput,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.sha512', wireInput(data, options), callOptions);\n}\n\n/**\n * Signs `data` with `key`, as HMAC-SHA256 or HMAC-SHA512, such as\n * `hmac({ algorithm: 'sha256', key, data })`.\n * @since 1.0\n */\nexport function hmac(options: HmacOptions, callOptions?: CallOptions): DashRequest<string> {\n const wireKey = valueAndEncoding(options.key);\n const params = {\n ...wireInput(options.data, options),\n algorithm: options.algorithm,\n key: wireKey.value,\n keyEncoding: wireKey.encoding,\n };\n return call('dash.crypto.hmac', params, callOptions);\n}\n\n/**\n * `count` secure random bytes, from 1 to 1024.\n * @since 1.0\n */\nexport function randomBytes(\n count: number,\n options: CryptoOutputOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.crypto.randomBytes', { count, as: outputEncoding(options) }, callOptions);\n}\n\n/**\n * A random version 4 UUID, such as \"3f0e5c3a-6d1b-4c8e-9a2f-1b7d4e6a9c05\".\n * @since 1.0\n */\nexport function randomUUID(callOptions?: CallOptions): DashRequest<string> {\n return call('dash.crypto.randomUUID', {}, callOptions);\n}\n\nfunction wireInput(data: CryptoInput, options: CryptoOutputOptions): WireInput {\n const { value, encoding } = valueAndEncoding(data);\n return { data: value, dataEncoding: encoding, as: outputEncoding(options) };\n}\n\nfunction outputEncoding(options: CryptoOutputOptions): OutputEncoding {\n return options.as ?? 'hex';\n}\n\nfunction valueAndEncoding(input: CryptoInput): { value: string; encoding: InputEncoding } {\n if (typeof input === 'string') {\n return { value: input, encoding: 'text' };\n }\n return { value: input.base64, encoding: 'base64' };\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface DotMethods {\n 'dash.dot.close': { params: Record<string, never>; result: void };\n}\n\n/**\n * Closes the dot, as going back from its first page does. Calls still running are cancelled.\n * @since 1.0\n */\nexport function close(callOptions?: CallOptions): DashRequest<void> {\n return call('dash.dot.close', {}, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\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 PickFileMethods {\n 'dash.media.pickFile': { params: { types?: string[] }; result: DotFile };\n}\n\n/**\n * Lets the person choose a file from their phone, of at most 25 MB.\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 unless you save it with `dash.storage.file.save`.\n * @since 1.0\n */\nexport function pickFile(\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.media.pickFile', params, callOptions);\n}\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/**\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.\n * @since 1.0\n */\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 // What the code holds, as text.\n text: string;\n format: CodeFormat;\n}\n\nexport interface ScanCodeMethods {\n 'dash.media.scanCode': { params: Record<string, never>; result: ScannedCode };\n}\n\n/**\n * Opens Dash's scanner until it reads a QR code. Rejects with\n * `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.\n * @since 1.0\n */\nexport function scanCode(callOptions?: CallOptions): DashRequest<ScannedCode> {\n return call('dash.media.scanCode', {}, callOptions);\n}\n","import type { PickFileMethods } from './pick-file';\nimport type { PickPhotoMethods } from './pick-photo';\nimport type { ScanCodeMethods } from './scan-code';\n\nexport { pickFile } from './pick-file';\nexport { pickPhoto } from './pick-photo';\nexport { scanCode } from './scan-code';\nexport type { PickFileOptions } from './pick-file';\nexport type { PhotoSource, PickPhotoOptions } from './pick-photo';\nexport type { CodeFormat, ScannedCode } from './scan-code';\n\nexport type MediaMethods = PickFileMethods & PickPhotoMethods & ScanCodeMethods;\n","import { createHostRequest, HostError } from '@monimesl/dot-core';\n\nimport type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\nimport type { DotFile } from '../files';\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';\n\nexport type HttpRequestBody = string | object;\n\nexport interface HttpRequest<RequestBody extends HttpRequestBody = HttpRequestBody> {\n // An https address on a host in `network.hosts` in `dot.json`.\n url: string;\n // Default: `GET`.\n method?: HttpMethod;\n headers?: Record<string, string>;\n // Text, or an object, which is sent as JSON.\n body?: RequestBody;\n}\n\nexport interface HttpResponse<ResponseBody = string> {\n // True for a status from 200 to 299.\n ok: boolean;\n status: number;\n statusText: string;\n // Names are lowercase, such as \"content-type\". A header sent more than once comes once, with its\n // values joined by \", \".\n headers: Record<string, string>;\n // Text, or the parsed JSON when you asked for `as: 'json'`.\n body: ResponseBody;\n}\n\n// Without `as`, the response body is text. Pass `as: 'json'` to get it parsed, typed as the call's\n// `ResponseBody`.\nexport type HttpReadOptions<ResponseBody> = [ResponseBody] extends [string]\n ? { as?: 'text' }\n : { as: 'json' };\n\nexport interface HttpDownloadRequest extends HttpRequest {\n // The file's name. Without it, the name comes from the response or the address.\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 // The form field the file goes in.\n field: string;\n file: DotFile;\n // The file name your server sees. Without it, it's the file's own name.\n name?: string;\n}\n\nexport interface HttpUploadRequest {\n // An https address on a host in `network.hosts` in `dot.json`.\n url: string;\n // Default: `POST`.\n method?: 'POST' | 'PUT' | 'PATCH';\n headers?: Record<string, string>;\n // Text fields sent along with the files.\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/**\n * Like fetch, resolves with any response, even a 404. An object body is sent as JSON.\n * @since 1.0\n */\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: readAs, ...request } = options as HttpRequest & { as?: ReadAs };\n const response = call('dash.network.http.request', wireRequest(request, readAs), callOptions);\n return readBody(response, readAs);\n}\n\n/**\n * Saves a 2xx response's body, up to 256 MB, to a temporary file.\n * @since 1.0\n */\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/**\n * Sends the dot's files as a multipart form.\n * @since 1.0\n */\nexport function upload<ResponseBody = string>(\n options: HttpUploadRequest & HttpReadOptions<ResponseBody>,\n callOptions?: CallOptions,\n): DashRequest<HttpResponse<ResponseBody>> {\n const { as: readAs, ...request } = options as HttpUploadRequest & { as?: ReadAs };\n const files = request.files.map((upload) => ({ ...upload, file: upload.file.id }));\n const params = { ...request, files };\n if (readAs === '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, readAs);\n}\n\nfunction wireRequest<Request extends HttpRequest>(\n request: Request,\n readAs?: ReadAs,\n): WireRequest<Request> {\n let headers = request.headers;\n let body: string | undefined;\n if (readAs === '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 if (headers === undefined) {\n return { [name]: value };\n }\n const lowerName = name.toLowerCase();\n const alreadySet = Object.keys(headers).some((existing) => existing.toLowerCase() === lowerName);\n if (alreadySet) {\n return headers;\n }\n return { ...headers, [name]: value };\n}\n\nfunction readBody<Body>(\n response: DashRequest<HttpResponse>,\n readAs: ReadAs | undefined,\n): DashRequest<HttpResponse<Body>> {\n if (readAs !== '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/**\n * Whether the phone is online now, and how. It can still be online without reaching a server.\n * @since 1.0\n */\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 { createHostRequest } from '@monimesl/dot-core';\n\nimport type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface Money {\n currency: 'SLE' | 'USD';\n // In minor units, as in Monime's API: SLE 75.00 is 7500.\n value: number;\n}\n\nexport interface OrderLineItem {\n name: string;\n unitPrice: Money;\n // 1 to 100,000. Default: 1.\n quantity?: number | undefined;\n // An https picture Dash shows beside the item. Its host must be in `network.hosts` in `dot.json`.\n imageUrl?: string | undefined;\n}\n\nexport interface Order {\n // What the person is paying for, such as \"Jazz Night tickets\". 3 to 64 characters.\n name: string;\n // The dot's own ID for the order, up to 64 characters. The same reference never pays twice:\n // asking again gives back the first payment.\n reference: string;\n description?: string | undefined;\n // 1 to 16 items, all in one currency. Dash adds them up for the total.\n lineItems: OrderLineItem[];\n // Up to 64 pairs, with keys up to 48 characters and values up to 100. They stay with the payment\n // and its webhooks. Keys can't start with \"@\", \"_\" or \"monime\", which Monime keeps for itself.\n metadata?: Record<string, string> | undefined;\n}\n\n// Monime's IDs for the mobile money providers: m17 is Orange Money and m18 is Africell Money.\nexport type MomoProvider = 'm17' | 'm18';\n\n// Monime's IDs for the banks a linked account can be at.\nexport type LinkProvider = 'slb001' | 'slb004' | 'slb007' | 'slb009' | 'slb013';\n\nexport interface LinkMethod {\n type: 'link';\n // The only banks that can pay. Empty or left out means any.\n providers?: LinkProvider[] | undefined;\n}\n\nexport interface CardMethod {\n type: 'card';\n}\n\nexport interface MomoMethod {\n type: 'momo';\n // The only providers that can pay. Empty or left out means both.\n providers?: MomoProvider[] | undefined;\n // Only this number can pay, such as \"+23276123456\".\n phoneNumber?: string | undefined;\n}\n\nexport type PaymentMethod = LinkMethod | CardMethod | MomoMethod;\n\nexport interface PaymentOptions {\n order: Order;\n // The methods to offer, in order, each with its own settings. Leave it out for all three\n // with no limits.\n methods?: PaymentMethod[] | undefined;\n // The financial account the money goes to, such as \"fac-k6VgVTfSmLruHpiQgMg4DUeySZx\". It must\n // belong to the Space that owns the dot and hold the order's currency. Leave it out for the\n // Space's main account.\n financialAccountId?: string | undefined;\n}\n\n// `failed` comes only from `get`, for a pending payment that failed later.\nexport type PaymentStatus = 'pending' | 'completed' | 'failed' | 'expired' | 'cancelled';\n\ninterface PaymentResultBase {\n // The order's `reference`.\n reference: string;\n // Dash's ID for the payment request. Give it to Monime's support when asking about a payment.\n requestId: string;\n // How the payment stands now.\n status: PaymentStatus;\n // The order's total.\n amount: Money;\n // Monime's payment, such as \"pay-…\", once there is one.\n paymentId?: string | undefined;\n // Monime's number for the order, for the person's receipt and for support. Only once the\n // payment has completed.\n orderNumber?: string | undefined;\n}\n\nexport interface CardPaymentResult extends PaymentResultBase {\n method: 'card';\n // The Monime checkout session the card paid through.\n checkoutSessionId: string;\n}\n\nexport interface MomoPaymentResult extends PaymentResultBase {\n method: 'momo';\n // The Monime payment code the mobile money paid through.\n paymentCodeId: string;\n}\n\nexport interface LinkPaymentResult extends PaymentResultBase {\n method: 'link';\n // The Monime payment the linked account made.\n paymentId: string;\n}\n\nexport type PaymentResult = CardPaymentResult | MomoPaymentResult | LinkPaymentResult;\n\n// No `timeout`: Dash decides how long the sheet waits.\nexport type PaymentCallOptions = Omit<CallOptions, 'timeout'>;\n\nexport interface PaymentsMethods {\n 'dash.payments.request': { params: PaymentOptions; result: PaymentResult };\n 'dash.payments.get': { params: { reference: string }; result: PaymentResult | null };\n}\n\n/**\n * Opens Dash's payment sheet, where the person pays for `order` with one of `methods`. The money\n * goes to the Space that owns the dot.\n *\n * Before the person picks a method, it can reject with:\n *\n * - `invalid`: Monime won't take the order, such as one below its smallest amount.\n * - `denied`: the dot or its Space can't take payments now.\n * - `failed`: Dash couldn't reach Monime.\n * - `cancelled`: the person closed the sheet.\n * - `timeout`: the sheet waited as long as Dash allows.\n *\n * Once they pick a method, it resolves with the payment's `status`: `completed`, `pending`,\n * `expired`, or `cancelled` if they closed the sheet. If a method fails, the sheet stays open for\n * them to try again. From then on, `cancel()` only stops your code waiting; the payment goes on.\n * Read it again later with `get`.\n * @since 1.0\n */\nexport function request(\n options: PaymentOptions,\n callOptions?: PaymentCallOptions,\n): DashRequest<PaymentResult> {\n // Plain JavaScript could still pass a timeout, so it's taken out here too.\n const withoutTimeout: CallOptions = { ...callOptions };\n delete withoutTimeout.timeout;\n return call('dash.payments.request', options, withoutTimeout);\n}\n\n/**\n * The payment for the order with this reference, to check a pending one later or after the dot\n * opens again. Undefined if this dot never asked for it, or the person never picked a method.\n * @since 1.0\n */\nexport function get(\n reference: string,\n callOptions?: CallOptions,\n): DashRequest<PaymentResult | undefined> {\n const response = call('dash.payments.get', { reference }, callOptions);\n // The host answers null for none, as JSON has no undefined.\n const found = response.then((result) => result ?? undefined);\n return createHostRequest(found, () => response.cancel());\n}\n","export { get, request } from './payments';\nexport type {\n CardMethod,\n CardPaymentResult,\n LinkMethod,\n LinkPaymentResult,\n LinkProvider,\n MomoMethod,\n MomoPaymentResult,\n MomoProvider,\n Money,\n Order,\n OrderLineItem,\n PaymentCallOptions,\n PaymentMethod,\n PaymentOptions,\n PaymentResult,\n PaymentsMethods,\n PaymentStatus,\n} from './payments';\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';\n\n// How a reminder repeats. Each `interval` counts from the start: every 2 weeks from the start's week.\nexport type ReminderRepeat =\n | { every: 'once' }\n // Once on each date, as \"2026-12-24\".\n | { every: 'dates'; dates: string[] }\n | { every: 'day'; interval?: number | undefined }\n | { every: 'week'; interval?: number | undefined; days: Weekday[] }\n // On these days of the month, 1 to 31. A day past a short month's end falls on its last day.\n | { every: 'month'; interval?: number | undefined; days: number[] }\n // On the first to fourth `day` of the month, or its last with -1.\n | { every: 'month'; interval?: number | undefined; nth: 1 | 2 | 3 | 4 | -1; day: Weekday }\n | { every: 'month'; interval?: number | undefined; lastDay: true };\n\n// When a repeating reminder stops: after its last time on or before a date, or after so many times.\nexport type ReminderEnd = { on: string } | { after: number };\n\nexport interface ReminderSchedule {\n // The first date, on the phone's calendar, as \"2026-11-05\".\n start: string;\n // On the phone's clock, as \"17:30\". Default: \"09:00\".\n time?: string | undefined;\n // Default: once.\n repeat?: ReminderRepeat | undefined;\n // Default: never.\n end?: ReminderEnd | undefined;\n}\n\nexport interface Reminder {\n // The dot's own name for it, up to 64 characters. Setting a reminder with the same key changes it.\n key: string;\n // What the notification says first, up to 80 characters.\n title: string;\n // Under the title, up to 200 characters.\n message?: string | undefined;\n // The dot's page the notification opens, from its \"/\", as \"/orders/42\". Default: its first page.\n page?: string | undefined;\n schedule: ReminderSchedule;\n}\n\nexport interface RemindersMethods {\n 'dash.reminders.set': { params: Reminder; result: void };\n 'dash.reminders.cancel': { params: { key: string }; result: boolean };\n 'dash.reminders.list': { params: Record<string, never>; result: Reminder[] };\n}\n\n/**\n * Sets a reminder: a notification at the times its schedule gives, which opens the dot at its page.\n * Dash never acts by itself; the person taps the notification. A dot can have 5 reminders still\n * to come at a time; past that, it rejects with `failed`. Needs the `reminders` permission.\n * @since 1.0\n */\nexport function set(reminder: Reminder, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.reminders.set', reminder, callOptions);\n}\n\n/**\n * Cancels the dot's reminder with `key`. Resolves to false when it had none. Needs the `reminders`\n * permission declared in dot.json; Dash doesn't ask the person for it here.\n * @since 1.0\n */\nexport function cancel(key: string, callOptions?: CallOptions): DashRequest<boolean> {\n return call('dash.reminders.cancel', { key }, callOptions);\n}\n\n/**\n * The dot's reminders, in the order it set them. The person can delete them in Dash. Needs the\n * `reminders` permission declared in dot.json; Dash doesn't ask the person for it here.\n * @since 1.0\n */\nexport function list(callOptions?: CallOptions): DashRequest<Reminder[]> {\n return call('dash.reminders.list', {}, callOptions);\n}\n","import type { RemindersMethods } from './reminders';\n\nexport { cancel, list, set } from './reminders';\nexport type { Reminder, ReminderEnd, ReminderRepeat, ReminderSchedule, Weekday } from './reminders';\n\nexport type { RemindersMethods };\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 milliseconds the entry lasts. Without it, or with 0 or less, it lasts until removed.\n ttl?: number | undefined;\n}\n\n/**\n * Resolves with null for a missing or expired key.\n * @since 1.0\n */\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\n/** @since 1.0 */\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\n/** @since 1.0 */\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.cache.remove', { key }, callOptions);\n}\n\n/** @since 1.0 */\nexport function exists(key: string, callOptions?: CallOptions): DashRequest<boolean> {\n return call('dash.storage.cache.exists', { key }, callOptions);\n}\n\n/**\n * The keys, sorted.\n * @since 1.0\n */\nexport function keys(callOptions?: CallOptions): DashRequest<string[]> {\n return call('dash.storage.cache.keys', {}, callOptions);\n}\n\n/** @since 1.0 */\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';\n\n// Files live in the dot's own folder, which no other dot sees. Paths are relative to it, such as\n// \"receipts/42.pdf\", and '' is the folder itself. A call on a path with nothing there fails with\n// `missing`, while `stat` gives null for it.\n\nexport interface FileEntry {\n name: string;\n path: string;\n // In bytes, and 0 for a folder.\n size: number;\n kind: 'file' | 'folder';\n // When it last changed, in milliseconds since 1 January 1970, as Date.now() gives.\n modifiedAt: number;\n contentType?: string;\n}\n\nexport type FileEncoding = 'text' | 'base64';\n\n// In bytes: what the dot's files take, and the most they may take.\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}\n\nexport interface ReadOptions {\n // Default: `text`.\n as?: FileEncoding;\n}\n\nexport interface WriteOptions {\n // How `data` is written. Default: `text`.\n as?: FileEncoding;\n // Adds to the end of the file in place of replacing it. Default: `false`.\n append?: boolean;\n}\n\nexport interface ReplaceOptions {\n // Replaces what's already at the path. Default: `false`.\n overwrite?: boolean;\n}\n\n/**\n * Reads a file of up to 5 MB.\n * @since 1.0\n */\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/**\n * Writes `data` to the file at `path`, as text or base64, and creates any missing folders above\n * it. Pass `{ append: true }` to add to the end of the file.\n * @since 1.0\n */\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\n/** @since 1.0 */\nexport function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null> {\n return call('dash.storage.file.stat', { path }, callOptions);\n}\n\n/**\n * Sorted by path.\n * @since 1.0\n */\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\n/** @since 1.0 */\nexport function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry> {\n return call('dash.storage.file.createFolder', { path }, callOptions);\n}\n\n/** @since 1.0 */\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\n/** @since 1.0 */\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/**\n * Deletes the file or folder at `path`. A folder with anything in it needs `{ recursive: true }`.\n * @since 1.0\n */\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/**\n * Keeps a temporary file, such as a download, at `path`.\n * @since 1.0\n */\nexport function save(\n file: DotFile,\n path: string,\n options: ReplaceOptions = {},\n callOptions?: CallOptions,\n): DashRequest<FileEntry> {\n return call('dash.storage.file.save', { file: file.id, path, ...options }, callOptions);\n}\n\n/**\n * A stored file as a DotFile, to show with its `url` or send with `http.upload`.\n * @since 1.0\n */\nexport function open(path: string, callOptions?: CallOptions): DashRequest<DotFile> {\n return call('dash.storage.file.open', { path }, callOptions);\n}\n\n/** @since 1.0 */\nexport function usage(callOptions?: CallOptions): DashRequest<StorageUsage> {\n return call('dash.storage.file.usage', {}, 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 32 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\n/** @since 1.0 */\nexport function get(key: string, callOptions?: CallOptions): DashRequest<string | null> {\n return call('dash.storage.secret.get', { key }, callOptions);\n}\n\n/** @since 1.0 */\nexport function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.set', { key, value }, callOptions);\n}\n\n/** @since 1.0 */\nexport function remove(key: string, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.storage.secret.remove', { key }, callOptions);\n}\n\n/** @since 1.0 */\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 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\n/** @since 1.0 */\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/**\n * Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.\n * @since 1.0\n */\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/**\n * Opens the phone's dialer with `number` ready, such as \"+232 76 123456\" or a USSD code such as\n * \"*715#\". The person taps Call. Spaces and dashes are fine; anything else but digits, +, * and #\n * rejects with `invalid`. For a code, Dash asks the person first, and rejects with `cancelled` if\n * they say no. Codes that set up call forwarding, such as \"**21*…#\", reject with `denied`.\n * @since 1.0\n */\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 // Default: `medium`.\n style?: VibrationStyle | undefined;\n}\n\nexport interface HapticsMethods {\n 'dash.system.vibrate': { params: VibrateOptions; result: void };\n}\n\n/**\n * Plays a short vibration. Resolves once it's done.\n * @since 1.0\n */\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\". To check for a call, use `dash.supports`.\n dashVersion: string;\n // The Dash API versions it offers, one for each major it supports, such as [\"1.0\"].\n apiVersions: string[];\n}\n\nexport interface InfoMethods {\n 'dash.system.info': { params: Record<string, never>; result: SystemInfo };\n}\n\n/**\n * Facts about the phone and Dash: the platform, language, region, time zone and versions. Nothing\n * in it identifies the person or the phone.\n * @since 1.0\n */\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/**\n * Opens an https address in the device's browser. Any other address rejects with `invalid`.\n * @since 1.0\n */\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/**\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.\n * @since 1.0\n */\nexport function keepAwake(on: boolean, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.keepAwake', { on }, callOptions);\n}\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.\n * @since 1.0\n */\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';\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;\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/**\n * Opens the device's share sheet. Resolves once it shows.\n * @since 1.0\n */\nexport function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void> {\n const { file, ...content } = options;\n if (file === undefined) {\n return call('dash.system.share', content, callOptions);\n }\n return call('dash.system.share', { ...content, file: file.id }, callOptions);\n}\n","import type { CallOptions, DashRequest } from '../call';\nimport { call } from '../call';\n\nexport interface TorchMethods {\n 'dash.system.torch': { params: { on: boolean }; result: void };\n}\n\n/**\n * Turns the torch on or off. Rejects with `unsupported` on a device without one.\n * @since 1.0\n */\nexport function torch(on: boolean, callOptions?: CallOptions): DashRequest<void> {\n return call('dash.system.torch', { on }, 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';\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 // What the alert resolves with, as `action`, when the person chooses this action.\n id: string;\n label: string;\n // `cancel` closes the alert, and on Android, Back or a tap outside the alert chooses it too.\n // Without a `cancel` action, the alert stays until the person picks one. `destructive` marks\n // something that can't be undone.\n role?: 'default' | 'cancel' | 'destructive' | undefined;\n}\n\nexport interface AlertOptions {\n title: string;\n // Dash ends it with a line naming the dot, such as \"From Plasas Kitchen\".\n message?: string | undefined;\n // Default: one OK button. An empty list fails with `invalid`.\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/**\n * Shows the phone's own alert. Resolves with the action the person chose.\n * @since 1.0\n */\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 // The date chosen when the picker opens, such as \"2026-10-24\".\n value?: string | undefined;\n // The earliest date the person can pick, such as \"2026-10-01\".\n min?: string | undefined;\n // The latest date the person can pick, such as \"2026-12-31\".\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/**\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.\n * @since 1.0\n */\nexport function pickDate(\n options: PickDateOptions = {},\n callOptions?: CallOptions,\n): DashRequest<string> {\n return call('dash.ui.pickDate', options, callOptions);\n}\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.\n * @since 1.0\n */\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","// Text to base64 or hex and back, as UTF-8. These run in the dot itself, so they need no Dash and\n// answer at once. The engines that run a dot's logic have no TextEncoder, so UTF-8 is done here.\n\nconst BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst HEX_PATTERN = /^(?:[0-9a-fA-F]{2})*$/;\n\nexport const base64 = {\n // \"Salone\" -> \"U2Fsb25l\"\n encode(text: string): string {\n return bytesToBase64(utf8Bytes(text));\n },\n // Throws for text that isn't base64.\n decode(encoded: string): string {\n return utf8Text(base64ToBytes(encoded));\n },\n};\n\nexport const hex = {\n // \"Salone\" -> \"53616c6f6e65\"\n encode(text: string): string {\n return utf8Bytes(text)\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n },\n // Throws for text that isn't hex.\n decode(encoded: string): string {\n if (!HEX_PATTERN.test(encoded)) {\n throw new Error(`\"${encoded.slice(0, 20)}\" isn't hex. Use pairs of 0-9 and a-f.`);\n }\n const bytes: number[] = [];\n for (let index = 0; index < encoded.length; index += 2) {\n bytes.push(parseInt(encoded.slice(index, index + 2), 16));\n }\n return utf8Text(bytes);\n },\n};\n\n// Each group of 3 bytes is 24 bits, written as 4 characters of 6 bits. A shorter last group writes\n// one character per byte plus one, and pads with \"=\" to 4.\nfunction bytesToBase64(bytes: number[]): string {\n let encoded = '';\n for (let index = 0; index < bytes.length; index += 3) {\n const group = bytes.slice(index, index + 3);\n const bits = ((group[0] ?? 0) << 16) | ((group[1] ?? 0) << 8) | (group[2] ?? 0);\n const sextets = [(bits >> 18) & 0x3f, (bits >> 12) & 0x3f, (bits >> 6) & 0x3f, bits & 0x3f];\n const characterCount = group.length + 1;\n for (const sextet of sextets.slice(0, characterCount)) {\n encoded += BASE64_ALPHABET[sextet];\n }\n encoded += '='.repeat(4 - characterCount);\n }\n return encoded;\n}\n\n// The reverse of bytesToBase64: each 4 characters give 3 bytes, less one for each \"=\".\nfunction base64ToBytes(encoded: string): number[] {\n if (!isBase64(encoded)) {\n throw new Error(`\"${encoded.slice(0, 20)}\" isn't base64.`);\n }\n const bytes: number[] = [];\n for (let index = 0; index < encoded.length; index += 4) {\n const characters = encoded.slice(index, index + 4);\n let bits = 0;\n let padding = 0;\n for (const character of characters) {\n bits <<= 6;\n if (character === '=') {\n padding += 1;\n } else {\n bits |= BASE64_ALPHABET.indexOf(character);\n }\n }\n bytes.push((bits >> 16) & 0xff);\n if (padding < 2) {\n bytes.push((bits >> 8) & 0xff);\n }\n if (padding < 1) {\n bytes.push(bits & 0xff);\n }\n }\n return bytes;\n}\n\n// A loop, not a regex, as a regex runs out of stack on a few megabytes.\nfunction isBase64(encoded: string): boolean {\n if (encoded.length % 4 !== 0) {\n return false;\n }\n // \"=\" only pads the end, as \"xx==\" or \"xxx=\".\n let padding = 0;\n if (encoded.endsWith('==')) {\n padding = 2;\n } else if (encoded.endsWith('=')) {\n padding = 1;\n }\n for (let index = 0; index < encoded.length - padding; index += 1) {\n if (BASE64_ALPHABET.indexOf(encoded[index]!) === -1) {\n return false;\n }\n }\n return true;\n}\n\nfunction utf8Bytes(text: string): number[] {\n const bytes: number[] = [];\n for (const character of text) {\n const codePoint = character.codePointAt(0)!;\n if (codePoint < 0x80) {\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n bytes.push(0xc0 | (codePoint >> 6), 0x80 | (codePoint & 0x3f));\n } else if (codePoint < 0x10000) {\n bytes.push(\n 0xe0 | (codePoint >> 12),\n 0x80 | ((codePoint >> 6) & 0x3f),\n 0x80 | (codePoint & 0x3f),\n );\n } else {\n bytes.push(\n 0xf0 | (codePoint >> 18),\n 0x80 | ((codePoint >> 12) & 0x3f),\n 0x80 | ((codePoint >> 6) & 0x3f),\n 0x80 | (codePoint & 0x3f),\n );\n }\n }\n return bytes;\n}\n\nconst MAX_CODE_POINT = 0x10ffff;\n// The smallest code point that needs each length, by length. A smaller one is spelled too long.\nconst MIN_CODE_POINT_FOR_LENGTH = [0, 0, 0x80, 0x800, 0x10000];\n\n// Bytes that aren't UTF-8 become \"�\", as browsers read them.\nfunction utf8Text(bytes: number[]): string {\n let text = '';\n let index = 0;\n while (index < bytes.length) {\n const first = bytes[index]!;\n const length = sequenceLength(first);\n const continuation = bytes.slice(index + 1, index + length);\n if (length === 0 || !isCompleteContinuation(continuation, length)) {\n text += '�';\n index += 1;\n continue;\n }\n let codePoint = firstByteBits(first, length);\n for (const byte of continuation) {\n codePoint = (codePoint << 6) | (byte & 0x3f);\n }\n // Four bytes can spell a number past the last character, as f7 bf bf bf does. UTF-8 also\n // refuses characters spelled with more bytes than they need, and the halves of UTF-16 pairs.\n const isPastLastCharacter = codePoint > MAX_CODE_POINT;\n const isSpelledTooLong = codePoint < MIN_CODE_POINT_FOR_LENGTH[length]!;\n const isSurrogate = codePoint >= 0xd800 && codePoint <= 0xdfff;\n if (isPastLastCharacter || isSpelledTooLong || isSurrogate) {\n text += '�';\n index += 1;\n continue;\n }\n text += String.fromCodePoint(codePoint);\n index += length;\n }\n return text;\n}\n\n// How many bytes a UTF-8 character takes, from its first byte. 0 for a byte that can't start one.\nfunction sequenceLength(first: number): number {\n if (first < 0x80) {\n return 1;\n }\n if (first >= 0xf0) {\n return 4;\n }\n if (first >= 0xe0) {\n return 3;\n }\n if (first >= 0xc0) {\n return 2;\n }\n return 0;\n}\n\n// Whether the bytes after a first byte are all there, and each is a continuation byte: 10xxxxxx.\nfunction isCompleteContinuation(continuation: number[], length: number): boolean {\n if (continuation.length !== length - 1) {\n return false;\n }\n return continuation.every((byte) => (byte & 0xc0) === 0x80);\n}\n\n// The bits of the code point that a first byte holds, after its length marker of 1s and a 0.\nfunction firstByteBits(first: number, length: number): number {\n if (length === 1) {\n return first;\n }\n return first & (0xff >> (length + 1));\n}\n","// Helpers that run in the dot itself, so they need no Dash and answer at once, without `await`.\n\n/**\n * Text to base64 and back, as UTF-8: `dash.utils.base64.encode(\"Salone\")` is `\"U2Fsb25l\"`.\n * `decode` throws for text that isn't base64.\n * @since 1.0\n */\nexport { base64 } from './encoding';\n\n/**\n * Text to hex and back, as UTF-8: `dash.utils.hex.encode(\"Salone\")` is `\"53616c6f6e65\"`.\n * `decode` throws for text that isn't hex.\n * @since 1.0\n */\nexport { hex } from './encoding';\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 startCall = member as (...args: unknown[]) => unknown;\n copy[name] = (...args: unknown[]) => {\n const result = startCall(...args);\n // Only calls return a request to track. dash.supports answers at once.\n if (result instanceof Promise) {\n track(result as DashRequest<unknown>);\n }\n return result;\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\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 (isDashError(error, 'cancelled')) {\n return undefined;\n }\n throw error;\n }\n}\n","import type { DashRequest } from './call';\nimport { isDashError } 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// when a newer call cut the wait short. Pass it the page's `this.dash`.\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 (isDashError(error, 'cancelled')) {\n return false;\n }\n throw error;\n }\n };\n}\n","import * as account from './account';\nimport { supports } from './api-versions';\nimport * as contacts from './contacts';\nimport * as crypto from './crypto';\nimport * as dot from './dot';\nimport * as media from './media';\nimport * as network from './network';\nimport * as payments from './payments';\nimport * as reminders from './reminders';\nimport * as storage from './storage';\nimport * as system from './system';\nimport * as ui from './ui';\nimport * as utils from './utils';\n\n// Dash's features for a dot's logic, in groups: `dash.ui.alert(...)`, `dash.system.torch(...)`,\n// `dash.network.http.request(...)`. `dash.supports(...)` says whether this Dash has a newer one.\n// `dash.utils` holds helpers that run in the dot and answer at once, such as `dash.utils.base64`.\nexport const dash = {\n ui,\n system,\n network,\n storage,\n media,\n contacts,\n dot,\n account,\n payments,\n reminders,\n crypto,\n utils,\n supports,\n};\n\nexport type Dash = typeof dash;\n\nexport { tracked } from './tracked';\nexport {\n DASH_API_SINCE,\n DASH_API_VERSION,\n useHostDashApiVersions,\n warnAboveDashApiVersion,\n} from './api-versions';\nexport type { DashFeature } from './api-versions';\n\n// The error a Dash call fails with. Inside the libraries it's core's HostError.\nexport { HostError as DashError } from '@monimesl/dot-core';\nexport type { HostErrorCode as DashErrorCode } from '@monimesl/dot-core';\nexport { errorMessage, isDashError, unlessCancelled } from './errors';\nexport { debounce, latest } from './latest';\nexport type {\n OidcProfile,\n OidcScope,\n OidcSignIn,\n OidcSignInOptions,\n SignInMode,\n SimpleSignIn,\n SimpleSignInOptions,\n} from './account';\nexport type {\n CardMethod,\n CardPaymentResult,\n LinkMethod,\n LinkPaymentResult,\n LinkProvider,\n MomoMethod,\n MomoPaymentResult,\n MomoProvider,\n Money,\n Order,\n OrderLineItem,\n PaymentCallOptions,\n PaymentMethod,\n PaymentOptions,\n PaymentResult,\n PaymentsMethods,\n PaymentStatus,\n} from './payments';\nexport type { CryptoInput, CryptoOutputOptions, HmacAlgorithm, HmacOptions } from './crypto';\nexport type { CallOptions, DashRequest } from './call';\nexport type { DashMethod, DashMethods } from './methods';\nexport type {\n CacheSetOptions,\n CacheValue,\n FileEncoding,\n FileEntry,\n ReadOptions,\n ReplaceOptions,\n StorageMethods,\n StorageUsage,\n WriteOptions,\n} from './storage';\nexport type { DotFile } from './files';\nexport type {\n CodeFormat,\n MediaMethods,\n PhotoSource,\n PickFileOptions,\n PickPhotoOptions,\n ScannedCode,\n} from './media';\nexport type { ContactsMethods, PickedContact } from './contacts';\nexport type {\n Reminder,\n ReminderEnd,\n ReminderRepeat,\n ReminderSchedule,\n RemindersMethods,\n Weekday,\n} from './reminders';\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 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":";;;AAGA,MAAa,mBAAmB;AAKhC,MAAa,iBAAiB;CAC5B,kBAAkB;CAClB,sBAAsB;CACtB,eAAe;CACf,sBAAsB;CACtB,qBAAqB;CACrB,iBAAiB;CACjB,iBAAiB;CACjB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,kBAAkB;CAClB,yBAAyB;CACzB,wBAAwB;CACxB,uBAAuB;CACvB,kBAAkB;CAClB,gBAAgB;CAChB,oBAAoB;CACpB,oBAAoB;CACpB,kBAAkB;CAClB,iBAAiB;CACjB,uBAAuB;CACvB,wBAAwB;CACxB,qBAAqB;CACrB,sBAAsB;CACtB,wBAAwB;CACxB,qBAAqB;CACrB,qBAAqB;CACrB,6BAA6B;CAC7B,qBAAqB;CACrB,qBAAqB;CACrB,qBAAqB;CACrB,qBAAqB;CACrB,uBAAuB;CACvB,qBAAqB;CACrB,qBAAqB;CACrB,sBAAsB;CACtB,sBAAsB;CACtB,wBAAwB;CACxB,sBAAsB;CACtB,yBAAyB;CACzB,sBAAsB;CACtB,qB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IAAY;CAEhE,OAAO;AACT;AAGA,SAAgB,aAAa,OAAwB;CACnD,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAEf,IAAI,OAAO,UAAU,YAAY,OAC/B,OAAO;CAET,OAAO;AACT;AAIA,eAAsB,gBACpB,MAC6B;CAC7B,IAAI;EACF,OAAO,MAAM;CACf,SAAS,OAAO;EACd,IAAI,YAAY,OAAO,WAAW,GAChC;EAEF,MAAM;CACR;AACF;;;ACjCA,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,YAAY,OAAO,WAAW,GAChC,OAAO;GAET,MAAM;EACR;CACF;AACF;;;ACbA,MAAa,OAAO;CAClB,IAAA;CACA,QAAA;CACA,SAAA;CACA,SAAA;CACA,OAAA;CACA,UAAA;CACA,KAAA;CACA,SAAA;CACA,UAAA;CACA,WAAA;CACA,QAAA;CACA,OAAA;CACA;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-dash",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "The dash calls a dot makes to Dash, such as alerts, storage, the network and payments",
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": "1.0.0-beta.4"
27
+ "@monimesl/dot-core": "1.0.0-beta.6"
28
28
  },
29
29
  "devDependencies": {
30
30
  "publint": "^0.3.24",