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