@midsummer-ai/sdk 0.1.0-staging.5036 → 0.1.0-staging.5059
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/THIRD-PARTY-NOTICES +0 -26
- package/auth/contract.mjs +1 -1
- package/auth/index.mjs +1 -1
- package/auth/password.mjs +1 -1
- package/{auth-Dp3oUiLB.mjs → auth-Cq_UKvop.mjs} +1 -1
- package/{authorize-BzDrbYtI-0gOzDrp2.mjs → authorize-BzDrbYtI-BOTNiImu.mjs} +4 -553
- package/client.d.mts +1 -1
- package/client.mjs +1 -1
- package/contract.d.mts +1 -1
- package/contract.mjs +40 -2
- package/database/stand-in.d.mts +1 -1
- package/database/stand-in.mjs +1 -1
- package/{dist-DXtY-DJA.mjs → dist-CVKQXPsH.mjs} +2 -2
- package/{engine-CmTP59GT.mjs → engine-UPVFI808.mjs} +7 -4
- package/{errors-B1tO_wdm.mjs → errors-BY4sZe52.mjs} +2 -1
- package/{factory-9jfDGyc1.mjs → factory-KME_pxnd.mjs} +1 -1
- package/{get-id-field-vhOArqXN.mjs → get-id-field-D2HgdhsI.mjs} +2 -321
- package/here-C2jhTheQ.mjs +1 -1
- package/{index-BhrtT3r7.d.mts → index-7AbnNJLx.d.mts} +17 -2
- package/index.d.mts +1 -1
- package/index.mjs +2 -2
- package/{names-C-VZGec6.mjs → names-Dk-eRYJU.mjs} +21 -2
- package/package.json +2 -1
- package/s3.d.mts +1 -1
- package/s3.mjs +5 -4
- package/socket.d.mts +1 -1
- package/socket.mjs +1 -1
- package/{src-CKKUcBlb.mjs → src-CQmtQTvJ.mjs} +7 -3
- package/stand-in.d.mts +1 -1
- package/stand-in.mjs +7 -2
- package/storage/contract.mjs +1 -1
- package/storage/files.d.mts +1 -1
- package/storage/files.mjs +2 -2
- package/wire.d.mts +1 -1
- package/wire.mjs +9 -4
package/contract.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as StorageError } from "./errors-
|
|
2
|
-
import "./src-
|
|
1
|
+
import { t as StorageError } from "./errors-BY4sZe52.mjs";
|
|
2
|
+
import "./src-CQmtQTvJ.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
|
|
@@ -13,6 +13,8 @@ import "./src-CKKUcBlb.mjs";
|
|
|
13
13
|
*/
|
|
14
14
|
const HELLO = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824";
|
|
15
15
|
const HELLO_WORLD = "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9";
|
|
16
|
+
const HELLO_BLAKE3 = "ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f";
|
|
17
|
+
const HELLO_WORLD_BLAKE3 = "d74981efa70a0c880b8d8c1985d075dbcbf679b99a5f9914e5aaf96b831a9e24";
|
|
16
18
|
const storageContract = [
|
|
17
19
|
{
|
|
18
20
|
name: "an Object put is read back byte for byte, with its size, content type, metadata and SHA-256 etag",
|
|
@@ -437,6 +439,42 @@ const storageContract = [
|
|
|
437
439
|
equal(await bucket.head("new.txt"), null, "the new key that refused its bytes");
|
|
438
440
|
}
|
|
439
441
|
},
|
|
442
|
+
{
|
|
443
|
+
name: "a put made ifAbsent with a BLAKE3 is kept once: the same bytes again return what is stored, other bytes or another BLAKE3 store nothing",
|
|
444
|
+
async run(storage) {
|
|
445
|
+
const bucket = storage.bucket("blobs");
|
|
446
|
+
const first = await bucket.put(`blake3/${HELLO_BLAKE3}`, "hello", {
|
|
447
|
+
blake3: HELLO_BLAKE3,
|
|
448
|
+
ifAbsent: true
|
|
449
|
+
});
|
|
450
|
+
equal([
|
|
451
|
+
first.key,
|
|
452
|
+
first.etag,
|
|
453
|
+
first.size
|
|
454
|
+
], [
|
|
455
|
+
`blake3/${HELLO_BLAKE3}`,
|
|
456
|
+
HELLO,
|
|
457
|
+
5
|
|
458
|
+
], "the first put of the bytes");
|
|
459
|
+
const again = await bucket.put(`blake3/${HELLO_BLAKE3}`, "hello", {
|
|
460
|
+
blake3: HELLO_BLAKE3.toUpperCase(),
|
|
461
|
+
ifAbsent: true
|
|
462
|
+
});
|
|
463
|
+
equal([again.etag, again.uploadedAt], [first.etag, first.uploadedAt], "the same bytes put again, which return what is stored");
|
|
464
|
+
await fails(bucket.put(`blake3/${HELLO_BLAKE3}`, "hello world", { ifAbsent: true }), "conflict", "other bytes under a key made ifAbsent");
|
|
465
|
+
await fails(bucket.put("new.txt", "hello world", {
|
|
466
|
+
blake3: HELLO_BLAKE3,
|
|
467
|
+
ifAbsent: true
|
|
468
|
+
}), "invalid", "bytes that do not have the BLAKE3 named");
|
|
469
|
+
await fails(bucket.put("bad.txt", "hello", { blake3: "not-a-hash" }), "invalid", "a BLAKE3 that is not 64 hexadecimal characters");
|
|
470
|
+
equal((await bucket.put("both.txt", "hello world", {
|
|
471
|
+
blake3: HELLO_WORLD_BLAKE3,
|
|
472
|
+
sha256: HELLO_WORLD
|
|
473
|
+
})).etag, HELLO_WORLD, "a put named with both hashes");
|
|
474
|
+
equal(text((await bucket.get(`blake3/${HELLO_BLAKE3}`)).body), "hello", "the key that refused other bytes");
|
|
475
|
+
equal(await bucket.head("new.txt"), null, "the new key that refused its bytes");
|
|
476
|
+
}
|
|
477
|
+
},
|
|
440
478
|
{
|
|
441
479
|
name: "an upload in parts named with a SHA-256 completes only when the whole Object has it; one whose bytes lack it is ended, storing nothing",
|
|
442
480
|
async run(storage) {
|
package/database/stand-in.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DatabaseError } from "../errors-DcEc-3eL.mjs";
|
|
2
|
-
import { h as Storage } from "../index-
|
|
2
|
+
import { h as Storage } from "../index-7AbnNJLx.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-CQmtQTvJ.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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createAdapterFactory } from "./factory-
|
|
1
|
+
import { C as logger } from "./get-id-field-D2HgdhsI.mjs";
|
|
2
|
+
import { t as createAdapterFactory } from "./factory-KME_pxnd.mjs";
|
|
3
3
|
//#region ../../node_modules/.bun/@better-auth+memory-adapter@1.7.18+9e8b14b0561c6771/node_modules/@better-auth/memory-adapter/dist/index.mjs
|
|
4
4
|
/**
|
|
5
5
|
* Case-insensitive in-memory comparison helpers.
|
|
@@ -2,14 +2,17 @@ import { i as __toCommonJS, n as __esmMin, r as __exportAll, t as __commonJSMin
|
|
|
2
2
|
import { KEY_PREFIX } from "./auth/key.mjs";
|
|
3
3
|
import { h as IDENTITY_SCOPES, o as ourWords, u as JoinRefused, x as resourceOf } from "./guard-VPI6xq4z.mjs";
|
|
4
4
|
import { impersonationIdentifier } from "./auth/impersonate.mjs";
|
|
5
|
-
import { $ as queueAfterTransactionHook, $t as
|
|
6
|
-
import {
|
|
5
|
+
import { $ as queueAfterTransactionHook, $t as isDynamicBaseURLConfig, A as freshSessionMiddleware, At as userSchema, B as sensitiveSessionMiddleware, Bt as jwtVerify, C as parseScopeField, Ct as parseAccountOutput, D as constantTimeEqual, Dt as parseUserInput, E as generateRandomString, Et as parseSessionOutput, F as listSessions, Ft as decodeJwt, G as createAuthMiddleware, Gt as JWTExpired, H as appendQueryParams, Ht as JOSEError, I as requestOnlySessionMiddleware, It as decodeProtectedHeader, J as defu, Jt as isPromise, K as isAPIError$1, Kt as hasServerSessionStore, L as revokeOtherSessions, Lt as importJWK, M as getSession, Mt as number, N as getSessionFromCtx, Nt as string, O as getOAuthServerContext, Ot as parseUserOutput, P as isStateful, Pt as signJWT, Q as getCurrentAdapter, Qt as getProtocol, R as revokeSession, Rt as createLocalJWKSet, S as parseProviderEmailVerified, St as mergeSchema, T as symmetricEncrypt, Tt as parseSessionInput, U as normalizePathname, Ut as JWKSNoMatchingKey, V as sessionMiddleware, Vt as isJwkSet, W as createAuthEndpoint, Wt as JWKSTimeout, X as findInvalidTrustedProxies, Xt as getHost, Y as createRateLimitKey, Yt as getBaseURL, Z as getIP, Zt as getOrigin, _ as encodeBasicCredentials, _t as parseSetCookieHeader, a as resolveSigningKey, an as wildcardMatch, at as tryGetCurrentAuthEndpointContext, b as getPrimaryClientId, bt as buildSyntheticUserOutput, c as getDefaultKeyAlg, ct as deleteSessionCookie, d as getOperationId, dt as setCookieCache, en as isRequestLike, et as runWithAdapter, f as verifyJwsAccessToken, ft as setSessionCookie, g as resolveClientAssertionParams, gt as createRouter$1, h as betterFetch, ht as setAccountCookie, i as getJwtToken, in as defineErrorCodes, it as getCurrentAuthEndpointContext, j as getAuthoritativeSessionFromCtx, jt as coreSchema, k as setOAuthState, kt as filterOutputFields, l as getJwksAdapter, lt as expireCookie, m as fetchRefusingRedirects, mt as getAccountCookie, n as metadataResponse, nn as trimTrailingSlashes, nt as runtimeSchemaCheckFor, o as signJWT$1, ot as createHash, p as DPOP_SIGNING_ALGORITHMS, pt as createHMAC, q as isLoopbackHost$1, qt as shouldBindAccountCookieToSessionUser, r as oauthProvider, rn as BASE_ERROR_CODES, rt as schemaCheckFor, s as createJwk, st as createCookieGetter, t as getIssuer, tn as resolveBaseURL, tt as runWithTransaction, u as dispatchAuthEndpoint, ut as getCookies, v as generateCodeChallenge, vt as parseCookieCachePayload, w as symmetricDecrypt, wt as parseAdditionalUserInputFromProviderProfile, x as mergeScopes, xt as getSessionDefaultFields, y as getOAuth2Tokens, yt as getDate$1, z as revokeSessions, zt as SignJWT } from "./authorize-BzDrbYtI-BOTNiImu.mjs";
|
|
6
|
+
import { A as isDevelopment, C as logger, D as env, E as ENV, M as isTest, O as getBooleanEnvVar, S as createLogger, a as createRandomStringGenerator, b as getAuthTables, c as ATTR_DB_COLLECTION_NAME, d as ATTR_HTTP_RESPONSE_STATUS_CODE, g as base64Url, h as base64$1, i as generateId$1, j as isProduction, k as getEnvVar, o as createWithSpan, s as ATTR_CONTEXT, t as encodeDeterministicId, u as ATTR_HOOK_TYPE, v as toUint8Array, y as safeJSONParse } from "./get-id-field-D2HgdhsI.mjs";
|
|
7
7
|
import { C as string$1, D as xor, F as BetterAuthError, H as getBetterAuthVersion, P as APIError, S as strictObject, T as unknown, b as optional, c as array, d as email, f as ipv4, g as looseObject, h as literal, j as validate, l as boolean, m as json, o as _enum, s as any, u as date, v as number$1, w as union, x as record, y as object } from "./schemas-DTJTcCdK.mjs";
|
|
8
8
|
import { n as hasRequestState, r as runWithRequestState, t as defineRequestState } from "./request-state-BaLB2Hrt.mjs";
|
|
9
|
-
import { t as createAdapterFactory } from "./factory-
|
|
9
|
+
import { t as createAdapterFactory } from "./factory-KME_pxnd.mjs";
|
|
10
10
|
import { isBcrypt } from "./auth/import.mjs";
|
|
11
|
+
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
11
12
|
import fsPromises from "node:fs/promises";
|
|
12
13
|
import path from "node:path";
|
|
14
|
+
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
15
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
13
16
|
import { randomBytes, scrypt } from "node:crypto";
|
|
14
17
|
import fs from "node:fs";
|
|
15
18
|
import os from "node:os";
|
|
@@ -9973,7 +9976,7 @@ async function getBaseAdapter(options, handleDirectDatabase) {
|
|
|
9973
9976
|
acc[key] = [];
|
|
9974
9977
|
return acc;
|
|
9975
9978
|
}, {});
|
|
9976
|
-
const { memoryAdapter } = await import("./dist-
|
|
9979
|
+
const { memoryAdapter } = await import("./dist-CVKQXPsH.mjs");
|
|
9977
9980
|
adapter = memoryAdapter(memoryDB)(options);
|
|
9978
9981
|
} else if (typeof options.database === "function") adapter = options.database(options);
|
|
9979
9982
|
else adapter = await handleDirectDatabase(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as createLogger, T as getColorDepth, b as getAuthTables, c as ATTR_DB_COLLECTION_NAME, l as ATTR_DB_OPERATION_NAME, n as initGetIdField, o as createWithSpan, r as initGetDefaultModelName, x as TTY_COLORS, y as safeJSONParse } from "./get-id-field-D2HgdhsI.mjs";
|
|
2
2
|
import { C as string, F as BetterAuthError, T as unknown, l as boolean, u as date, v as number, w as union, x as record, y as object } from "./schemas-DTJTcCdK.mjs";
|
|
3
3
|
//#region ../../node_modules/.bun/@better-auth+core@1.7.18+2cdb03908a7b5946/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs
|
|
4
4
|
const initGetDefaultFieldName = ({ schema, usePlural }) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { F as BetterAuthError, V as __getCurrentEndpointContext } from "./schemas-DTJTcCdK.mjs";
|
|
2
|
+
import { hexToBytes } from "@noble/hashes/utils.js";
|
|
2
3
|
//#region ../../node_modules/.bun/@better-auth+core@1.7.18+2cdb03908a7b5946/node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
3
4
|
const _envShim = Object.create(null);
|
|
4
5
|
const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
@@ -254,326 +255,6 @@ const logger = {
|
|
|
254
255
|
}
|
|
255
256
|
};
|
|
256
257
|
//#endregion
|
|
257
|
-
//#region ../../node_modules/.bun/@noble+hashes@2.4.0/node_modules/@noble/hashes/utils.js
|
|
258
|
-
/**
|
|
259
|
-
* Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.
|
|
260
|
-
* @param a - value to test
|
|
261
|
-
* @returns `true` when the value is a Uint8Array-compatible view.
|
|
262
|
-
* @example
|
|
263
|
-
* Check whether a value is a Uint8Array-compatible view.
|
|
264
|
-
* ```ts
|
|
265
|
-
* isBytes(new Uint8Array([1, 2, 3]));
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
function isBytes(a) {
|
|
269
|
-
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
270
|
-
}
|
|
271
|
-
const atitle = (title) => title ? `"${title}" ` : "";
|
|
272
|
-
/**
|
|
273
|
-
* Asserts something is a non-negative integer.
|
|
274
|
-
* @param n - number to validate
|
|
275
|
-
* @param title - label included in thrown errors
|
|
276
|
-
* @returns The validated number.
|
|
277
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
278
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
279
|
-
* @example
|
|
280
|
-
* Validate a non-negative integer option.
|
|
281
|
-
* ```ts
|
|
282
|
-
* anumber(32, 'length');
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
function anumber(n, title = "") {
|
|
286
|
-
if (typeof n !== "number") throw new TypeError(atitle(title) + "expected number, got " + typeof n);
|
|
287
|
-
if (!Number.isSafeInteger(n) || n < 0) throw new RangeError(atitle(title) + "expected integer >= 0, got " + n);
|
|
288
|
-
return n;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Asserts something is Uint8Array.
|
|
292
|
-
* @param value - value to validate
|
|
293
|
-
* @param length - optional exact length constraint
|
|
294
|
-
* @param title - label included in thrown errors
|
|
295
|
-
* @returns The validated byte array.
|
|
296
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
297
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
298
|
-
* @example
|
|
299
|
-
* Validate that a value is a byte array.
|
|
300
|
-
* ```ts
|
|
301
|
-
* abytes(new Uint8Array([1, 2, 3]));
|
|
302
|
-
* ```
|
|
303
|
-
*/
|
|
304
|
-
function abytes(value, length, title = "") {
|
|
305
|
-
if (isBytes(value) && (length === void 0 || value.length === length)) return value;
|
|
306
|
-
if (length !== void 0) anumber(length, "length");
|
|
307
|
-
const bytes = isBytes(value);
|
|
308
|
-
const ofLen = length !== void 0 ? ` of length ${length}` : "";
|
|
309
|
-
const got = bytes ? `length=${value.length}` : `type=${typeof value}`;
|
|
310
|
-
const message = atitle(title) + "expected Uint8Array" + ofLen + ", got " + got;
|
|
311
|
-
if (!bytes) throw new TypeError(message);
|
|
312
|
-
throw new RangeError(message);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Asserts something is a wrapped hash constructor.
|
|
316
|
-
* @param h - hash constructor to validate
|
|
317
|
-
* @throws On wrong argument types or invalid hash wrapper shape. {@link TypeError}
|
|
318
|
-
* @throws On invalid hash metadata ranges or values. {@link RangeError}
|
|
319
|
-
* @throws If the hash metadata allows empty outputs or block sizes. {@link Error}
|
|
320
|
-
* @example
|
|
321
|
-
* Validate a callable hash wrapper.
|
|
322
|
-
* ```ts
|
|
323
|
-
* import { ahash } from '@noble/hashes/utils.js';
|
|
324
|
-
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
325
|
-
* ahash(sha256);
|
|
326
|
-
* ```
|
|
327
|
-
*/
|
|
328
|
-
function ahash(h) {
|
|
329
|
-
if (typeof h !== "function" || typeof h.create !== "function") throw new TypeError("expected hash wrapped by utils.createHasher");
|
|
330
|
-
anumber(h.outputLen);
|
|
331
|
-
anumber(h.blockLen);
|
|
332
|
-
if (h.outputLen < 1 || h.blockLen < 1) throw new Error("hash blockLen / outputLen must be >= 1");
|
|
333
|
-
}
|
|
334
|
-
const aobject = (value, label) => {
|
|
335
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new TypeError((label === "object" ? "" : `"${label}" `) + "expected object, got type=" + typeof value);
|
|
336
|
-
};
|
|
337
|
-
const aopts = (value, label) => {
|
|
338
|
-
aobject(value, label);
|
|
339
|
-
const proto = Object.getPrototypeOf(value);
|
|
340
|
-
if (proto !== Object.prototype && proto !== null) throw new TypeError(`"${label}" expected plain object`);
|
|
341
|
-
if (Object.hasOwn(value, "__proto__")) throw new TypeError(`"${label}.__proto__" is not allowed`);
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* Asserts a hash instance has not been destroyed or finished.
|
|
345
|
-
* @param instance - hash instance to validate
|
|
346
|
-
* @param checkFinished - whether to reject finalized instances
|
|
347
|
-
* @throws If the hash instance has already been destroyed or finalized. {@link Error}
|
|
348
|
-
* @example
|
|
349
|
-
* Validate that a hash instance is still usable.
|
|
350
|
-
* ```ts
|
|
351
|
-
* import { aexists } from '@noble/hashes/utils.js';
|
|
352
|
-
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
353
|
-
* const hash = sha256.create();
|
|
354
|
-
* aexists(hash);
|
|
355
|
-
* ```
|
|
356
|
-
*/
|
|
357
|
-
function aexists(instance, checkFinished = true) {
|
|
358
|
-
if (instance.destroyed) throw new Error("hash was destroyed");
|
|
359
|
-
if (checkFinished && instance.finished) throw new Error("digest() was already called");
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Asserts output is a sufficiently-sized byte array.
|
|
363
|
-
* @param out - destination buffer
|
|
364
|
-
* @param instance - hash instance providing output length
|
|
365
|
-
* Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.
|
|
366
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
367
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
368
|
-
* @example
|
|
369
|
-
* Validate a caller-provided digest buffer.
|
|
370
|
-
* ```ts
|
|
371
|
-
* import { aoutput } from '@noble/hashes/utils.js';
|
|
372
|
-
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
373
|
-
* const hash = sha256.create();
|
|
374
|
-
* aoutput(new Uint8Array(hash.outputLen), hash);
|
|
375
|
-
* ```
|
|
376
|
-
*/
|
|
377
|
-
function aoutput(out, instance) {
|
|
378
|
-
abytes(out, void 0, "output");
|
|
379
|
-
const min = instance.outputLen;
|
|
380
|
-
if (!(out.length >= min)) throw new RangeError("\"output\" expected length >= " + min);
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Zeroizes typed arrays in place. Warning: JS provides no guarantees.
|
|
384
|
-
* @param arrays - arrays to overwrite with zeros
|
|
385
|
-
* @example
|
|
386
|
-
* Zeroize sensitive buffers in place.
|
|
387
|
-
* ```ts
|
|
388
|
-
* clean(new Uint8Array([1, 2, 3]));
|
|
389
|
-
* ```
|
|
390
|
-
*/
|
|
391
|
-
function clean(...arrays) {
|
|
392
|
-
for (let i = 0; i < arrays.length; i++) arrays[i].fill(0);
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Creates a DataView for byte-level manipulation.
|
|
396
|
-
* @param arr - source typed array
|
|
397
|
-
* @returns DataView over the same buffer region.
|
|
398
|
-
* @example
|
|
399
|
-
* Create a DataView over an existing buffer.
|
|
400
|
-
* ```ts
|
|
401
|
-
* createView(new Uint8Array(4));
|
|
402
|
-
* ```
|
|
403
|
-
*/
|
|
404
|
-
function createView(arr) {
|
|
405
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Rotate-right operation for uint32 values.
|
|
409
|
-
* @param word - source word
|
|
410
|
-
* @param shift - shift amount in bits
|
|
411
|
-
* @returns Rotated word.
|
|
412
|
-
* @example
|
|
413
|
-
* Rotate a 32-bit word to the right.
|
|
414
|
-
* ```ts
|
|
415
|
-
* rotr(0x12345678, 8);
|
|
416
|
-
* ```
|
|
417
|
-
*/
|
|
418
|
-
function rotr(word, shift) {
|
|
419
|
-
return word << 32 - shift | word >>> shift;
|
|
420
|
-
}
|
|
421
|
-
const hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
|
|
422
|
-
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
423
|
-
/**
|
|
424
|
-
* Convert byte array to hex string.
|
|
425
|
-
* Uses the built-in function when available and assumes it matches the tested
|
|
426
|
-
* fallback semantics.
|
|
427
|
-
* @param bytes - bytes to encode
|
|
428
|
-
* @returns Lowercase hexadecimal string.
|
|
429
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
430
|
-
* @example
|
|
431
|
-
* Convert bytes to lowercase hexadecimal.
|
|
432
|
-
* ```ts
|
|
433
|
-
* bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])); // 'cafe0123'
|
|
434
|
-
* ```
|
|
435
|
-
*/
|
|
436
|
-
function bytesToHex(bytes) {
|
|
437
|
-
abytes(bytes);
|
|
438
|
-
if (hasHexBuiltin) return bytes.toHex();
|
|
439
|
-
let hex = "";
|
|
440
|
-
for (let i = 0; i < bytes.length; i++) hex += hexes[bytes[i]];
|
|
441
|
-
return hex;
|
|
442
|
-
}
|
|
443
|
-
function asciiToBase16(ch) {
|
|
444
|
-
return ch >= 48 && ch <= 57 ? ch - 48 : ch >= 65 && ch <= 70 ? ch - 55 : ch >= 97 && ch <= 102 ? ch - 87 : void 0;
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Convert hex string to byte array. Uses built-in function, when available.
|
|
448
|
-
* @param hex - hexadecimal string to decode
|
|
449
|
-
* @returns Decoded bytes.
|
|
450
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
451
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
452
|
-
* @example
|
|
453
|
-
* Decode lowercase hexadecimal into bytes.
|
|
454
|
-
* ```ts
|
|
455
|
-
* hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
456
|
-
* ```
|
|
457
|
-
*/
|
|
458
|
-
function hexToBytes(hex) {
|
|
459
|
-
if (typeof hex !== "string") throw new TypeError("hex string expected, got " + typeof hex);
|
|
460
|
-
if (hasHexBuiltin) try {
|
|
461
|
-
return Uint8Array.fromHex(hex);
|
|
462
|
-
} catch (error) {
|
|
463
|
-
if (error instanceof SyntaxError) throw new RangeError(error.message);
|
|
464
|
-
throw error;
|
|
465
|
-
}
|
|
466
|
-
const hl = hex.length;
|
|
467
|
-
const al = hl / 2;
|
|
468
|
-
if (hl % 2) throw new RangeError("hex string expected, got unpadded hex of length " + hl);
|
|
469
|
-
const array = new Uint8Array(al);
|
|
470
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
471
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
472
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
473
|
-
if (n1 === void 0 || n2 === void 0) {
|
|
474
|
-
const char = hex[hi] + hex[hi + 1];
|
|
475
|
-
throw new RangeError("hex string expected, got non-hex character \"" + char + "\" at index " + hi);
|
|
476
|
-
}
|
|
477
|
-
array[ai] = n1 * 16 + n2;
|
|
478
|
-
}
|
|
479
|
-
return array;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Converts string to bytes using UTF8 encoding.
|
|
483
|
-
* Built-in doesn't validate input to be string: we do the check.
|
|
484
|
-
* Non-ASCII details are delegated to the platform `TextEncoder`.
|
|
485
|
-
* @param str - string to encode
|
|
486
|
-
* @returns UTF-8 encoded bytes.
|
|
487
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
488
|
-
* @example
|
|
489
|
-
* Encode a string as UTF-8 bytes.
|
|
490
|
-
* ```ts
|
|
491
|
-
* utf8ToBytes('abc'); // Uint8Array.from([97, 98, 99])
|
|
492
|
-
* ```
|
|
493
|
-
*/
|
|
494
|
-
function utf8ToBytes(str) {
|
|
495
|
-
if (typeof str !== "string") throw new TypeError("string expected");
|
|
496
|
-
const encoded = new TextEncoder().encode(str);
|
|
497
|
-
try {
|
|
498
|
-
return new Uint8Array(encoded);
|
|
499
|
-
} finally {
|
|
500
|
-
clean(encoded);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Merges default options and passed options.
|
|
505
|
-
* @param defaults - base option object
|
|
506
|
-
* @param opts - user overrides
|
|
507
|
-
* @param title - label included in thrown override errors
|
|
508
|
-
* @returns Fresh merged option object with a null prototype.
|
|
509
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
510
|
-
* @example
|
|
511
|
-
* Merge user overrides onto default options.
|
|
512
|
-
* ```ts
|
|
513
|
-
* checkOpts({ dkLen: 32 }, { asyncTick: 10 });
|
|
514
|
-
* ```
|
|
515
|
-
*/
|
|
516
|
-
function checkOpts(defaults, opts, title = "opts") {
|
|
517
|
-
aopts(defaults, "defaults");
|
|
518
|
-
if (opts !== void 0) aopts(opts, title);
|
|
519
|
-
return Object.assign(Object.create(null), defaults, opts);
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Creates a callable hash function from a stateful class constructor.
|
|
523
|
-
* @param hashCons - hash constructor or factory
|
|
524
|
-
* @param info - optional metadata such as DER OID
|
|
525
|
-
* @returns Frozen callable hash wrapper with `.create()`.
|
|
526
|
-
* Wrapper construction eagerly calls `hashCons(undefined)` once to read
|
|
527
|
-
* `outputLen` / `blockLen`, so constructor side effects happen at module
|
|
528
|
-
* init time.
|
|
529
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
530
|
-
* @example
|
|
531
|
-
* Wrap a stateful hash constructor into a callable helper.
|
|
532
|
-
* ```ts
|
|
533
|
-
* import { createHasher } from '@noble/hashes/utils.js';
|
|
534
|
-
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
535
|
-
* const wrapped = createHasher(sha256.create, { oid: sha256.oid });
|
|
536
|
-
* wrapped(new Uint8Array([1]));
|
|
537
|
-
* ```
|
|
538
|
-
*/
|
|
539
|
-
function createHasher(hashCons, info = {}) {
|
|
540
|
-
if (typeof hashCons !== "function") throw new TypeError("\"hashCons\" expected function, got type=" + typeof hashCons);
|
|
541
|
-
info = checkOpts({}, info, "info");
|
|
542
|
-
const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
|
|
543
|
-
const tmp = hashCons(void 0);
|
|
544
|
-
hashC.outputLen = tmp.outputLen;
|
|
545
|
-
hashC.blockLen = tmp.blockLen;
|
|
546
|
-
hashC.canXOF = tmp.canXOF;
|
|
547
|
-
hashC.create = (opts) => hashCons(opts);
|
|
548
|
-
Object.assign(hashC, info);
|
|
549
|
-
return Object.freeze(hashC);
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Creates OID metadata for NIST hashes with prefix `06 09 60 86 48 01 65 03 04 02`.
|
|
553
|
-
* @param suffix - final OID byte for the selected hash.
|
|
554
|
-
* The helper accepts any byte even though only the documented NIST hash
|
|
555
|
-
* suffixes are meaningful downstream.
|
|
556
|
-
* @returns Object containing the DER-encoded OID.
|
|
557
|
-
* @example
|
|
558
|
-
* Build OID metadata for a NIST hash.
|
|
559
|
-
* ```ts
|
|
560
|
-
* oidNist(0x01);
|
|
561
|
-
* ```
|
|
562
|
-
*/
|
|
563
|
-
const oidNist = (suffix) => ({ oid: Uint8Array.from([
|
|
564
|
-
6,
|
|
565
|
-
9,
|
|
566
|
-
96,
|
|
567
|
-
134,
|
|
568
|
-
72,
|
|
569
|
-
1,
|
|
570
|
-
101,
|
|
571
|
-
3,
|
|
572
|
-
4,
|
|
573
|
-
2,
|
|
574
|
-
suffix
|
|
575
|
-
]) });
|
|
576
|
-
//#endregion
|
|
577
258
|
//#region ../../node_modules/.bun/@better-auth+core@1.7.18+2cdb03908a7b5946/node_modules/@better-auth/core/dist/db/database-index.mjs
|
|
578
259
|
const MAX_DATABASE_INDEX_NAME_BYTES = 63;
|
|
579
260
|
const MAX_DATABASE_INDEX_FIELDS = 16;
|
|
@@ -1452,4 +1133,4 @@ const initGetIdField = ({ usePlural, schema, disableIdGeneration, options, custo
|
|
|
1452
1133
|
return idField;
|
|
1453
1134
|
};
|
|
1454
1135
|
//#endregion
|
|
1455
|
-
export {
|
|
1136
|
+
export { isDevelopment as A, logger as C, env as D, ENV as E, isTest as M, getBooleanEnvVar as O, createLogger as S, getColorDepth as T, toBufferSource as _, createRandomStringGenerator as a, getAuthTables as b, ATTR_DB_COLLECTION_NAME as c, ATTR_HTTP_RESPONSE_STATUS_CODE as d, ATTR_HTTP_ROUTE as f, base64Url as g, base64 as h, generateId as i, isProduction as j, getEnvVar as k, ATTR_DB_OPERATION_NAME as l, hex as m, initGetIdField as n, createWithSpan as o, ATTR_OPERATION_ID as p, initGetDefaultModelName as r, ATTR_CONTEXT as s, encodeDeterministicId as t, ATTR_HOOK_TYPE as u, toUint8Array as v, shouldPublishLog as w, TTY_COLORS as x, safeJSONParse as y };
|
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.5059";
|
|
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
|
|
@@ -9,9 +9,9 @@ type StorageErrorCode = "invalid" | "not_found" | "conflict" | "forbidden" | "qu
|
|
|
9
9
|
* Which rule a failure broke, where a caller acts on it: `range` (it starts past the end),
|
|
10
10
|
* `upload` (no such upload, or it is finished), `part` (a part to complete is missing or its etag
|
|
11
11
|
* differs), `part-order` (the parts to complete are not in ascending order), `part-too-small`
|
|
12
|
-
* (a part other than the last is under 5 MiB).
|
|
12
|
+
* (a part other than the last is under 5 MiB), `erased` (a put made `ifAbsent` is for a key that was erased).
|
|
13
13
|
*/
|
|
14
|
-
type StorageErrorReason = "range" | "upload" | "part" | "part-order" | "part-too-small";
|
|
14
|
+
type StorageErrorReason = "range" | "upload" | "part" | "part-order" | "part-too-small" | "erased";
|
|
15
15
|
declare class StorageError extends Error {
|
|
16
16
|
readonly code: StorageErrorCode;
|
|
17
17
|
readonly reason?: StorageErrorReason | undefined;
|
|
@@ -67,6 +67,17 @@ interface PutOptions {
|
|
|
67
67
|
* this hash.
|
|
68
68
|
*/
|
|
69
69
|
readonly sha256?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The BLAKE3 the bytes must have, in hex, beside or instead of `sha256`: a body that differs is `invalid` and stored
|
|
72
|
+
* nowhere. For a body up to 16 MiB, put in one call.
|
|
73
|
+
*/
|
|
74
|
+
readonly blake3?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Put only if nothing is stored under the key, as for a key named by its content's hash. The same bytes put again
|
|
77
|
+
* return what is stored, so a put repeated after a lost answer succeeds; other bytes are `conflict`, and the key keeps
|
|
78
|
+
* what it has. For a body up to 16 MiB, put in one call.
|
|
79
|
+
*/
|
|
80
|
+
readonly ifAbsent?: true;
|
|
70
81
|
}
|
|
71
82
|
interface ListOptions {
|
|
72
83
|
/** Only keys that start with this. */
|
|
@@ -273,6 +284,10 @@ interface EnginePut {
|
|
|
273
284
|
readonly ifMatch?: string;
|
|
274
285
|
/** The SHA-256 the body must have, in lowercase hex: one that differs is `invalid` and stored nowhere. */
|
|
275
286
|
readonly sha256?: string;
|
|
287
|
+
/** The BLAKE3 the body must have, in lowercase hex: one that differs is `invalid` and stored nowhere. */
|
|
288
|
+
readonly blake3?: string;
|
|
289
|
+
/** Put only if nothing is stored under the key: the same bytes again return what is stored, other bytes are `conflict`. */
|
|
290
|
+
readonly ifAbsent?: true;
|
|
276
291
|
}
|
|
277
292
|
interface EngineList {
|
|
278
293
|
readonly prefix: string;
|
package/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-7AbnNJLx.mjs";
|
|
2
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
|
-
import { t as StorageError } from "./errors-
|
|
2
|
-
import { i as streamsOf, n as bucket, r as storage, t as WORKLOAD_PATH } from "./src-
|
|
1
|
+
import { t as StorageError } from "./errors-BY4sZe52.mjs";
|
|
2
|
+
import { i as streamsOf, n as bucket, r as storage, t as WORKLOAD_PATH } from "./src-CQmtQTvJ.mjs";
|
|
3
3
|
export { StorageError, WORKLOAD_PATH, bucket, storage, streamsOf };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { t as StorageError } from "./errors-
|
|
1
|
+
import { t as StorageError } from "./errors-BY4sZe52.mjs";
|
|
2
|
+
import { blake3 } from "@noble/hashes/blake3.js";
|
|
3
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
2
4
|
//#region src/names.ts
|
|
3
5
|
function invalid(why) {
|
|
4
6
|
throw new StorageError("invalid", why);
|
|
@@ -69,6 +71,11 @@ function checkSha256(sha256) {
|
|
|
69
71
|
if (!/^[0-9a-fA-F]{64}$/.test(sha256)) invalid("sha256 is not a SHA-256: 64 hexadecimal characters");
|
|
70
72
|
return sha256.toLowerCase();
|
|
71
73
|
}
|
|
74
|
+
/** A BLAKE3 the caller names for a body, in hex: answered in lowercase. */
|
|
75
|
+
function checkBlake3(blake3) {
|
|
76
|
+
if (!/^[0-9a-fA-F]{64}$/.test(blake3)) invalid("blake3 is not a BLAKE3: 64 hexadecimal characters");
|
|
77
|
+
return blake3.toLowerCase();
|
|
78
|
+
}
|
|
72
79
|
/** What a watch names: 1 to 1,000 keys or one prefix, and a cursor to go on from. */
|
|
73
80
|
function checkWatch(options) {
|
|
74
81
|
if (options.keys === void 0 === (options.prefix === void 0)) invalid("a watch names keys or a prefix: one of them");
|
|
@@ -95,6 +102,14 @@ async function missingByHead(engine, bucket, keys) {
|
|
|
95
102
|
}
|
|
96
103
|
/** Why a body named with the SHA-256 `expected` is refused, its own being `actual`. */
|
|
97
104
|
const sha256Refusal = (expected, actual) => `the body's SHA-256 is ${actual}, not the ${expected} it was sent with; nothing was stored`;
|
|
105
|
+
/** Why a body named with the BLAKE3 `expected` is refused, its own being `actual`. */
|
|
106
|
+
const blake3Refusal = (expected, actual) => `the body's BLAKE3 is ${actual}, not the ${expected} it was sent with; nothing was stored`;
|
|
107
|
+
/** The BLAKE3 a body was named with, against the one it has: `invalid`, storing nothing, when they differ. */
|
|
108
|
+
function checkBodyBlake3(expected, actual) {
|
|
109
|
+
if (expected !== void 0 && expected !== actual) invalid(blake3Refusal(expected, actual));
|
|
110
|
+
}
|
|
111
|
+
/** Why a put made `ifAbsent` is refused: the key keeps other bytes. */
|
|
112
|
+
const otherBytesRefusal = (key) => `"${key}" already keeps other bytes; nothing was stored`;
|
|
98
113
|
/** Why an upload named with the SHA-256 `expected` is refused on completing, its whole bytes' being `actual`: it is ended. */
|
|
99
114
|
const uploadSha256Refusal = (expected, actual) => `the upload's SHA-256 is ${actual}, not the ${expected} it was begun with; nothing was stored and the upload is ended, so begin another`;
|
|
100
115
|
/** The SHA-256 a body was named with, against the one it has: `invalid`, storing nothing, when they differ. */
|
|
@@ -110,6 +125,10 @@ function compareKeys(a, b) {
|
|
|
110
125
|
for (let i = 0; i < Math.min(x.length, y.length); i += 1) if (x[i] !== y[i]) return x[i] - y[i];
|
|
111
126
|
return x.length - y.length;
|
|
112
127
|
}
|
|
128
|
+
/** The BLAKE3 of `bytes`, in lowercase hex. */
|
|
129
|
+
function blake3Of(bytes) {
|
|
130
|
+
return bytesToHex(blake3(bytes));
|
|
131
|
+
}
|
|
113
132
|
async function sha256(bytes) {
|
|
114
133
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
115
134
|
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -123,4 +142,4 @@ function sameSizes(sizes, named) {
|
|
|
123
142
|
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");
|
|
124
143
|
}
|
|
125
144
|
//#endregion
|
|
126
|
-
export {
|
|
145
|
+
export { sha256 as C, sameSizes as S, compareKeys as _, checkBodySha256 as a, otherBytesRefusal as b, checkListLimit as c, checkPartNumber as d, checkParts as f, checkWatch as g, checkUploadId as h, checkBodyBlake3 as i, checkMetadata as l, checkSha256 as m, blake3Of as n, checkBucketName as o, checkRange as p, checkBlake3 as r, checkKey as s, MIN_PART as t, checkMissingKeys as u, invalid as v, uploadSha256Refusal as w, resolveRange as x, missingByHead 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.5059",
|
|
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.",
|
|
@@ -517,6 +517,7 @@
|
|
|
517
517
|
"node": "^20.19.0 || ^22.12.0 || ^24.0.0 || >=26.0.0"
|
|
518
518
|
},
|
|
519
519
|
"dependencies": {
|
|
520
|
+
"@noble/hashes": "2.4.0",
|
|
520
521
|
"acorn": "8.15.0",
|
|
521
522
|
"zod": "4.1.12"
|
|
522
523
|
},
|
package/s3.d.mts
CHANGED
package/s3.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as StorageError } from "./errors-
|
|
2
|
-
import {
|
|
3
|
-
import { i as streamsOf } from "./src-
|
|
1
|
+
import { t as StorageError } from "./errors-BY4sZe52.mjs";
|
|
2
|
+
import { C as sha256, d as checkPartNumber, f as checkParts, h as checkUploadId, l as checkMetadata, o as checkBucketName, s as checkKey } from "./names-Dk-eRYJU.mjs";
|
|
3
|
+
import { i as streamsOf } from "./src-CQmtQTvJ.mjs";
|
|
4
4
|
import { inertHeaders } from "./inert.mjs";
|
|
5
5
|
//#region src/s3.ts
|
|
6
6
|
/**
|
|
@@ -148,7 +148,8 @@ const byReason = {
|
|
|
148
148
|
upload: [404, "NoSuchUpload"],
|
|
149
149
|
part: [400, "InvalidPart"],
|
|
150
150
|
"part-order": [400, "InvalidPartOrder"],
|
|
151
|
-
"part-too-small": [400, "EntityTooSmall"]
|
|
151
|
+
"part-too-small": [400, "EntityTooSmall"],
|
|
152
|
+
erased: [412, "PreconditionFailed"]
|
|
152
153
|
};
|
|
153
154
|
function statusOf(code, reason) {
|
|
154
155
|
if (reason) return byReason[reason];
|