@fkn/lib 0.9.64 → 0.9.65

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.
Files changed (165) hide show
  1. package/README.md +1 -2
  2. package/account-Bm7uIcQo.d.ts +39 -0
  3. package/account-Uh0-1Cbp.js +22 -0
  4. package/{account-generation-BiZxPztj.cjs → account-generation-ACCBzaI-.cjs} +1 -1
  5. package/{account-generation-DvRuJDa2.js → account-generation-BKHNe-jL.js} +2 -3
  6. package/account-m2iCmNui.cjs +1 -0
  7. package/{account-storage-D8CBG1cv.js → account-storage-BmCVutNL.js} +4 -5
  8. package/{account-storage-Co9IvkPr.d.ts → account-storage-UmSfF63A.d.ts} +1 -66
  9. package/{account-storage-DpHBgeX5.cjs → account-storage-dYWDpqsr.cjs} +1 -1
  10. package/account.cjs +1 -1
  11. package/account.d.ts +3 -40
  12. package/account.js +1 -23
  13. package/{api-xh6lzApn.d.ts → api-0Yp9uZcV.d.ts} +3 -7
  14. package/{api-BvJu2X1L.js → api-DRglK7ft.js} +19 -21
  15. package/{api-CrUO33y-.cjs → api-DrvhPN56.cjs} +1 -1
  16. package/api.cjs +1 -1
  17. package/api.d.ts +2 -2
  18. package/api.js +1 -2
  19. package/attach-policy.d.ts +0 -4
  20. package/attach-policy.js +2 -3
  21. package/{broker-frame-B31OXcnH.js → broker-frame-vjSpBa8d.js} +1 -2
  22. package/broker-frame.d.ts +1 -3
  23. package/broker-frame.js +1 -2
  24. package/{busy-DsMWrSzc.js → busy-C1JPjoZ_.js} +1 -2
  25. package/cloud/dgram.cjs +1 -1
  26. package/cloud/dgram.d.ts +1 -1
  27. package/cloud/dgram.js +1 -2
  28. package/cloud/dns.cjs +1 -1
  29. package/cloud/dns.d.ts +2 -2
  30. package/cloud/dns.js +1 -2
  31. package/cloud/fetch.cjs +1 -1
  32. package/cloud/fetch.d.ts +1 -1
  33. package/cloud/fetch.js +1 -2
  34. package/cloud/fs/promises.cjs +1 -1
  35. package/cloud/fs/promises.d.ts +3 -5
  36. package/cloud/fs/promises.js +2 -3
  37. package/cloud/fs.cjs +1 -1
  38. package/cloud/fs.d.ts +4 -4
  39. package/cloud/fs.js +4 -34
  40. package/cloud/http.cjs +1 -1
  41. package/cloud/http.d.ts +1 -1
  42. package/cloud/http.js +1 -2
  43. package/cloud/net.cjs +1 -1
  44. package/cloud/net.d.ts +1 -1
  45. package/cloud/net.js +3 -3
  46. package/{cloud-CI7FFRMC.d.ts → cloud-BoH54gaM.d.ts} +7 -11
  47. package/{cloud-FW59_g8F.js → cloud-C7StNncS.js} +15 -16
  48. package/cloud-TN0eDUy3.cjs +1 -0
  49. package/cloud.cjs +1 -1
  50. package/cloud.d.ts +7 -7
  51. package/cloud.js +7 -7
  52. package/connect-button-2FmOM8ai.d.ts +2 -0
  53. package/{connect-button-DtsN3X1J.js → connect-button-C1wKkIhh.js} +1 -2
  54. package/{contract-BGMJVvTg.d.ts → contract-0rua6Wsh.d.ts} +11 -6
  55. package/contract.d.ts +3 -3
  56. package/contract.js +1 -2
  57. package/desktop-DOubT4ES.d.ts +57 -0
  58. package/desktop-vXKU4wEK.cjs +1 -0
  59. package/desktop-xTT7ciGX.js +50 -0
  60. package/desktop.cjs +1 -1
  61. package/desktop.d.ts +2 -58
  62. package/desktop.js +1 -51
  63. package/dgram-BBbLokVF.js +397 -0
  64. package/dgram-BYk-QDHW.d.ts +118 -0
  65. package/dgram-D9ljiUFh.cjs +1 -0
  66. package/dgram.cjs +1 -1
  67. package/dgram.d.ts +2 -119
  68. package/dgram.js +1 -410
  69. package/dns-2v96zoEh.cjs +1 -0
  70. package/dns-DyB4K2oE.d.ts +9 -0
  71. package/dns-o8DLFjP1.js +5 -0
  72. package/dns.cjs +1 -1
  73. package/dns.d.ts +3 -10
  74. package/dns.js +1 -6
  75. package/extension-BXBjpypy.cjs +1 -0
  76. package/{extension-Chmpunqf.js → extension-D5UMnEmQ.js} +9 -11
  77. package/{extension-C1bcizcn.d.ts → extension-D98KM8W7.d.ts} +1 -27
  78. package/extension.cjs +1 -1
  79. package/extension.d.ts +2 -2
  80. package/extension.js +2 -2
  81. package/fs/promises.cjs +1 -1
  82. package/fs/promises.d.ts +2 -4
  83. package/fs/promises.js +2 -3
  84. package/fs--MLHvMW-.cjs +1 -0
  85. package/fs-BX_ghRy0.cjs +1 -0
  86. package/fs-BnWXGRik.js +33 -0
  87. package/{fs-DCJAYoYy.d.ts → fs-ChOYC6VD.d.ts} +3 -4
  88. package/{fs-Djuaj5pQ.js → fs-Cw7CcUhx.js} +17 -41
  89. package/fs.cjs +1 -1
  90. package/fs.d.ts +4 -4
  91. package/fs.js +2 -2
  92. package/{hosts-t7CKGTRz.js → hosts-HUfgMimI.js} +1 -2
  93. package/http-BE3UBktN.cjs +9 -0
  94. package/http-CDhG4bUc.d.ts +187 -0
  95. package/http-DIDjdm08.js +523 -0
  96. package/http.cjs +1 -9
  97. package/http.d.ts +2 -188
  98. package/http.js +1 -542
  99. package/index-CUWTpQKP.d.ts +87 -0
  100. package/{index-BQgZVQl7.d.ts → index-CcVwh9yz.d.ts} +0 -2
  101. package/{index-C5DdoMGo.d.ts → index-Cu5EcdK0.d.ts} +0 -59
  102. package/{index-57lTXnoe.d.ts → index-D6GPJ4Ow.d.ts} +29 -26
  103. package/index.cjs +1 -1
  104. package/index.d.ts +17 -25
  105. package/index.js +22 -27
  106. package/lib-Bs-g5jyp.cjs +53 -0
  107. package/{lib-BrsqpUkv.js → lib-CtJaID_y.js} +7 -31
  108. package/{messages-AdPfdoLV.d.ts → messages-B9dOXntM.d.ts} +0 -2
  109. package/messages.d.ts +1 -1
  110. package/messages.js +1 -2
  111. package/net-COkJw8lV.js +286 -0
  112. package/net-Dk2kqtgE.cjs +1 -0
  113. package/{net-BpyIeQ8r.d.ts → net-mVAYXs8e.d.ts} +5 -7
  114. package/net.cjs +1 -1
  115. package/net.d.ts +1 -1
  116. package/net.js +3 -323
  117. package/{node-fs-DY2fO5zd.js → node-fs-B4pY08Kc.js} +3 -10
  118. package/node-fs-DN0ejGTL.cjs +1 -0
  119. package/opfs/promises.cjs +1 -1
  120. package/opfs/promises.d.ts +2 -4
  121. package/opfs/promises.js +2 -3
  122. package/{opfs-D0goLAQW.js → opfs-CzCfVam3.js} +2 -3
  123. package/opfs-D3pYzYRc.js +35 -0
  124. package/opfs-DuXvTgIl.cjs +1 -0
  125. package/opfs.cjs +1 -1
  126. package/opfs.d.ts +3 -88
  127. package/opfs.js +1 -36
  128. package/package.json +1 -1
  129. package/packages-BEadIy_h.d.ts +155 -0
  130. package/packages-Cws_rcgf.js +346 -0
  131. package/packages-DT8vPB5_.cjs +1 -0
  132. package/packages.cjs +1 -1
  133. package/packages.d.ts +3 -156
  134. package/packages.js +1 -347
  135. package/{proxy-C4sYkxB5.js → proxy-BBAQxJmP.js} +5 -6
  136. package/{proxy-Dz60YyYy.d.ts → proxy-BP40IXYD.d.ts} +2 -4
  137. package/{proxy-jdE5tCwz.cjs → proxy-DVgGp6A8.cjs} +1 -1
  138. package/react.cjs +1 -1
  139. package/react.d.ts +16 -4
  140. package/react.js +96 -7
  141. package/{relay-choice-BGwXRC5d.js → relay-choice-Bb3oP2gw.js} +1 -2
  142. package/{relay-choice-5yUPI-tJ.d.ts → relay-choice-DOUttUnL.d.ts} +2 -4
  143. package/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
  144. package/rooms-C6mbannC.d.ts +227 -0
  145. package/rooms-DHFS9cwA.cjs +1 -0
  146. package/rooms-DP5stTEr.js +300 -0
  147. package/rooms.cjs +1 -1
  148. package/rooms.d.ts +3 -228
  149. package/rooms.js +1 -301
  150. package/storage-BCjYihUO.cjs +1 -0
  151. package/storage-BhfImh_2.js +136 -0
  152. package/storage-DpCLksAa.d.ts +68 -0
  153. package/storage.cjs +1 -1
  154. package/storage.d.ts +3 -69
  155. package/storage.js +1 -137
  156. package/{utils-Cyq8uJiy.js → utils-DtWP-E9x.js} +1 -2
  157. package/{wire-Fk5pJaoy.d.ts → wire-DhmLnYEU.d.ts} +0 -2
  158. package/wire.d.ts +1 -1
  159. package/wire.js +1 -2
  160. package/cloud-DcgY8Xfp.cjs +0 -1
  161. package/connect-button-Cp0NS95-.d.ts +0 -4
  162. package/extension-I2Ziv2pk.cjs +0 -1
  163. package/fs-DeyJwJ3w.cjs +0 -1
  164. package/lib-C_X3WR4G.cjs +0 -53
  165. package/node-fs-vsWuoMGa.cjs +0 -1
package/rooms.js CHANGED
@@ -1,301 +1 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { l as t, s as n, u as r } from "./api-BvJu2X1L.js";
3
- import { t as i } from "./busy-DsMWrSzc.js";
4
- import { ROOM_TEMPORARY_MS as a } from "./contract.js";
5
- //#region src/rooms.ts
6
- var o = /* @__PURE__ */ e({
7
- available: () => w,
8
- create: () => D,
9
- join: () => O,
10
- open: () => E
11
- }), s = {
12
- wrongKey: "rooms: wrong room key",
13
- inviteNoKey: "rooms: the invite carries no key",
14
- badName: "rooms: the name is not one a room can have",
15
- badKeyOption: "rooms: the key is not 32 bytes base64url",
16
- noSuchMember: "rooms: no such member",
17
- noSuchMessage: "rooms: no such message",
18
- roomFull: "rooms: the room is full",
19
- tooManyConnections: "rooms: too many connections",
20
- tooManyBlocks: "rooms: too many blocks",
21
- tooManyClaims: "rooms: too many claims",
22
- mailboxFull: "rooms: the mailbox is full",
23
- outOfStorage: "rooms: the owner is out of storage",
24
- outOfQuota: "rooms: out of daily bandwidth",
25
- blocked: "rooms: you are blocked from this room",
26
- cannotSend: "rooms: you cannot send here",
27
- permissionDenied: "rooms: permission denied",
28
- notOwner: "rooms: not the room owner",
29
- ownerNotRemovable: "rooms: the owner cannot be removed",
30
- ownerKeepsEvery: "rooms: the owner keeps every permission",
31
- removeYourself: "rooms: you cannot remove yourself",
32
- needsAccount: "rooms: claiming needs an account",
33
- nameClaimed: "rooms: the name is claimed",
34
- notClaimed: "rooms: the room is not claimed",
35
- noMailbox: "rooms: the room keeps no messages",
36
- badLimit: "rooms: the limit is out of range",
37
- badDescription: "rooms: the description is not one a claim can carry",
38
- notClaimer: "rooms: only the app that claimed the room can describe it",
39
- notReleaser: "rooms: only the app that claimed the room can release it",
40
- notClaimingApp: "rooms: only the app that claimed the room can change it",
41
- badTemporary: "rooms: the temporary duration is not one a claim can carry",
42
- notTemporaryClaimer: "rooms: only the app that claimed the room can set when it expires",
43
- temporaryUnavailable: "rooms: temporary claims are not available",
44
- mailboxUnavailable: "rooms: the mailbox switch is not available",
45
- guestUnavailable: "rooms: guest joins are not available",
46
- schemasUnavailable: "rooms: room schemas are not available",
47
- badSchema: "rooms: the schema is not one a room can take",
48
- newerSchema: "rooms: the room holds a newer schema",
49
- noSchema: "rooms: the room has no schema",
50
- misfit: "rooms: the message does not fit the room's schema",
51
- ownerSends: "rooms: only the owner sends this type",
52
- accountSends: "rooms: sending this needs an account",
53
- perAccount: "rooms: you have as many of these here as the room allows",
54
- tooFast: "rooms: sending too fast",
55
- tooLarge: "rooms: the message is too large",
56
- unavailable: "rooms: rooms are unavailable",
57
- notEnabled: "rooms: rooms are not available",
58
- alreadyJoined: "rooms: already joined",
59
- notJoined: "rooms: not joined",
60
- malformed: "rooms: malformed frame",
61
- ended: "rooms: the room has ended"
62
- }, c = (e, t) => Object.assign(Error(t), { code: e }), l = (e) => e instanceof Error && typeof e.code == "string", u = {
63
- send: !0,
64
- receive: !0,
65
- maxMessageBytes: 262144
66
- }, d = 2048, f = () => ({
67
- messages: 0,
68
- bytes: 0,
69
- cap: 5e8,
70
- archived: !1
71
- }), p = async () => {
72
- if (!t) return;
73
- let e = (await n("a room").catch(() => void 0))?.rooms;
74
- return typeof e?.open == "function" ? e : void 0;
75
- }, m = () => {
76
- throw c("unavailable", s.unavailable);
77
- }, h = (e) => e === "blocked" ? "blocked" : e === "not-found" ? "ended" : "unavailable", g = (e) => {
78
- if (e !== void 0 && e !== !1) return e === !0 ? a.default : typeof e != "number" || !Number.isInteger(e) ? null : e >= a.min && e <= a.max ? e : null;
79
- }, _ = (e, t) => {
80
- let n = t ? e?.guest : e;
81
- return typeof n?.join == "function" ? n : void 0;
82
- }, v = (e) => {
83
- let t;
84
- try {
85
- t = JSON.stringify(e);
86
- } catch {}
87
- let n = t === void 0 ? void 0 : JSON.parse(t), r = typeof n == "object" && !!n && !Array.isArray(n) && typeof n.type == "string";
88
- if (t === void 0 || !r || t.length > d) throw c("invalid", s.misfit);
89
- return t;
90
- }, y = (e) => {
91
- let t;
92
- try {
93
- t = JSON.parse(JSON.stringify(e));
94
- } catch {}
95
- if (typeof t != "object" || !t || Array.isArray(t)) throw c("invalid", s.badSchema);
96
- return t;
97
- }, b = (e) => e?.schema === void 0 ? e : {
98
- ...e,
99
- schema: y(e.schema)
100
- }, x = (e) => {
101
- if (e.schemas !== !0) throw c("unavailable", s.schemasUnavailable);
102
- return e;
103
- }, S = (e) => {
104
- let t = e?.guest;
105
- if (t !== void 0 && typeof t != "boolean") throw c("invalid", s.malformed);
106
- return t === !0;
107
- }, C = async (e, t) => {
108
- let n = e.invite, a = e, o = 0, d = e.self, p = e.owner, m = e.claimed, b = e.mailbox, S = 0, C = await e.defaults().catch(() => u), w = e.schemas === !0 ? await Promise.resolve(e.schema()).catch(() => null) : null, T = 0, E = !1, D = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), k = i("room"), A = () => {}, j = () => {}, M = new Promise((e) => {
109
- j = e;
110
- }), N = (e) => {
111
- let t = [...O];
112
- O.clear();
113
- for (let n of t) try {
114
- n(e);
115
- } catch {}
116
- }, P = (e) => {
117
- E || (E = !0, A(), D.clear(), k(), N(c("closed", s.ended)), j({ reason: e }));
118
- }, F = (e) => {
119
- if (E) return;
120
- let t = e;
121
- if (t.type === "defaults" && (C = t.defaults), t.type === "schema" && (T += 1, w = t.schema), t.type === "message" || t.type === "edited") {
122
- let e = {
123
- ...t.message,
124
- envelope: t.message.envelope ?? null
125
- };
126
- t = t.type === "message" ? {
127
- ...t,
128
- message: e
129
- } : {
130
- type: "edited",
131
- message: e
132
- };
133
- }
134
- if (t.type === "permissions" && t.id === d.id && (d = {
135
- id: d.id,
136
- permissions: t.permissions,
137
- maxMessageBytes: t.maxMessageBytes
138
- }), t.type === "claim") {
139
- S += 1;
140
- let e = t.claimed && t.mailbox !== !1;
141
- t = {
142
- type: "claim",
143
- claimed: t.claimed,
144
- owner: t.owner,
145
- mailbox: e
146
- }, m = t.claimed, p = t.owner, b = e ? f() : null;
147
- }
148
- for (let e of [...D]) try {
149
- e(t);
150
- } catch {}
151
- }, I = (e, t) => {
152
- Promise.resolve(e.on(F)).catch(() => {}), Promise.resolve(e.closed).then((e) => {
153
- t === o && P(e.reason);
154
- }, () => {});
155
- }, L = async (e, r) => {
156
- let i = _(e, t);
157
- if (!i) return P("unavailable");
158
- let s = await i.join(n).catch(() => void 0);
159
- if (E || r !== o) return;
160
- if (!s) return P("unavailable");
161
- if ("error" in s) return P(h(s.error));
162
- if (s.self.id !== d.id) return Promise.resolve(s.leave()).catch(() => {}), P("unavailable");
163
- a = s, d = s.self, p = s.owner, m = s.claimed, b = s.mailbox, I(s, r);
164
- let c = await s.defaults().catch(() => void 0);
165
- if (c && !E && r === o && (C = c), s.schemas !== !0) return;
166
- let l = await Promise.resolve(s.schema()).catch(() => void 0);
167
- l !== void 0 && !E && r === o && (w = l);
168
- };
169
- A = r((e, t) => {
170
- let n = o;
171
- o = t, !(E || n === 0 || n === t) && (N(c("unavailable", s.unavailable)), L(e.rooms, t));
172
- }), I(e, o);
173
- let R = async (e) => {
174
- if (E) throw c("closed", s.ended);
175
- let t = () => {}, n = new Promise((e, n) => {
176
- t = n;
177
- });
178
- O.add(t);
179
- try {
180
- return await Promise.race([Promise.resolve(e(a)), n]);
181
- } catch (e) {
182
- throw l(e) ? e : c("unavailable", s.unavailable);
183
- } finally {
184
- O.delete(t);
185
- }
186
- }, z = async (e) => {
187
- let t = await R(e);
188
- if ("error" in t) throw c(t.error, t.message);
189
- }, B = async (e) => {
190
- let t = await R(e);
191
- if (typeof t == "object" && t && "error" in t) throw c(t.error, t.message);
192
- return t;
193
- };
194
- return {
195
- id: e.id,
196
- name: e.name,
197
- key: e.key,
198
- invite: n,
199
- get self() {
200
- return d;
201
- },
202
- get owner() {
203
- return p;
204
- },
205
- get claimed() {
206
- return m;
207
- },
208
- get mailbox() {
209
- return b;
210
- },
211
- defaults: () => C,
212
- members: () => R((e) => e.members()),
213
- schema: () => w,
214
- send: async (e, t) => {
215
- if (t === void 0) return z((t) => t.send(e));
216
- let n = v(t);
217
- return z((t) => x(t).send(e, n));
218
- },
219
- edit: async (e, t, n) => {
220
- if (n === void 0) return z((n) => n.edit(e, t));
221
- let r = v(n);
222
- return z((n) => x(n).edit(e, t, r));
223
- },
224
- setSchema: async (e) => {
225
- let t = y(e), n = T;
226
- await z((e) => x(e).setSchema(t)), T === n && (w = t);
227
- },
228
- delete: (e, t) => z((n) => n.delete(e, t)),
229
- backlog: (e, t) => B((n) => n.backlog(e, t)),
230
- setDefault: (e, t) => z((n) => n.setDefault(e, t)),
231
- limit: (e, t) => z((n) => n.limit(e, t)),
232
- grant: (e, t) => z((n) => n.grant(e, t)),
233
- revoke: (e, t) => z((n) => n.revoke(e, t)),
234
- remove: (e) => z((t) => t.remove(e)),
235
- block: (e) => z((t) => t.block(e)),
236
- unblock: (e) => z((t) => t.unblock(e)),
237
- claim: async (e) => {
238
- let t = e?.description;
239
- if (t !== void 0 && typeof t != "string") throw c("invalid", s.badDescription);
240
- let n = g(e?.temporary);
241
- if (n === null) throw c("invalid", s.badTemporary);
242
- let r = e?.mailbox;
243
- if (r !== void 0 && typeof r != "boolean") throw c("invalid", s.malformed);
244
- let i = {
245
- ...t === void 0 ? {} : { description: t },
246
- ...n === void 0 ? {} : { temporary: n },
247
- ...r === void 0 ? {} : { mailbox: r }
248
- };
249
- return Object.keys(i).length === 0 ? z((e) => e.claim()) : z((e) => {
250
- if (n !== void 0 && e.temporaryClaims !== !0) throw c("unavailable", s.temporaryUnavailable);
251
- if (r === !1 && e.mailboxSwitch !== !0) throw c("unavailable", s.mailboxUnavailable);
252
- return e.claim(i);
253
- });
254
- },
255
- setMailbox: async (e) => {
256
- if (typeof e != "boolean") throw c("invalid", s.malformed);
257
- let t = S;
258
- await z((t) => {
259
- if (t.mailboxSwitch !== !0) throw c("unavailable", s.mailboxUnavailable);
260
- return t.setMailbox(e);
261
- }), S === t && (e ? b === null && (b = f()) : b = null);
262
- },
263
- release: () => z((e) => e.release()),
264
- usage: async () => {
265
- let e = await B((e) => e.usage());
266
- return b = e, e;
267
- },
268
- on: async (e) => E ? () => {} : (D.add(e), () => {
269
- D.delete(e);
270
- }),
271
- leave: async () => {
272
- await Promise.resolve(a.leave()).catch(() => {}), P("left");
273
- },
274
- closed: M
275
- };
276
- }, w = async () => {
277
- let e = await p();
278
- return e ? e.available().catch(() => !1) : !1;
279
- }, T = async (e, t, n) => {
280
- let r = await p();
281
- if (!r) throw c("unavailable", s.unavailable);
282
- let i = _(r, e);
283
- if (!i) throw c("unavailable", s.guestUnavailable);
284
- let a = await n(i).catch(m);
285
- if ("error" in a) throw c(a.error, a.message);
286
- if (t?.schema !== void 0 && a.schemas !== !0) throw await Promise.resolve(a.leave()).catch(() => {}), c("unavailable", s.schemasUnavailable);
287
- return C(a, e);
288
- }, E = async (e, t) => {
289
- if (typeof e != "string" || e.length === 0 || e.length > 72) throw c("invalid", s.badName);
290
- let n = S(t), r = b(t);
291
- return T(n, r, (t) => t.open(e, r));
292
- }, D = async (e) => {
293
- let t = S(e), n = b(e);
294
- return T(t, n, (e) => e.create(n));
295
- }, O = async (e, t) => {
296
- let n = typeof e == "string" ? e.indexOf(".") : -1;
297
- if (n <= 0 || n === e.length - 1) throw c("invalid", s.inviteNoKey);
298
- return T(S(t), void 0, (n) => n.join(e, t));
299
- };
300
- //#endregion
301
- export { w as available, D as create, O as join, E as open, o as t };
1
+ export { t as available, n as create, r as join, i as open } from "./rooms-DP5stTEr.js";
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DrvhPN56.cjs"),n=require("./contract.cjs"),r=require("./account-generation-ACCBzaI-.cjs"),i=require("./account-storage-dYWDpqsr.cjs");var a=e.t({available:()=>v,delete:()=>C,get:()=>x,list:()=>S,put:()=>y}),o=new Map(Object.values(n.STORAGE_REFUSALS).map(({code:e,message:t})=>[t,e])),s=new Set(o.values()),c=(e,t)=>Object.assign(Error(t),{code:e}),l=e=>c(n.STORAGE_REFUSALS[e].code,n.STORAGE_REFUSALS[e].message),u=e=>e instanceof Error&&s.has(e.code),d=e=>{if(u(e))return e;let t=e instanceof Error?e.message:``,n=o.get(t);return n?c(n,t):l(`unavailable`)},f=async()=>{if(!t.l)return;let e=(await t.s(`storage`).catch(()=>void 0))?.storage;return typeof e?.put==`function`?e:void 0},p=()=>{throw l(`unavailable`)},m=e=>typeof e==`object`&&!!e&&typeof e.error==`string`&&typeof e.message==`string`,h=(e,t,n)=>{throw e.error===`aborted`?t?.reason??new DOMException(`The operation was aborted.`,`AbortError`):(e.error===`account-changed`&&n&&r.r(n.generation),s.has(e.error)?c(e.error,e.message):l(`unavailable`))},g=async e=>{try{return await i.m(e)}catch(e){throw i.l(e)?l(`accountChanged`):e instanceof Error&&/not connected|not signed in/i.test(e.message)?l(`needsAccount`):l(`unavailable`)}},_=(e,t)=>(e.catch(()=>{}),t?Promise.race([e,new Promise((e,n)=>t.addEventListener(`abort`,()=>n(t.reason),{once:!0}))]):e),v=async()=>{let e=await f();return e?Promise.resolve(e.available()).catch(()=>!1):!1},y=async(e,t={})=>{let n=i.s(),{signal:r,onProgress:a,key:o}=t;r?.throwIfAborted();let s=typeof Blob<`u`&&e instanceof Blob,c=typeof ReadableStream<`u`&&e instanceof ReadableStream;if(!s&&!c)throw l(`notAFile`);let u=s?e.size:t.size;if(typeof u!=`number`||!Number.isSafeInteger(u)||u<0||s&&t.size!==void 0&&t.size!==u)throw l(`badSize`);let d=await f();if(!d)throw l(`unavailable`);let v=await g(n);r?.throwIfAborted();let y=await _(Promise.resolve(d.put(e,{size:u,...o===void 0?{}:{key:o},accountPin:v,...r?{signal:r}:{},...typeof a==`function`?{onProgress:e=>{try{a(e)}catch{}}}:{}})).catch(p),r);return m(y)?h(y,r,n):y},b=(e,t,n)=>{let r=(t,n)=>{if(t===void 0)return n;let r=Math.trunc(Number.isFinite(t)?t:t>0?e:-e);return r<0?Math.max(e+r,0):Math.min(r,e)},i=r(t,0);return{from:i,to:Math.max(i,r(n,e))}},x=async(e,n,r={})=>{if(typeof e!=`string`)throw l(`badUrl`);if(typeof n!=`string`)throw l(`badKey`);let{signal:i}=r;i?.throwIfAborted();let a=async()=>{let r=await f();if(!r)throw l(`unavailable`);let a=t.c()?.epoch,o=await _(Promise.resolve(r.get(e,n,i?{signal:i}:void 0)).catch(p),i);return m(o)?h(o,i):{handle:o,epoch:a}},o=await a(),s=async()=>{let e=t.c()?.epoch;return o.epoch!==void 0&&e!==void 0&&e!==o.epoch&&(o=await a()),o.handle},c=(e,t)=>{let n;return new ReadableStream({pull:async r=>{try{if(!n){let r=await s(),i=await Promise.resolve(r.read(e,t)).catch(p);if(m(i))return h(i);n=i.getReader()}let{value:i,done:a}=await n.read();a?r.close():r.enqueue(i)}catch(e){throw d(e)}},cancel:e=>n?.cancel(e)},{highWaterMark:0})},u=(e,t)=>({size:t-e,stream:()=>c(e,t),arrayBuffer:async()=>{let n=new Uint8Array(t-e),r=c(e,t).getReader(),i=0;for(;;){let{value:e,done:t}=await r.read();if(t)break;n.set(e,i),i+=e.length}return n.buffer},slice:(n,r)=>{let i=b(t-e,n,r);return u(e+i.from,e+i.to)}});return u(0,o.handle.size)},S=async(e={})=>{let t=i.s(),n=await f();if(!n)throw l(`unavailable`);let r=await g(t),{limit:a,cursor:o}=e,s=await Promise.resolve(n.list({accountPin:r,...a===void 0?{}:{limit:a},...o===void 0?{}:{cursor:o}})).catch(p);return m(s)?h(s,void 0,t):s},C=async e=>{let t=i.s();if(typeof e!=`string`)throw l(`badUrl`);let n=await f();if(!n)throw l(`unavailable`);let r=await g(t),a=await Promise.resolve(n.delete(e,{accountPin:r})).catch(p);m(a)&&h(a,void 0,t)};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
@@ -0,0 +1,136 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { c as t, l as n, s as r } from "./api-DRglK7ft.js";
3
+ import { STORAGE_REFUSALS as i } from "./contract.js";
4
+ import { r as a } from "./account-generation-BKHNe-jL.js";
5
+ import { l as o, m as s, s as c } from "./account-storage-BmCVutNL.js";
6
+ // src/storage.ts
7
+ var l = /* @__PURE__ */ e({
8
+ available: () => S,
9
+ delete: () => D,
10
+ get: () => T,
11
+ list: () => E,
12
+ put: () => C
13
+ }), u = new Map(Object.values(i).map(({ code: e, message: t }) => [t, e])), d = new Set(u.values()), f = (e, t) => Object.assign(Error(t), { code: e }), p = (e) => f(i[e].code, i[e].message), m = (e) => e instanceof Error && d.has(e.code), h = (e) => {
14
+ if (m(e)) return e;
15
+ let t = e instanceof Error ? e.message : "", n = u.get(t);
16
+ return n ? f(n, t) : p("unavailable");
17
+ }, g = async () => {
18
+ if (!n) return;
19
+ let e = (await r("storage").catch(() => void 0))?.storage;
20
+ return typeof e?.put == "function" ? e : void 0;
21
+ }, _ = () => {
22
+ throw p("unavailable");
23
+ }, v = (e) => typeof e == "object" && !!e && typeof e.error == "string" && typeof e.message == "string", y = (e, t, n) => {
24
+ throw e.error === "aborted" ? t?.reason ?? new DOMException("The operation was aborted.", "AbortError") : (e.error === "account-changed" && n && a(n.generation), d.has(e.error) ? f(e.error, e.message) : p("unavailable"));
25
+ }, b = async (e) => {
26
+ try {
27
+ return await s(e);
28
+ } catch (e) {
29
+ throw o(e) ? p("accountChanged") : e instanceof Error && /not connected|not signed in/i.test(e.message) ? p("needsAccount") : p("unavailable");
30
+ }
31
+ }, x = (e, t) => (e.catch(() => {}), t ? Promise.race([e, new Promise((e, n) => t.addEventListener("abort", () => n(t.reason), { once: !0 }))]) : e), S = async () => {
32
+ let e = await g();
33
+ return e ? Promise.resolve(e.available()).catch(() => !1) : !1;
34
+ }, C = async (e, t = {}) => {
35
+ let n = c(), { signal: r, onProgress: i, key: a } = t;
36
+ r?.throwIfAborted();
37
+ let o = typeof Blob < "u" && e instanceof Blob, s = typeof ReadableStream < "u" && e instanceof ReadableStream;
38
+ if (!o && !s) throw p("notAFile");
39
+ let l = o ? e.size : t.size;
40
+ if (typeof l != "number" || !Number.isSafeInteger(l) || l < 0 || o && t.size !== void 0 && t.size !== l) throw p("badSize");
41
+ let u = await g();
42
+ if (!u) throw p("unavailable");
43
+ let d = await b(n);
44
+ r?.throwIfAborted();
45
+ let f = await x(Promise.resolve(u.put(e, {
46
+ size: l,
47
+ ...a === void 0 ? {} : { key: a },
48
+ accountPin: d,
49
+ ...r ? { signal: r } : {},
50
+ ...typeof i == "function" ? { onProgress: (e) => {
51
+ try {
52
+ i(e);
53
+ } catch {}
54
+ } } : {}
55
+ })).catch(_), r);
56
+ return v(f) ? y(f, r, n) : f;
57
+ }, w = (e, t, n) => {
58
+ let r = (t, n) => {
59
+ if (t === void 0) return n;
60
+ let r = Math.trunc(Number.isFinite(t) ? t : t > 0 ? e : -e);
61
+ return r < 0 ? Math.max(e + r, 0) : Math.min(r, e);
62
+ }, i = r(t, 0);
63
+ return {
64
+ from: i,
65
+ to: Math.max(i, r(n, e))
66
+ };
67
+ }, T = async (e, n, r = {}) => {
68
+ if (typeof e != "string") throw p("badUrl");
69
+ if (typeof n != "string") throw p("badKey");
70
+ let { signal: i } = r;
71
+ i?.throwIfAborted();
72
+ let a = async () => {
73
+ let r = await g();
74
+ if (!r) throw p("unavailable");
75
+ let a = t()?.epoch, o = await x(Promise.resolve(r.get(e, n, i ? { signal: i } : void 0)).catch(_), i);
76
+ return v(o) ? y(o, i) : {
77
+ handle: o,
78
+ epoch: a
79
+ };
80
+ }, o = await a(), s = async () => {
81
+ let e = t()?.epoch;
82
+ return o.epoch !== void 0 && e !== void 0 && e !== o.epoch && (o = await a()), o.handle;
83
+ }, c = (e, t) => {
84
+ let n;
85
+ return new ReadableStream({
86
+ pull: async (r) => {
87
+ try {
88
+ if (!n) {
89
+ let r = await s(), i = await Promise.resolve(r.read(e, t)).catch(_);
90
+ if (v(i)) return y(i);
91
+ n = i.getReader();
92
+ }
93
+ let { value: i, done: a } = await n.read();
94
+ a ? r.close() : r.enqueue(i);
95
+ } catch (e) {
96
+ throw h(e);
97
+ }
98
+ },
99
+ cancel: (e) => n?.cancel(e)
100
+ }, { highWaterMark: 0 });
101
+ }, l = (e, t) => ({
102
+ size: t - e,
103
+ stream: () => c(e, t),
104
+ arrayBuffer: async () => {
105
+ let n = new Uint8Array(t - e), r = c(e, t).getReader(), i = 0;
106
+ for (;;) {
107
+ let { value: e, done: t } = await r.read();
108
+ if (t) break;
109
+ n.set(e, i), i += e.length;
110
+ }
111
+ return n.buffer;
112
+ },
113
+ slice: (n, r) => {
114
+ let i = w(t - e, n, r);
115
+ return l(e + i.from, e + i.to);
116
+ }
117
+ });
118
+ return l(0, o.handle.size);
119
+ }, E = async (e = {}) => {
120
+ let t = c(), n = await g();
121
+ if (!n) throw p("unavailable");
122
+ let r = await b(t), { limit: i, cursor: a } = e, o = await Promise.resolve(n.list({
123
+ accountPin: r,
124
+ ...i === void 0 ? {} : { limit: i },
125
+ ...a === void 0 ? {} : { cursor: a }
126
+ })).catch(_);
127
+ return v(o) ? y(o, void 0, t) : o;
128
+ }, D = async (e) => {
129
+ let t = c();
130
+ if (typeof e != "string") throw p("badUrl");
131
+ let n = await g();
132
+ if (!n) throw p("unavailable");
133
+ let r = await b(t), i = await Promise.resolve(n.delete(e, { accountPin: r })).catch(_);
134
+ v(i) && y(i, void 0, t);
135
+ };
136
+ export { D as a, C as i, T as n, l as o, E as r, S as t };
@@ -0,0 +1,68 @@
1
+ import { It as StoredObject, Lt as StoredPage, Mt as StoragePutOptions, jt as StorageProgress, kt as StorageErrorCode } from "./contract-0rua6Wsh.js";
2
+ declare namespace storage_d_exports {
3
+ export { StorageError, StorageErrorCode, StorageProgress, StoragePutOptions, StoredBlob, StoredObject, StoredPage, available, remove as delete, get, list, put };
4
+ }
5
+ /** Thrown by every member of this namespace except on an aborted signal. Match on `code`, never on the message. */
6
+ type StorageError = Error & {
7
+ code: StorageErrorCode;
8
+ };
9
+ /**
10
+ * The bytes `get` opened, shaped like a `Blob`: `size`, `stream`, `arrayBuffer` and `slice`. Every read
11
+ * is by range and each 1 MiB record is checked before it is handed over, so a `slice` near the end of
12
+ * a large object fetches only that end.
13
+ */
14
+ type StoredBlob = {
15
+ /** the plaintext bytes of this blob, a slice's own length */
16
+ size: number;
17
+ /** errors with `integrity` on the first record that does not open under the key */
18
+ stream: () => ReadableStream<Uint8Array>;
19
+ arrayBuffer: () => Promise<ArrayBuffer>;
20
+ /** `Blob.slice`'s arguments, negative ones counted from the end, and the same shape back */
21
+ slice: (start?: number, end?: number) => StoredBlob;
22
+ };
23
+ /** Whether put, list and delete can run here now. `get` needs no account and does not depend on this. Answers rather than rejecting. */
24
+ declare const available: () => Promise<boolean>;
25
+ /**
26
+ * Seals the data in the broker and uploads it, then answers its url and the key that opens it: the
27
+ * app's own `key` unchanged, or the one the broker minted. Resolves once the object is `ready`. Needs
28
+ * a signed-in account, and counts the sealed size (28 bytes more per 1 MiB) against the account's
29
+ * storage from the moment it starts until the object is deleted or the upload is aborted. The account
30
+ * the call belongs to is the one this page is on when it is made, as for every storage call.
31
+ *
32
+ * `data` is a `Blob` (a `File` included) or a `ReadableStream<Uint8Array>` with its `size`. An upload
33
+ * survives the network dropping a part, not a reload: a reload starts the file again, and the upload
34
+ * left behind stops counting within the hour.
35
+ *
36
+ * Refused `invalid` for a stream without its size or one that delivers another, a file past the
37
+ * service's part ceiling, or a `key` that is not 32 bytes base64url; `denied` with no account; `quota`;
38
+ * `too-many` past the account's stored objects or this hour's uploads; `account-changed`.
39
+ */
40
+ declare const put: (data: Blob | ReadableStream<Uint8Array>, options?: StoragePutOptions) => Promise<StoredObject & {
41
+ key: string;
42
+ }>;
43
+ /**
44
+ * Opens an object any app stored, with no account: the broker reads its size from the first ranged
45
+ * answer and fetches the sealed bytes by range. Refused `invalid` for a url that names no stored object
46
+ * or a key that is not 32 bytes base64url, `not-found` for an object that was never made, was deleted
47
+ * or is still uploading (one answer for all of them). A wrong key shows on the first read, as
48
+ * `integrity`. A broker replaced while the object is held is asked to open it again on the next read.
49
+ */
50
+ declare const get: (url: string, key: string, options?: {
51
+ signal?: AbortSignal;
52
+ }) => Promise<StoredBlob>;
53
+ /**
54
+ * This app's objects, newest first, uploads in progress included: no key, which the service never
55
+ * holds. `limit` is 1 to 1,000 (1,000 by default), and `cursor` is the one a previous page answered;
56
+ * `invalid` otherwise.
57
+ */
58
+ declare const list: (options?: {
59
+ limit?: number;
60
+ cursor?: string;
61
+ }) => Promise<StoredPage>;
62
+ /**
63
+ * Deletes an object by its url: every later `get` of it answers `not-found`, and an upload in progress
64
+ * is aborted and stops counting. Only the app that stored it (the same app once it is verified)
65
+ * deletes it, `denied` otherwise. An object already gone resolves.
66
+ */
67
+ declare const remove: (url: string) => Promise<void>;
68
+ export { list as a, storage_d_exports as c, get as i, StoredBlob as n, put as o, available as r, remove as s, StorageError as t };
package/storage.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-CrUO33y-.cjs"),n=require("./contract.cjs"),r=require("./account-generation-BiZxPztj.cjs"),i=require("./account-storage-DpHBgeX5.cjs");var a=e.t({available:()=>v,delete:()=>C,get:()=>x,list:()=>S,put:()=>y}),o=new Map(Object.values(n.STORAGE_REFUSALS).map(({code:e,message:t})=>[t,e])),s=new Set(o.values()),c=(e,t)=>Object.assign(Error(t),{code:e}),l=e=>c(n.STORAGE_REFUSALS[e].code,n.STORAGE_REFUSALS[e].message),u=e=>e instanceof Error&&s.has(e.code),d=e=>{if(u(e))return e;let t=e instanceof Error?e.message:``,n=o.get(t);return n?c(n,t):l(`unavailable`)},f=async()=>{if(!t.l)return;let e=(await t.s(`storage`).catch(()=>void 0))?.storage;return typeof e?.put==`function`?e:void 0},p=()=>{throw l(`unavailable`)},m=e=>typeof e==`object`&&!!e&&typeof e.error==`string`&&typeof e.message==`string`,h=(e,t,n)=>{throw e.error===`aborted`?t?.reason??new DOMException(`The operation was aborted.`,`AbortError`):(e.error===`account-changed`&&n&&r.r(n.generation),s.has(e.error)?c(e.error,e.message):l(`unavailable`))},g=async e=>{try{return await i.m(e)}catch(e){throw i.l(e)?l(`accountChanged`):e instanceof Error&&/not connected|not signed in/i.test(e.message)?l(`needsAccount`):l(`unavailable`)}},_=(e,t)=>(e.catch(()=>{}),t?Promise.race([e,new Promise((e,n)=>t.addEventListener(`abort`,()=>n(t.reason),{once:!0}))]):e),v=async()=>{let e=await f();return e?Promise.resolve(e.available()).catch(()=>!1):!1},y=async(e,t={})=>{let n=i.s(),{signal:r,onProgress:a,key:o}=t;r?.throwIfAborted();let s=typeof Blob<`u`&&e instanceof Blob,c=typeof ReadableStream<`u`&&e instanceof ReadableStream;if(!s&&!c)throw l(`notAFile`);let u=s?e.size:t.size;if(typeof u!=`number`||!Number.isSafeInteger(u)||u<0||s&&t.size!==void 0&&t.size!==u)throw l(`badSize`);let d=await f();if(!d)throw l(`unavailable`);let v=await g(n);r?.throwIfAborted();let y=await _(Promise.resolve(d.put(e,{size:u,...o===void 0?{}:{key:o},accountPin:v,...r?{signal:r}:{},...typeof a==`function`?{onProgress:e=>{try{a(e)}catch{}}}:{}})).catch(p),r);return m(y)?h(y,r,n):y},b=(e,t,n)=>{let r=(t,n)=>{if(t===void 0)return n;let r=Math.trunc(Number.isFinite(t)?t:t>0?e:-e);return r<0?Math.max(e+r,0):Math.min(r,e)},i=r(t,0);return{from:i,to:Math.max(i,r(n,e))}},x=async(e,n,r={})=>{if(typeof e!=`string`)throw l(`badUrl`);if(typeof n!=`string`)throw l(`badKey`);let{signal:i}=r;i?.throwIfAborted();let a=async()=>{let r=await f();if(!r)throw l(`unavailable`);let a=t.c()?.epoch,o=await _(Promise.resolve(r.get(e,n,i?{signal:i}:void 0)).catch(p),i);return m(o)?h(o,i):{handle:o,epoch:a}},o=await a(),s=async()=>{let e=t.c()?.epoch;return o.epoch!==void 0&&e!==void 0&&e!==o.epoch&&(o=await a()),o.handle},c=(e,t)=>{let n;return new ReadableStream({pull:async r=>{try{if(!n){let r=await s(),i=await Promise.resolve(r.read(e,t)).catch(p);if(m(i))return h(i);n=i.getReader()}let{value:i,done:a}=await n.read();a?r.close():r.enqueue(i)}catch(e){throw d(e)}},cancel:e=>n?.cancel(e)},{highWaterMark:0})},u=(e,t)=>({size:t-e,stream:()=>c(e,t),arrayBuffer:async()=>{let n=new Uint8Array(t-e),r=c(e,t).getReader(),i=0;for(;;){let{value:e,done:t}=await r.read();if(t)break;n.set(e,i),i+=e.length}return n.buffer},slice:(n,r)=>{let i=b(t-e,n,r);return u(e+i.from,e+i.to)}});return u(0,o.handle.size)},S=async(e={})=>{let t=i.s(),n=await f();if(!n)throw l(`unavailable`);let r=await g(t),{limit:a,cursor:o}=e,s=await Promise.resolve(n.list({accountPin:r,...a===void 0?{}:{limit:a},...o===void 0?{}:{cursor:o}})).catch(p);return m(s)?h(s,void 0,t):s},C=async e=>{let t=i.s();if(typeof e!=`string`)throw l(`badUrl`);let n=await f();if(!n)throw l(`unavailable`);let r=await g(t),a=await Promise.resolve(n.delete(e,{accountPin:r})).catch(p);m(a)&&h(a,void 0,t)};exports.available=v,exports.delete=C,exports.get=x,exports.list=S,exports.put=y,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./storage-BCjYihUO.cjs");exports.available=e.t,exports.delete=e.a,exports.get=e.n,exports.list=e.r,exports.put=e.i;
package/storage.d.ts CHANGED
@@ -1,69 +1,3 @@
1
- import { It as StoredObject, Lt as StoredPage, Mt as StoragePutOptions, jt as StorageProgress, kt as StorageErrorCode } from "./contract-BGMJVvTg.js";
2
- declare namespace storage_d_exports {
3
- export { StorageError, StorageErrorCode, StorageProgress, StoragePutOptions, StoredBlob, StoredObject, StoredPage, available, remove as delete, get, list, put };
4
- }
5
- /** Thrown by every member of this namespace except on an aborted signal. Match on `code`, never on the message. */
6
- export type StorageError = Error & {
7
- code: StorageErrorCode;
8
- };
9
- /**
10
- * The bytes `get` opened, shaped like a `Blob`: `size`, `stream`, `arrayBuffer` and `slice`. Every read
11
- * is by range and each 1 MiB record is checked before it is handed over, so a `slice` near the end of
12
- * a large object fetches only that end.
13
- */
14
- export type StoredBlob = {
15
- /** the plaintext bytes of this blob, a slice's own length */
16
- size: number;
17
- /** errors with `integrity` on the first record that does not open under the key */
18
- stream: () => ReadableStream<Uint8Array>;
19
- arrayBuffer: () => Promise<ArrayBuffer>;
20
- /** `Blob.slice`'s arguments, negative ones counted from the end, and the same shape back */
21
- slice: (start?: number, end?: number) => StoredBlob;
22
- };
23
- /** Whether put, list and delete can run here now. `get` needs no account and does not depend on this. Answers rather than rejecting. */
24
- export declare const available: () => Promise<boolean>;
25
- /**
26
- * Seals the data in the broker and uploads it, then answers its url and the key that opens it: the
27
- * app's own `key` unchanged, or the one the broker minted. Resolves once the object is `ready`. Needs
28
- * a signed-in account, and counts the sealed size (28 bytes more per 1 MiB) against the account's
29
- * storage from the moment it starts until the object is deleted or the upload is aborted. The account
30
- * the call belongs to is the one this page is on when it is made, as for every storage call.
31
- *
32
- * `data` is a `Blob` (a `File` included) or a `ReadableStream<Uint8Array>` with its `size`. An upload
33
- * survives the network dropping a part, not a reload: a reload starts the file again, and the upload
34
- * left behind stops counting within the hour.
35
- *
36
- * Refused `invalid` for a stream without its size or one that delivers another, a file past the
37
- * service's part ceiling, or a `key` that is not 32 bytes base64url; `denied` with no account; `quota`;
38
- * `too-many` past the account's stored objects or this hour's uploads; `account-changed`.
39
- */
40
- export declare const put: (data: Blob | ReadableStream<Uint8Array>, options?: StoragePutOptions) => Promise<StoredObject & {
41
- key: string;
42
- }>;
43
- /**
44
- * Opens an object any app stored, with no account: the broker reads its size from the first ranged
45
- * answer and fetches the sealed bytes by range. Refused `invalid` for a url that names no stored object
46
- * or a key that is not 32 bytes base64url, `not-found` for an object that was never made, was deleted
47
- * or is still uploading (one answer for all of them). A wrong key shows on the first read, as
48
- * `integrity`. A broker replaced while the object is held is asked to open it again on the next read.
49
- */
50
- export declare const get: (url: string, key: string, options?: {
51
- signal?: AbortSignal;
52
- }) => Promise<StoredBlob>;
53
- /**
54
- * This app's objects, newest first, uploads in progress included: no key, which the service never
55
- * holds. `limit` is 1 to 1,000 (1,000 by default), and `cursor` is the one a previous page answered;
56
- * `invalid` otherwise.
57
- */
58
- export declare const list: (options?: {
59
- limit?: number;
60
- cursor?: string;
61
- }) => Promise<StoredPage>;
62
- /**
63
- * Deletes an object by its url: every later `get` of it answers `not-found`, and an upload in progress
64
- * is aborted and stops counting. Only the app that stored it (the same app once it is verified)
65
- * deletes it, `denied` otherwise. An object already gone resolves.
66
- */
67
- declare const remove: (url: string) => Promise<void>;
68
- //#endregion
69
- export { type StorageErrorCode, type StorageProgress, type StoragePutOptions, type StoredObject, type StoredPage, remove as delete, storage_d_exports as t };
1
+ import { It as StoredObject, Lt as StoredPage, Mt as StoragePutOptions, jt as StorageProgress, kt as StorageErrorCode } from "./contract-0rua6Wsh.js";
2
+ import { a as list, i as get, n as StoredBlob, o as put, r as available, s as remove, t as StorageError } from "./storage-DpCLksAa.js";
3
+ export { StorageError, type StorageErrorCode, type StorageProgress, type StoragePutOptions, StoredBlob, type StoredObject, type StoredPage, available, remove as delete, get, list, put };