alinea 2.0.0-preview.0 → 2.0.0-preview.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.
Files changed (125) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/LICENSES.md +116 -89
  3. package/dist/backend/Handler.js +17 -14
  4. package/dist/backend/router/Router.d.ts +1 -0
  5. package/dist/backend/router/Router.js +21 -15
  6. package/dist/bundled.d.ts +114 -39
  7. package/dist/chunks/chunk-6UT4N4CO.js +919 -0
  8. package/dist/chunks/{chunk-EQ3TDHYD.js → chunk-FRYHNUEK.js} +1 -1
  9. package/dist/cli/Serve.js +1 -1
  10. package/dist/cli/bin.js +1 -1
  11. package/dist/cli/generate/CompileConfig.js +3 -2
  12. package/dist/cloud/CloudRemote.d.ts +2 -1
  13. package/dist/cloud/CloudRemote.js +3 -2
  14. package/dist/components/Calendar.js +6 -6
  15. package/dist/components/Checkbox.js +3 -3
  16. package/dist/components/ComboBox.js +9 -9
  17. package/dist/components/DatePicker.js +3 -3
  18. package/dist/components/DateRangePicker.js +5 -5
  19. package/dist/components/Disclosure.js +5 -5
  20. package/dist/components/Label.js +4 -4
  21. package/dist/components/List.js +33 -33
  22. package/dist/components/Menu.js +3 -3
  23. package/dist/components/Modal.js +3 -3
  24. package/dist/components/MultipleSelect.js +26 -26
  25. package/dist/components/NumberField.js +4 -4
  26. package/dist/components/ProgressCircle.js +3 -3
  27. package/dist/components/RadioGroup.js +2 -2
  28. package/dist/components/SearchField.js +9 -9
  29. package/dist/components/Select.js +7 -7
  30. package/dist/components/Surface.js +3 -3
  31. package/dist/components/Switch.js +2 -2
  32. package/dist/components/Table.js +5 -5
  33. package/dist/components/Tabs.js +1 -1
  34. package/dist/components/TagGroup.js +2 -2
  35. package/dist/components/TextField.js +4 -4
  36. package/dist/components/TimeField.js +2 -2
  37. package/dist/components/Toggle.js +2 -2
  38. package/dist/components/Toolbar.js +3 -3
  39. package/dist/components/Tooltip.js +3 -3
  40. package/dist/components/Tree.js +5 -5
  41. package/dist/core/BlobTransport.d.ts +5 -0
  42. package/dist/core/BlobTransport.js +79 -0
  43. package/dist/core/Client.d.ts +2 -1
  44. package/dist/core/Client.js +14 -10
  45. package/dist/core/Connection.d.ts +2 -1
  46. package/dist/core/Type.d.ts +7 -1
  47. package/dist/core/db/EntryIndex.d.ts +2 -2
  48. package/dist/core/db/EntryIndex.js +14 -13
  49. package/dist/core/db/EntryTransaction.js +4 -9
  50. package/dist/core/db/LocalDB.d.ts +3 -2
  51. package/dist/core/db/LocalDB.js +14 -4
  52. package/dist/core/field/RichTextField.js +2 -18
  53. package/dist/core/media/MediaLocation.d.ts +5 -2
  54. package/dist/core/media/MediaLocation.js +6 -7
  55. package/dist/core/media/MediaTypes.js +11 -0
  56. package/dist/core/source/CombinedSource.d.ts +2 -2
  57. package/dist/core/source/CombinedSource.js +6 -3
  58. package/dist/core/source/FSSource.d.ts +4 -3
  59. package/dist/core/source/FSSource.js +59 -27
  60. package/dist/core/source/GithubSource.d.ts +2 -2
  61. package/dist/core/source/GithubSource.js +21 -9
  62. package/dist/core/source/IndexedDBSource.d.ts +2 -2
  63. package/dist/core/source/IndexedDBSource.js +3 -1
  64. package/dist/core/source/MemorySource.d.ts +2 -2
  65. package/dist/core/source/MemorySource.js +3 -1
  66. package/dist/core/source/Source.d.ts +4 -1
  67. package/dist/core/util/Async.d.ts +8 -2
  68. package/dist/core/util/Async.js +67 -0
  69. package/dist/core/util/EntryFilenames.d.ts +2 -2
  70. package/dist/core/util/EntryFilenames.js +3 -3
  71. package/dist/dashboard/App.js +3 -3
  72. package/dist/dashboard/app/AccessDenied.js +4 -4
  73. package/dist/dashboard/app/ActivityStatus.js +9 -9
  74. package/dist/dashboard/app/AppShell.js +2 -2
  75. package/dist/dashboard/app/AuthView.js +12 -12
  76. package/dist/dashboard/app/Badge.js +2 -2
  77. package/dist/dashboard/app/CompactField.js +7 -7
  78. package/dist/dashboard/app/DashboardErrorBoundary.js +5 -5
  79. package/dist/dashboard/app/EntryHeader.js +8 -8
  80. package/dist/dashboard/app/EntryReferences.js +8 -8
  81. package/dist/dashboard/app/EntrySidebar.js +14 -14
  82. package/dist/dashboard/app/EntrySidebarPreview.js +10 -10
  83. package/dist/dashboard/app/EntryTranslationBanner.js +9 -9
  84. package/dist/dashboard/app/Explorer.js +54 -46
  85. package/dist/dashboard/app/ExplorerCards.js +31 -31
  86. package/dist/dashboard/app/ExplorerFileCard.js +17 -17
  87. package/dist/dashboard/app/ExplorerList.js +10 -10
  88. package/dist/dashboard/app/ExplorerModal.js +5 -5
  89. package/dist/dashboard/app/ExplorerTable.js +63 -48
  90. package/dist/dashboard/app/LinkPicker.js +3 -3
  91. package/dist/dashboard/app/LocaleMenu.js +4 -4
  92. package/dist/dashboard/app/SidebarTree.js +43 -43
  93. package/dist/dashboard/app/WorkspaceMenu.js +11 -11
  94. package/dist/dashboard/app/WorkspaceRoots.js +24 -24
  95. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -1
  96. package/dist/dashboard/app/editor/FileEditor.js +40 -30
  97. package/dist/dashboard/app/editor/FilePreview.js +5 -5
  98. package/dist/dashboard/app/modals/CreateEntry.js +4 -4
  99. package/dist/dashboard/app/pages/EntryPage.js +21 -19
  100. package/dist/dashboard/app/pages/UsersPage.js +33 -33
  101. package/dist/dashboard/app/ui/DashboardModal.js +19 -19
  102. package/dist/dashboard/app/ui/Rail.js +3 -3
  103. package/dist/dashboard/app/ui/Sidebar.js +1 -1
  104. package/dist/dashboard/atoms/entry.d.ts +45 -1
  105. package/dist/dashboard/atoms/entry.js +167 -2
  106. package/dist/dashboard/atoms/explorer.js +1 -1
  107. package/dist/dashboard/atoms/root.d.ts +4 -1
  108. package/dist/dashboard/atoms/root.js +96 -157
  109. package/dist/field/code/CodeField.view.js +10 -10
  110. package/dist/field/link/FileLink.d.ts +2 -2
  111. package/dist/field/link/FileLink.js +5 -3
  112. package/dist/field/link/ImageLink.d.ts +1 -1
  113. package/dist/field/link/ImageLink.js +1 -1
  114. package/dist/field/link/LinkField.view.js +111 -95
  115. package/dist/field/list/ListField.view.js +14 -14
  116. package/dist/field/metadata/MetadataField.view.js +18 -18
  117. package/dist/field/richtext/RichTextExtensions.js +18 -18
  118. package/dist/field/richtext/RichTextField.view.js +2 -2
  119. package/dist/field/richtext/RichTextInsertMenu.js +2 -2
  120. package/dist/index.css +8 -2
  121. package/dist/picker/entry/EntryPicker.js +9 -35
  122. package/dist/preview/PreviewPayload.js +35 -250
  123. package/package.json +1 -1
  124. package/dist/cli/util/ExternalPlugin.d.ts +0 -2
  125. package/dist/cli/util/ExternalPlugin.js +0 -919
@@ -1,5 +1,5 @@
1
1
  {
2
- "_id": "3ILxfpG8awCRztjREry6a4aMPXT",
2
+ "_id": "3ISJqzspZnQ0LXWCDRtPXYjlfWD",
3
3
  "_type": "Page",
4
4
  "_index": "a0",
5
5
  "_seeded": "welcome.json",
package/dist/LICENSES.md CHANGED
@@ -28,7 +28,34 @@ SOFTWARE.
28
28
 
29
29
  ===
30
30
 
31
- # react-aria-components@1.17.0 (Apache-2.0)
31
+ # microcbor@1.2.1 (MIT)
32
+
33
+ MIT License
34
+
35
+ Copyright (c) 2021 Joel Gustafson
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in all
45
+ copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
53
+ SOFTWARE.
54
+
55
+
56
+ ===
57
+
58
+ # react-stately@3.46.0 (Apache-2.0)
32
59
 
33
60
  Apache License
34
61
  Version 2.0, January 2004
@@ -233,33 +260,6 @@ SOFTWARE.
233
260
  limitations under the License.
234
261
 
235
262
 
236
- ===
237
-
238
- # lib0@0.2.88 (MIT)
239
-
240
- The MIT License (MIT)
241
-
242
- Copyright (c) 2019 Kevin Jahns <kevin.jahns@protonmail.com>.
243
-
244
- Permission is hereby granted, free of charge, to any person obtaining a copy
245
- of this software and associated documentation files (the "Software"), to deal
246
- in the Software without restriction, including without limitation the rights
247
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
248
- copies of the Software, and to permit persons to whom the Software is
249
- furnished to do so, subject to the following conditions:
250
-
251
- The above copyright notice and this permission notice shall be included in all
252
- copies or substantial portions of the Software.
253
-
254
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
255
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
256
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
257
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
258
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
259
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
260
- SOFTWARE.
261
-
262
-
263
263
  ===
264
264
 
265
265
  # @internationalized/date@3.12.1 (Apache-2.0)
@@ -469,34 +469,7 @@ SOFTWARE.
469
469
 
470
470
  ===
471
471
 
472
- # jotai-location@0.6.2 (MIT)
473
-
474
- The MIT License (MIT)
475
-
476
- Copyright (c) 2022 Daishi Kato
477
-
478
- Permission is hereby granted, free of charge, to any person obtaining a copy
479
- of this software and associated documentation files (the "Software"), to deal
480
- in the Software without restriction, including without limitation the rights
481
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
482
- copies of the Software, and to permit persons to whom the Software is
483
- furnished to do so, subject to the following conditions:
484
-
485
- The above copyright notice and this permission notice shall be included in
486
- all copies or substantial portions of the Software.
487
-
488
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
489
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
490
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
491
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
492
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
493
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
494
- THE SOFTWARE.
495
-
496
-
497
- ===
498
-
499
- # react-stately@3.46.0 (Apache-2.0)
472
+ # react-aria-components@1.17.0 (Apache-2.0)
500
473
 
501
474
  Apache License
502
475
  Version 2.0, January 2004
@@ -701,6 +674,60 @@ THE SOFTWARE.
701
674
  limitations under the License.
702
675
 
703
676
 
677
+ ===
678
+
679
+ # jotai-location@0.6.2 (MIT)
680
+
681
+ The MIT License (MIT)
682
+
683
+ Copyright (c) 2022 Daishi Kato
684
+
685
+ Permission is hereby granted, free of charge, to any person obtaining a copy
686
+ of this software and associated documentation files (the "Software"), to deal
687
+ in the Software without restriction, including without limitation the rights
688
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
689
+ copies of the Software, and to permit persons to whom the Software is
690
+ furnished to do so, subject to the following conditions:
691
+
692
+ The above copyright notice and this permission notice shall be included in
693
+ all copies or substantial portions of the Software.
694
+
695
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
696
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
697
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
698
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
699
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
700
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
701
+ THE SOFTWARE.
702
+
703
+
704
+ ===
705
+
706
+ # @badgateway/oauth2-client@3.3.1 (MIT)
707
+
708
+ MIT License
709
+
710
+ Copyright (c) 2019-2025 Evert Pot
711
+
712
+ Permission is hereby granted, free of charge, to any person obtaining a copy
713
+ of this software and associated documentation files (the "Software"), to deal
714
+ in the Software without restriction, including without limitation the rights
715
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
716
+ copies of the Software, and to permit persons to whom the Software is
717
+ furnished to do so, subject to the following conditions:
718
+
719
+ The above copyright notice and this permission notice shall be included in all
720
+ copies or substantial portions of the Software.
721
+
722
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
723
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
724
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
725
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
726
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
727
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
728
+ SOFTWARE.
729
+
730
+
704
731
  ===
705
732
 
706
733
  # react-aria@3.48.0 (Apache-2.0)
@@ -910,11 +937,38 @@ THE SOFTWARE.
910
937
 
911
938
  ===
912
939
 
913
- # @badgateway/oauth2-client@3.3.1 (MIT)
940
+ # @tiptap/core@3.27.3 (MIT)
914
941
 
915
942
  MIT License
916
943
 
917
- Copyright (c) 2019-2025 Evert Pot
944
+ Copyright (c) 2025, Tiptap GmbH
945
+
946
+ Permission is hereby granted, free of charge, to any person obtaining a copy
947
+ of this software and associated documentation files (the "Software"), to deal
948
+ in the Software without restriction, including without limitation the rights
949
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
950
+ copies of the Software, and to permit persons to whom the Software is
951
+ furnished to do so, subject to the following conditions:
952
+
953
+ The above copyright notice and this permission notice shall be included in all
954
+ copies or substantial portions of the Software.
955
+
956
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
957
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
958
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
959
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
960
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
961
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
962
+ SOFTWARE.
963
+
964
+
965
+ ===
966
+
967
+ # fp16@1.0.0 (MIT)
968
+
969
+ MIT License
970
+
971
+ Copyright (c) 2021 Joel Gustafson
918
972
 
919
973
  Permission is hereby granted, free of charge, to any person obtaining a copy
920
974
  of this software and associated documentation files (the "Software"), to deal
@@ -960,11 +1014,11 @@ IN THE SOFTWARE.
960
1014
 
961
1015
  ===
962
1016
 
963
- # @tiptap/core@3.27.3 (MIT)
1017
+ # use-sync-external-store@1.6.0 (MIT)
964
1018
 
965
1019
  MIT License
966
1020
 
967
- Copyright (c) 2025, Tiptap GmbH
1021
+ Copyright (c) Meta Platforms, Inc. and affiliates.
968
1022
 
969
1023
  Permission is hereby granted, free of charge, to any person obtaining a copy
970
1024
  of this software and associated documentation files (the "Software"), to deal
@@ -1019,33 +1073,6 @@ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRE
1019
1073
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1020
1074
 
1021
1075
 
1022
- ===
1023
-
1024
- # use-sync-external-store@1.6.0 (MIT)
1025
-
1026
- MIT License
1027
-
1028
- Copyright (c) Meta Platforms, Inc. and affiliates.
1029
-
1030
- Permission is hereby granted, free of charge, to any person obtaining a copy
1031
- of this software and associated documentation files (the "Software"), to deal
1032
- in the Software without restriction, including without limitation the rights
1033
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1034
- copies of the Software, and to permit persons to whom the Software is
1035
- furnished to do so, subject to the following conditions:
1036
-
1037
- The above copyright notice and this permission notice shall be included in all
1038
- copies or substantial portions of the Software.
1039
-
1040
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1041
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1042
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1043
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1044
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1045
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1046
- SOFTWARE.
1047
-
1048
-
1049
1076
  ===
1050
1077
 
1051
1078
  # entities@4.5.0 (BSD-2-Clause)
@@ -1082,7 +1109,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1082
1109
 
1083
1110
  ===
1084
1111
 
1085
- # @internationalized/number@3.6.6 (Apache-2.0)
1112
+ # @internationalized/string@3.2.8 (Apache-2.0)
1086
1113
 
1087
1114
  Apache License
1088
1115
  Version 2.0, January 2004
@@ -1289,7 +1316,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1289
1316
 
1290
1317
  ===
1291
1318
 
1292
- # @internationalized/string@3.2.8 (Apache-2.0)
1319
+ # @internationalized/number@3.6.6 (Apache-2.0)
1293
1320
 
1294
1321
  Apache License
1295
1322
  Version 2.0, January 2004
@@ -13,6 +13,10 @@ import "../chunks/chunk-CQ52GEHY.js";
13
13
  // src/backend/Handler.ts
14
14
  import { JWTPreviews } from "alinea/backend/util/JWTPreviews";
15
15
  import { CloudRemote } from "alinea/cloud/CloudRemote";
16
+ import {
17
+ BLOB_SEQUENCE_CONTENT_TYPE,
18
+ encodeBlobSequence
19
+ } from "alinea/core/BlobTransport";
16
20
  import { ErrorCode, HttpError } from "alinea/core/HttpError";
17
21
  import { assertUploadSize } from "alinea/core/media/UploadLimits";
18
22
  import { Permission, Policy } from "alinea/core/Role";
@@ -23,6 +27,7 @@ import { isRecord } from "alinea/core/util/Objects";
23
27
  import { InvalidCredentialsError, MissingCredentialsError } from "./Auth.js";
24
28
  import { HandleAction } from "./HandleAction.js";
25
29
  import { createPreviewParser } from "./resolver/ParsePreview.js";
30
+ import { compressResponse } from "./router/Router.js";
26
31
  import { createThrottledSync } from "./util/Syncable.js";
27
32
  var PrepareBody = object({
28
33
  filename: string,
@@ -210,7 +215,7 @@ function createHandler({
210
215
  const sha = string(url.searchParams.get("sha"));
211
216
  await local.syncWith(cnx);
212
217
  const tree = await local.getTreeIfDifferent(sha);
213
- return Response.json(tree ?? null);
218
+ return compressResponse(request, Response.json(tree ?? null));
214
219
  }
215
220
  if (action === HandleAction.Blob && request.method === "POST") {
216
221
  const { shas } = object({ shas: array(string) })(await body);
@@ -222,20 +227,18 @@ function createHandler({
222
227
  if (tree.hasSha(sha)) fromLocal.push(sha);
223
228
  else fromRemote.push(sha);
224
229
  }
225
- const formData = new FormData();
226
- if (fromLocal.length > 0) {
227
- const blobs = local.source.getBlobs(fromLocal);
228
- for await (const [sha, blob] of blobs) {
229
- formData.append(sha, new Blob([blob]));
230
- }
231
- }
232
- if (fromRemote.length > 0) {
233
- const blobs = cnx.getBlobs(fromRemote);
234
- for await (const [sha, blob] of blobs) {
235
- formData.append(sha, new Blob([blob]));
236
- }
230
+ async function* blobs() {
231
+ const options = { signal: request.signal };
232
+ if (fromLocal.length > 0)
233
+ yield* local.source.getBlobs(fromLocal, options);
234
+ if (fromRemote.length > 0) yield* cnx.getBlobs(fromRemote, options);
237
235
  }
238
- return new Response(formData);
236
+ return compressResponse(
237
+ request,
238
+ new Response(encodeBlobSequence(blobs()), {
239
+ headers: { "content-type": BLOB_SEQUENCE_CONTENT_TYPE }
240
+ })
241
+ );
239
242
  }
240
243
  if (action === HandleAction.Upload) {
241
244
  const user = expectUser();
@@ -144,4 +144,5 @@ export declare namespace router {
144
144
  function cookie(...cookies: Array<Cookie>): string;
145
145
  function compress(...routes: Array<Next<Request, Response | undefined>>): Route<Request, Response | undefined>;
146
146
  }
147
+ export declare function compressResponse(request: Request, response: Response): Response;
147
148
  export {};
@@ -186,27 +186,33 @@ function callHandler(handler, input) {
186
186
  async (request) => {
187
187
  const response = await route.handle(request);
188
188
  if (response === void 0) return void 0;
189
- const body = response.body;
190
- if (!body) return response;
191
- const isCompressed = response.headers.get("content-encoding");
192
- if (isCompressed) return response;
193
- const accept = request.headers.get("accept-encoding");
194
- const method = accept?.includes("gzip") ? "gzip" : accept?.includes("deflate") ? "deflate" : void 0;
195
- if (method === void 0) return response;
196
- const stream = body.pipeThrough(new CompressionStream(method));
197
- const headers = new Headers(response.headers);
198
- headers.set("content-encoding", method);
199
- headers.delete("content-length");
200
- return new Response(stream, {
201
- headers,
202
- status: response.status
203
- });
189
+ return compressResponse(request, response);
204
190
  }
205
191
  );
206
192
  }
207
193
  router2.compress = compress;
208
194
  })(router || (router = {}));
195
+ function compressResponse(request, response) {
196
+ const body = response.body;
197
+ if (!body) return response;
198
+ const isCompressed = response.headers.get("content-encoding");
199
+ if (isCompressed) return response;
200
+ const accept = request.headers.get("accept-encoding");
201
+ const method = accept?.includes("gzip") ? "gzip" : accept?.includes("deflate") ? "deflate" : void 0;
202
+ if (method === void 0) return response;
203
+ const stream = body.pipeThrough(new CompressionStream(method));
204
+ const headers = new Headers(response.headers);
205
+ headers.set("content-encoding", method);
206
+ headers.set("vary", "accept-encoding");
207
+ headers.delete("content-length");
208
+ return new Response(stream, {
209
+ headers,
210
+ status: response.status,
211
+ statusText: response.statusText
212
+ });
213
+ }
209
214
  export {
210
215
  Route,
216
+ compressResponse,
211
217
  router
212
218
  };