@meshagent/meshagent 0.35.5 → 0.35.6
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/CHANGELOG.md +8 -0
- package/dist/browser/storage-client.js +37 -14
- package/dist/esm/storage-client.js +37 -14
- package/dist/node/storage-client.js +37 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.35.6]
|
|
2
|
+
- New `@meshagent/meshagent-ts-auth` package provides framework-agnostic OAuth/PKCE login, token storage/refresh, and access-token providers.
|
|
3
|
+
- New `@meshagent/meshagent-react-dev` package adds developer console hooks for logs, terminal sessions, and webterm/ghostty integrations.
|
|
4
|
+
- Breaking: `@meshagent/meshagent-react-auth` now builds on `@meshagent/meshagent-ts-auth` and React Query; built-in auth primitives and the LoginScope component were removed in favor of hook-based APIs.
|
|
5
|
+
- TypeScript storage uploads now honor server-provided `chunk_size` pull headers for adaptive chunking.
|
|
6
|
+
- Async-iterable subscriptions in the React package now call iterator `return()` on unsubscribe to clean up resources.
|
|
7
|
+
- Dependency updates: `react`/`react-dom` ^19.1.8, `@tanstack/react-query`/`@tanstack/react-query-devtools` ^5.95.2, `ghostty-web` ^0.4.0, `wasm-webterm` (GitHub), `jest` ^30.3.0, `@types/jest` ^30.0.0, `ts-jest` ^29.4.6, `esbuild` ^0.25.0, `@types/react` ^19.1.8, `@types/react-dom` ^19.1.8.
|
|
8
|
+
|
|
1
9
|
## [0.35.5]
|
|
2
10
|
- Stability
|
|
3
11
|
|
|
@@ -135,7 +135,10 @@ class StorageClient extends event_emitter_1.EventEmitter {
|
|
|
135
135
|
if (chunk.headers["kind"] !== "pull") {
|
|
136
136
|
throw this._unexpectedResponseError("upload");
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
const rawChunkSize = chunk.headers["chunk_size"];
|
|
139
|
+
input.requestNext(typeof rawChunkSize === "number" && rawChunkSize > 0
|
|
140
|
+
? rawChunkSize
|
|
141
|
+
: null);
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
finally {
|
|
@@ -326,7 +329,7 @@ class _StorageDownloadInputStream {
|
|
|
326
329
|
class _StorageUploadInputStream {
|
|
327
330
|
constructor({ path, overwrite, chunks, chunkSize, size, name, mimeType, }) {
|
|
328
331
|
this.closed = false;
|
|
329
|
-
this.pendingPulls =
|
|
332
|
+
this.pendingPulls = [];
|
|
330
333
|
this.waitingResolver = null;
|
|
331
334
|
this.pendingChunk = new Uint8Array(0);
|
|
332
335
|
this.pendingOffset = 0;
|
|
@@ -339,11 +342,11 @@ class _StorageUploadInputStream {
|
|
|
339
342
|
this.name = name;
|
|
340
343
|
this.mimeType = mimeType;
|
|
341
344
|
}
|
|
342
|
-
requestNext() {
|
|
345
|
+
requestNext(chunkSize = null) {
|
|
343
346
|
if (this.closed) {
|
|
344
347
|
return;
|
|
345
348
|
}
|
|
346
|
-
this.pendingPulls
|
|
349
|
+
this.pendingPulls.push(chunkSize);
|
|
347
350
|
if (this.waitingResolver) {
|
|
348
351
|
const resolver = this.waitingResolver;
|
|
349
352
|
this.waitingResolver = null;
|
|
@@ -361,21 +364,26 @@ class _StorageUploadInputStream {
|
|
|
361
364
|
resolver();
|
|
362
365
|
}
|
|
363
366
|
}
|
|
364
|
-
async nextChunk() {
|
|
365
|
-
|
|
367
|
+
async nextChunk(requestedChunkSize) {
|
|
368
|
+
const parts = [];
|
|
369
|
+
let totalLength = 0;
|
|
370
|
+
while (totalLength < requestedChunkSize) {
|
|
366
371
|
if (this.pendingOffset < this.pendingChunk.length) {
|
|
367
372
|
const start = this.pendingOffset;
|
|
368
|
-
const end = Math.min(start +
|
|
373
|
+
const end = Math.min(start + (requestedChunkSize - totalLength), this.pendingChunk.length);
|
|
374
|
+
const part = this.pendingChunk.slice(start, end);
|
|
369
375
|
this.pendingOffset = end;
|
|
370
|
-
|
|
376
|
+
parts.push(part);
|
|
377
|
+
totalLength += part.length;
|
|
378
|
+
continue;
|
|
371
379
|
}
|
|
372
380
|
if (this.sourceExhausted) {
|
|
373
|
-
|
|
381
|
+
break;
|
|
374
382
|
}
|
|
375
383
|
const next = await this.source.next();
|
|
376
384
|
if (next.done) {
|
|
377
385
|
this.sourceExhausted = true;
|
|
378
|
-
|
|
386
|
+
break;
|
|
379
387
|
}
|
|
380
388
|
if (next.value.length === 0) {
|
|
381
389
|
continue;
|
|
@@ -383,6 +391,19 @@ class _StorageUploadInputStream {
|
|
|
383
391
|
this.pendingChunk = next.value;
|
|
384
392
|
this.pendingOffset = 0;
|
|
385
393
|
}
|
|
394
|
+
if (totalLength === 0) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
if (parts.length === 1) {
|
|
398
|
+
return parts[0];
|
|
399
|
+
}
|
|
400
|
+
const combined = new Uint8Array(totalLength);
|
|
401
|
+
let offset = 0;
|
|
402
|
+
for (const part of parts) {
|
|
403
|
+
combined.set(part, offset);
|
|
404
|
+
offset += part.length;
|
|
405
|
+
}
|
|
406
|
+
return combined;
|
|
386
407
|
}
|
|
387
408
|
async *stream() {
|
|
388
409
|
yield new response_1.BinaryContent({
|
|
@@ -397,7 +418,7 @@ class _StorageUploadInputStream {
|
|
|
397
418
|
},
|
|
398
419
|
});
|
|
399
420
|
while (!this.closed) {
|
|
400
|
-
if (this.pendingPulls === 0) {
|
|
421
|
+
if (this.pendingPulls.length === 0) {
|
|
401
422
|
await new Promise((resolve) => {
|
|
402
423
|
this.waitingResolver = resolve;
|
|
403
424
|
});
|
|
@@ -405,11 +426,13 @@ class _StorageUploadInputStream {
|
|
|
405
426
|
if (this.closed) {
|
|
406
427
|
return;
|
|
407
428
|
}
|
|
408
|
-
if (this.pendingPulls === 0) {
|
|
429
|
+
if (this.pendingPulls.length === 0) {
|
|
409
430
|
continue;
|
|
410
431
|
}
|
|
411
|
-
this.pendingPulls
|
|
412
|
-
const chunk = await this.nextChunk(
|
|
432
|
+
const requestedChunkSize = this.pendingPulls.shift();
|
|
433
|
+
const chunk = await this.nextChunk(typeof requestedChunkSize === "number" && requestedChunkSize > 0
|
|
434
|
+
? requestedChunkSize
|
|
435
|
+
: this.chunkSize);
|
|
413
436
|
if (chunk == null) {
|
|
414
437
|
return;
|
|
415
438
|
}
|
|
@@ -131,7 +131,10 @@ export class StorageClient extends EventEmitter {
|
|
|
131
131
|
if (chunk.headers["kind"] !== "pull") {
|
|
132
132
|
throw this._unexpectedResponseError("upload");
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
const rawChunkSize = chunk.headers["chunk_size"];
|
|
135
|
+
input.requestNext(typeof rawChunkSize === "number" && rawChunkSize > 0
|
|
136
|
+
? rawChunkSize
|
|
137
|
+
: null);
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
finally {
|
|
@@ -321,7 +324,7 @@ class _StorageDownloadInputStream {
|
|
|
321
324
|
class _StorageUploadInputStream {
|
|
322
325
|
constructor({ path, overwrite, chunks, chunkSize, size, name, mimeType, }) {
|
|
323
326
|
this.closed = false;
|
|
324
|
-
this.pendingPulls =
|
|
327
|
+
this.pendingPulls = [];
|
|
325
328
|
this.waitingResolver = null;
|
|
326
329
|
this.pendingChunk = new Uint8Array(0);
|
|
327
330
|
this.pendingOffset = 0;
|
|
@@ -334,11 +337,11 @@ class _StorageUploadInputStream {
|
|
|
334
337
|
this.name = name;
|
|
335
338
|
this.mimeType = mimeType;
|
|
336
339
|
}
|
|
337
|
-
requestNext() {
|
|
340
|
+
requestNext(chunkSize = null) {
|
|
338
341
|
if (this.closed) {
|
|
339
342
|
return;
|
|
340
343
|
}
|
|
341
|
-
this.pendingPulls
|
|
344
|
+
this.pendingPulls.push(chunkSize);
|
|
342
345
|
if (this.waitingResolver) {
|
|
343
346
|
const resolver = this.waitingResolver;
|
|
344
347
|
this.waitingResolver = null;
|
|
@@ -356,21 +359,26 @@ class _StorageUploadInputStream {
|
|
|
356
359
|
resolver();
|
|
357
360
|
}
|
|
358
361
|
}
|
|
359
|
-
async nextChunk() {
|
|
360
|
-
|
|
362
|
+
async nextChunk(requestedChunkSize) {
|
|
363
|
+
const parts = [];
|
|
364
|
+
let totalLength = 0;
|
|
365
|
+
while (totalLength < requestedChunkSize) {
|
|
361
366
|
if (this.pendingOffset < this.pendingChunk.length) {
|
|
362
367
|
const start = this.pendingOffset;
|
|
363
|
-
const end = Math.min(start +
|
|
368
|
+
const end = Math.min(start + (requestedChunkSize - totalLength), this.pendingChunk.length);
|
|
369
|
+
const part = this.pendingChunk.slice(start, end);
|
|
364
370
|
this.pendingOffset = end;
|
|
365
|
-
|
|
371
|
+
parts.push(part);
|
|
372
|
+
totalLength += part.length;
|
|
373
|
+
continue;
|
|
366
374
|
}
|
|
367
375
|
if (this.sourceExhausted) {
|
|
368
|
-
|
|
376
|
+
break;
|
|
369
377
|
}
|
|
370
378
|
const next = await this.source.next();
|
|
371
379
|
if (next.done) {
|
|
372
380
|
this.sourceExhausted = true;
|
|
373
|
-
|
|
381
|
+
break;
|
|
374
382
|
}
|
|
375
383
|
if (next.value.length === 0) {
|
|
376
384
|
continue;
|
|
@@ -378,6 +386,19 @@ class _StorageUploadInputStream {
|
|
|
378
386
|
this.pendingChunk = next.value;
|
|
379
387
|
this.pendingOffset = 0;
|
|
380
388
|
}
|
|
389
|
+
if (totalLength === 0) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
if (parts.length === 1) {
|
|
393
|
+
return parts[0];
|
|
394
|
+
}
|
|
395
|
+
const combined = new Uint8Array(totalLength);
|
|
396
|
+
let offset = 0;
|
|
397
|
+
for (const part of parts) {
|
|
398
|
+
combined.set(part, offset);
|
|
399
|
+
offset += part.length;
|
|
400
|
+
}
|
|
401
|
+
return combined;
|
|
381
402
|
}
|
|
382
403
|
async *stream() {
|
|
383
404
|
yield new BinaryContent({
|
|
@@ -392,7 +413,7 @@ class _StorageUploadInputStream {
|
|
|
392
413
|
},
|
|
393
414
|
});
|
|
394
415
|
while (!this.closed) {
|
|
395
|
-
if (this.pendingPulls === 0) {
|
|
416
|
+
if (this.pendingPulls.length === 0) {
|
|
396
417
|
await new Promise((resolve) => {
|
|
397
418
|
this.waitingResolver = resolve;
|
|
398
419
|
});
|
|
@@ -400,11 +421,13 @@ class _StorageUploadInputStream {
|
|
|
400
421
|
if (this.closed) {
|
|
401
422
|
return;
|
|
402
423
|
}
|
|
403
|
-
if (this.pendingPulls === 0) {
|
|
424
|
+
if (this.pendingPulls.length === 0) {
|
|
404
425
|
continue;
|
|
405
426
|
}
|
|
406
|
-
this.pendingPulls
|
|
407
|
-
const chunk = await this.nextChunk(
|
|
427
|
+
const requestedChunkSize = this.pendingPulls.shift();
|
|
428
|
+
const chunk = await this.nextChunk(typeof requestedChunkSize === "number" && requestedChunkSize > 0
|
|
429
|
+
? requestedChunkSize
|
|
430
|
+
: this.chunkSize);
|
|
408
431
|
if (chunk == null) {
|
|
409
432
|
return;
|
|
410
433
|
}
|
|
@@ -135,7 +135,10 @@ class StorageClient extends event_emitter_1.EventEmitter {
|
|
|
135
135
|
if (chunk.headers["kind"] !== "pull") {
|
|
136
136
|
throw this._unexpectedResponseError("upload");
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
const rawChunkSize = chunk.headers["chunk_size"];
|
|
139
|
+
input.requestNext(typeof rawChunkSize === "number" && rawChunkSize > 0
|
|
140
|
+
? rawChunkSize
|
|
141
|
+
: null);
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
finally {
|
|
@@ -326,7 +329,7 @@ class _StorageDownloadInputStream {
|
|
|
326
329
|
class _StorageUploadInputStream {
|
|
327
330
|
constructor({ path, overwrite, chunks, chunkSize, size, name, mimeType, }) {
|
|
328
331
|
this.closed = false;
|
|
329
|
-
this.pendingPulls =
|
|
332
|
+
this.pendingPulls = [];
|
|
330
333
|
this.waitingResolver = null;
|
|
331
334
|
this.pendingChunk = new Uint8Array(0);
|
|
332
335
|
this.pendingOffset = 0;
|
|
@@ -339,11 +342,11 @@ class _StorageUploadInputStream {
|
|
|
339
342
|
this.name = name;
|
|
340
343
|
this.mimeType = mimeType;
|
|
341
344
|
}
|
|
342
|
-
requestNext() {
|
|
345
|
+
requestNext(chunkSize = null) {
|
|
343
346
|
if (this.closed) {
|
|
344
347
|
return;
|
|
345
348
|
}
|
|
346
|
-
this.pendingPulls
|
|
349
|
+
this.pendingPulls.push(chunkSize);
|
|
347
350
|
if (this.waitingResolver) {
|
|
348
351
|
const resolver = this.waitingResolver;
|
|
349
352
|
this.waitingResolver = null;
|
|
@@ -361,21 +364,26 @@ class _StorageUploadInputStream {
|
|
|
361
364
|
resolver();
|
|
362
365
|
}
|
|
363
366
|
}
|
|
364
|
-
async nextChunk() {
|
|
365
|
-
|
|
367
|
+
async nextChunk(requestedChunkSize) {
|
|
368
|
+
const parts = [];
|
|
369
|
+
let totalLength = 0;
|
|
370
|
+
while (totalLength < requestedChunkSize) {
|
|
366
371
|
if (this.pendingOffset < this.pendingChunk.length) {
|
|
367
372
|
const start = this.pendingOffset;
|
|
368
|
-
const end = Math.min(start +
|
|
373
|
+
const end = Math.min(start + (requestedChunkSize - totalLength), this.pendingChunk.length);
|
|
374
|
+
const part = this.pendingChunk.slice(start, end);
|
|
369
375
|
this.pendingOffset = end;
|
|
370
|
-
|
|
376
|
+
parts.push(part);
|
|
377
|
+
totalLength += part.length;
|
|
378
|
+
continue;
|
|
371
379
|
}
|
|
372
380
|
if (this.sourceExhausted) {
|
|
373
|
-
|
|
381
|
+
break;
|
|
374
382
|
}
|
|
375
383
|
const next = await this.source.next();
|
|
376
384
|
if (next.done) {
|
|
377
385
|
this.sourceExhausted = true;
|
|
378
|
-
|
|
386
|
+
break;
|
|
379
387
|
}
|
|
380
388
|
if (next.value.length === 0) {
|
|
381
389
|
continue;
|
|
@@ -383,6 +391,19 @@ class _StorageUploadInputStream {
|
|
|
383
391
|
this.pendingChunk = next.value;
|
|
384
392
|
this.pendingOffset = 0;
|
|
385
393
|
}
|
|
394
|
+
if (totalLength === 0) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
if (parts.length === 1) {
|
|
398
|
+
return parts[0];
|
|
399
|
+
}
|
|
400
|
+
const combined = new Uint8Array(totalLength);
|
|
401
|
+
let offset = 0;
|
|
402
|
+
for (const part of parts) {
|
|
403
|
+
combined.set(part, offset);
|
|
404
|
+
offset += part.length;
|
|
405
|
+
}
|
|
406
|
+
return combined;
|
|
386
407
|
}
|
|
387
408
|
async *stream() {
|
|
388
409
|
yield new response_1.BinaryContent({
|
|
@@ -397,7 +418,7 @@ class _StorageUploadInputStream {
|
|
|
397
418
|
},
|
|
398
419
|
});
|
|
399
420
|
while (!this.closed) {
|
|
400
|
-
if (this.pendingPulls === 0) {
|
|
421
|
+
if (this.pendingPulls.length === 0) {
|
|
401
422
|
await new Promise((resolve) => {
|
|
402
423
|
this.waitingResolver = resolve;
|
|
403
424
|
});
|
|
@@ -405,11 +426,13 @@ class _StorageUploadInputStream {
|
|
|
405
426
|
if (this.closed) {
|
|
406
427
|
return;
|
|
407
428
|
}
|
|
408
|
-
if (this.pendingPulls === 0) {
|
|
429
|
+
if (this.pendingPulls.length === 0) {
|
|
409
430
|
continue;
|
|
410
431
|
}
|
|
411
|
-
this.pendingPulls
|
|
412
|
-
const chunk = await this.nextChunk(
|
|
432
|
+
const requestedChunkSize = this.pendingPulls.shift();
|
|
433
|
+
const chunk = await this.nextChunk(typeof requestedChunkSize === "number" && requestedChunkSize > 0
|
|
434
|
+
? requestedChunkSize
|
|
435
|
+
: this.chunkSize);
|
|
413
436
|
if (chunk == null) {
|
|
414
437
|
return;
|
|
415
438
|
}
|