@midsummer-ai/sdk 0.1.0-staging.4970 → 0.1.0-staging.4977
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/calls/contract.d.mts +1 -1
- package/calls/index.d.mts +1 -1
- package/calls/index.mjs +1608 -1
- package/calls/protocol.d.mts +1 -1
- package/calls/react.d.mts +1 -1
- package/calls/react.mjs +1 -1
- package/calls/stand-in.d.mts +1 -1
- package/calls/stand-in.mjs +1 -1
- package/calls/ui.mjs +1 -1
- package/client.d.mts +1 -1
- package/client.mjs +1 -1
- package/contract.d.mts +7 -2
- package/contract.mjs +111 -2
- package/database/stand-in.d.mts +1 -1
- package/database/stand-in.mjs +1 -1
- package/here-C2jhTheQ.mjs +1 -1
- package/{index-_phnWnst.d.mts → index-BhrtT3r7.d.mts} +55 -1
- package/index.d.mts +2 -2
- package/index.mjs +1 -1
- package/{names-44OMPNTX.mjs → names-C-VZGec6.mjs} +11 -1
- package/package.json +1 -1
- package/{protocol-d_NS2wT_.d.mts → protocol-eCEy2GzD.d.mts} +0 -10
- package/s3.d.mts +1 -1
- package/s3.mjs +2 -2
- package/socket.d.mts +5 -2
- package/socket.mjs +1 -1
- package/{src-DM6HKVuc.mjs → src-CKKUcBlb.mjs} +161 -4
- package/stand-in.d.mts +1 -1
- package/stand-in.mjs +62 -2
- package/storage/files.d.mts +1 -1
- package/storage/files.mjs +1 -1
- package/wire.d.mts +15 -2
- package/wire.mjs +116 -4
- package/calls-BSpnsn8P.mjs +0 -1644
package/calls/protocol.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CallToken, c as Layer, d as TrackName, f as WireParticipant, i as CallOp, l as Sdp, m as WireSignal, n as CALL_STATUS, o as CallWire, p as WireRoom, r as CallErrorCode, s as IceServer, t as CALL_OPS, u as TRACK_KINDS } from "../protocol-
|
|
1
|
+
import { a as CallToken, c as Layer, d as TrackName, f as WireParticipant, i as CallOp, l as Sdp, m as WireSignal, n as CALL_STATUS, o as CallWire, p as WireRoom, r as CallErrorCode, s as IceServer, t as CALL_OPS, u as TRACK_KINDS } from "../protocol-eCEy2GzD.mjs";
|
|
2
2
|
export { CALL_OPS, CALL_STATUS, CallErrorCode, CallOp, CallToken, CallWire, IceServer, Layer, Sdp, TRACK_KINDS, TrackName, WireParticipant, WireRoom, WireSignal };
|
package/calls/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TrackName } from "../protocol-
|
|
1
|
+
import { d as TrackName } from "../protocol-eCEy2GzD.mjs";
|
|
2
2
|
import { Call, CallError, CallState, LocalTrack, Participant, Rtc, TokenSource } from "./index.mjs";
|
|
3
3
|
import { AudioHTMLAttributes, ReactNode, VideoHTMLAttributes } from "react";
|
|
4
4
|
//#region src/calls/react.d.ts
|
package/calls/react.mjs
CHANGED
package/calls/stand-in.d.mts
CHANGED
package/calls/stand-in.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as identityProblem, u as roomProblem } from "../calls-BSpnsn8P.mjs";
|
|
2
1
|
import { CALL_OPS, CALL_STATUS, TRACK_KINDS } from "./protocol.mjs";
|
|
2
|
+
import { identityProblem, roomProblem } from "./index.mjs";
|
|
3
3
|
//#region src/calls/stand-in.ts
|
|
4
4
|
/**
|
|
5
5
|
* The calls Stand-in: the whole call wire in memory, for tests and `midsummer dev`, with no media server. Browsers
|
package/calls/ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { CAMERA, CallError } from "./index.mjs";
|
|
3
3
|
import { Audio, CallProvider, Video, useCall, useCallError, useCallState, useLocalTracks, useParticipants } from "./react.mjs";
|
|
4
4
|
import { a as TYPE, i as MATERIAL, n as FOUNDATION, r as LIGHT, t as DARK } from "../tokens-BpV8U5E1.mjs";
|
|
5
5
|
import { createContext, createElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
package/client.d.mts
CHANGED
package/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as FRAMES_PATH, c as serveSigned, l as signedHttp, o as SOCKET_PATH, s as client } from "./src-
|
|
1
|
+
import { a as FRAMES_PATH, c as serveSigned, l as signedHttp, o as SOCKET_PATH, s as client } from "./src-CKKUcBlb.mjs";
|
|
2
2
|
export { FRAMES_PATH, SOCKET_PATH, client, serveSigned, signedHttp };
|
package/contract.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as Storage } from "./index-BhrtT3r7.mjs";
|
|
2
2
|
//#region src/contract.d.ts
|
|
3
3
|
interface ContractCase {
|
|
4
4
|
/** A line of the specification. */
|
|
@@ -6,5 +6,10 @@ interface ContractCase {
|
|
|
6
6
|
run(storage: Storage): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
declare const storageContract: ReadonlyArray<ContractCase>;
|
|
9
|
+
/**
|
|
10
|
+
* What a watch promises, for engines that keep one (the Stand-in, the socket of `client`, the platform's): run as
|
|
11
|
+
* `storageContract` is. A case waits at most 20 seconds for each change it expects.
|
|
12
|
+
*/
|
|
13
|
+
declare const watchContract: ReadonlyArray<ContractCase>;
|
|
9
14
|
//#endregion
|
|
10
|
-
export { ContractCase, storageContract };
|
|
15
|
+
export { ContractCase, storageContract, watchContract };
|
package/contract.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as StorageError } from "./errors-B1tO_wdm.mjs";
|
|
2
|
-
import "./src-
|
|
2
|
+
import "./src-CKKUcBlb.mjs";
|
|
3
3
|
//#region src/contract.ts
|
|
4
4
|
/**
|
|
5
5
|
* Storage's contract: what every engine promises, as cases any test runner can run. The Stand-in
|
|
@@ -487,6 +487,115 @@ const storageContract = [
|
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
];
|
|
490
|
+
/**
|
|
491
|
+
* What a watch promises, for engines that keep one (the Stand-in, the socket of `client`, the platform's): run as
|
|
492
|
+
* `storageContract` is. A case waits at most 20 seconds for each change it expects.
|
|
493
|
+
*/
|
|
494
|
+
const watchContract = [
|
|
495
|
+
{
|
|
496
|
+
name: "a watch is told each put, copy and delete of the keys it names, as the key and its new etag, and nothing of other keys",
|
|
497
|
+
async run(storage) {
|
|
498
|
+
const bucket = storage.bucket("lines");
|
|
499
|
+
const watch = bucket.watch({ keys: ["a.txt", "b.txt"] });
|
|
500
|
+
await watch.ready;
|
|
501
|
+
await bucket.put("a.txt", "hello");
|
|
502
|
+
await bucket.put("c.txt", "hello world");
|
|
503
|
+
await bucket.copy("a.txt", "b.txt");
|
|
504
|
+
await bucket.delete("a.txt");
|
|
505
|
+
await bucket.delete("nothing.txt");
|
|
506
|
+
equal((await take(watch, 3)).map(said), [
|
|
507
|
+
["a.txt", HELLO],
|
|
508
|
+
["b.txt", HELLO],
|
|
509
|
+
["a.txt", null]
|
|
510
|
+
], "the changes told");
|
|
511
|
+
watch.close();
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: "a prefix watch hears every key under it, and one opened again from its last cursor hears what changed while it was away, each key's latest",
|
|
516
|
+
async run(storage) {
|
|
517
|
+
const bucket = storage.bucket("lines");
|
|
518
|
+
const first = bucket.watch({ prefix: "ada/" });
|
|
519
|
+
await first.ready;
|
|
520
|
+
await bucket.put("ada/head", "1");
|
|
521
|
+
await bucket.put("grace/head", "1");
|
|
522
|
+
const [heard] = await take(first, 1);
|
|
523
|
+
equal(said(heard), ["ada/head", await hex(new TextEncoder().encode("1"))], "the change under the prefix");
|
|
524
|
+
first.close();
|
|
525
|
+
await bucket.put("ada/head", "2");
|
|
526
|
+
await bucket.put("ada/head", "3");
|
|
527
|
+
await bucket.put("ada/notes", "hello");
|
|
528
|
+
await bucket.put("grace/head", "2");
|
|
529
|
+
const again = bucket.watch({
|
|
530
|
+
prefix: "ada/",
|
|
531
|
+
after: heard.cursor
|
|
532
|
+
});
|
|
533
|
+
await again.ready;
|
|
534
|
+
await bucket.delete("ada/notes");
|
|
535
|
+
equal((await take(again, 3)).map(said), [
|
|
536
|
+
["ada/head", await hex(new TextEncoder().encode("3"))],
|
|
537
|
+
["ada/notes", HELLO],
|
|
538
|
+
["ada/notes", null]
|
|
539
|
+
], "what changed while it was away, then after");
|
|
540
|
+
again.close();
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: "a watch from a cursor no watch told is reset, and hears changes from then on",
|
|
545
|
+
async run(storage) {
|
|
546
|
+
const bucket = storage.bucket("lines");
|
|
547
|
+
const watch = bucket.watch({
|
|
548
|
+
prefix: "",
|
|
549
|
+
after: "zzzzzzzz.7"
|
|
550
|
+
});
|
|
551
|
+
await watch.ready;
|
|
552
|
+
await bucket.put("a.txt", "hello");
|
|
553
|
+
const told = await take(watch, 2);
|
|
554
|
+
equal(["reset" in told[0] && told[0].reset, said(told[1])], [true, ["a.txt", HELLO]], "the reset, then the change");
|
|
555
|
+
watch.close();
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: "a watch names keys or a prefix, 1 to 1,000 keys, and a cursor a watch told; anything else is refused before it is sent",
|
|
560
|
+
async run(storage) {
|
|
561
|
+
const bucket = storage.bucket("lines");
|
|
562
|
+
const refused = (options, what) => {
|
|
563
|
+
try {
|
|
564
|
+
bucket.watch(options).close();
|
|
565
|
+
} catch (error) {
|
|
566
|
+
if (error instanceof StorageError && error.code === "invalid") return;
|
|
567
|
+
throw new Error(`${what}: expected a StorageError "invalid", got ${String(error)}`);
|
|
568
|
+
}
|
|
569
|
+
throw new Error(`${what}: expected a StorageError "invalid", but it was taken`);
|
|
570
|
+
};
|
|
571
|
+
refused({
|
|
572
|
+
keys: ["a"],
|
|
573
|
+
prefix: ""
|
|
574
|
+
}, "keys and a prefix");
|
|
575
|
+
refused({}, "neither");
|
|
576
|
+
refused({ keys: [] }, "no keys");
|
|
577
|
+
refused({ keys: Array.from({ length: 1001 }, (_, i) => `k${i}`) }, "1,001 keys");
|
|
578
|
+
refused({
|
|
579
|
+
prefix: "",
|
|
580
|
+
after: "not a cursor"
|
|
581
|
+
}, "a cursor no watch told");
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
];
|
|
585
|
+
/** The next `n` events a watch is told, waiting at most 20 seconds for each. */
|
|
586
|
+
async function take(watch, n) {
|
|
587
|
+
const iterator = watch[Symbol.asyncIterator](), told = [];
|
|
588
|
+
while (told.length < n) {
|
|
589
|
+
let timer;
|
|
590
|
+
const next = await Promise.race([iterator.next(), new Promise((resolve) => timer = setTimeout(() => resolve("late"), 2e4))]);
|
|
591
|
+
clearTimeout(timer);
|
|
592
|
+
if (next === "late") throw new Error(`waited 20 seconds for change ${told.length + 1} of ${n}; told ${JSON.stringify(told)}`);
|
|
593
|
+
if (next.done) throw new Error(`the watch ended after ${told.length} of ${n} changes`);
|
|
594
|
+
told.push(next.value);
|
|
595
|
+
}
|
|
596
|
+
return told;
|
|
597
|
+
}
|
|
598
|
+
const said = (event) => "reset" in event ? ["reset"] : [event.key, event.etag];
|
|
490
599
|
function pick(o) {
|
|
491
600
|
return {
|
|
492
601
|
key: o.key,
|
|
@@ -532,4 +641,4 @@ async function hex(bytes) {
|
|
|
532
641
|
return [...new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
533
642
|
}
|
|
534
643
|
//#endregion
|
|
535
|
-
export { storageContract };
|
|
644
|
+
export { storageContract, watchContract };
|
package/database/stand-in.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DatabaseError } from "../errors-DcEc-3eL.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { h as Storage } from "../index-BhrtT3r7.mjs";
|
|
3
3
|
import { t as AuthConfig } from "../auth-B7rCtXFQ.mjs";
|
|
4
4
|
import { a as FileMetadata, c as FunctionReference, d as HttpRouter, n as CronJob, s as FunctionKind, v as RegisteredFunction, y as Row } from "../server-B5HK2Ou9.mjs";
|
|
5
5
|
import { r as Built } from "../build-DX7RUtzJ.mjs";
|
package/database/stand-in.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as storage } from "../src-
|
|
1
|
+
import { r as storage } from "../src-CKKUcBlb.mjs";
|
|
2
2
|
import { standIn } from "../stand-in.mjs";
|
|
3
3
|
import { _ as shapeError, a as tagBytes, b as valueAt, f as indexFields, g as shapeAt, i as keyBytes, o as untagBytes, v as tableCode } from "../bytes-C2pcyl9u.mjs";
|
|
4
4
|
import { A as comparePrefix, M as indexTuple, O as valueKey, S as nextCron, T as readLimited, _ as isFunction, a as Refusal, b as limits, i as NotFoundError, j as documentBytes, k as compareKey, l as fetchOver, o as TooLarge, r as InsufficientError, y as isRouter } from "../server-Drjni3-F.mjs";
|
package/here-C2jhTheQ.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function processEnv() {
|
|
|
12
12
|
* This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
|
|
13
13
|
* release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
|
|
14
14
|
*/
|
|
15
|
-
const SDK_VERSION = "0.1.0-staging.
|
|
15
|
+
const SDK_VERSION = "0.1.0-staging.4977";
|
|
16
16
|
/**
|
|
17
17
|
* The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
|
|
18
18
|
* <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
|
|
@@ -78,6 +78,44 @@ interface ListOptions {
|
|
|
78
78
|
/** At most this many entries, Objects and prefixes together: 1 to 1,000, default 1,000. */
|
|
79
79
|
readonly limit?: number;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* What a watch follows: the keys named (1 to 1,000), or every key under `prefix` (`""` for the whole Bucket). `after`
|
|
83
|
+
* is the `cursor` of the last change heard, to hear every change made since, as after a restart.
|
|
84
|
+
*/
|
|
85
|
+
interface WatchOptions {
|
|
86
|
+
readonly keys?: ReadonlyArray<string>;
|
|
87
|
+
readonly prefix?: string;
|
|
88
|
+
readonly after?: string;
|
|
89
|
+
}
|
|
90
|
+
/** A key that changed: its new etag, or `null` once it was deleted. `cursor` names this change, to watch on from it with `after`. */
|
|
91
|
+
interface KeyChange {
|
|
92
|
+
readonly key: string;
|
|
93
|
+
readonly etag: string | null;
|
|
94
|
+
readonly cursor: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Changes may have been missed: the `after` given is older than what Storage keeps (a day), or a change could not be
|
|
98
|
+
* told. Read again what you watch; the watch goes on from `cursor`.
|
|
99
|
+
*/
|
|
100
|
+
interface WatchReset {
|
|
101
|
+
readonly reset: true;
|
|
102
|
+
readonly cursor: string;
|
|
103
|
+
}
|
|
104
|
+
type WatchEvent = KeyChange | WatchReset;
|
|
105
|
+
/**
|
|
106
|
+
* A watch of a Bucket's keys, read with `for await`. It costs nothing while nothing changes, and its connection is
|
|
107
|
+
* kept for it: dropped, it opens again and hears what it missed.
|
|
108
|
+
*/
|
|
109
|
+
interface Watch extends AsyncIterable<WatchEvent> {
|
|
110
|
+
/**
|
|
111
|
+
* Resolves with the cursor once the watch is ready: every change made after it is told at least once, and a key's
|
|
112
|
+
* changes in the order they were made, perhaps only the latest of several close together. Read what you watch after
|
|
113
|
+
* this, and you miss nothing. Rejects when the watch is refused.
|
|
114
|
+
*/
|
|
115
|
+
readonly ready: Promise<string>;
|
|
116
|
+
/** Ends the watch. An iteration ends once it has taken what it was already told. */
|
|
117
|
+
close(): void;
|
|
118
|
+
}
|
|
81
119
|
/** One page of a listing, in UTF-8 byte order of key. `next` is set when there is more. */
|
|
82
120
|
interface Listing {
|
|
83
121
|
readonly objects: ReadonlyArray<StoredObject>;
|
|
@@ -101,6 +139,12 @@ interface Bucket {
|
|
|
101
139
|
* range until it holds 50,000 keys or takes hundreds of calls a second, so 10,000 keys of most Buckets cost one read.
|
|
102
140
|
*/
|
|
103
141
|
missing(keys: ReadonlyArray<string>): Promise<ReadonlyArray<string>>;
|
|
142
|
+
/**
|
|
143
|
+
* Tells each change to the keys named, or to every key under a prefix, as the key and its new etag, once the change
|
|
144
|
+
* is made: see `Watch` for what is promised. It travels on the client's socket (`client`), so code with a storage key
|
|
145
|
+
* watches; it costs nothing while nothing changes. A connection that cannot stay open is `unavailable`.
|
|
146
|
+
*/
|
|
147
|
+
watch(options: WatchOptions): Watch;
|
|
104
148
|
/** Removes what `key` holds. Removing nothing is not an error. */
|
|
105
149
|
delete(key: string): Promise<void>;
|
|
106
150
|
list(options?: ListOptions): Promise<Listing>;
|
|
@@ -172,6 +216,11 @@ interface StorageEngine {
|
|
|
172
216
|
* Bucket's keys it touches. An engine without it is asked `head` for each key instead.
|
|
173
217
|
*/
|
|
174
218
|
missing?(bucket: string, keys: ReadonlyArray<string>): Promise<ReadonlyArray<string>>;
|
|
219
|
+
/**
|
|
220
|
+
* Starts a watch: `on` hears each change and reset, from `options.after` when given, until `close`; `ended` hears the
|
|
221
|
+
* watch end on its own, with why. An engine whose watch can be lost (over a network) keeps it open itself.
|
|
222
|
+
*/
|
|
223
|
+
watch?(bucket: string, options: WatchOptions, on: (event: WatchEvent) => void, ended: (error: StorageError) => void): EngineWatch;
|
|
175
224
|
delete(bucket: string, key: string): Promise<void>;
|
|
176
225
|
list(bucket: string, options: EngineList): Promise<Listing>;
|
|
177
226
|
copy(bucket: string, from: string, to: string, options: {
|
|
@@ -204,6 +253,11 @@ interface StorageEngine {
|
|
|
204
253
|
* (for `stream`) and `write` (for the rest) turn it; none where `engine` has none.
|
|
205
254
|
*/
|
|
206
255
|
declare function streamsOf(engine: StorageEngine, read: (bucket: string) => string, write: (bucket: string) => string): Pick<StorageEngine, "stream" | "putStream" | "uploadPartStream">;
|
|
256
|
+
/** A watch an engine runs: `ready` resolves with its first cursor; `close` ends it. */
|
|
257
|
+
interface EngineWatch {
|
|
258
|
+
readonly ready: Promise<string>;
|
|
259
|
+
close(): void;
|
|
260
|
+
}
|
|
207
261
|
/** An Object read as a stream: its description and the bytes asked for, `range.length` of them or its whole size. */
|
|
208
262
|
interface ObjectStream extends StoredObject {
|
|
209
263
|
readonly body: ReadableStream<Uint8Array>;
|
|
@@ -238,4 +292,4 @@ declare function bucket(name: string): Bucket;
|
|
|
238
292
|
/** Storage over `engine`. */
|
|
239
293
|
declare function storage(engine: StorageEngine): Storage;
|
|
240
294
|
//#endregion
|
|
241
|
-
export {
|
|
295
|
+
export { WatchReset as C, StorageError as D, streamsOf as E, StorageErrorCode as O, WatchOptions as S, storage as T, StoredObject as _, EngineWatch as a, Watch as b, Listing as c, Operations as d, Part as f, StorageEngine as g, Storage as h, EnginePut as i, StorageErrorReason as k, ObjectRead as l, Range as m, Bucket as n, KeyChange as o, PutOptions as p, EngineList as r, ListOptions as s, Body as t, ObjectStream as u, Usage as v, bucket as w, WatchEvent as x, WORKLOAD_PATH as y };
|
package/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { Body, Bucket, EngineList, EnginePut, ListOptions, Listing, ObjectRead, ObjectStream, Operations, Part, PutOptions, Range, Storage, StorageEngine, StorageError, type StorageErrorCode, type StorageErrorReason, StoredObject, Usage, WORKLOAD_PATH, bucket, storage, streamsOf };
|
|
1
|
+
import { C as WatchReset, D as StorageError, E as streamsOf, O as StorageErrorCode, S as WatchOptions, T as storage, _ as StoredObject, a as EngineWatch, b as Watch, c as Listing, d as Operations, f as Part, g as StorageEngine, h as Storage, i as EnginePut, k as StorageErrorReason, l as ObjectRead, m as Range, n as Bucket, o as KeyChange, p as PutOptions, r as EngineList, s as ListOptions, t as Body, u as ObjectStream, v as Usage, w as bucket, x as WatchEvent, y as WORKLOAD_PATH } from "./index-BhrtT3r7.mjs";
|
|
2
|
+
export { Body, Bucket, EngineList, EnginePut, EngineWatch, KeyChange, ListOptions, Listing, ObjectRead, ObjectStream, Operations, Part, PutOptions, Range, Storage, StorageEngine, StorageError, type StorageErrorCode, type StorageErrorReason, StoredObject, Usage, WORKLOAD_PATH, Watch, WatchEvent, WatchOptions, WatchReset, bucket, storage, streamsOf };
|
package/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as StorageError } from "./errors-B1tO_wdm.mjs";
|
|
2
|
-
import { i as streamsOf, n as bucket, r as storage, t as WORKLOAD_PATH } from "./src-
|
|
2
|
+
import { i as streamsOf, n as bucket, r as storage, t as WORKLOAD_PATH } from "./src-CKKUcBlb.mjs";
|
|
3
3
|
export { StorageError, WORKLOAD_PATH, bucket, storage, streamsOf };
|
|
@@ -69,6 +69,16 @@ function checkSha256(sha256) {
|
|
|
69
69
|
if (!/^[0-9a-fA-F]{64}$/.test(sha256)) invalid("sha256 is not a SHA-256: 64 hexadecimal characters");
|
|
70
70
|
return sha256.toLowerCase();
|
|
71
71
|
}
|
|
72
|
+
/** What a watch names: 1 to 1,000 keys or one prefix, and a cursor to go on from. */
|
|
73
|
+
function checkWatch(options) {
|
|
74
|
+
if (options.keys === void 0 === (options.prefix === void 0)) invalid("a watch names keys or a prefix: one of them");
|
|
75
|
+
if (options.keys !== void 0) {
|
|
76
|
+
if (!Array.isArray(options.keys) || options.keys.length < 1 || options.keys.length > 1e3) invalid("a watch names 1 to 1,000 keys");
|
|
77
|
+
for (const key of options.keys) checkKey(key);
|
|
78
|
+
}
|
|
79
|
+
if (options.prefix !== void 0 && encoder.encode(options.prefix).length > 1024) invalid("a watch's prefix is at most 1,024 bytes");
|
|
80
|
+
if (options.after !== void 0 && !/^[0-9a-z]{1,16}\.\d{1,15}$/.test(options.after)) invalid("after is not a cursor a watch told");
|
|
81
|
+
}
|
|
72
82
|
/** The keys of one `missing` call: 1 to 10,000 of them, each a key. */
|
|
73
83
|
function checkMissingKeys(keys) {
|
|
74
84
|
if (!Array.isArray(keys) || keys.length < 1 || keys.length > 1e4) invalid(`missing asks about 1 to 10,000 keys a call; this asked about ${Array.isArray(keys) ? keys.length.toLocaleString("en-US") : "none"}`);
|
|
@@ -113,4 +123,4 @@ function sameSizes(sizes, named) {
|
|
|
113
123
|
for (let i = 1; i < sizes.length; i += 1) if (i < sizes.length - 1 ? sizes[i] !== sizes[0] : sizes[i] > sizes[0]) throw new StorageError("invalid", `part ${named[i].partNumber} is ${sizes[i]} bytes: every part but the last must be ${sizes[0]} bytes, as the first is, and the last no larger`, "part");
|
|
114
124
|
}
|
|
115
125
|
//#endregion
|
|
116
|
-
export {
|
|
126
|
+
export { resolveRange as _, checkListLimit as a, uploadSha256Refusal as b, checkPartNumber as c, checkSha256 as d, checkUploadId as f, missingByHead as g, invalid as h, checkKey as i, checkParts as l, compareKeys as m, checkBodySha256 as n, checkMetadata as o, checkWatch as p, checkBucketName as r, checkMissingKeys as s, MIN_PART as t, checkRange as u, sameSizes as v, sha256 as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midsummer-ai/sdk",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.4977",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",
|
|
@@ -110,7 +110,6 @@ interface CallWire {
|
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
112
|
/** With `pull`, the tracks are received as `pull` does once the answer is applied: the next offer and their mids, in one trip. A platform from before it returns neither, and the tracks are asked for with `pull`. */
|
|
113
|
-
/** With `publish`, the first tracks go with the answer to the join's offer, published once it is applied: `published`. */
|
|
114
113
|
answer: {
|
|
115
114
|
body: {
|
|
116
115
|
participant: string;
|
|
@@ -120,14 +119,6 @@ interface CallWire {
|
|
|
120
119
|
name: TrackName;
|
|
121
120
|
layer?: Layer;
|
|
122
121
|
}>;
|
|
123
|
-
publish?: {
|
|
124
|
-
offer: Sdp;
|
|
125
|
-
tracks: ReadonlyArray<{
|
|
126
|
-
mid: string;
|
|
127
|
-
name: TrackName;
|
|
128
|
-
layers?: number;
|
|
129
|
-
}>;
|
|
130
|
-
};
|
|
131
122
|
};
|
|
132
123
|
answer: {
|
|
133
124
|
offer?: Sdp;
|
|
@@ -136,7 +127,6 @@ interface CallWire {
|
|
|
136
127
|
name: TrackName;
|
|
137
128
|
mid: string;
|
|
138
129
|
}>;
|
|
139
|
-
published?: CallWire["publish"]["answer"];
|
|
140
130
|
};
|
|
141
131
|
};
|
|
142
132
|
/** New relays once the token was renewed, asked for what is left of the token that asks; none where the call gives none. */
|
package/s3.d.mts
CHANGED
package/s3.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as StorageError } from "./errors-B1tO_wdm.mjs";
|
|
2
|
-
import { c as checkPartNumber, f as checkUploadId, i as checkKey, l as checkParts, o as checkMetadata, r as checkBucketName,
|
|
3
|
-
import { i as streamsOf } from "./src-
|
|
2
|
+
import { c as checkPartNumber, f as checkUploadId, i as checkKey, l as checkParts, o as checkMetadata, r as checkBucketName, y as sha256 } from "./names-C-VZGec6.mjs";
|
|
3
|
+
import { i as streamsOf } from "./src-CKKUcBlb.mjs";
|
|
4
4
|
import { inertHeaders } from "./inert.mjs";
|
|
5
5
|
//#region src/s3.ts
|
|
6
6
|
/**
|
package/socket.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as StorageEngine } from "./index-BhrtT3r7.mjs";
|
|
2
2
|
import { S3Credential } from "./s3.mjs";
|
|
3
3
|
import { Transport } from "./wire.mjs";
|
|
4
4
|
//#region src/socket.d.ts
|
|
@@ -31,7 +31,7 @@ declare function socket(url: string, options: {
|
|
|
31
31
|
readonly fallback?: Transport;
|
|
32
32
|
readonly WebSocket?: new (url: string) => SocketLike;
|
|
33
33
|
readonly clock?: () => number;
|
|
34
|
-
}): Transport & {
|
|
34
|
+
}): Transport & Required<Pick<Transport, "subscribe">> & {
|
|
35
35
|
close(): void;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
@@ -57,11 +57,14 @@ interface SocketSession {
|
|
|
57
57
|
receive(message: unknown): Promise<string | Uint8Array | null>;
|
|
58
58
|
/** Settles once the key is accepted or refused; a refused connection should then be closed. */
|
|
59
59
|
readonly settled: Promise<"ready" | "refused">;
|
|
60
|
+
/** The connection closed: every watch it held ends. */
|
|
61
|
+
end(): void;
|
|
60
62
|
}
|
|
61
63
|
/** A server's side of one connection: the handshake against `credentials`, then each frame served by `engine` as the key reaches it. */
|
|
62
64
|
declare function socketSession(options: {
|
|
63
65
|
readonly engine: StorageEngine;
|
|
64
66
|
readonly credentials: (accessKeyId: string) => S3Credential | null | Promise<S3Credential | null>;
|
|
67
|
+
readonly push?: (message: Uint8Array) => void;
|
|
65
68
|
}): SocketSession;
|
|
66
69
|
//#endregion
|
|
67
70
|
export { SocketSession, keyed, sameHex, sign, socket, socketSession };
|
package/socket.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as sameHex, f as sign, m as socketSession, p as socket, u as keyed } from "./src-
|
|
1
|
+
import { d as sameHex, f as sign, m as socketSession, p as socket, u as keyed } from "./src-CKKUcBlb.mjs";
|
|
2
2
|
export { keyed, sameHex, sign, socket, socketSession };
|