@midsummer-ai/sdk 0.1.0-staging.3850 → 0.1.0-staging.3853

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/ai/contract.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as AiError } from "../ai-2Llbc56l.mjs";
1
+ import { t as AiError } from "../ai-BkbpMs2m.mjs";
2
2
  //#region src/ai/contract.ts
3
3
  /**
4
4
  * AI's contract: what every engine promises, as cases any test runner can run. The Stand-in runs
package/ai/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as boundAi, n as ai, r as aiClient, t as AiError } from "../ai-2Llbc56l.mjs";
1
+ import { i as boundAi, n as ai, r as aiClient, t as AiError } from "../ai-BkbpMs2m.mjs";
2
2
  export { AiError, ai, aiClient, boundAi };
package/ai/stand-in.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as aiStandIn } from "../ai-2Llbc56l.mjs";
1
+ import { a as aiStandIn } from "../ai-BkbpMs2m.mjs";
2
2
  export { aiStandIn };
@@ -1,4 +1,4 @@
1
- import { i as processEnv, n as late, t as here } from "./here-BKjizr_N.mjs";
1
+ import { a as processEnv, n as here, r as late, t as clientHeaders } from "./here-C2jhTheQ.mjs";
2
2
  //#region src/ai/stand-in.ts
3
3
  /**
4
4
  * AI's Stand-in: Model calls replied to on this computer, for `midsummer dev` and tests, with no
@@ -256,7 +256,10 @@ function aiClient(origin, options) {
256
256
  response = await send(url, {
257
257
  method: "POST",
258
258
  signal: leave.signal,
259
- headers: { "Content-Type": "application/json" },
259
+ headers: {
260
+ "Content-Type": "application/json",
261
+ ...clientHeaders("ai")
262
+ },
260
263
  body: JSON.stringify({
261
264
  ...input,
262
265
  key: options.key,
package/apps.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { r as platformApi } from "./here-BKjizr_N.mjs";
1
+ import { i as platformApi, t as clientHeaders } from "./here-C2jhTheQ.mjs";
2
2
  //#region src/apps.ts
3
3
  /**
4
4
  * For an app teams install on Midsummer: check that an event or a runner job Midsummer posted is
@@ -62,7 +62,10 @@ var InstalledApp = class {
62
62
  if (kept && kept.until - 6e4 > now) return kept.token;
63
63
  const response = await this.#fetch(`${this.#origin}/v1/oauth/token`, {
64
64
  method: "POST",
65
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
65
+ headers: {
66
+ "Content-Type": "application/x-www-form-urlencoded",
67
+ ...clientHeaders("apps")
68
+ },
66
69
  body: new URLSearchParams({
67
70
  grant_type: "client_credentials",
68
71
  client_id: this.#id,
@@ -82,6 +85,7 @@ var InstalledApp = class {
82
85
  async request(installationId, path, init = {}) {
83
86
  const headers = new Headers(init.headers);
84
87
  headers.set("Authorization", `Bearer ${await this.token(installationId)}`);
88
+ for (const [name, value] of Object.entries(clientHeaders("apps"))) headers.set(name, value);
85
89
  if (init.body !== void 0 && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
86
90
  return this.#fetch(`${this.#origin}${path.startsWith("/") ? path : `/${path}`}`, {
87
91
  ...init,
@@ -91,7 +95,10 @@ var InstalledApp = class {
91
95
  /** Trades the one-time code a manifest's app was made with for its id, secret and signing secret, shown this once. */
92
96
  static async fromManifestCode(code, options = {}) {
93
97
  const origin = (options.origin ?? platformApi()).replace(/\/+$/, "");
94
- const response = await (options.fetch ?? fetch)(`${origin}/v1/apps/conversions/${encodeURIComponent(code)}`, { method: "POST" });
98
+ const response = await (options.fetch ?? fetch)(`${origin}/v1/apps/conversions/${encodeURIComponent(code)}`, {
99
+ method: "POST",
100
+ headers: clientHeaders("apps")
101
+ });
95
102
  if (!response.ok) throw new Error(`Midsummer refused the code: HTTP ${response.status} ${await response.text()}`);
96
103
  return await response.json();
97
104
  }
package/auth/contract.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { r as AuthError } from "../auth-DokDWe3i.mjs";
1
+ import { r as AuthError } from "../auth-BCYdfoxn.mjs";
2
2
  import { d as SETTINGS_TTL_MS, n as LIMIT_WINDOW_MS, t as LIMITS } from "../guard-Br3K8CVx.mjs";
3
3
  import { IMPERSONATION_TOKEN_MS, startImpersonation } from "./impersonate.mjs";
4
4
  //#region src/auth/contract.ts
package/auth/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SESSION_CACHE_S, c as databaseStore, i as IMPERSONATION_S, n as AUTH_ROUTES, o as auth, r as AuthError, s as createAuth, t as AUTH_PATH } from "../auth-DokDWe3i.mjs";
1
+ import { a as SESSION_CACHE_S, c as databaseStore, i as IMPERSONATION_S, n as AUTH_ROUTES, o as auth, r as AuthError, s as createAuth, t as AUTH_PATH } from "../auth-BCYdfoxn.mjs";
2
2
  import { checkSignInMail, signInWords } from "./mail.mjs";
3
3
  import { n as authFiles } from "../files-DhPeWwcT.mjs";
4
4
  export { AUTH_PATH, AUTH_ROUTES, AuthError, IMPERSONATION_S, SESSION_CACHE_S, auth, authFiles, checkSignInMail, createAuth, databaseStore, signInWords };
package/auth/mail.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { i as processEnv, t as here } from "../here-BKjizr_N.mjs";
2
- import { l as email, t as EmailError } from "../email-DmWG_Ug-.mjs";
1
+ import { a as processEnv, n as here } from "../here-C2jhTheQ.mjs";
2
+ import { l as email, t as EmailError } from "../email-Bp45mjUS.mjs";
3
3
  //#region src/auth/mail.ts
4
4
  /**
5
5
  * The mail sign-in sends: a code, a sign-in link, an email check, a password reset, an invitation or a sign-in from
package/auth/react.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as DATABASE_TOKEN_PATH, u as signedInDatabase } from "../client-DD0xZprk.mjs";
1
+ import { t as DATABASE_TOKEN_PATH, u as signedInDatabase } from "../client-Bj5NBIbS.mjs";
2
2
  import { DatabaseProvider } from "../database/react.mjs";
3
3
  import { a as WORDS, c as deviceOf, i as CAPTCHA_WIDGETS, l as screenName, n as textOn, o as ago, t as authCss, u as setupKeyOf } from "../style-BJzVvUKV.mjs";
4
4
  import { a as shapeAttributes, r as ICONS, t as qrPath } from "../qr-BySxqLW6.mjs";
@@ -1,5 +1,5 @@
1
- import { i as processEnv, r as platformApi, t as here } from "./here-BKjizr_N.mjs";
2
- import { d as userToken, o as connect, s as databaseUrl } from "./client-DD0xZprk.mjs";
1
+ import { a as processEnv, i as platformApi, n as here } from "./here-C2jhTheQ.mjs";
2
+ import { d as userToken, o as connect, s as databaseUrl } from "./client-Bj5NBIbS.mjs";
3
3
  import { sendSignInMail } from "./auth/mail.mjs";
4
4
  import "./files-DhPeWwcT.mjs";
5
5
  import { standIn } from "./auth/stand-in.mjs";
package/billing/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as processEnv, n as late, t as here } from "../here-BKjizr_N.mjs";
1
+ import { a as processEnv, n as here, r as late } from "../here-C2jhTheQ.mjs";
2
2
  //#region src/billing/index.ts
3
3
  /**
4
4
  * Billing from a Project's code: send a customer to a checkout, and ask what they have bought. Each customer is your
@@ -1,4 +1,4 @@
1
- import { r as platformApi, t as here } from "./here-BKjizr_N.mjs";
1
+ import { i as platformApi, n as here, t as clientHeaders } from "./here-C2jhTheQ.mjs";
2
2
  import { n as bytesTagged, r as bytesUntagged } from "./bytes-C2pcyl9u.mjs";
3
3
  import { DatabaseError } from "./database/errors.mjs";
4
4
  import { a as socketAt, i as payloadOf, r as fetchAt, t as Connection } from "./connection-CpT0x1EE.mjs";
@@ -13,7 +13,9 @@ import { t as callKey } from "./key-BrRdFY-n.mjs";
13
13
  * if (socket.ready("Bearer <token>", body.length)) const { status, text } = await socket.call(body)
14
14
  *
15
15
  * - **Hello**, the client's first bytes, once: `MAGIC`, a u32 of the bytes after it, a u8 form (`FORM_JSON`), a u16 and
16
- * the Database (`db-<id>`), a u16 and the token (the Authorization value). Frames may follow it at once; it is answered
16
+ * the Database (`db-<id>`), a u16 and the token (the Authorization value), then a u16 and the client the calls come
17
+ * from (`sdk/<version> database`, the `Midsummer-Client` header's value, `clientHeaders`), which the Database reads past
18
+ * where it doesn't take it. Frames may follow it at once; it is answered
17
19
  * `HELLO_OK` (id 0: u32 calls allowed in flight, u32 the largest call), or `REFUSED` (id 0: u16 status, a JSON body)
18
20
  * and the socket closes.
19
21
  * - **Frames**, both ways: a u32 of the bytes after it (5 + the payload), a u32 id, a u8 kind, the payload. The client
@@ -33,10 +35,10 @@ const IN_FLIGHT = 1024;
33
35
  const MAX_CALL = 2 << 20;
34
36
  const encoder$1 = new TextEncoder();
35
37
  const decoder = new TextDecoder();
36
- /** The client's hello for `database` (`db-<id>`) with `authorization` (`Bearer <token>`), bodies as JSON. */
37
- function hello(database, authorization, form = 0) {
38
- const db = encoder$1.encode(database), auth = encoder$1.encode(authorization);
39
- const n = 5 + db.length + auth.length;
38
+ /** The client's hello for `database` (`db-<id>`) with `authorization` (`Bearer <token>`), bodies as JSON, from `client` when one is given. */
39
+ function hello(database, authorization, client, form = 0) {
40
+ const db = encoder$1.encode(database), auth = encoder$1.encode(authorization), from = encoder$1.encode(client ?? "");
41
+ const n = 5 + db.length + auth.length + (client === void 0 ? 0 : 2 + from.length);
40
42
  if (n > MAX_HELLO) throw new RangeError(`a hello holds at most ${MAX_HELLO} bytes; this one is ${n}`);
41
43
  const out = new Uint8Array(8 + n), view = new DataView(out.buffer);
42
44
  out.set(MAGIC, 0);
@@ -46,6 +48,10 @@ function hello(database, authorization, form = 0) {
46
48
  out.set(db, 11);
47
49
  view.setUint16(11 + db.length, auth.length, true);
48
50
  out.set(auth, 13 + db.length);
51
+ if (client !== void 0) {
52
+ view.setUint16(13 + db.length + auth.length, from.length, true);
53
+ out.set(from, 15 + db.length + auth.length);
54
+ }
49
55
  return out;
50
56
  }
51
57
  /** A frame either way: its length, `id`, `kind`, then `payload`. */
@@ -218,7 +224,7 @@ var DoorSocket = class {
218
224
  /** Opens the protocol on `made` for `database` (`db-<id>`) as `authorization` (`Bearer <token>`); a hello too long for it throws. */
219
225
  constructor(made, database, authorization) {
220
226
  this.authorization = authorization;
221
- this.#queued.push(hello(database, authorization));
227
+ this.#queued.push(hello(database, authorization, clientHeaders("database")["midsummer-client"]));
222
228
  Promise.resolve(made).then((raw) => this.#run(raw), (error) => this.end(`it could not be opened (${error instanceof Error ? error.message : String(error)})`));
223
229
  }
224
230
  /** Whether a call of `bytes` as `authorization` goes on it now: open, its hello's token, within its bounds. */
@@ -587,7 +593,10 @@ async function exchange(api, proof) {
587
593
  const asked = `${api}/v1/db/tokens`;
588
594
  const response = await fetch(asked, {
589
595
  method: "POST",
590
- headers: { "Content-Type": "application/json" },
596
+ headers: {
597
+ "Content-Type": "application/json",
598
+ ...clientHeaders("database")
599
+ },
591
600
  body: JSON.stringify(typeof proof === "string" ? { key: proof } : proof)
592
601
  }).catch((error) => {
593
602
  throw new DatabaseError("unavailable", `Couldn't reach ${new URL(api).host} for a database token (${error instanceof Error ? error.message : String(error)}). It should be the API of the Midsummer site your database is on: set MIDSUMMER_API, or pass api.`);
@@ -1168,7 +1177,8 @@ function doorCalls(handle, binding, first) {
1168
1177
  method: "POST",
1169
1178
  headers: {
1170
1179
  authorization,
1171
- "content-type": "application/json"
1180
+ "content-type": "application/json",
1181
+ ...clientHeaders("database")
1172
1182
  },
1173
1183
  body,
1174
1184
  signal
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-DgX-tCDn.mjs";
1
+ import { a as FRAMES_PATH, c as serveSigned, l as signedHttp, o as SOCKET_PATH, s as client } from "./src-CZw5kkUg.mjs";
2
2
  export { FRAMES_PATH, SOCKET_PATH, client, serveSigned, signedHttp };
package/contract.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as StorageError } from "./errors-B1tO_wdm.mjs";
2
- import "./src-DgX-tCDn.mjs";
2
+ import "./src-CZw5kkUg.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
@@ -1,3 +1,3 @@
1
1
  import { DatabaseError } from "./errors.mjs";
2
- import { a as clerk, c as oidc, d as userToken, i as auth0, l as profileClaims, n as DatabaseClient, o as connect, r as PROFILE_MOST, s as databaseUrl, t as DATABASE_TOKEN_PATH, u as signedInDatabase } from "../client-DD0xZprk.mjs";
2
+ import { a as clerk, c as oidc, d as userToken, i as auth0, l as profileClaims, n as DatabaseClient, o as connect, r as PROFILE_MOST, s as databaseUrl, t as DATABASE_TOKEN_PATH, u as signedInDatabase } from "../client-Bj5NBIbS.mjs";
3
3
  export { DATABASE_TOKEN_PATH, DatabaseClient, DatabaseError, PROFILE_MOST, auth0, clerk, connect, databaseUrl, oidc, profileClaims, signedInDatabase, userToken };
@@ -1,4 +1,4 @@
1
- import { r as storage } from "../src-DgX-tCDn.mjs";
1
+ import { r as storage } from "../src-CZw5kkUg.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/email/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as serveMessages, S as serveBound, b as boundEmail, x as client, y as MESSAGES_PATH } from "../email-DmWG_Ug-.mjs";
1
+ import { C as serveMessages, S as serveBound, b as boundEmail, x as client, y as MESSAGES_PATH } from "../email-Bp45mjUS.mjs";
2
2
  export { MESSAGES_PATH, boundEmail, client, serveBound, serveMessages };
@@ -1,4 +1,4 @@
1
- import { t as EmailError } from "../email-DmWG_Ug-.mjs";
1
+ import { t as EmailError } from "../email-Bp45mjUS.mjs";
2
2
  //#region src/email/contract.ts
3
3
  /**
4
4
  * Email's contract: what every engine promises, as cases any test runner can run. The Stand-in runs
package/email/inbox.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as inbox, d as INBOX_HEADER, f as MAX_REPLY, g as checkReply, h as checkPage, m as boundInbox, p as MAX_THREADS, v as serveInbox } from "../email-DmWG_Ug-.mjs";
1
+ import { _ as inbox, d as INBOX_HEADER, f as MAX_REPLY, g as checkReply, h as checkPage, m as boundInbox, p as MAX_THREADS, v as serveInbox } from "../email-Bp45mjUS.mjs";
2
2
  export { INBOX_HEADER, MAX_REPLY, MAX_THREADS, boundInbox, checkPage, checkReply, inbox, serveInbox };
package/email/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as inbox, a as MAX_MESSAGE_BYTES, c as checkMessage, d as INBOX_HEADER, i as MAX_BATCH, l as email, n as MAX_ATTACHMENTS, o as MAX_RECIPIENTS, p as MAX_THREADS, r as MAX_ATTACHMENT_BYTES, s as addressOf, t as EmailError, u as verifyWebhook } from "../email-DmWG_Ug-.mjs";
1
+ import { _ as inbox, a as MAX_MESSAGE_BYTES, c as checkMessage, d as INBOX_HEADER, i as MAX_BATCH, l as email, n as MAX_ATTACHMENTS, o as MAX_RECIPIENTS, p as MAX_THREADS, r as MAX_ATTACHMENT_BYTES, s as addressOf, t as EmailError, u as verifyWebhook } from "../email-Bp45mjUS.mjs";
2
2
  export { EmailError, INBOX_HEADER, MAX_ATTACHMENTS, MAX_ATTACHMENT_BYTES, MAX_BATCH, MAX_MESSAGE_BYTES, MAX_RECIPIENTS, MAX_THREADS, addressOf, checkMessage, email, inbox, verifyWebhook };
package/email/smtp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as email, t as EmailError, x as client } from "../email-DmWG_Ug-.mjs";
1
+ import { l as email, t as EmailError, x as client } from "../email-Bp45mjUS.mjs";
2
2
  import { createServer } from "node:net";
3
3
  import { createServer as createServer$1 } from "node:tls";
4
4
  //#region src/email/smtp.ts
@@ -1,4 +1,4 @@
1
- import { s as addressOf, t as EmailError } from "../email-DmWG_Ug-.mjs";
1
+ import { s as addressOf, t as EmailError } from "../email-Bp45mjUS.mjs";
2
2
  //#region src/email/stand-in.ts
3
3
  /**
4
4
  * Email's Stand-in: the Capability's behaviour in memory, for `midsummer dev` and tests. It sends
@@ -1,4 +1,4 @@
1
- import { i as processEnv, n as late, t as here } from "./here-BKjizr_N.mjs";
1
+ import { a as processEnv, n as here, r as late, t as clientHeaders } from "./here-C2jhTheQ.mjs";
2
2
  import { verifyEvent } from "./apps.mjs";
3
3
  //#region src/email/client.ts
4
4
  /**
@@ -30,7 +30,8 @@ function client(origin, options) {
30
30
  method: "POST",
31
31
  headers: {
32
32
  authorization: `Bearer ${options.key}`,
33
- "content-type": "application/json"
33
+ "content-type": "application/json",
34
+ ...clientHeaders("email")
34
35
  },
35
36
  body: JSON.stringify(body)
36
37
  });
@@ -9,6 +9,22 @@ function processEnv() {
9
9
  return globalThis.process?.env ?? {};
10
10
  }
11
11
  /**
12
+ * This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
13
+ * release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
14
+ */
15
+ const SDK_VERSION = "0.1.0-staging.3853";
16
+ /**
17
+ * The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
18
+ * <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
19
+ * versions still call what. It says nothing else. None from a browser, where a header of its own would make the
20
+ * browser ask the address's permission before each call.
21
+ *
22
+ * fetch(url, { method: "POST", headers: { ...clientHeaders("storage"), "content-type": "application/octet-stream" }, body })
23
+ */
24
+ function clientHeaders(part) {
25
+ return /^Mozilla\//u.test(globalThis.navigator?.userAgent ?? "") ? {} : { "midsummer-client": `sdk/${SDK_VERSION} ${part}` };
26
+ }
27
+ /**
12
28
  * Where a call to Midsummer's API goes when the caller names no `api`: `MIDSUMMER_API`, which Midsummer sets for
13
29
  * every build and deployment, so code reaches the site it runs on; else the site this package was published for
14
30
  * (`PUBLISHED_API`).
@@ -35,11 +51,12 @@ function late(current) {
35
51
  /**
36
52
  * Where a run's frames go when Midsummer gave it a Workload session (`MIDSUMMER_IDENTITY_REQUEST_TOKEN`), as a CI run,
37
53
  * an agent's dev server and `midsummer dev --view` have: `path` on the API its identity token comes from, sent with
38
- * the session's token, so `bucket` and `queue` reach what its environment binds, and a view's own copies on a view.
54
+ * the session's token and the client it is (`clientHeaders`, `part` its product), so `bucket` and `queue` reach what its
55
+ * environment binds, and a view's own copies on a view.
39
56
  * Undefined outside one. `fail` makes the product's own error: `forbidden` for a session that has ended, `unavailable`
40
57
  * for an API that can't be reached.
41
58
  */
42
- function workloadTransport(path, fail) {
59
+ function workloadTransport(path, part, fail) {
43
60
  const env = processEnv(), token = env.MIDSUMMER_IDENTITY_REQUEST_TOKEN, tokenUrl = env.MIDSUMMER_IDENTITY_TOKEN_URL;
44
61
  if (!token || !tokenUrl) return void 0;
45
62
  const url = `${new URL(tokenUrl).origin}${path}`;
@@ -48,7 +65,8 @@ function workloadTransport(path, fail) {
48
65
  method: "POST",
49
66
  headers: {
50
67
  authorization: `Bearer ${token}`,
51
- "content-type": "application/octet-stream"
68
+ "content-type": "application/octet-stream",
69
+ ...clientHeaders(part)
52
70
  },
53
71
  body: frame
54
72
  }).catch(() => void 0);
@@ -59,4 +77,4 @@ function workloadTransport(path, fail) {
59
77
  } };
60
78
  }
61
79
  //#endregion
62
- export { workloadTransport as a, processEnv as i, late as n, platformApi as r, here as t };
80
+ export { processEnv as a, platformApi as i, here as n, workloadTransport as o, late as r, clientHeaders as t };
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-DgX-tCDn.mjs";
2
+ import { i as streamsOf, n as bucket, r as storage, t as WORKLOAD_PATH } from "./src-CZw5kkUg.mjs";
3
3
  export { StorageError, WORKLOAD_PATH, bucket, storage, streamsOf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.3850",
3
+ "version": "0.1.0-staging.3853",
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.",
package/queues/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as workloadTransport, i as processEnv, n as late, t as here } from "../here-BKjizr_N.mjs";
1
+ import { a as processEnv, n as here, o as workloadTransport, r as late } from "../here-C2jhTheQ.mjs";
2
2
  //#region src/queues/index.ts
3
3
  /**
4
4
  * Queues: a Team's Queues of Messages, which the SDK reaches by the name an Environment binds each one
@@ -161,7 +161,7 @@ function hereEngine() {
161
161
  if (!response || response.status !== 200) throw new QueueError("unavailable", "Queues could not be reached. Is midsummer dev still running?");
162
162
  return new Uint8Array(await response.arrayBuffer());
163
163
  } });
164
- const transport = workloadTransport(WORKLOAD_PATH, (code, why) => new QueueError(code, why));
164
+ const transport = workloadTransport(WORKLOAD_PATH, "queues", (code, why) => new QueueError(code, why));
165
165
  if (transport) return remoteOver(transport);
166
166
  throw new QueueError("forbidden", "This code runs outside Midsummer, so no environment binds a queue for it.");
167
167
  });
package/s3.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as StorageError } from "./errors-B1tO_wdm.mjs";
2
2
  import { a as checkMetadata, l as checkUploadId, m as sha256, n as checkBucketName, o as checkPartNumber, r as checkKey, s as checkParts } from "./names-Do0ot5Ha.mjs";
3
- import { i as streamsOf } from "./src-DgX-tCDn.mjs";
3
+ import { i as streamsOf } from "./src-CZw5kkUg.mjs";
4
4
  //#region src/s3.ts
5
5
  /**
6
6
  * Storage over the S3 protocol, so the tools and SDKs that speak it reach a Project's Buckets
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-DgX-tCDn.mjs";
1
+ import { d as sameHex, f as sign, m as socketSession, p as socket, u as keyed } from "./src-CZw5kkUg.mjs";
2
2
  export { keyed, sameHex, sign, socket, socketSession };
@@ -1,7 +1,7 @@
1
1
  import { t as StorageError } from "./errors-B1tO_wdm.mjs";
2
2
  import { a as checkMetadata, c as checkRange, d as invalid, i as checkListLimit, l as checkUploadId, n as checkBucketName, o as checkPartNumber, r as checkKey, s as checkParts } from "./names-Do0ot5Ha.mjs";
3
+ import { a as processEnv, n as here, o as workloadTransport, r as late, t as clientHeaders } from "./here-C2jhTheQ.mjs";
3
4
  import { bucketsOf, remote, repeatable, serve } from "./wire.mjs";
4
- import { a as workloadTransport, i as processEnv, n as late, t as here } from "./here-BKjizr_N.mjs";
5
5
  //#region src/socket.ts
6
6
  /**
7
7
  * Storage's wire over a WebSocket: one connection carries every call, so a client pays for one HTTP
@@ -324,7 +324,8 @@ function signedHttp(url, options) {
324
324
  method: "POST",
325
325
  headers: {
326
326
  authorization: `Midsummer-Key key=${options.key}, time=${time}, signature=${signature}`,
327
- "content-type": "application/octet-stream"
327
+ "content-type": "application/octet-stream",
328
+ ...clientHeaders("storage")
328
329
  },
329
330
  body: frame
330
331
  });
@@ -428,7 +429,7 @@ function bucket(name) {
428
429
  };
429
430
  return dev.engine;
430
431
  }
431
- const transport = workloadTransport(WORKLOAD_PATH, (code, why) => new StorageError(code, why));
432
+ const transport = workloadTransport(WORKLOAD_PATH, "storage", (code, why) => new StorageError(code, why));
432
433
  if (transport) return remote(transport, { batch: true });
433
434
  throw new StorageError("forbidden", "This code runs outside Midsummer, so no environment binds a bucket for it. Connect with a storage key: storage(client(origin, { key, secret })).");
434
435
  })).bucket(name);
package/storage/files.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { t as StorageError } from "../errors-B1tO_wdm.mjs";
2
2
  import { n as checkBucketName } from "../names-Do0ot5Ha.mjs";
3
+ import { t as clientHeaders } from "../here-C2jhTheQ.mjs";
3
4
  import { DatabaseError } from "../database/errors.mjs";
4
5
  import { i as verifier, r as trustedOf, t as authConfigOf } from "../auth-1W-SzpD3.mjs";
5
6
  //#region src/storage/files.ts
@@ -434,7 +435,8 @@ function files(options) {
434
435
  ...init,
435
436
  headers: {
436
437
  ...init.headers,
437
- ...token ? { Authorization: `Bearer ${token}` } : {}
438
+ ...token ? { Authorization: `Bearer ${token}` } : {},
439
+ ...clientHeaders("storage")
438
440
  }
439
441
  });
440
442
  } catch {
@@ -1,4 +1,4 @@
1
- import { T as VectorError } from "../wire-BnZXAFNf.mjs";
1
+ import { T as VectorError } from "../wire-DaZNP-qh.mjs";
2
2
  import { vectorDb } from "./index.mjs";
3
3
  //#region src/vector/contract.ts
4
4
  /**
package/vector/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as late, t as here } from "../here-BKjizr_N.mjs";
2
- import { C as Vectors, E as vectorErrorCodes, S as TextSearch, T as VectorError, _ as MAX_TOP_K, a as remote, b as NamespaceName, c as Aggregation, d as MAX_BATCH, f as MAX_DIMENSION, g as MAX_TEXT, h as MAX_QUERIES, l as Ids, m as MAX_METADATA_BYTES, n as direct, p as MAX_FULL_TEXT, u as List, v as MAX_VALUE, w as checked, x as Query, y as MultiQuery } from "../wire-BnZXAFNf.mjs";
1
+ import { n as here, r as late } from "../here-C2jhTheQ.mjs";
2
+ import { C as Vectors, E as vectorErrorCodes, S as TextSearch, T as VectorError, _ as MAX_TOP_K, a as remote, b as NamespaceName, c as Aggregation, d as MAX_BATCH, f as MAX_DIMENSION, g as MAX_TEXT, h as MAX_QUERIES, l as Ids, m as MAX_METADATA_BYTES, n as direct, p as MAX_FULL_TEXT, u as List, v as MAX_VALUE, w as checked, x as Query, y as MultiQuery } from "../wire-DaZNP-qh.mjs";
3
3
  //#region src/vector/index.ts
4
4
  /**
5
5
  * Vector DB: a Team's Vectors in Vector namespaces, searched by closeness and filtered by their
@@ -1,4 +1,4 @@
1
- import { T as VectorError } from "../wire-BnZXAFNf.mjs";
1
+ import { T as VectorError } from "../wire-DaZNP-qh.mjs";
2
2
  import { embedded } from "./index.mjs";
3
3
  //#region src/vector/stand-in.ts
4
4
  /**
package/vector/wire.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as remote, i as places, n as direct, o as scoped, r as encode, s as serve, t as decode } from "../wire-BnZXAFNf.mjs";
1
+ import { a as remote, i as places, n as direct, o as scoped, r as encode, s as serve, t as decode } from "../wire-DaZNP-qh.mjs";
2
2
  export { decode, direct, encode, places, remote, scoped, serve };
@@ -1,3 +1,4 @@
1
+ import { t as clientHeaders } from "./here-C2jhTheQ.mjs";
1
2
  import { z } from "zod";
2
3
  //#region src/vector/errors.ts
3
4
  const vectorErrorCodes = [
@@ -426,7 +427,8 @@ function direct(options) {
426
427
  method: "POST",
427
428
  headers: {
428
429
  authorization: `Bearer ${options.key}`,
429
- "content-type": "application/octet-stream"
430
+ "content-type": "application/octet-stream",
431
+ ...clientHeaders("vector")
430
432
  },
431
433
  body: frame
432
434
  });
package/wire.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { n as storageErrorCodes, r as storageErrorReasons, t as StorageError } from "./errors-B1tO_wdm.mjs";
2
2
  import { a as checkMetadata, c as checkRange, i as checkListLimit, l as checkUploadId, n as checkBucketName, o as checkPartNumber, r as checkKey, s as checkParts } from "./names-Do0ot5Ha.mjs";
3
+ import { t as clientHeaders } from "./here-C2jhTheQ.mjs";
3
4
  import { z } from "zod";
4
5
  //#region src/wire.ts
5
6
  /**
@@ -670,7 +671,8 @@ function http(url, options) {
670
671
  method: "POST",
671
672
  headers: {
672
673
  authorization: `Bearer ${options.token}`,
673
- "content-type": "application/octet-stream"
674
+ "content-type": "application/octet-stream",
675
+ ...clientHeaders("storage")
674
676
  },
675
677
  body: frame
676
678
  });