@waffle-os/runtime 0.0.151 → 0.0.152
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/browser/service-worker.ts +18 -3
- package/dist/browser/service-worker.js +9 -3
- package/dist/fs/multitab-backend.js +303 -97
- package/dist/fs/multitab-protocol.js +2 -0
- package/dist/fs/service.js +25 -3
- package/dist/tooling/program/program-transformer.json +1 -1
- package/fs/backend.ts +6 -1
- package/fs/multitab-backend.ts +385 -105
- package/fs/multitab-protocol.ts +11 -0
- package/fs/service.ts +28 -6
- package/package.json +1 -1
- package/tooling/program/program-transformer.json +1 -1
package/fs/multitab-protocol.ts
CHANGED
|
@@ -340,6 +340,12 @@ export type PeerMessage =
|
|
|
340
340
|
readonly totalBytes: number;
|
|
341
341
|
readonly chunk: Uint8Array;
|
|
342
342
|
}
|
|
343
|
+
| {
|
|
344
|
+
readonly kind: "chunk-abort";
|
|
345
|
+
readonly hostTerm: string;
|
|
346
|
+
readonly sessionId: string;
|
|
347
|
+
readonly uploadId: string;
|
|
348
|
+
}
|
|
343
349
|
| {
|
|
344
350
|
readonly kind: "chunk-get";
|
|
345
351
|
readonly hostTerm: string;
|
|
@@ -378,6 +384,7 @@ export type PeerMessage =
|
|
|
378
384
|
readonly pendingWatchAcks?: readonly (readonly [number, boolean])[];
|
|
379
385
|
readonly pendingUnpins?: readonly number[];
|
|
380
386
|
readonly pendingWatchCloses?: readonly number[];
|
|
387
|
+
readonly pendingUploadAborts?: readonly string[];
|
|
381
388
|
}
|
|
382
389
|
| {
|
|
383
390
|
readonly kind: "pong";
|
|
@@ -389,6 +396,7 @@ export type PeerMessage =
|
|
|
389
396
|
readonly settledWatchAcks?: readonly number[];
|
|
390
397
|
readonly settledUnpins?: readonly number[];
|
|
391
398
|
readonly settledWatchCloses?: readonly number[];
|
|
399
|
+
readonly settledUploadAborts?: readonly string[];
|
|
392
400
|
readonly creditLimit: PeerCreditLimit;
|
|
393
401
|
readonly hostState: HostHealthState;
|
|
394
402
|
}
|
|
@@ -430,6 +438,7 @@ export type PeerMessage =
|
|
|
430
438
|
readonly watchAcks?: readonly number[];
|
|
431
439
|
readonly unpins?: readonly number[];
|
|
432
440
|
readonly watchCloses?: readonly number[];
|
|
441
|
+
readonly uploadAborts?: readonly string[];
|
|
433
442
|
}
|
|
434
443
|
| {
|
|
435
444
|
readonly kind: "detach";
|
|
@@ -534,6 +543,8 @@ export function isPeerMessage(value: unknown): value is PeerMessage {
|
|
|
534
543
|
typeof value.totalBytes === "number" &&
|
|
535
544
|
value.chunk instanceof Uint8Array
|
|
536
545
|
);
|
|
546
|
+
case "chunk-abort":
|
|
547
|
+
return typeof value.uploadId === "string";
|
|
537
548
|
case "chunk-get":
|
|
538
549
|
return (
|
|
539
550
|
typeof value.reqId === "number" &&
|
package/fs/service.ts
CHANGED
|
@@ -1169,18 +1169,40 @@ export class FilesystemService {
|
|
|
1169
1169
|
return;
|
|
1170
1170
|
}
|
|
1171
1171
|
if (operation === "flush" || operation === "sync") {
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
this.
|
|
1172
|
+
const target = operation === "sync" ? a : typeof a === "string" ? a : undefined;
|
|
1173
|
+
if (operation === "sync") this.backend.retain(a);
|
|
1174
|
+
let flushing: Promise<void> | undefined;
|
|
1175
|
+
try {
|
|
1176
|
+
flushing = this.backend.flush?.(target);
|
|
1177
|
+
} catch (error) {
|
|
1178
|
+
if (operation === "sync") this.backend.release(a);
|
|
1179
|
+
throw error;
|
|
1180
|
+
}
|
|
1181
|
+
return this.trackRequestWork(session, Promise.resolve(flushing)).then(
|
|
1182
|
+
() => {
|
|
1183
|
+
if (operation === "sync") this.backend.release(a);
|
|
1184
|
+
return this.finishResult(session, id, operation, operation === "sync" ? 0 : undefined);
|
|
1185
|
+
},
|
|
1186
|
+
(error) => {
|
|
1187
|
+
if (operation === "sync") this.backend.release(a);
|
|
1188
|
+
throw error;
|
|
1189
|
+
},
|
|
1177
1190
|
);
|
|
1178
1191
|
}
|
|
1179
1192
|
if (operation === "resolve" && session.socketScope && this.backend instanceof MemoryBackend) {
|
|
1180
1193
|
const result = this.backend.fs.resolveSocket(a, b, c === true);
|
|
1181
1194
|
return this.finishResult(session, id, operation, result, args);
|
|
1182
1195
|
}
|
|
1183
|
-
const
|
|
1196
|
+
const isCancelled = () => {
|
|
1197
|
+
const pending = session.pending.get(id);
|
|
1198
|
+
return (
|
|
1199
|
+
!pending ||
|
|
1200
|
+
sessionRevoked(session) ||
|
|
1201
|
+
!this.sessions.has(session) ||
|
|
1202
|
+
requestCancelled(pending)
|
|
1203
|
+
);
|
|
1204
|
+
};
|
|
1205
|
+
const result = this.backend.execute(operation, args, data, isCancelled);
|
|
1184
1206
|
if (result instanceof Promise)
|
|
1185
1207
|
return this.trackRequestWork(session, result).then((value) =>
|
|
1186
1208
|
this.finishResult(session, id, operation, value, args),
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"72849910ef1260a1e27ec37e6b3a8e0371f71de3","buildToolsSha256":"b617652c1601f8722bb85c3a688a1fca4985b53f2c2066c10c76c2e693081137","optimizerSourceSha256":"34c4a040f3cf639f039823880822c6541c384c9b4eaa116d27dda8d9cb5c9f9e"}
|