@monimesl/dot-dash 0.1.0-alpha.9 → 1.0.0-beta.1
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 +720 -92
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +652 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,390 @@
|
|
|
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
|
|
110
|
+
//#region src/files.d.ts
|
|
111
|
+
interface DotFile {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
size: number;
|
|
115
|
+
contentType: string;
|
|
116
|
+
url: string;
|
|
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;
|
|
183
|
+
declare namespace http_d_exports {
|
|
184
|
+
export { HttpDownloadRequest, HttpDownloadResponse, HttpMethod, HttpMethods, HttpReadOptions, HttpRequest, HttpRequestBody, HttpResponse, HttpUploadFile, HttpUploadRequest, download, request$1 as request, upload };
|
|
185
|
+
}
|
|
186
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
187
|
+
type HttpRequestBody = string | object;
|
|
188
|
+
interface HttpRequest<Body extends HttpRequestBody = HttpRequestBody> {
|
|
189
|
+
url: string;
|
|
190
|
+
method?: HttpMethod;
|
|
191
|
+
headers?: Record<string, string>;
|
|
192
|
+
body?: Body;
|
|
193
|
+
}
|
|
194
|
+
interface HttpResponse<Body = string> {
|
|
195
|
+
ok: boolean;
|
|
196
|
+
status: number;
|
|
197
|
+
statusText: string;
|
|
198
|
+
headers: Record<string, string>;
|
|
199
|
+
body: Body;
|
|
200
|
+
}
|
|
201
|
+
type HttpReadOptions<Body> = [Body] extends [string] ? {
|
|
202
|
+
as?: 'text';
|
|
203
|
+
} : {
|
|
204
|
+
as: 'json';
|
|
205
|
+
};
|
|
206
|
+
interface HttpDownloadRequest extends HttpRequest {
|
|
207
|
+
name?: string;
|
|
208
|
+
}
|
|
209
|
+
type HttpDownloadResponse = (Omit<HttpResponse, 'ok' | 'body'> & {
|
|
210
|
+
ok: true;
|
|
211
|
+
file: DotFile;
|
|
212
|
+
}) | (Omit<HttpResponse, 'ok'> & {
|
|
213
|
+
ok: false;
|
|
214
|
+
});
|
|
215
|
+
interface HttpUploadFile {
|
|
216
|
+
field: string;
|
|
217
|
+
file: DotFile;
|
|
218
|
+
name?: string;
|
|
219
|
+
}
|
|
220
|
+
interface HttpUploadRequest {
|
|
221
|
+
url: string;
|
|
222
|
+
method?: 'POST' | 'PUT' | 'PATCH';
|
|
223
|
+
headers?: Record<string, string>;
|
|
224
|
+
fields?: Record<string, string>;
|
|
225
|
+
files: HttpUploadFile[];
|
|
226
|
+
}
|
|
227
|
+
type WireRequest<Request extends HttpRequest> = Omit<Request, 'headers' | 'body'> & {
|
|
228
|
+
headers?: Record<string, string> | undefined;
|
|
229
|
+
body?: string | undefined;
|
|
230
|
+
};
|
|
231
|
+
interface HttpMethods {
|
|
232
|
+
'dash.network.http.request': {
|
|
233
|
+
params: WireRequest<HttpRequest>;
|
|
234
|
+
result: HttpResponse;
|
|
235
|
+
};
|
|
236
|
+
'dash.network.http.download': {
|
|
237
|
+
params: WireRequest<HttpDownloadRequest>;
|
|
238
|
+
result: HttpDownloadResponse;
|
|
239
|
+
};
|
|
240
|
+
'dash.network.http.upload': {
|
|
241
|
+
params: Omit<HttpUploadRequest, 'files'> & {
|
|
242
|
+
files: {
|
|
243
|
+
field: string;
|
|
244
|
+
file: string;
|
|
245
|
+
name?: string;
|
|
246
|
+
}[];
|
|
247
|
+
};
|
|
248
|
+
result: HttpResponse;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
265
|
+
declare function upload<ResponseBody = string>(options: HttpUploadRequest & HttpReadOptions<ResponseBody>, callOptions?: CallOptions): DashRequest<HttpResponse<ResponseBody>>;
|
|
266
|
+
//#endregion
|
|
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;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Whether the phone is online now, and how. It can still be online without reaching a server.
|
|
281
|
+
* @since 1.0
|
|
282
|
+
*/
|
|
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;
|
|
288
|
+
//#endregion
|
|
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': {
|
|
358
|
+
params: {
|
|
359
|
+
reference: string;
|
|
360
|
+
};
|
|
361
|
+
result: PaymentResult | null;
|
|
362
|
+
};
|
|
363
|
+
}
|
|
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 };
|
|
387
|
+
}
|
|
2
388
|
declare namespace cache_d_exports {
|
|
3
389
|
export { CacheMethods, CacheSetOptions, CacheValue, clear$1 as clear, exists, get$1 as get, keys, remove$2 as remove, set$1 as set };
|
|
4
390
|
}
|
|
@@ -44,21 +430,24 @@ interface CacheMethods {
|
|
|
44
430
|
interface CacheSetOptions {
|
|
45
431
|
ttl?: number | undefined;
|
|
46
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Resolves with null for a missing or expired key.
|
|
435
|
+
* @since 1.0
|
|
436
|
+
*/
|
|
47
437
|
declare function get$1<Value extends CacheValue = CacheValue>(key: string, callOptions?: CallOptions): DashRequest<Value | null>;
|
|
438
|
+
/** @since 1.0 */
|
|
48
439
|
declare function set$1(key: string, value: CacheValue, options?: CacheSetOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
440
|
+
/** @since 1.0 */
|
|
49
441
|
declare function remove$2(key: string, callOptions?: CallOptions): DashRequest<void>;
|
|
442
|
+
/** @since 1.0 */
|
|
50
443
|
declare function exists(key: string, callOptions?: CallOptions): DashRequest<boolean>;
|
|
444
|
+
/**
|
|
445
|
+
* The keys, sorted.
|
|
446
|
+
* @since 1.0
|
|
447
|
+
*/
|
|
51
448
|
declare function keys(callOptions?: CallOptions): DashRequest<string[]>;
|
|
449
|
+
/** @since 1.0 */
|
|
52
450
|
declare function clear$1(callOptions?: CallOptions): DashRequest<void>;
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/files.d.ts
|
|
55
|
-
interface DotFile {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
size: number;
|
|
59
|
-
contentType: string;
|
|
60
|
-
url: string;
|
|
61
|
-
}
|
|
62
451
|
declare namespace file_d_exports {
|
|
63
452
|
export { FileEncoding, FileEntry, FileMethods, ReadOptions, ReplaceOptions, StorageUsage, WriteOptions, copy, createFolder, list, move, open, read, remove$1 as remove, save, stat, usage, write };
|
|
64
453
|
}
|
|
@@ -163,20 +552,49 @@ interface WriteOptions {
|
|
|
163
552
|
interface ReplaceOptions {
|
|
164
553
|
overwrite?: boolean;
|
|
165
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Reads a file of up to 5 MB.
|
|
557
|
+
* @since 1.0
|
|
558
|
+
*/
|
|
166
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
|
+
*/
|
|
167
564
|
declare function write(path: string, data: string, options?: WriteOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
565
|
+
/** @since 1.0 */
|
|
168
566
|
declare function stat(path: string, callOptions?: CallOptions): DashRequest<FileEntry | null>;
|
|
567
|
+
/**
|
|
568
|
+
* Sorted by path.
|
|
569
|
+
* @since 1.0
|
|
570
|
+
*/
|
|
169
571
|
declare function list(path?: string, options?: {
|
|
170
572
|
recursive?: boolean;
|
|
171
573
|
}, callOptions?: CallOptions): DashRequest<FileEntry[]>;
|
|
574
|
+
/** @since 1.0 */
|
|
172
575
|
declare function createFolder(path: string, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
576
|
+
/** @since 1.0 */
|
|
173
577
|
declare function move(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
578
|
+
/** @since 1.0 */
|
|
174
579
|
declare function copy(from: string, to: string, options?: ReplaceOptions, callOptions?: CallOptions): DashRequest<FileEntry>;
|
|
580
|
+
/**
|
|
581
|
+
* Removing a folder that isn't empty needs `recursive`.
|
|
582
|
+
* @since 1.0
|
|
583
|
+
*/
|
|
175
584
|
declare function remove$1(path: string, options?: {
|
|
176
585
|
recursive?: boolean;
|
|
177
586
|
}, callOptions?: CallOptions): DashRequest<void>;
|
|
178
|
-
|
|
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
|
+
*/
|
|
179
596
|
declare function open(path: string, callOptions?: CallOptions): DashRequest<DotFile>;
|
|
597
|
+
/** @since 1.0 */
|
|
180
598
|
declare function usage(callOptions?: CallOptions): DashRequest<StorageUsage>;
|
|
181
599
|
declare namespace secret_d_exports {
|
|
182
600
|
export { SecretMethods, clear, get, remove, set };
|
|
@@ -206,11 +624,15 @@ interface SecretMethods {
|
|
|
206
624
|
result: void;
|
|
207
625
|
};
|
|
208
626
|
}
|
|
627
|
+
/** @since 1.0 */
|
|
209
628
|
declare function get(key: string, callOptions?: CallOptions): DashRequest<string | null>;
|
|
629
|
+
/** @since 1.0 */
|
|
210
630
|
declare function set(key: string, value: string, callOptions?: CallOptions): DashRequest<void>;
|
|
631
|
+
/** @since 1.0 */
|
|
211
632
|
declare function remove(key: string, callOptions?: CallOptions): DashRequest<void>;
|
|
633
|
+
/** @since 1.0 */
|
|
212
634
|
declare function clear(callOptions?: CallOptions): DashRequest<void>;
|
|
213
|
-
declare namespace index_d_exports$
|
|
635
|
+
declare namespace index_d_exports$4 {
|
|
214
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 };
|
|
215
637
|
}
|
|
216
638
|
type StorageMethods = FileMethods & CacheMethods & SecretMethods;
|
|
@@ -224,6 +646,7 @@ interface ClipboardMethods {
|
|
|
224
646
|
result: void;
|
|
225
647
|
};
|
|
226
648
|
}
|
|
649
|
+
/** @since 1.0 */
|
|
227
650
|
declare function copyText(text: string, callOptions?: CallOptions): DashRequest<void>;
|
|
228
651
|
//#endregion
|
|
229
652
|
//#region src/system/delay.d.ts
|
|
@@ -235,8 +658,30 @@ interface DelayMethods {
|
|
|
235
658
|
result: void;
|
|
236
659
|
};
|
|
237
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.
|
|
663
|
+
* @since 1.0
|
|
664
|
+
*/
|
|
238
665
|
declare function delay(milliseconds: number, callOptions?: CallOptions): DashRequest<void>;
|
|
239
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
|
|
240
685
|
//#region src/system/haptics.d.ts
|
|
241
686
|
type VibrationStyle = 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';
|
|
242
687
|
interface VibrateOptions {
|
|
@@ -248,8 +693,35 @@ interface HapticsMethods {
|
|
|
248
693
|
result: void;
|
|
249
694
|
};
|
|
250
695
|
}
|
|
696
|
+
/**
|
|
697
|
+
* Plays a short vibration. Resolves once it's done.
|
|
698
|
+
* @since 1.0
|
|
699
|
+
*/
|
|
251
700
|
declare function vibrate(options?: VibrateOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
252
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
|
|
253
725
|
//#region src/system/open-url.d.ts
|
|
254
726
|
interface OpenUrlMethods {
|
|
255
727
|
'dash.system.openUrl': {
|
|
@@ -259,14 +731,47 @@ interface OpenUrlMethods {
|
|
|
259
731
|
result: void;
|
|
260
732
|
};
|
|
261
733
|
}
|
|
734
|
+
/**
|
|
735
|
+
* Opens an https address in the device's browser. Any other address rejects with `invalid`.
|
|
736
|
+
* @since 1.0
|
|
737
|
+
*/
|
|
262
738
|
declare function openUrl(url: string, callOptions?: CallOptions): DashRequest<void>;
|
|
263
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
|
|
264
769
|
//#region src/system/share.d.ts
|
|
265
770
|
interface ShareOptions {
|
|
266
771
|
title?: string;
|
|
267
772
|
text?: string;
|
|
268
773
|
url?: string;
|
|
269
|
-
file?: DotFile
|
|
774
|
+
file?: DotFile;
|
|
270
775
|
}
|
|
271
776
|
interface ShareMethods {
|
|
272
777
|
'dash.system.share': {
|
|
@@ -279,23 +784,30 @@ interface ShareMethods {
|
|
|
279
784
|
result: void;
|
|
280
785
|
};
|
|
281
786
|
}
|
|
787
|
+
/**
|
|
788
|
+
* Opens the device's share sheet. Resolves once it shows.
|
|
789
|
+
* @since 1.0
|
|
790
|
+
*/
|
|
282
791
|
declare function share(options: ShareOptions, callOptions?: CallOptions): DashRequest<void>;
|
|
283
792
|
//#endregion
|
|
284
793
|
//#region src/system/torch.d.ts
|
|
285
|
-
type TorchState = 'on' | 'off';
|
|
286
794
|
interface TorchMethods {
|
|
287
795
|
'dash.system.torch': {
|
|
288
796
|
params: {
|
|
289
|
-
|
|
797
|
+
on: boolean;
|
|
290
798
|
};
|
|
291
799
|
result: void;
|
|
292
800
|
};
|
|
293
801
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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 };
|
|
297
809
|
}
|
|
298
|
-
type SystemMethods = ClipboardMethods & DelayMethods & HapticsMethods & OpenUrlMethods & ShareMethods & TorchMethods;
|
|
810
|
+
type SystemMethods = ClipboardMethods & DelayMethods & DialMethods & HapticsMethods & InfoMethods & OpenUrlMethods & ScreenMethods & ShareMethods & TorchMethods;
|
|
299
811
|
//#endregion
|
|
300
812
|
//#region src/ui/dialogs.d.ts
|
|
301
813
|
interface AlertAction {
|
|
@@ -317,106 +829,222 @@ interface DialogMethods {
|
|
|
317
829
|
result: AlertResult;
|
|
318
830
|
};
|
|
319
831
|
}
|
|
832
|
+
/**
|
|
833
|
+
* Shows a native alert. Resolves with the action the person chose.
|
|
834
|
+
* @since 1.0
|
|
835
|
+
*/
|
|
320
836
|
declare function alert(options: AlertOptions, callOptions?: CallOptions): DashRequest<AlertResult>;
|
|
321
|
-
|
|
322
|
-
|
|
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;
|
|
323
848
|
}
|
|
324
|
-
|
|
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;
|
|
325
875
|
//#endregion
|
|
326
876
|
//#region src/methods.d.ts
|
|
327
|
-
type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods;
|
|
877
|
+
type DashMethods = UIMethods & SystemMethods & NetworkMethods & StorageMethods & MediaMethods & ContactsMethods & DotMethods & AccountMethods & CryptoMethods & PaymentsMethods;
|
|
328
878
|
type DashMethod = keyof DashMethods;
|
|
329
879
|
//#endregion
|
|
330
880
|
//#region src/call.d.ts
|
|
331
881
|
type CallOptions = HostCallOptions;
|
|
332
882
|
type DashRequest<Result> = HostRequest<Result>;
|
|
333
|
-
declare namespace
|
|
334
|
-
export {
|
|
883
|
+
declare namespace index_d_exports$1 {
|
|
884
|
+
export { AccountMethods, OidcProfile, OidcScope, OidcSignIn, OidcSignInOptions, SignInMode, SimpleSignIn, SimpleSignInOptions, signIn };
|
|
335
885
|
}
|
|
336
|
-
type
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
method?: HttpMethod;
|
|
341
|
-
headers?: Record<string, string>;
|
|
342
|
-
body?: Body;
|
|
886
|
+
type SignInMode = 'simple' | 'oidc';
|
|
887
|
+
interface SimpleSignInOptions {
|
|
888
|
+
mode: 'simple';
|
|
889
|
+
nonce?: string | undefined;
|
|
343
890
|
}
|
|
344
|
-
interface
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
headers: Record<string, string>;
|
|
349
|
-
body: Body;
|
|
891
|
+
interface SimpleSignIn {
|
|
892
|
+
fullName: string;
|
|
893
|
+
alias: string;
|
|
894
|
+
accountIdToken: string;
|
|
350
895
|
}
|
|
351
|
-
type
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
interface HttpDownloadRequest extends HttpRequest {
|
|
357
|
-
name?: string;
|
|
896
|
+
type OidcScope = 'profile' | 'phone' | 'email';
|
|
897
|
+
interface OidcSignInOptions {
|
|
898
|
+
mode: 'oidc';
|
|
899
|
+
scopes?: OidcScope[] | undefined;
|
|
900
|
+
nonce?: string | undefined;
|
|
358
901
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
interface HttpUploadFile {
|
|
366
|
-
field: string;
|
|
367
|
-
file: DotFile | string;
|
|
368
|
-
name?: string;
|
|
902
|
+
interface OidcProfile {
|
|
903
|
+
name?: string | undefined;
|
|
904
|
+
givenName?: string | undefined;
|
|
905
|
+
familyName?: string | undefined;
|
|
906
|
+
phone?: string | undefined;
|
|
907
|
+
email?: string | undefined;
|
|
369
908
|
}
|
|
370
|
-
interface
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
files: HttpUploadFile[];
|
|
909
|
+
interface OidcSignIn {
|
|
910
|
+
id: string;
|
|
911
|
+
idToken: string;
|
|
912
|
+
expiresAt: string;
|
|
913
|
+
profile: OidcProfile;
|
|
376
914
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
params: WireRequest<HttpRequest>;
|
|
384
|
-
result: HttpResponse;
|
|
385
|
-
};
|
|
386
|
-
'dash.network.http.download': {
|
|
387
|
-
params: WireRequest<HttpDownloadRequest>;
|
|
388
|
-
result: HttpDownloadResponse;
|
|
389
|
-
};
|
|
390
|
-
'dash.network.http.upload': {
|
|
391
|
-
params: Omit<HttpUploadRequest, 'files'> & {
|
|
392
|
-
files: {
|
|
393
|
-
field: string;
|
|
394
|
-
file: string;
|
|
395
|
-
name?: string;
|
|
396
|
-
}[];
|
|
915
|
+
interface AccountMethods {
|
|
916
|
+
'dash.account.signIn': {
|
|
917
|
+
params: {
|
|
918
|
+
mode: SignInMode;
|
|
919
|
+
nonce: string;
|
|
920
|
+
scopes?: OidcScope[];
|
|
397
921
|
};
|
|
398
|
-
result:
|
|
922
|
+
result: SimpleSignIn | OidcSignIn;
|
|
399
923
|
};
|
|
400
924
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
+
};
|
|
404
1013
|
declare namespace index_d_exports {
|
|
405
|
-
export {
|
|
1014
|
+
export { base64, hex };
|
|
406
1015
|
}
|
|
407
|
-
type NetworkMethods = HttpMethods;
|
|
408
1016
|
//#endregion
|
|
409
1017
|
//#region src/tracked.d.ts
|
|
410
1018
|
export declare function tracked<Group extends object>(group: Group, track: (request: DashRequest<unknown>) => void): Group;
|
|
411
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
|
|
412
1032
|
//#region src/index.d.ts
|
|
413
1033
|
export declare const dash: {
|
|
414
|
-
ui: typeof index_d_exports$
|
|
415
|
-
system: typeof index_d_exports$
|
|
416
|
-
network: typeof index_d_exports;
|
|
417
|
-
storage: typeof index_d_exports$
|
|
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;
|
|
418
1046
|
};
|
|
419
1047
|
export type Dash = typeof dash;
|
|
420
1048
|
//#endregion
|
|
421
|
-
export { type AlertAction, type AlertOptions, type AlertResult, type CacheSetOptions, type CacheValue, type CallOptions, type DashMethod, type DashMethods, type DashRequest, type DotFile, type FileEncoding, type FileEntry,
|
|
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 };
|
|
422
1050
|
//# sourceMappingURL=index.d.ts.map
|