@monimesl/dot-dash 0.1.0-alpha.9 → 1.0.0-beta.0
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.js
CHANGED
|
@@ -1,45 +1,295 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { HostError, HostError as
|
|
2
|
+
import { DEFAULT_DASH_API_VERSION, HostError, HostError as DashError, callHost, createHostRequest, offersDashApiVersion } from "@monimesl/dot-core";
|
|
3
|
+
//#region src/api-versions.ts
|
|
4
|
+
const DASH_API_VERSION = "1.0";
|
|
5
|
+
const DASH_API_SINCE = {
|
|
6
|
+
"account.signIn": "1.0",
|
|
7
|
+
"contacts.pickPhone": "1.0",
|
|
8
|
+
"crypto.hmac": "1.0",
|
|
9
|
+
"crypto.randomBytes": "1.0",
|
|
10
|
+
"crypto.randomUUID": "1.0",
|
|
11
|
+
"crypto.sha256": "1.0",
|
|
12
|
+
"crypto.sha512": "1.0",
|
|
13
|
+
"dot.close": "1.0",
|
|
14
|
+
"media.pickFile": "1.0",
|
|
15
|
+
"media.pickPhoto": "1.0",
|
|
16
|
+
"media.scanCode": "1.0",
|
|
17
|
+
"network.http.download": "1.0",
|
|
18
|
+
"network.http.request": "1.0",
|
|
19
|
+
"network.http.upload": "1.0",
|
|
20
|
+
"network.status": "1.0",
|
|
21
|
+
"payments.get": "1.0",
|
|
22
|
+
"payments.request": "1.0",
|
|
23
|
+
"storage.cache.clear": "1.0",
|
|
24
|
+
"storage.cache.exists": "1.0",
|
|
25
|
+
"storage.cache.get": "1.0",
|
|
26
|
+
"storage.cache.keys": "1.0",
|
|
27
|
+
"storage.cache.remove": "1.0",
|
|
28
|
+
"storage.cache.set": "1.0",
|
|
29
|
+
"storage.file.copy": "1.0",
|
|
30
|
+
"storage.file.createFolder": "1.0",
|
|
31
|
+
"storage.file.list": "1.0",
|
|
32
|
+
"storage.file.move": "1.0",
|
|
33
|
+
"storage.file.open": "1.0",
|
|
34
|
+
"storage.file.read": "1.0",
|
|
35
|
+
"storage.file.remove": "1.0",
|
|
36
|
+
"storage.file.save": "1.0",
|
|
37
|
+
"storage.file.stat": "1.0",
|
|
38
|
+
"storage.file.usage": "1.0",
|
|
39
|
+
"storage.file.write": "1.0",
|
|
40
|
+
"storage.secret.clear": "1.0",
|
|
41
|
+
"storage.secret.get": "1.0",
|
|
42
|
+
"storage.secret.remove": "1.0",
|
|
43
|
+
"storage.secret.set": "1.0",
|
|
44
|
+
"system.brightness": "1.0",
|
|
45
|
+
"system.copyText": "1.0",
|
|
46
|
+
"system.delay": "1.0",
|
|
47
|
+
"system.dial": "1.0",
|
|
48
|
+
"system.info": "1.0",
|
|
49
|
+
"system.keepAwake": "1.0",
|
|
50
|
+
"system.openUrl": "1.0",
|
|
51
|
+
"system.share": "1.0",
|
|
52
|
+
"system.torch": "1.0",
|
|
53
|
+
"system.vibrate": "1.0",
|
|
54
|
+
"ui.alert": "1.0",
|
|
55
|
+
"ui.pickDate": "1.0",
|
|
56
|
+
"ui.pickTime": "1.0"
|
|
57
|
+
};
|
|
58
|
+
let hostApiVersions = [DEFAULT_DASH_API_VERSION];
|
|
59
|
+
let dotMinApiVersion;
|
|
60
|
+
const checkedFeatures = /* @__PURE__ */ new Set();
|
|
61
|
+
const warnedFeatures = /* @__PURE__ */ new Set();
|
|
62
|
+
function useHostDashApiVersions(versions) {
|
|
63
|
+
hostApiVersions = versions;
|
|
64
|
+
}
|
|
65
|
+
function warnAboveDashApiVersion(minApiVersion) {
|
|
66
|
+
dotMinApiVersion = minApiVersion;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
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.
|
|
71
|
+
* @since 1.0
|
|
72
|
+
*/
|
|
73
|
+
function supports(feature) {
|
|
74
|
+
checkedFeatures.add(feature);
|
|
75
|
+
const since = sinceOf(feature);
|
|
76
|
+
return since !== void 0 && offersDashApiVersion(hostApiVersions, since);
|
|
77
|
+
}
|
|
78
|
+
function warnIfNewerThanDot(method, params) {
|
|
79
|
+
if (dotMinApiVersion === void 0) return;
|
|
80
|
+
const callName = method.replace(/^dash\./, "");
|
|
81
|
+
for (const feature of [callName, ...fieldsSent(callName, params)]) {
|
|
82
|
+
const since = sinceOf(feature);
|
|
83
|
+
if (since === void 0) continue;
|
|
84
|
+
if (checkedFeatures.has(feature) || warnedFeatures.has(feature)) continue;
|
|
85
|
+
if (offersDashApiVersion([dotMinApiVersion], since)) continue;
|
|
86
|
+
warnedFeatures.add(feature);
|
|
87
|
+
console.warn(`dash.${feature} came in Dash API ${since}, but this dot's minApiVersion is ${dotMinApiVersion}, so older Dash doesn't have it. Raise "minApiVersion" in dot.json, or check dash.supports('${feature}') first.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function sinceOf(feature) {
|
|
91
|
+
const table = DASH_API_SINCE;
|
|
92
|
+
return Object.hasOwn(table, feature) ? table[feature] : void 0;
|
|
93
|
+
}
|
|
94
|
+
function fieldsSent(callName, params) {
|
|
95
|
+
if (typeof params !== "object" || params === null) return [];
|
|
96
|
+
return Object.keys(params).map((field) => `${callName}.${field}`).filter((feature) => sinceOf(feature) !== void 0);
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
3
99
|
//#region src/call.ts
|
|
4
100
|
function call(method, params, options = {}) {
|
|
101
|
+
warnIfNewerThanDot(method, params);
|
|
5
102
|
return callHost(method, params, options);
|
|
6
103
|
}
|
|
7
104
|
//#endregion
|
|
8
|
-
//#region src/
|
|
9
|
-
|
|
10
|
-
|
|
105
|
+
//#region src/account/index.ts
|
|
106
|
+
var account_exports = /* @__PURE__ */ __exportAll({ signIn: () => signIn });
|
|
107
|
+
function signIn(options, callOptions) {
|
|
108
|
+
const params = {
|
|
109
|
+
mode: options.mode,
|
|
110
|
+
nonce: options.nonce ?? ""
|
|
111
|
+
};
|
|
112
|
+
if (options.mode === "oidc" && options.scopes) params.scopes = options.scopes;
|
|
113
|
+
return call("dash.account.signIn", params, callOptions);
|
|
11
114
|
}
|
|
12
115
|
//#endregion
|
|
116
|
+
//#region src/contacts/pick-phone.ts
|
|
117
|
+
/**
|
|
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
|
+
* @since 1.0
|
|
122
|
+
*/
|
|
123
|
+
function pickPhone(callOptions) {
|
|
124
|
+
return call("dash.contacts.pickPhone", {}, callOptions);
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/contacts/index.ts
|
|
128
|
+
var contacts_exports = /* @__PURE__ */ __exportAll({ pickPhone: () => pickPhone });
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/crypto/index.ts
|
|
131
|
+
var crypto_exports = /* @__PURE__ */ __exportAll({
|
|
132
|
+
hmac: () => hmac,
|
|
133
|
+
randomBytes: () => randomBytes,
|
|
134
|
+
randomUUID: () => randomUUID,
|
|
135
|
+
sha256: () => sha256,
|
|
136
|
+
sha512: () => sha512
|
|
137
|
+
});
|
|
138
|
+
/** @since 1.0 */
|
|
139
|
+
function sha256(data, options = {}, callOptions) {
|
|
140
|
+
return call("dash.crypto.sha256", wireInput(data, options), callOptions);
|
|
141
|
+
}
|
|
142
|
+
/** @since 1.0 */
|
|
143
|
+
function sha512(data, options = {}, callOptions) {
|
|
144
|
+
return call("dash.crypto.sha512", wireInput(data, options), callOptions);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Signs `data` with `key`, as HMAC-SHA256 or HMAC-SHA512, such as
|
|
148
|
+
* `hmac({ algorithm: 'sha256', key, data })`.
|
|
149
|
+
* @since 1.0
|
|
150
|
+
*/
|
|
151
|
+
function hmac(options, callOptions) {
|
|
152
|
+
const wireKey = valueAndEncoding(options.key);
|
|
153
|
+
return call("dash.crypto.hmac", {
|
|
154
|
+
...wireInput(options.data, options),
|
|
155
|
+
algorithm: options.algorithm,
|
|
156
|
+
key: wireKey.value,
|
|
157
|
+
keyEncoding: wireKey.encoding
|
|
158
|
+
}, callOptions);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* `count` secure random bytes, from 1 to 1024, such as for a nonce.
|
|
162
|
+
* @since 1.0
|
|
163
|
+
*/
|
|
164
|
+
function randomBytes(count, options = {}, callOptions) {
|
|
165
|
+
return call("dash.crypto.randomBytes", {
|
|
166
|
+
count,
|
|
167
|
+
as: outputEncoding(options)
|
|
168
|
+
}, callOptions);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A random version 4 UUID, such as "3f0e5c3a-6d1b-4c8e-9a2f-1b7d4e6a9c05".
|
|
172
|
+
* @since 1.0
|
|
173
|
+
*/
|
|
174
|
+
function randomUUID(callOptions) {
|
|
175
|
+
return call("dash.crypto.randomUUID", {}, callOptions);
|
|
176
|
+
}
|
|
177
|
+
function wireInput(data, options) {
|
|
178
|
+
const { value, encoding } = valueAndEncoding(data);
|
|
179
|
+
return {
|
|
180
|
+
data: value,
|
|
181
|
+
dataEncoding: encoding,
|
|
182
|
+
as: outputEncoding(options)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function outputEncoding(options) {
|
|
186
|
+
return options.as ?? "hex";
|
|
187
|
+
}
|
|
188
|
+
function valueAndEncoding(input) {
|
|
189
|
+
if (typeof input === "string") return {
|
|
190
|
+
value: input,
|
|
191
|
+
encoding: "text"
|
|
192
|
+
};
|
|
193
|
+
return {
|
|
194
|
+
value: input.base64,
|
|
195
|
+
encoding: "base64"
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/dot/index.ts
|
|
200
|
+
var dot_exports = /* @__PURE__ */ __exportAll({ close: () => close });
|
|
201
|
+
/**
|
|
202
|
+
* Closes the dot, as going back from its first page does. Calls still running are cancelled.
|
|
203
|
+
* @since 1.0
|
|
204
|
+
*/
|
|
205
|
+
function close(callOptions) {
|
|
206
|
+
return call("dash.dot.close", {}, callOptions);
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/media/pick-file.ts
|
|
210
|
+
/**
|
|
211
|
+
* Lets the person choose a file from their phone, of at most 25 MB. Needs the `files` permission.
|
|
212
|
+
* 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.
|
|
214
|
+
* @since 1.0
|
|
215
|
+
*/
|
|
216
|
+
function pickFile(options = {}, callOptions) {
|
|
217
|
+
const params = {};
|
|
218
|
+
if (options.types) params.types = options.types;
|
|
219
|
+
return call("dash.media.pickFile", params, callOptions);
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/media/pick-photo.ts
|
|
223
|
+
/**
|
|
224
|
+
* Lets the person choose a photo or take one. Resolves with it as a JPEG of at most 2048 pixels on its
|
|
225
|
+
* longest side, without its location or other details. Rejects with `cancelled` if they close the
|
|
226
|
+
* picker, and with `unsupported` on a device without a camera. Save it with `dash.storage.file.save`
|
|
227
|
+
* to keep it after the dot closes.
|
|
228
|
+
* @since 1.0
|
|
229
|
+
*/
|
|
230
|
+
function pickPhoto(options, callOptions) {
|
|
231
|
+
return call("dash.media.pickPhoto", { source: options.source }, callOptions);
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/media/scan-code.ts
|
|
235
|
+
/**
|
|
236
|
+
* Opens Dash's scanner until it reads a QR code. Needs the `camera` permission. Rejects with
|
|
237
|
+
* `cancelled` if the person closes it, and with `unsupported` where Dash has no scanner.
|
|
238
|
+
* @since 1.0
|
|
239
|
+
*/
|
|
240
|
+
function scanCode(callOptions) {
|
|
241
|
+
return call("dash.media.scanCode", {}, callOptions);
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/media/index.ts
|
|
245
|
+
var media_exports = /* @__PURE__ */ __exportAll({
|
|
246
|
+
pickFile: () => pickFile,
|
|
247
|
+
pickPhoto: () => pickPhoto,
|
|
248
|
+
scanCode: () => scanCode
|
|
249
|
+
});
|
|
250
|
+
//#endregion
|
|
13
251
|
//#region src/network/http.ts
|
|
14
252
|
var http_exports = /* @__PURE__ */ __exportAll({
|
|
15
253
|
download: () => download,
|
|
16
|
-
request: () => request,
|
|
254
|
+
request: () => request$1,
|
|
17
255
|
upload: () => upload
|
|
18
256
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Like fetch, resolves with any response, even a 404. An object body is sent as JSON.
|
|
259
|
+
* @since 1.0
|
|
260
|
+
*/
|
|
261
|
+
function request$1(options, callOptions) {
|
|
262
|
+
const { as: readAs, ...request } = options;
|
|
263
|
+
return readBody(call("dash.network.http.request", wireRequest(request, readAs), callOptions), readAs);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Saves a 2xx response's body, up to 256 MB, to a temporary file.
|
|
267
|
+
* @since 1.0
|
|
268
|
+
*/
|
|
23
269
|
function download(options, callOptions) {
|
|
24
270
|
return call("dash.network.http.download", wireRequest(options), callOptions);
|
|
25
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Sends the dot's files as a multipart form.
|
|
274
|
+
* @since 1.0
|
|
275
|
+
*/
|
|
26
276
|
function upload(options, callOptions) {
|
|
27
|
-
const { as, ...request } = options;
|
|
28
|
-
const files = request.files.map((
|
|
29
|
-
...
|
|
30
|
-
file:
|
|
277
|
+
const { as: readAs, ...request } = options;
|
|
278
|
+
const files = request.files.map((upload) => ({
|
|
279
|
+
...upload,
|
|
280
|
+
file: upload.file.id
|
|
31
281
|
}));
|
|
32
282
|
const params = {
|
|
33
283
|
...request,
|
|
34
284
|
files
|
|
35
285
|
};
|
|
36
|
-
if (
|
|
37
|
-
return readBody(call("dash.network.http.upload", params, callOptions),
|
|
286
|
+
if (readAs === "json") params.headers = withDefaultHeader(request.headers, "Accept", "application/json");
|
|
287
|
+
return readBody(call("dash.network.http.upload", params, callOptions), readAs);
|
|
38
288
|
}
|
|
39
|
-
function wireRequest(request,
|
|
289
|
+
function wireRequest(request, readAs) {
|
|
40
290
|
let headers = request.headers;
|
|
41
291
|
let body;
|
|
42
|
-
if (
|
|
292
|
+
if (readAs === "json") headers = withDefaultHeader(headers, "Accept", "application/json");
|
|
43
293
|
if (typeof request.body === "string") body = request.body;
|
|
44
294
|
else if (request.body !== void 0) {
|
|
45
295
|
headers = withDefaultHeader(headers, "Content-Type", "application/json");
|
|
@@ -52,15 +302,16 @@ function wireRequest(request, as) {
|
|
|
52
302
|
};
|
|
53
303
|
}
|
|
54
304
|
function withDefaultHeader(headers, name, value) {
|
|
305
|
+
if (headers === void 0) return { [name]: value };
|
|
55
306
|
const lowerName = name.toLowerCase();
|
|
56
|
-
if (
|
|
307
|
+
if (Object.keys(headers).some((existing) => existing.toLowerCase() === lowerName)) return headers;
|
|
57
308
|
return {
|
|
58
309
|
...headers,
|
|
59
310
|
[name]: value
|
|
60
311
|
};
|
|
61
312
|
}
|
|
62
|
-
function readBody(response,
|
|
63
|
-
if (
|
|
313
|
+
function readBody(response, readAs) {
|
|
314
|
+
if (readAs !== "json") return response;
|
|
64
315
|
const parsed = response.then((result) => ({
|
|
65
316
|
...result,
|
|
66
317
|
body: parseJson(result)
|
|
@@ -72,12 +323,61 @@ function parseJson({ status, statusText, body }) {
|
|
|
72
323
|
return JSON.parse(body);
|
|
73
324
|
} catch (error) {
|
|
74
325
|
const message = error instanceof Error ? error.message : String(error);
|
|
75
|
-
throw new HostError
|
|
326
|
+
throw new HostError("failed", `The response (${status} ${statusText}) isn't JSON: ${message}`);
|
|
76
327
|
}
|
|
77
328
|
}
|
|
78
329
|
//#endregion
|
|
330
|
+
//#region src/network/status.ts
|
|
331
|
+
/**
|
|
332
|
+
* Whether the phone is online now, and how. It can still be online without reaching a server.
|
|
333
|
+
* @since 1.0
|
|
334
|
+
*/
|
|
335
|
+
function status(callOptions) {
|
|
336
|
+
return call("dash.network.status", {}, callOptions);
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
79
339
|
//#region src/network/index.ts
|
|
80
|
-
var network_exports = /* @__PURE__ */ __exportAll({
|
|
340
|
+
var network_exports = /* @__PURE__ */ __exportAll({
|
|
341
|
+
http: () => http_exports,
|
|
342
|
+
status: () => status
|
|
343
|
+
});
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/payments/payments.ts
|
|
346
|
+
/**
|
|
347
|
+
* Opens Dash's payment sheet for `order`, where the person picks one of `methods` and pays the
|
|
348
|
+
* Space that owns the dot. Needs `payments` in dot.json's permissions. Monime checks the request
|
|
349
|
+
* before the sheet opens: an order it won't take, such as one below its smallest amount, rejects
|
|
350
|
+
* with `invalid`, a dot or Space it won't take payments for rejects with `denied`, and `failed`
|
|
351
|
+
* means Dash couldn't reach Monime. If a method fails, the sheet stays open for the person to try
|
|
352
|
+
* again or pick another. Once they pick a method, it resolves with how the payment ended:
|
|
353
|
+
* `completed`, `pending` while it's still on its way, `expired`, or `cancelled` if the person
|
|
354
|
+
* closed the sheet. Before that, it rejects with `cancelled` if the person closes the sheet, or
|
|
355
|
+
* `timeout` if Dash's time runs out. A payment already under way carries on after `cancel()`: read
|
|
356
|
+
* it later with `get`.
|
|
357
|
+
* @since 1.0
|
|
358
|
+
*/
|
|
359
|
+
function request(options, callOptions) {
|
|
360
|
+
const withoutTimeout = { ...callOptions };
|
|
361
|
+
delete withoutTimeout.timeout;
|
|
362
|
+
return call("dash.payments.request", options, withoutTimeout);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The payment for the order with this reference, such as to check a pending one later, or after
|
|
366
|
+
* the dot opens again. Undefined if this dot never asked for it, or the person never picked a
|
|
367
|
+
* method. Needs `payments` in dot.json's permissions.
|
|
368
|
+
* @since 1.0
|
|
369
|
+
*/
|
|
370
|
+
function get$2(reference, callOptions) {
|
|
371
|
+
const response = call("dash.payments.get", { reference }, callOptions);
|
|
372
|
+
const found = response.then((result) => result ?? void 0);
|
|
373
|
+
return createHostRequest(found, () => response.cancel());
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/payments/index.ts
|
|
377
|
+
var payments_exports = /* @__PURE__ */ __exportAll({
|
|
378
|
+
get: () => get$2,
|
|
379
|
+
request: () => request
|
|
380
|
+
});
|
|
81
381
|
//#endregion
|
|
82
382
|
//#region src/storage/cache.ts
|
|
83
383
|
var cache_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -88,9 +388,14 @@ var cache_exports = /* @__PURE__ */ __exportAll({
|
|
|
88
388
|
remove: () => remove$2,
|
|
89
389
|
set: () => set$1
|
|
90
390
|
});
|
|
391
|
+
/**
|
|
392
|
+
* Resolves with null for a missing or expired key.
|
|
393
|
+
* @since 1.0
|
|
394
|
+
*/
|
|
91
395
|
function get$1(key, callOptions) {
|
|
92
396
|
return call("dash.storage.cache.get", { key }, callOptions);
|
|
93
397
|
}
|
|
398
|
+
/** @since 1.0 */
|
|
94
399
|
function set$1(key, value, options = {}, callOptions) {
|
|
95
400
|
return call("dash.storage.cache.set", {
|
|
96
401
|
key,
|
|
@@ -98,15 +403,22 @@ function set$1(key, value, options = {}, callOptions) {
|
|
|
98
403
|
...options
|
|
99
404
|
}, callOptions);
|
|
100
405
|
}
|
|
406
|
+
/** @since 1.0 */
|
|
101
407
|
function remove$2(key, callOptions) {
|
|
102
408
|
return call("dash.storage.cache.remove", { key }, callOptions);
|
|
103
409
|
}
|
|
410
|
+
/** @since 1.0 */
|
|
104
411
|
function exists(key, callOptions) {
|
|
105
412
|
return call("dash.storage.cache.exists", { key }, callOptions);
|
|
106
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* The keys, sorted.
|
|
416
|
+
* @since 1.0
|
|
417
|
+
*/
|
|
107
418
|
function keys(callOptions) {
|
|
108
419
|
return call("dash.storage.cache.keys", {}, callOptions);
|
|
109
420
|
}
|
|
421
|
+
/** @since 1.0 */
|
|
110
422
|
function clear$1(callOptions) {
|
|
111
423
|
return call("dash.storage.cache.clear", {}, callOptions);
|
|
112
424
|
}
|
|
@@ -125,12 +437,20 @@ var file_exports = /* @__PURE__ */ __exportAll({
|
|
|
125
437
|
usage: () => usage,
|
|
126
438
|
write: () => write
|
|
127
439
|
});
|
|
440
|
+
/**
|
|
441
|
+
* Reads a file of up to 5 MB.
|
|
442
|
+
* @since 1.0
|
|
443
|
+
*/
|
|
128
444
|
function read(path, options = {}, callOptions) {
|
|
129
445
|
return call("dash.storage.file.read", {
|
|
130
446
|
path,
|
|
131
447
|
...options
|
|
132
448
|
}, callOptions);
|
|
133
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Creates any missing folders above the file.
|
|
452
|
+
* @since 1.0
|
|
453
|
+
*/
|
|
134
454
|
function write(path, data, options = {}, callOptions) {
|
|
135
455
|
return call("dash.storage.file.write", {
|
|
136
456
|
path,
|
|
@@ -138,18 +458,25 @@ function write(path, data, options = {}, callOptions) {
|
|
|
138
458
|
...options
|
|
139
459
|
}, callOptions);
|
|
140
460
|
}
|
|
461
|
+
/** @since 1.0 */
|
|
141
462
|
function stat(path, callOptions) {
|
|
142
463
|
return call("dash.storage.file.stat", { path }, callOptions);
|
|
143
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Sorted by path.
|
|
467
|
+
* @since 1.0
|
|
468
|
+
*/
|
|
144
469
|
function list(path = "", options = {}, callOptions) {
|
|
145
470
|
return call("dash.storage.file.list", {
|
|
146
471
|
path,
|
|
147
472
|
...options
|
|
148
473
|
}, callOptions);
|
|
149
474
|
}
|
|
475
|
+
/** @since 1.0 */
|
|
150
476
|
function createFolder(path, callOptions) {
|
|
151
477
|
return call("dash.storage.file.createFolder", { path }, callOptions);
|
|
152
478
|
}
|
|
479
|
+
/** @since 1.0 */
|
|
153
480
|
function move(from, to, options = {}, callOptions) {
|
|
154
481
|
return call("dash.storage.file.move", {
|
|
155
482
|
from,
|
|
@@ -157,6 +484,7 @@ function move(from, to, options = {}, callOptions) {
|
|
|
157
484
|
...options
|
|
158
485
|
}, callOptions);
|
|
159
486
|
}
|
|
487
|
+
/** @since 1.0 */
|
|
160
488
|
function copy(from, to, options = {}, callOptions) {
|
|
161
489
|
return call("dash.storage.file.copy", {
|
|
162
490
|
from,
|
|
@@ -164,22 +492,35 @@ function copy(from, to, options = {}, callOptions) {
|
|
|
164
492
|
...options
|
|
165
493
|
}, callOptions);
|
|
166
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Removing a folder that isn't empty needs `recursive`.
|
|
497
|
+
* @since 1.0
|
|
498
|
+
*/
|
|
167
499
|
function remove$1(path, options = {}, callOptions) {
|
|
168
500
|
return call("dash.storage.file.remove", {
|
|
169
501
|
path,
|
|
170
502
|
...options
|
|
171
503
|
}, callOptions);
|
|
172
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Keeps a temporary file, such as a download, at `path`.
|
|
507
|
+
* @since 1.0
|
|
508
|
+
*/
|
|
173
509
|
function save(file, path, options = {}, callOptions) {
|
|
174
510
|
return call("dash.storage.file.save", {
|
|
175
|
-
file:
|
|
511
|
+
file: file.id,
|
|
176
512
|
path,
|
|
177
513
|
...options
|
|
178
514
|
}, callOptions);
|
|
179
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* A stored file as a DotFile, to show with its `url` or send with `http.upload`.
|
|
518
|
+
* @since 1.0
|
|
519
|
+
*/
|
|
180
520
|
function open(path, callOptions) {
|
|
181
521
|
return call("dash.storage.file.open", { path }, callOptions);
|
|
182
522
|
}
|
|
523
|
+
/** @since 1.0 */
|
|
183
524
|
function usage(callOptions) {
|
|
184
525
|
return call("dash.storage.file.usage", {}, callOptions);
|
|
185
526
|
}
|
|
@@ -191,18 +532,22 @@ var secret_exports = /* @__PURE__ */ __exportAll({
|
|
|
191
532
|
remove: () => remove,
|
|
192
533
|
set: () => set
|
|
193
534
|
});
|
|
535
|
+
/** @since 1.0 */
|
|
194
536
|
function get(key, callOptions) {
|
|
195
537
|
return call("dash.storage.secret.get", { key }, callOptions);
|
|
196
538
|
}
|
|
539
|
+
/** @since 1.0 */
|
|
197
540
|
function set(key, value, callOptions) {
|
|
198
541
|
return call("dash.storage.secret.set", {
|
|
199
542
|
key,
|
|
200
543
|
value
|
|
201
544
|
}, callOptions);
|
|
202
545
|
}
|
|
546
|
+
/** @since 1.0 */
|
|
203
547
|
function remove(key, callOptions) {
|
|
204
548
|
return call("dash.storage.secret.remove", { key }, callOptions);
|
|
205
549
|
}
|
|
550
|
+
/** @since 1.0 */
|
|
206
551
|
function clear(callOptions) {
|
|
207
552
|
return call("dash.storage.secret.clear", {}, callOptions);
|
|
208
553
|
}
|
|
@@ -215,44 +560,108 @@ var storage_exports = /* @__PURE__ */ __exportAll({
|
|
|
215
560
|
});
|
|
216
561
|
//#endregion
|
|
217
562
|
//#region src/system/clipboard.ts
|
|
563
|
+
/** @since 1.0 */
|
|
218
564
|
function copyText(text, callOptions) {
|
|
219
565
|
return call("dash.system.copyText", { text }, callOptions);
|
|
220
566
|
}
|
|
221
567
|
//#endregion
|
|
222
568
|
//#region src/system/delay.ts
|
|
569
|
+
/**
|
|
570
|
+
* Resolves after `milliseconds`. The host keeps the time, since a dot's logic has no timers.
|
|
571
|
+
* @since 1.0
|
|
572
|
+
*/
|
|
223
573
|
function delay(milliseconds, callOptions) {
|
|
224
574
|
return call("dash.system.delay", { milliseconds }, callOptions);
|
|
225
575
|
}
|
|
226
576
|
//#endregion
|
|
577
|
+
//#region src/system/dial.ts
|
|
578
|
+
/**
|
|
579
|
+
* Opens the phone's dialer with `number` ready, such as "+232 76 123456" or a USSD code such as
|
|
580
|
+
* "*715#". The person taps Call. Spaces and dashes are fine; anything else but digits, +, * and #
|
|
581
|
+
* rejects with `invalid`. For a code, Dash asks the person first, and rejects with `cancelled` if
|
|
582
|
+
* they say no. Codes that set up call forwarding, such as "**21*…#", reject with `denied`.
|
|
583
|
+
* @since 1.0
|
|
584
|
+
*/
|
|
585
|
+
function dial(number, callOptions) {
|
|
586
|
+
return call("dash.system.dial", { number }, callOptions);
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
227
589
|
//#region src/system/haptics.ts
|
|
590
|
+
/**
|
|
591
|
+
* Plays a short vibration. Resolves once it's done.
|
|
592
|
+
* @since 1.0
|
|
593
|
+
*/
|
|
228
594
|
function vibrate(options = {}, callOptions) {
|
|
229
595
|
return call("dash.system.vibrate", { style: options.style ?? "medium" }, callOptions);
|
|
230
596
|
}
|
|
231
597
|
//#endregion
|
|
598
|
+
//#region src/system/info.ts
|
|
599
|
+
/**
|
|
600
|
+
* The phone and the Dash the dot runs in. It has nothing that identifies the person or the phone.
|
|
601
|
+
* @since 1.0
|
|
602
|
+
*/
|
|
603
|
+
function info(callOptions) {
|
|
604
|
+
return call("dash.system.info", {}, callOptions);
|
|
605
|
+
}
|
|
606
|
+
//#endregion
|
|
232
607
|
//#region src/system/open-url.ts
|
|
608
|
+
/**
|
|
609
|
+
* Opens an https address in the device's browser. Any other address rejects with `invalid`.
|
|
610
|
+
* @since 1.0
|
|
611
|
+
*/
|
|
233
612
|
function openUrl(url, callOptions) {
|
|
234
613
|
return call("dash.system.openUrl", { url }, callOptions);
|
|
235
614
|
}
|
|
236
615
|
//#endregion
|
|
616
|
+
//#region src/system/screen.ts
|
|
617
|
+
/**
|
|
618
|
+
* Keeps the screen from dimming and locking while the dot shows, such as while a ticket's QR code is
|
|
619
|
+
* up. Dash undoes it when the dot closes.
|
|
620
|
+
* @since 1.0
|
|
621
|
+
*/
|
|
622
|
+
function keepAwake(on, callOptions) {
|
|
623
|
+
return call("dash.system.keepAwake", { on }, callOptions);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* `max` makes the screen as bright as it goes, so a scanner can read a QR code on it, and `normal`
|
|
627
|
+
* puts it back. Dash puts it back too when the dot closes or the person leaves the app.
|
|
628
|
+
* @since 1.0
|
|
629
|
+
*/
|
|
630
|
+
function brightness(level, callOptions) {
|
|
631
|
+
return call("dash.system.brightness", { level }, callOptions);
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
237
634
|
//#region src/system/share.ts
|
|
635
|
+
/**
|
|
636
|
+
* Opens the device's share sheet. Resolves once it shows.
|
|
637
|
+
* @since 1.0
|
|
638
|
+
*/
|
|
238
639
|
function share(options, callOptions) {
|
|
239
|
-
const { file, ...
|
|
240
|
-
if (file === void 0) return call("dash.system.share",
|
|
640
|
+
const { file, ...content } = options;
|
|
641
|
+
if (file === void 0) return call("dash.system.share", content, callOptions);
|
|
241
642
|
return call("dash.system.share", {
|
|
242
|
-
...
|
|
243
|
-
file:
|
|
643
|
+
...content,
|
|
644
|
+
file: file.id
|
|
244
645
|
}, callOptions);
|
|
245
646
|
}
|
|
246
647
|
//#endregion
|
|
247
648
|
//#region src/system/torch.ts
|
|
248
|
-
|
|
249
|
-
|
|
649
|
+
/**
|
|
650
|
+
* Turns the torch on or off. Rejects with `unsupported` on a device without one.
|
|
651
|
+
* @since 1.0
|
|
652
|
+
*/
|
|
653
|
+
function torch(on, callOptions) {
|
|
654
|
+
return call("dash.system.torch", { on }, callOptions);
|
|
250
655
|
}
|
|
251
656
|
//#endregion
|
|
252
657
|
//#region src/system/index.ts
|
|
253
658
|
var system_exports = /* @__PURE__ */ __exportAll({
|
|
659
|
+
brightness: () => brightness,
|
|
254
660
|
copyText: () => copyText,
|
|
255
661
|
delay: () => delay,
|
|
662
|
+
dial: () => dial,
|
|
663
|
+
info: () => info,
|
|
664
|
+
keepAwake: () => keepAwake,
|
|
256
665
|
openUrl: () => openUrl,
|
|
257
666
|
share: () => share,
|
|
258
667
|
torch: () => torch,
|
|
@@ -260,6 +669,10 @@ var system_exports = /* @__PURE__ */ __exportAll({
|
|
|
260
669
|
});
|
|
261
670
|
//#endregion
|
|
262
671
|
//#region src/ui/dialogs.ts
|
|
672
|
+
/**
|
|
673
|
+
* Shows a native alert. Resolves with the action the person chose.
|
|
674
|
+
* @since 1.0
|
|
675
|
+
*/
|
|
263
676
|
function alert(options, callOptions) {
|
|
264
677
|
const actions = options.actions ?? [{
|
|
265
678
|
id: "ok",
|
|
@@ -271,31 +684,234 @@ function alert(options, callOptions) {
|
|
|
271
684
|
}, callOptions);
|
|
272
685
|
}
|
|
273
686
|
//#endregion
|
|
687
|
+
//#region src/ui/pickers.ts
|
|
688
|
+
/**
|
|
689
|
+
* Opens the phone's own calendar. Resolves with the chosen date, such as "2026-10-24", or rejects
|
|
690
|
+
* with `cancelled` if the person closes it.
|
|
691
|
+
* @since 1.0
|
|
692
|
+
*/
|
|
693
|
+
function pickDate(options = {}, callOptions) {
|
|
694
|
+
return call("dash.ui.pickDate", options, callOptions);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Opens the phone's own clock. Resolves with the chosen time in 24 hours, such as "19:30", or
|
|
698
|
+
* rejects with `cancelled` if the person closes it.
|
|
699
|
+
* @since 1.0
|
|
700
|
+
*/
|
|
701
|
+
function pickTime(options = {}, callOptions) {
|
|
702
|
+
return call("dash.ui.pickTime", options, callOptions);
|
|
703
|
+
}
|
|
704
|
+
//#endregion
|
|
274
705
|
//#region src/ui/index.ts
|
|
275
|
-
var ui_exports = /* @__PURE__ */ __exportAll({
|
|
706
|
+
var ui_exports = /* @__PURE__ */ __exportAll({
|
|
707
|
+
alert: () => alert,
|
|
708
|
+
pickDate: () => pickDate,
|
|
709
|
+
pickTime: () => pickTime
|
|
710
|
+
});
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/utils/encoding.ts
|
|
713
|
+
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
714
|
+
const HEX_PATTERN = /^(?:[0-9a-fA-F]{2})*$/;
|
|
715
|
+
const base64 = {
|
|
716
|
+
encode(text) {
|
|
717
|
+
return bytesToBase64(utf8Bytes(text));
|
|
718
|
+
},
|
|
719
|
+
decode(encoded) {
|
|
720
|
+
return utf8Text(base64ToBytes(encoded));
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
const hex = {
|
|
724
|
+
encode(text) {
|
|
725
|
+
return utf8Bytes(text).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
726
|
+
},
|
|
727
|
+
decode(encoded) {
|
|
728
|
+
if (!HEX_PATTERN.test(encoded)) throw new Error(`"${encoded.slice(0, 20)}" isn't hex. Use pairs of 0-9 and a-f.`);
|
|
729
|
+
const bytes = [];
|
|
730
|
+
for (let index = 0; index < encoded.length; index += 2) bytes.push(parseInt(encoded.slice(index, index + 2), 16));
|
|
731
|
+
return utf8Text(bytes);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
function bytesToBase64(bytes) {
|
|
735
|
+
let encoded = "";
|
|
736
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
737
|
+
const group = bytes.slice(index, index + 3);
|
|
738
|
+
const bits = (group[0] ?? 0) << 16 | (group[1] ?? 0) << 8 | (group[2] ?? 0);
|
|
739
|
+
const sextets = [
|
|
740
|
+
bits >> 18 & 63,
|
|
741
|
+
bits >> 12 & 63,
|
|
742
|
+
bits >> 6 & 63,
|
|
743
|
+
bits & 63
|
|
744
|
+
];
|
|
745
|
+
const characterCount = group.length + 1;
|
|
746
|
+
for (const sextet of sextets.slice(0, characterCount)) encoded += BASE64_ALPHABET[sextet];
|
|
747
|
+
encoded += "=".repeat(4 - characterCount);
|
|
748
|
+
}
|
|
749
|
+
return encoded;
|
|
750
|
+
}
|
|
751
|
+
function base64ToBytes(encoded) {
|
|
752
|
+
if (!isBase64(encoded)) throw new Error(`"${encoded.slice(0, 20)}" isn't base64.`);
|
|
753
|
+
const bytes = [];
|
|
754
|
+
for (let index = 0; index < encoded.length; index += 4) {
|
|
755
|
+
const characters = encoded.slice(index, index + 4);
|
|
756
|
+
let bits = 0;
|
|
757
|
+
let padding = 0;
|
|
758
|
+
for (const character of characters) {
|
|
759
|
+
bits <<= 6;
|
|
760
|
+
if (character === "=") padding += 1;
|
|
761
|
+
else bits |= BASE64_ALPHABET.indexOf(character);
|
|
762
|
+
}
|
|
763
|
+
bytes.push(bits >> 16 & 255);
|
|
764
|
+
if (padding < 2) bytes.push(bits >> 8 & 255);
|
|
765
|
+
if (padding < 1) bytes.push(bits & 255);
|
|
766
|
+
}
|
|
767
|
+
return bytes;
|
|
768
|
+
}
|
|
769
|
+
function isBase64(encoded) {
|
|
770
|
+
if (encoded.length % 4 !== 0) return false;
|
|
771
|
+
let padding = 0;
|
|
772
|
+
if (encoded.endsWith("==")) padding = 2;
|
|
773
|
+
else if (encoded.endsWith("=")) padding = 1;
|
|
774
|
+
for (let index = 0; index < encoded.length - padding; index += 1) if (BASE64_ALPHABET.indexOf(encoded[index]) === -1) return false;
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
function utf8Bytes(text) {
|
|
778
|
+
const bytes = [];
|
|
779
|
+
for (const character of text) {
|
|
780
|
+
const codePoint = character.codePointAt(0);
|
|
781
|
+
if (codePoint < 128) bytes.push(codePoint);
|
|
782
|
+
else if (codePoint < 2048) bytes.push(192 | codePoint >> 6, 128 | codePoint & 63);
|
|
783
|
+
else if (codePoint < 65536) bytes.push(224 | codePoint >> 12, 128 | codePoint >> 6 & 63, 128 | codePoint & 63);
|
|
784
|
+
else bytes.push(240 | codePoint >> 18, 128 | codePoint >> 12 & 63, 128 | codePoint >> 6 & 63, 128 | codePoint & 63);
|
|
785
|
+
}
|
|
786
|
+
return bytes;
|
|
787
|
+
}
|
|
788
|
+
const MAX_CODE_POINT = 1114111;
|
|
789
|
+
const MIN_CODE_POINT_FOR_LENGTH = [
|
|
790
|
+
0,
|
|
791
|
+
0,
|
|
792
|
+
128,
|
|
793
|
+
2048,
|
|
794
|
+
65536
|
|
795
|
+
];
|
|
796
|
+
function utf8Text(bytes) {
|
|
797
|
+
let text = "";
|
|
798
|
+
let index = 0;
|
|
799
|
+
while (index < bytes.length) {
|
|
800
|
+
const first = bytes[index];
|
|
801
|
+
const length = sequenceLength(first);
|
|
802
|
+
const continuation = bytes.slice(index + 1, index + length);
|
|
803
|
+
if (length === 0 || !isCompleteContinuation(continuation, length)) {
|
|
804
|
+
text += "�";
|
|
805
|
+
index += 1;
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
let codePoint = firstByteBits(first, length);
|
|
809
|
+
for (const byte of continuation) codePoint = codePoint << 6 | byte & 63;
|
|
810
|
+
const isPastLastCharacter = codePoint > MAX_CODE_POINT;
|
|
811
|
+
const isSpelledTooLong = codePoint < MIN_CODE_POINT_FOR_LENGTH[length];
|
|
812
|
+
if (isPastLastCharacter || isSpelledTooLong || codePoint >= 55296 && codePoint <= 57343) {
|
|
813
|
+
text += "�";
|
|
814
|
+
index += 1;
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
text += String.fromCodePoint(codePoint);
|
|
818
|
+
index += length;
|
|
819
|
+
}
|
|
820
|
+
return text;
|
|
821
|
+
}
|
|
822
|
+
function sequenceLength(first) {
|
|
823
|
+
if (first < 128) return 1;
|
|
824
|
+
if (first >= 240) return 4;
|
|
825
|
+
if (first >= 224) return 3;
|
|
826
|
+
if (first >= 192) return 2;
|
|
827
|
+
return 0;
|
|
828
|
+
}
|
|
829
|
+
function isCompleteContinuation(continuation, length) {
|
|
830
|
+
if (continuation.length !== length - 1) return false;
|
|
831
|
+
return continuation.every((byte) => (byte & 192) === 128);
|
|
832
|
+
}
|
|
833
|
+
function firstByteBits(first, length) {
|
|
834
|
+
if (length === 1) return first;
|
|
835
|
+
return first & 255 >> length + 1;
|
|
836
|
+
}
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/utils/index.ts
|
|
839
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
840
|
+
base64: () => base64,
|
|
841
|
+
hex: () => hex
|
|
842
|
+
});
|
|
276
843
|
//#endregion
|
|
277
844
|
//#region src/tracked.ts
|
|
278
845
|
function tracked(group, track) {
|
|
279
846
|
const copy = {};
|
|
280
847
|
for (const [name, member] of Object.entries(group)) if (typeof member === "function") {
|
|
281
|
-
const
|
|
848
|
+
const startCall = member;
|
|
282
849
|
copy[name] = (...args) => {
|
|
283
|
-
const
|
|
284
|
-
track(
|
|
285
|
-
return
|
|
850
|
+
const result = startCall(...args);
|
|
851
|
+
if (result instanceof Promise) track(result);
|
|
852
|
+
return result;
|
|
286
853
|
};
|
|
287
854
|
} else copy[name] = tracked(member, track);
|
|
288
855
|
return copy;
|
|
289
856
|
}
|
|
290
857
|
//#endregion
|
|
858
|
+
//#region src/errors.ts
|
|
859
|
+
function isDashError(error, ...codes) {
|
|
860
|
+
if (error instanceof HostError) return codes.length === 0 || codes.includes(error.code);
|
|
861
|
+
return false;
|
|
862
|
+
}
|
|
863
|
+
function errorMessage(error) {
|
|
864
|
+
if (error instanceof Error) return error.message;
|
|
865
|
+
if (typeof error === "string" && error) return error;
|
|
866
|
+
return "Something went wrong. Try again.";
|
|
867
|
+
}
|
|
868
|
+
async function unlessCancelled(call) {
|
|
869
|
+
try {
|
|
870
|
+
return await call;
|
|
871
|
+
} catch (error) {
|
|
872
|
+
if (isDashError(error, "cancelled")) return;
|
|
873
|
+
throw error;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/latest.ts
|
|
878
|
+
function latest() {
|
|
879
|
+
let running;
|
|
880
|
+
return (call) => {
|
|
881
|
+
running?.cancel();
|
|
882
|
+
running = call;
|
|
883
|
+
return call;
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function debounce(milliseconds) {
|
|
887
|
+
const wait = latest();
|
|
888
|
+
return async (dash) => {
|
|
889
|
+
try {
|
|
890
|
+
await wait(dash.system.delay(milliseconds));
|
|
891
|
+
return true;
|
|
892
|
+
} catch (error) {
|
|
893
|
+
if (isDashError(error, "cancelled")) return false;
|
|
894
|
+
throw error;
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
//#endregion
|
|
291
899
|
//#region src/index.ts
|
|
292
900
|
const dash = {
|
|
293
901
|
ui: ui_exports,
|
|
294
902
|
system: system_exports,
|
|
295
903
|
network: network_exports,
|
|
296
|
-
storage: storage_exports
|
|
904
|
+
storage: storage_exports,
|
|
905
|
+
media: media_exports,
|
|
906
|
+
contacts: contacts_exports,
|
|
907
|
+
dot: dot_exports,
|
|
908
|
+
account: account_exports,
|
|
909
|
+
payments: payments_exports,
|
|
910
|
+
crypto: crypto_exports,
|
|
911
|
+
utils: utils_exports,
|
|
912
|
+
supports
|
|
297
913
|
};
|
|
298
914
|
//#endregion
|
|
299
|
-
export {
|
|
915
|
+
export { DASH_API_SINCE, DASH_API_VERSION, DashError, dash, debounce, errorMessage, isDashError, latest, tracked, unlessCancelled, useHostDashApiVersions, warnAboveDashApiVersion };
|
|
300
916
|
|
|
301
917
|
//# sourceMappingURL=index.js.map
|