Update app and tooling

This commit is contained in:
Lawrence Chen 2026-01-29 17:36:26 -08:00
parent 3046531bdd
commit e620ec7349
4950 changed files with 2975120 additions and 10 deletions

86
node_modules/@vercel/blob/README.md generated vendored Normal file
View file

@ -0,0 +1,86 @@
# 🍙 @vercel/blob
The Vercel Blob JavaScript API client.
---
<p align="center">
👉
<a href="https://vercel.com/docs/vercel-blob">
<b>Quickstart</b>
</a>
<a href="https://vercel.com/docs/vercel-blob/using-blob-sdk">
<b>SDK Reference</b>
</a>
👈
</b>
</p>
---
## Installation
```sh
npm install @vercel/blob
```
## Quickstart
We have examples on the vercel.com documentation, there are two ways to upload files to Vercel Blob:
1. [Server uploads](https://vercel.com/docs/vercel-blob/server-upload): This is the most common way to upload files. The file is first sent to your server and then to Vercel Blob. It's straightforward to implement, but you are limited to the request body your server can handle. Which in case of a Vercel-hosted website is 4.5 MB. **This means you can't upload files larger than 4.5 MB on Vercel when using this method.**
2. [Client uploads](https://vercel.com/docs/vercel-blob/client-upload): This is a more advanced solution for when you need to upload larger files. The file is securely sent directly from the client (a browser for example) to Vercel Blob. This requires a bit more work to implement, but it allows you to upload files up to 5 TB.
## Releasing
Make sure to include a changeset in your PR. You can do this by running:
```sh
pnpm changeset
git commit -am "changeset"
git push
```
Once such a commit gets merged in main, then GitHub will open a versioning PR you can merge. And the package will be automatically published to npm.
## A note for Vite users
`@vercel/blob` reads the token from the environment variables on `process.env`. In general, `process.env` is automatically populated from your `.env` file during development, which is created when you run `vc env pull`. However, Vite does not expose the `.env` variables on `process.env.`
You can fix this in **one** of following two ways:
1. You can populate `process.env` yourself using something like `dotenv-expand`:
```shell
pnpm install --save-dev dotenv dotenv-expand
```
```js
// vite.config.js
import dotenvExpand from 'dotenv-expand';
import { loadEnv, defineConfig } from 'vite';
export default defineConfig(({ mode }) => {
// This check is important!
if (mode === 'development') {
const env = loadEnv(mode, process.cwd(), '');
dotenvExpand.expand({ parsed: env });
}
return {
...
};
});
```
2. You can provide the credentials explicitly, instead of relying on a zero-config setup. For example, this is how you could create a client in SvelteKit, which makes private environment variables available via `$env/static/private`:
```diff
import { put } from '@vercel/blob';
+ import { BLOB_TOKEN } from '$env/static/private';
const blob = await head("filepath", {
- token: '<token>',
+ token: BLOB_TOKEN,
});
```

1345
node_modules/@vercel/blob/dist/chunk-KLNTTDLT.cjs generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

1345
node_modules/@vercel/blob/dist/chunk-Z56QURM6.js generated vendored Normal file

File diff suppressed because it is too large Load diff

1
node_modules/@vercel/blob/dist/chunk-Z56QURM6.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

287
node_modules/@vercel/blob/dist/client.cjs generated vendored Normal file
View file

@ -0,0 +1,287 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
var _chunkKLNTTDLTcjs = require('./chunk-KLNTTDLT.cjs');
// src/client.ts
var _crypto = require('crypto'); var crypto = _interopRequireWildcard(_crypto);
var _undici = require('undici');
function createPutExtraChecks(methodName) {
return function extraChecks(options) {
if (!options.token.startsWith("vercel_blob_client_")) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(`${methodName} must be called with a client token`);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.allowOverwrite !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`${methodName} doesn't allow \`addRandomSuffix\`, \`cacheControlMaxAge\` or \`allowOverwrite\`. Configure these options at the server side when generating client tokens.`
);
}
};
}
var put = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`put`")
});
var createMultipartUpload = _chunkKLNTTDLTcjs.createCreateMultipartUploadMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
});
var createMultipartUploader = _chunkKLNTTDLTcjs.createCreateMultipartUploaderMethod.call(void 0,
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
}
);
var uploadPart = _chunkKLNTTDLTcjs.createUploadPartMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`multipartUpload`")
});
var completeMultipartUpload = _chunkKLNTTDLTcjs.createCompleteMultipartUploadMethod.call(void 0,
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`completeMultipartUpload`")
}
);
var upload = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: ["contentType"],
extraChecks(options) {
if (options.handleUploadUrl === void 0) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
"client/`upload` requires the 'handleUploadUrl' parameter"
);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.createPutExtraChecks !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
"client/`upload` doesn't allow `addRandomSuffix`, `cacheControlMaxAge` or `allowOverwrite`. Configure these options at the server side when generating client tokens."
);
}
},
async getToken(pathname, options) {
var _a, _b;
return retrieveClientToken({
handleUploadUrl: options.handleUploadUrl,
pathname,
clientPayload: (_a = options.clientPayload) != null ? _a : null,
multipart: (_b = options.multipart) != null ? _b : false
});
}
});
async function importKey(token) {
return globalThis.crypto.subtle.importKey(
"raw",
new TextEncoder().encode(token),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign", "verify"]
);
}
async function signPayload(payload, token) {
if (!globalThis.crypto) {
return crypto.createHmac("sha256", token).update(payload).digest("hex");
}
const signature = await globalThis.crypto.subtle.sign(
"HMAC",
await importKey(token),
new TextEncoder().encode(payload)
);
return Buffer.from(new Uint8Array(signature)).toString("hex");
}
async function verifyCallbackSignature({
token,
signature,
body
}) {
const secret = token;
if (!globalThis.crypto) {
const digest = crypto.createHmac("sha256", secret).update(body).digest("hex");
const digestBuffer = Buffer.from(digest);
const signatureBuffer = Buffer.from(signature);
return digestBuffer.length === signatureBuffer.length && crypto.timingSafeEqual(digestBuffer, signatureBuffer);
}
const verified = await globalThis.crypto.subtle.verify(
"HMAC",
await importKey(token),
hexToArrayByte(signature),
new TextEncoder().encode(body)
);
return verified;
}
function hexToArrayByte(input) {
if (input.length % 2 !== 0) {
throw new RangeError("Expected string to be an even number of characters");
}
const view = new Uint8Array(input.length / 2);
for (let i = 0; i < input.length; i += 2) {
view[i / 2] = parseInt(input.substring(i, i + 2), 16);
}
return Buffer.from(view);
}
function getPayloadFromClientToken(clientToken) {
const [, , , , encodedToken] = clientToken.split("_");
const encodedPayload = Buffer.from(encodedToken != null ? encodedToken : "", "base64").toString().split(".")[1];
const decodedPayload = Buffer.from(encodedPayload != null ? encodedPayload : "", "base64").toString();
return JSON.parse(decodedPayload);
}
var EventTypes = {
generateClientToken: "blob.generate-client-token",
uploadCompleted: "blob.upload-completed"
};
async function handleUpload({
token,
request,
body,
onBeforeGenerateToken,
onUploadCompleted
}) {
var _a, _b, _c, _d;
const resolvedToken = _chunkKLNTTDLTcjs.getTokenFromOptionsOrEnv.call(void 0, { token });
const type = body.type;
switch (type) {
case "blob.generate-client-token": {
const { pathname, callbackUrl, clientPayload, multipart } = body.payload;
const payload = await onBeforeGenerateToken(
pathname,
clientPayload,
multipart
);
const tokenPayload = (_a = payload.tokenPayload) != null ? _a : clientPayload;
const oneHourInSeconds = 60 * 60;
const now = /* @__PURE__ */ new Date();
const validUntil = (_b = payload.validUntil) != null ? _b : now.setSeconds(now.getSeconds() + oneHourInSeconds);
return {
type,
clientToken: await generateClientTokenFromReadWriteToken({
...payload,
token: resolvedToken,
pathname,
onUploadCompleted: {
callbackUrl,
tokenPayload
},
validUntil
})
};
}
case "blob.upload-completed": {
const signatureHeader = "x-vercel-signature";
const signature = "credentials" in request ? (_c = request.headers.get(signatureHeader)) != null ? _c : "" : (_d = request.headers[signatureHeader]) != null ? _d : "";
if (!signature) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Missing callback signature");
}
const isVerified = await verifyCallbackSignature({
token: resolvedToken,
signature,
body: JSON.stringify(body)
});
if (!isVerified) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Invalid callback signature");
}
await onUploadCompleted(body.payload);
return { type, response: "ok" };
}
default:
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Invalid event type");
}
}
async function retrieveClientToken(options) {
const { handleUploadUrl, pathname } = options;
const url = isAbsoluteUrl(handleUploadUrl) ? handleUploadUrl : toAbsoluteUrl(handleUploadUrl);
const event = {
type: EventTypes.generateClientToken,
payload: {
pathname,
callbackUrl: url,
clientPayload: options.clientPayload,
multipart: options.multipart
}
};
const res = await _undici.fetch.call(void 0, url, {
method: "POST",
body: JSON.stringify(event),
headers: {
"content-type": "application/json"
},
signal: options.abortSignal
});
if (!res.ok) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Failed to retrieve the client token");
}
try {
const { clientToken } = await res.json();
return clientToken;
} catch (e) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Failed to retrieve the client token");
}
}
function toAbsoluteUrl(url) {
return new URL(url, location.href).href;
}
function isAbsoluteUrl(url) {
try {
return Boolean(new URL(url));
} catch (e) {
return false;
}
}
async function generateClientTokenFromReadWriteToken({
token,
...argsWithoutToken
}) {
var _a;
if (typeof window !== "undefined") {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
'"generateClientTokenFromReadWriteToken" must be called from a server environment'
);
}
const timestamp = /* @__PURE__ */ new Date();
timestamp.setSeconds(timestamp.getSeconds() + 30);
const readWriteToken = _chunkKLNTTDLTcjs.getTokenFromOptionsOrEnv.call(void 0, { token });
const [, , , storeId = null] = readWriteToken.split("_");
if (!storeId) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
token ? "Invalid `token` parameter" : "Invalid `BLOB_READ_WRITE_TOKEN`"
);
}
const payload = Buffer.from(
JSON.stringify({
...argsWithoutToken,
validUntil: (_a = argsWithoutToken.validUntil) != null ? _a : timestamp.getTime()
})
).toString("base64");
const securedKey = await signPayload(payload, readWriteToken);
if (!securedKey) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("Unable to sign client token");
}
return `vercel_blob_client_${storeId}_${Buffer.from(
`${securedKey}.${payload}`
).toString("base64")}`;
}
exports.completeMultipartUpload = completeMultipartUpload; exports.createFolder = _chunkKLNTTDLTcjs.createFolder; exports.createMultipartUpload = createMultipartUpload; exports.createMultipartUploader = createMultipartUploader; exports.generateClientTokenFromReadWriteToken = generateClientTokenFromReadWriteToken; exports.getPayloadFromClientToken = getPayloadFromClientToken; exports.handleUpload = handleUpload; exports.put = put; exports.upload = upload; exports.uploadPart = uploadPart;
//# sourceMappingURL=client.cjs.map

1
node_modules/@vercel/blob/dist/client.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

397
node_modules/@vercel/blob/dist/client.d.cts generated vendored Normal file
View file

@ -0,0 +1,397 @@
import { W as WithUploadProgress, P as PutBody, a as PutBlobResult, b as Part, C as CommonMultipartUploadOptions, c as CommonCompleteMultipartUploadOptions, B as BlobCommandOptions } from './create-folder-C02EFEPE.cjs';
export { d as createFolder } from './create-folder-C02EFEPE.cjs';
import { IncomingMessage } from 'node:http';
import 'stream';
import 'undici';
/**
* Interface for put, upload and multipart upload operations.
* This type omits all options that are encoded in the client token.
*/
interface ClientCommonCreateBlobOptions {
/**
* Whether the blob should be publicly accessible.
*/
access: 'public';
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname.
* Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
/**
* Shared interface for put and multipart operations that use client tokens.
*/
interface ClientTokenOptions {
/**
* A client token that was generated by your server using the `generateClientToken` method.
*/
token: string;
}
/**
* Shared interface for put and upload operations.
* @internal This is an internal interface not intended for direct use by consumers.
*/
interface ClientCommonPutOptions extends ClientCommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files.
* It will split the file into multiple parts, upload them in parallel and retry failed parts.
*/
multipart?: boolean;
}
/**
* Options for the client-side put operation.
*/
type ClientPutCommandOptions = ClientCommonPutOptions & ClientTokenOptions;
/**
* Uploads a file to the blob store using a client token.
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob.
* @param body - The content of your blob. Can be a string, File, Blob, Buffer or ReadableStream.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: ClientPutCommandOptions) => Promise<PutBlobResult>;
/**
* Options for creating a multipart upload from the client side.
*/
type ClientCreateMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* @internal Internal type for multipart upload options.
*/
type ClientMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonMultipartUploadOptions & WithUploadProgress;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: ClientMultipartUploadCommandOptions) => Promise<Part>;
/**
* @internal Internal type for completing multipart uploads.
*/
type ClientCompleteMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonCompleteMultipartUploadOptions;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: ClientCompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
/**
* Options for client-side upload operations.
*/
interface CommonUploadOptions {
/**
* A route that implements the `handleUpload` function for generating a client token.
*/
handleUploadUrl: string;
/**
* Additional data which will be sent to your `handleUpload` route.
*/
clientPayload?: string;
}
/**
* Options for the upload method, which handles client-side uploads.
*/
type UploadOptions = ClientCommonPutOptions & CommonUploadOptions;
/**
* Uploads a blob into your store from the client.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* If you want to upload from your server instead, check out the documentation for the put operation: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* Unlike the put method, this method does not require a client token as it will fetch one from your server.
*
* @param pathname - The pathname to upload the blob to. This includes the filename and extension.
* @param body - The contents of your blob. This has to be a supported fetch body type (string, Blob, File, ArrayBuffer, etc).
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - handleUploadUrl - (Required) A string specifying the route to call for generating client tokens for client uploads.
* - clientPayload - (Optional) A string to be sent to your handleUpload server code. Example use-case: attaching the post id an image relates to.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const upload: (pathname: string, body: PutBody, optionsInput: UploadOptions) => Promise<PutBlobResult>;
/**
* Decoded payload from a client token.
*/
type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & {
/**
* Timestamp in milliseconds when the token will expire.
*/
validUntil: number;
};
/**
* Extracts and decodes the payload from a client token.
*
* @param clientToken - The client token string to decode
* @returns The decoded payload containing token options
*/
declare function getPayloadFromClientToken(clientToken: string): DecodedClientTokenPayload;
/**
* @internal Event type constants for internal use.
*/
declare const EventTypes: {
readonly generateClientToken: "blob.generate-client-token";
readonly uploadCompleted: "blob.upload-completed";
};
/**
* Event for generating a client token for blob uploads.
* @internal This is an internal interface used by the SDK.
*/
interface GenerateClientTokenEvent {
/**
* Type identifier for the generate client token event.
*/
type: (typeof EventTypes)['generateClientToken'];
/**
* Payload containing information needed to generate a client token.
*/
payload: {
/**
* The destination path for the blob.
*/
pathname: string;
/**
* URL where upload completion callbacks will be sent.
*/
callbackUrl: string;
/**
* Whether the upload will use multipart uploading.
*/
multipart: boolean;
/**
* Additional data from the client which will be available in onBeforeGenerateToken.
*/
clientPayload: string | null;
};
}
/**
* Event that occurs when a client upload has completed.
* @internal This is an internal interface used by the SDK.
*/
interface UploadCompletedEvent {
/**
* Type identifier for the upload completed event.
*/
type: (typeof EventTypes)['uploadCompleted'];
/**
* Payload containing information about the uploaded blob.
*/
payload: {
/**
* Details about the blob that was uploaded.
*/
blob: PutBlobResult;
/**
* Optional payload that was defined during token generation.
*/
tokenPayload?: string | null;
};
}
/**
* Union type representing either a request to generate a client token or a notification that an upload completed.
*/
type HandleUploadBody = GenerateClientTokenEvent | UploadCompletedEvent;
/**
* Type representing either a Node.js IncomingMessage or a web standard Request object.
* @internal This is an internal type used by the SDK.
*/
type RequestType = IncomingMessage | Request;
/**
* Options for the handleUpload function.
*/
interface HandleUploadOptions {
/**
* The request body containing upload information.
*/
body: HandleUploadBody;
/**
* Function called before generating the client token for uploads.
*
* @param pathname - The destination path for the blob
* @param clientPayload - A string payload specified on the client when calling upload()
* @param multipart - A boolean specifying whether the file is a multipart upload
*
* @returns An object with configuration options for the client token
*/
onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'allowOverwrite' | 'cacheControlMaxAge'> & {
tokenPayload?: string | null;
}>;
/**
* Function called by Vercel Blob when the client upload finishes.
* This is useful to update your database with the blob URL that was uploaded.
*
* @param body - Contains information about the completed upload including the blob details
*/
onUploadCompleted: (body: UploadCompletedEvent['payload']) => Promise<void>;
/**
* A string specifying the read-write token to use when making requests.
* It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
*/
token?: string;
/**
* An IncomingMessage or Request object to be used to determine the action to take.
*/
request: RequestType;
}
/**
* A server-side route helper to manage client uploads. It has two responsibilities:
* 1. Generate tokens for client uploads
* 2. Listen for completed client uploads, so you can update your database with the URL of the uploaded file
*
* @param options - Configuration options for handling uploads
* - request - (Required) An IncomingMessage or Request object to be used to determine the action to take.
* - body - (Required) The request body containing upload information.
* - onBeforeGenerateToken - (Required) Function called before generating the client token for uploads.
* - onUploadCompleted - (Required) Function called by Vercel Blob when the client upload finishes.
* - token - (Optional) A string specifying the read-write token to use when making requests. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* @returns A promise that resolves to either a client token generation result or an upload completion result
*/
declare function handleUpload({ token, request, body, onBeforeGenerateToken, onUploadCompleted, }: HandleUploadOptions): Promise<{
type: 'blob.generate-client-token';
clientToken: string;
} | {
type: 'blob.upload-completed';
response: 'ok';
}>;
/**
* Generates a client token from a read-write token. This function must be called from a server environment.
* The client token contains permissions and constraints that limit what the client can do.
*
* @param options - Options for generating the client token
* - pathname - (Required) The destination path for the blob.
* - token - (Optional) A string specifying the read-write token to use. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* - onUploadCompleted - (Optional) Configuration for upload completion callback.
* - maximumSizeInBytes - (Optional) A number specifying the maximum size in bytes that can be uploaded (max 5TB).
* - allowedContentTypes - (Optional) An array of media types that are allowed to be uploaded. Wildcards are supported (text/*).
* - validUntil - (Optional) A timestamp in ms when the token will expire. Defaults to one hour from generation.
* - addRandomSuffix - (Optional) Whether to add a random suffix to the filename. Defaults to false.
* - allowOverwrite - (Optional) Whether to allow overwriting existing blobs. Defaults to false.
* - cacheControlMaxAge - (Optional) Number of seconds to configure cache duration. Defaults to one month.
* @returns A promise that resolves to the generated client token string which can be used in client-side upload operations.
*/
declare function generateClientTokenFromReadWriteToken({ token, ...argsWithoutToken }: GenerateClientTokenOptions): Promise<string>;
/**
* Options for generating a client token.
*/
interface GenerateClientTokenOptions extends BlobCommandOptions {
/**
* The destination path for the blob
*/
pathname: string;
/**
* Configuration for upload completion callback
*/
onUploadCompleted?: {
callbackUrl: string;
tokenPayload?: string | null;
};
/**
* A number specifying the maximum size in bytes that can be uploaded. The maximum is 5TB.
*/
maximumSizeInBytes?: number;
/**
* An array of strings specifying the media type that are allowed to be uploaded.
* By default, it's all content types. Wildcards are supported (text/*)
*/
allowedContentTypes?: string[];
/**
* A number specifying the timestamp in ms when the token will expire.
* By default, it's now + 1 hour.
*/
validUntil?: number;
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
export { type ClientCommonCreateBlobOptions, type ClientCreateMultipartUploadCommandOptions, type ClientPutCommandOptions, type ClientTokenOptions, type CommonUploadOptions, type DecodedClientTokenPayload, type GenerateClientTokenOptions, type HandleUploadBody, type HandleUploadOptions, type UploadOptions, completeMultipartUpload, createMultipartUpload, createMultipartUploader, generateClientTokenFromReadWriteToken, getPayloadFromClientToken, handleUpload, put, upload, uploadPart };

397
node_modules/@vercel/blob/dist/client.d.ts generated vendored Normal file
View file

@ -0,0 +1,397 @@
import { W as WithUploadProgress, P as PutBody, a as PutBlobResult, b as Part, C as CommonMultipartUploadOptions, c as CommonCompleteMultipartUploadOptions, B as BlobCommandOptions } from './create-folder-C02EFEPE.js';
export { d as createFolder } from './create-folder-C02EFEPE.js';
import { IncomingMessage } from 'node:http';
import 'stream';
import 'undici';
/**
* Interface for put, upload and multipart upload operations.
* This type omits all options that are encoded in the client token.
*/
interface ClientCommonCreateBlobOptions {
/**
* Whether the blob should be publicly accessible.
*/
access: 'public';
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname.
* Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
/**
* Shared interface for put and multipart operations that use client tokens.
*/
interface ClientTokenOptions {
/**
* A client token that was generated by your server using the `generateClientToken` method.
*/
token: string;
}
/**
* Shared interface for put and upload operations.
* @internal This is an internal interface not intended for direct use by consumers.
*/
interface ClientCommonPutOptions extends ClientCommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files.
* It will split the file into multiple parts, upload them in parallel and retry failed parts.
*/
multipart?: boolean;
}
/**
* Options for the client-side put operation.
*/
type ClientPutCommandOptions = ClientCommonPutOptions & ClientTokenOptions;
/**
* Uploads a file to the blob store using a client token.
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob.
* @param body - The content of your blob. Can be a string, File, Blob, Buffer or ReadableStream.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: ClientPutCommandOptions) => Promise<PutBlobResult>;
/**
* Options for creating a multipart upload from the client side.
*/
type ClientCreateMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* @internal Internal type for multipart upload options.
*/
type ClientMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonMultipartUploadOptions & WithUploadProgress;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: ClientMultipartUploadCommandOptions) => Promise<Part>;
/**
* @internal Internal type for completing multipart uploads.
*/
type ClientCompleteMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonCompleteMultipartUploadOptions;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: ClientCompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
/**
* Options for client-side upload operations.
*/
interface CommonUploadOptions {
/**
* A route that implements the `handleUpload` function for generating a client token.
*/
handleUploadUrl: string;
/**
* Additional data which will be sent to your `handleUpload` route.
*/
clientPayload?: string;
}
/**
* Options for the upload method, which handles client-side uploads.
*/
type UploadOptions = ClientCommonPutOptions & CommonUploadOptions;
/**
* Uploads a blob into your store from the client.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* If you want to upload from your server instead, check out the documentation for the put operation: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* Unlike the put method, this method does not require a client token as it will fetch one from your server.
*
* @param pathname - The pathname to upload the blob to. This includes the filename and extension.
* @param body - The contents of your blob. This has to be a supported fetch body type (string, Blob, File, ArrayBuffer, etc).
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - handleUploadUrl - (Required) A string specifying the route to call for generating client tokens for client uploads.
* - clientPayload - (Optional) A string to be sent to your handleUpload server code. Example use-case: attaching the post id an image relates to.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const upload: (pathname: string, body: PutBody, optionsInput: UploadOptions) => Promise<PutBlobResult>;
/**
* Decoded payload from a client token.
*/
type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & {
/**
* Timestamp in milliseconds when the token will expire.
*/
validUntil: number;
};
/**
* Extracts and decodes the payload from a client token.
*
* @param clientToken - The client token string to decode
* @returns The decoded payload containing token options
*/
declare function getPayloadFromClientToken(clientToken: string): DecodedClientTokenPayload;
/**
* @internal Event type constants for internal use.
*/
declare const EventTypes: {
readonly generateClientToken: "blob.generate-client-token";
readonly uploadCompleted: "blob.upload-completed";
};
/**
* Event for generating a client token for blob uploads.
* @internal This is an internal interface used by the SDK.
*/
interface GenerateClientTokenEvent {
/**
* Type identifier for the generate client token event.
*/
type: (typeof EventTypes)['generateClientToken'];
/**
* Payload containing information needed to generate a client token.
*/
payload: {
/**
* The destination path for the blob.
*/
pathname: string;
/**
* URL where upload completion callbacks will be sent.
*/
callbackUrl: string;
/**
* Whether the upload will use multipart uploading.
*/
multipart: boolean;
/**
* Additional data from the client which will be available in onBeforeGenerateToken.
*/
clientPayload: string | null;
};
}
/**
* Event that occurs when a client upload has completed.
* @internal This is an internal interface used by the SDK.
*/
interface UploadCompletedEvent {
/**
* Type identifier for the upload completed event.
*/
type: (typeof EventTypes)['uploadCompleted'];
/**
* Payload containing information about the uploaded blob.
*/
payload: {
/**
* Details about the blob that was uploaded.
*/
blob: PutBlobResult;
/**
* Optional payload that was defined during token generation.
*/
tokenPayload?: string | null;
};
}
/**
* Union type representing either a request to generate a client token or a notification that an upload completed.
*/
type HandleUploadBody = GenerateClientTokenEvent | UploadCompletedEvent;
/**
* Type representing either a Node.js IncomingMessage or a web standard Request object.
* @internal This is an internal type used by the SDK.
*/
type RequestType = IncomingMessage | Request;
/**
* Options for the handleUpload function.
*/
interface HandleUploadOptions {
/**
* The request body containing upload information.
*/
body: HandleUploadBody;
/**
* Function called before generating the client token for uploads.
*
* @param pathname - The destination path for the blob
* @param clientPayload - A string payload specified on the client when calling upload()
* @param multipart - A boolean specifying whether the file is a multipart upload
*
* @returns An object with configuration options for the client token
*/
onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'allowOverwrite' | 'cacheControlMaxAge'> & {
tokenPayload?: string | null;
}>;
/**
* Function called by Vercel Blob when the client upload finishes.
* This is useful to update your database with the blob URL that was uploaded.
*
* @param body - Contains information about the completed upload including the blob details
*/
onUploadCompleted: (body: UploadCompletedEvent['payload']) => Promise<void>;
/**
* A string specifying the read-write token to use when making requests.
* It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
*/
token?: string;
/**
* An IncomingMessage or Request object to be used to determine the action to take.
*/
request: RequestType;
}
/**
* A server-side route helper to manage client uploads. It has two responsibilities:
* 1. Generate tokens for client uploads
* 2. Listen for completed client uploads, so you can update your database with the URL of the uploaded file
*
* @param options - Configuration options for handling uploads
* - request - (Required) An IncomingMessage or Request object to be used to determine the action to take.
* - body - (Required) The request body containing upload information.
* - onBeforeGenerateToken - (Required) Function called before generating the client token for uploads.
* - onUploadCompleted - (Required) Function called by Vercel Blob when the client upload finishes.
* - token - (Optional) A string specifying the read-write token to use when making requests. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* @returns A promise that resolves to either a client token generation result or an upload completion result
*/
declare function handleUpload({ token, request, body, onBeforeGenerateToken, onUploadCompleted, }: HandleUploadOptions): Promise<{
type: 'blob.generate-client-token';
clientToken: string;
} | {
type: 'blob.upload-completed';
response: 'ok';
}>;
/**
* Generates a client token from a read-write token. This function must be called from a server environment.
* The client token contains permissions and constraints that limit what the client can do.
*
* @param options - Options for generating the client token
* - pathname - (Required) The destination path for the blob.
* - token - (Optional) A string specifying the read-write token to use. Defaults to process.env.BLOB_READ_WRITE_TOKEN.
* - onUploadCompleted - (Optional) Configuration for upload completion callback.
* - maximumSizeInBytes - (Optional) A number specifying the maximum size in bytes that can be uploaded (max 5TB).
* - allowedContentTypes - (Optional) An array of media types that are allowed to be uploaded. Wildcards are supported (text/*).
* - validUntil - (Optional) A timestamp in ms when the token will expire. Defaults to one hour from generation.
* - addRandomSuffix - (Optional) Whether to add a random suffix to the filename. Defaults to false.
* - allowOverwrite - (Optional) Whether to allow overwriting existing blobs. Defaults to false.
* - cacheControlMaxAge - (Optional) Number of seconds to configure cache duration. Defaults to one month.
* @returns A promise that resolves to the generated client token string which can be used in client-side upload operations.
*/
declare function generateClientTokenFromReadWriteToken({ token, ...argsWithoutToken }: GenerateClientTokenOptions): Promise<string>;
/**
* Options for generating a client token.
*/
interface GenerateClientTokenOptions extends BlobCommandOptions {
/**
* The destination path for the blob
*/
pathname: string;
/**
* Configuration for upload completion callback
*/
onUploadCompleted?: {
callbackUrl: string;
tokenPayload?: string | null;
};
/**
* A number specifying the maximum size in bytes that can be uploaded. The maximum is 5TB.
*/
maximumSizeInBytes?: number;
/**
* An array of strings specifying the media type that are allowed to be uploaded.
* By default, it's all content types. Wildcards are supported (text/*)
*/
allowedContentTypes?: string[];
/**
* A number specifying the timestamp in ms when the token will expire.
* By default, it's now + 1 hour.
*/
validUntil?: number;
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
export { type ClientCommonCreateBlobOptions, type ClientCreateMultipartUploadCommandOptions, type ClientPutCommandOptions, type ClientTokenOptions, type CommonUploadOptions, type DecodedClientTokenPayload, type GenerateClientTokenOptions, type HandleUploadBody, type HandleUploadOptions, type UploadOptions, completeMultipartUpload, createMultipartUpload, createMultipartUploader, generateClientTokenFromReadWriteToken, getPayloadFromClientToken, handleUpload, put, upload, uploadPart };

287
node_modules/@vercel/blob/dist/client.js generated vendored Normal file
View file

@ -0,0 +1,287 @@
import {
BlobError,
createCompleteMultipartUploadMethod,
createCreateMultipartUploadMethod,
createCreateMultipartUploaderMethod,
createFolder,
createPutMethod,
createUploadPartMethod,
getTokenFromOptionsOrEnv
} from "./chunk-Z56QURM6.js";
// src/client.ts
import * as crypto from "crypto";
import { fetch } from "undici";
function createPutExtraChecks(methodName) {
return function extraChecks(options) {
if (!options.token.startsWith("vercel_blob_client_")) {
throw new BlobError(`${methodName} must be called with a client token`);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.allowOverwrite !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new BlobError(
`${methodName} doesn't allow \`addRandomSuffix\`, \`cacheControlMaxAge\` or \`allowOverwrite\`. Configure these options at the server side when generating client tokens.`
);
}
};
}
var put = createPutMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`put`")
});
var createMultipartUpload = createCreateMultipartUploadMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
});
var createMultipartUploader = createCreateMultipartUploaderMethod(
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`createMultipartUpload`")
}
);
var uploadPart = createUploadPartMethod({
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`multipartUpload`")
});
var completeMultipartUpload = createCompleteMultipartUploadMethod(
{
allowedOptions: ["contentType"],
extraChecks: createPutExtraChecks("client/`completeMultipartUpload`")
}
);
var upload = createPutMethod({
allowedOptions: ["contentType"],
extraChecks(options) {
if (options.handleUploadUrl === void 0) {
throw new BlobError(
"client/`upload` requires the 'handleUploadUrl' parameter"
);
}
if (
// @ts-expect-error -- Runtime check for DX.
options.addRandomSuffix !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.createPutExtraChecks !== void 0 || // @ts-expect-error -- Runtime check for DX.
options.cacheControlMaxAge !== void 0
) {
throw new BlobError(
"client/`upload` doesn't allow `addRandomSuffix`, `cacheControlMaxAge` or `allowOverwrite`. Configure these options at the server side when generating client tokens."
);
}
},
async getToken(pathname, options) {
var _a, _b;
return retrieveClientToken({
handleUploadUrl: options.handleUploadUrl,
pathname,
clientPayload: (_a = options.clientPayload) != null ? _a : null,
multipart: (_b = options.multipart) != null ? _b : false
});
}
});
async function importKey(token) {
return globalThis.crypto.subtle.importKey(
"raw",
new TextEncoder().encode(token),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign", "verify"]
);
}
async function signPayload(payload, token) {
if (!globalThis.crypto) {
return crypto.createHmac("sha256", token).update(payload).digest("hex");
}
const signature = await globalThis.crypto.subtle.sign(
"HMAC",
await importKey(token),
new TextEncoder().encode(payload)
);
return Buffer.from(new Uint8Array(signature)).toString("hex");
}
async function verifyCallbackSignature({
token,
signature,
body
}) {
const secret = token;
if (!globalThis.crypto) {
const digest = crypto.createHmac("sha256", secret).update(body).digest("hex");
const digestBuffer = Buffer.from(digest);
const signatureBuffer = Buffer.from(signature);
return digestBuffer.length === signatureBuffer.length && crypto.timingSafeEqual(digestBuffer, signatureBuffer);
}
const verified = await globalThis.crypto.subtle.verify(
"HMAC",
await importKey(token),
hexToArrayByte(signature),
new TextEncoder().encode(body)
);
return verified;
}
function hexToArrayByte(input) {
if (input.length % 2 !== 0) {
throw new RangeError("Expected string to be an even number of characters");
}
const view = new Uint8Array(input.length / 2);
for (let i = 0; i < input.length; i += 2) {
view[i / 2] = parseInt(input.substring(i, i + 2), 16);
}
return Buffer.from(view);
}
function getPayloadFromClientToken(clientToken) {
const [, , , , encodedToken] = clientToken.split("_");
const encodedPayload = Buffer.from(encodedToken != null ? encodedToken : "", "base64").toString().split(".")[1];
const decodedPayload = Buffer.from(encodedPayload != null ? encodedPayload : "", "base64").toString();
return JSON.parse(decodedPayload);
}
var EventTypes = {
generateClientToken: "blob.generate-client-token",
uploadCompleted: "blob.upload-completed"
};
async function handleUpload({
token,
request,
body,
onBeforeGenerateToken,
onUploadCompleted
}) {
var _a, _b, _c, _d;
const resolvedToken = getTokenFromOptionsOrEnv({ token });
const type = body.type;
switch (type) {
case "blob.generate-client-token": {
const { pathname, callbackUrl, clientPayload, multipart } = body.payload;
const payload = await onBeforeGenerateToken(
pathname,
clientPayload,
multipart
);
const tokenPayload = (_a = payload.tokenPayload) != null ? _a : clientPayload;
const oneHourInSeconds = 60 * 60;
const now = /* @__PURE__ */ new Date();
const validUntil = (_b = payload.validUntil) != null ? _b : now.setSeconds(now.getSeconds() + oneHourInSeconds);
return {
type,
clientToken: await generateClientTokenFromReadWriteToken({
...payload,
token: resolvedToken,
pathname,
onUploadCompleted: {
callbackUrl,
tokenPayload
},
validUntil
})
};
}
case "blob.upload-completed": {
const signatureHeader = "x-vercel-signature";
const signature = "credentials" in request ? (_c = request.headers.get(signatureHeader)) != null ? _c : "" : (_d = request.headers[signatureHeader]) != null ? _d : "";
if (!signature) {
throw new BlobError("Missing callback signature");
}
const isVerified = await verifyCallbackSignature({
token: resolvedToken,
signature,
body: JSON.stringify(body)
});
if (!isVerified) {
throw new BlobError("Invalid callback signature");
}
await onUploadCompleted(body.payload);
return { type, response: "ok" };
}
default:
throw new BlobError("Invalid event type");
}
}
async function retrieveClientToken(options) {
const { handleUploadUrl, pathname } = options;
const url = isAbsoluteUrl(handleUploadUrl) ? handleUploadUrl : toAbsoluteUrl(handleUploadUrl);
const event = {
type: EventTypes.generateClientToken,
payload: {
pathname,
callbackUrl: url,
clientPayload: options.clientPayload,
multipart: options.multipart
}
};
const res = await fetch(url, {
method: "POST",
body: JSON.stringify(event),
headers: {
"content-type": "application/json"
},
signal: options.abortSignal
});
if (!res.ok) {
throw new BlobError("Failed to retrieve the client token");
}
try {
const { clientToken } = await res.json();
return clientToken;
} catch (e) {
throw new BlobError("Failed to retrieve the client token");
}
}
function toAbsoluteUrl(url) {
return new URL(url, location.href).href;
}
function isAbsoluteUrl(url) {
try {
return Boolean(new URL(url));
} catch (e) {
return false;
}
}
async function generateClientTokenFromReadWriteToken({
token,
...argsWithoutToken
}) {
var _a;
if (typeof window !== "undefined") {
throw new BlobError(
'"generateClientTokenFromReadWriteToken" must be called from a server environment'
);
}
const timestamp = /* @__PURE__ */ new Date();
timestamp.setSeconds(timestamp.getSeconds() + 30);
const readWriteToken = getTokenFromOptionsOrEnv({ token });
const [, , , storeId = null] = readWriteToken.split("_");
if (!storeId) {
throw new BlobError(
token ? "Invalid `token` parameter" : "Invalid `BLOB_READ_WRITE_TOKEN`"
);
}
const payload = Buffer.from(
JSON.stringify({
...argsWithoutToken,
validUntil: (_a = argsWithoutToken.validUntil) != null ? _a : timestamp.getTime()
})
).toString("base64");
const securedKey = await signPayload(payload, readWriteToken);
if (!securedKey) {
throw new BlobError("Unable to sign client token");
}
return `vercel_blob_client_${storeId}_${Buffer.from(
`${securedKey}.${payload}`
).toString("base64")}`;
}
export {
completeMultipartUpload,
createFolder,
createMultipartUpload,
createMultipartUploader,
generateClientTokenFromReadWriteToken,
getPayloadFromClientToken,
handleUpload,
put,
upload,
uploadPart
};
//# sourceMappingURL=client.js.map

1
node_modules/@vercel/blob/dist/client.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,205 @@
import { Readable } from 'stream';
import { File } from 'undici';
interface BlobCommandOptions {
/**
* Define your blob API token.
* @defaultvalue process.env.BLOB_READ_WRITE_TOKEN
*/
token?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
interface CommonCreateBlobOptions extends BlobCommandOptions {
/**
* Whether the blob should be publicly accessible. The only currently allowed value is `public`.
*/
access: 'public';
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname. Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* Number in seconds to configure the edge and browser cache. The minimum is 1 minute. There's no maximum but keep in mind that browser and edge caches will do a best effort to respect this value.
* Detailed documentation can be found here: https://vercel.com/docs/storage/vercel-blob#caching
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
/**
* Event object passed to the onUploadProgress callback.
*/
interface UploadProgressEvent {
/**
* The number of bytes uploaded.
*/
loaded: number;
/**
* The total number of bytes to upload.
*/
total: number;
/**
* The percentage of the upload that has been completed.
*/
percentage: number;
}
/**
* Callback type for tracking upload progress.
*/
type OnUploadProgressCallback = (progressEvent: UploadProgressEvent) => void;
/**
* Interface for including upload progress tracking capabilities.
*/
interface WithUploadProgress {
/**
* Callback to track the upload progress. You will receive an object with the following properties:
* - `loaded`: The number of bytes uploaded
* - `total`: The total number of bytes to upload
* - `percentage`: The percentage of the upload that has been completed
*/
onUploadProgress?: OnUploadProgressCallback;
}
declare class BlobError extends Error {
constructor(message: string);
}
/**
* Generates a download URL for a blob.
* The download URL includes a ?download=1 parameter which causes browsers to download
* the file instead of displaying it inline.
*
* @param blobUrl - The URL of the blob to generate a download URL for
* @returns A string containing the download URL with the download parameter appended
*/
declare function getDownloadUrl(blobUrl: string): string;
/**
* Result of a successful put or copy operation.
*/
interface PutBlobResult {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content-type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
}
/**
* Represents the body content for a put operation.
* Can be one of several supported types.
*/
type PutBody = string | Readable | Buffer | Blob | ArrayBuffer | ReadableStream | File;
/**
* Input format for a multipart upload part.
* Used internally for processing multipart uploads.
*/
interface PartInput {
/**
* The part number (1-based index).
*/
partNumber: number;
/**
* The content of the part.
*/
blob: PutBody;
}
/**
* Represents a single part of a multipart upload.
* This structure is used when completing a multipart upload to specify the
* uploaded parts and their order.
*/
interface Part {
/**
* The ETag value returned when the part was uploaded.
* This value is used to verify the integrity of the uploaded part.
*/
etag: string;
/**
* The part number of this part (1-based).
* This number is used to order the parts when completing the multipart upload.
*/
partNumber: number;
}
/**
* Options for completing a multipart upload.
* Used with the completeMultipartUpload method.
*/
interface CommonCompleteMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to identify which multipart upload is being completed.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
}
type CompleteMultipartUploadCommandOptions = CommonCompleteMultipartUploadOptions & CommonCreateBlobOptions;
/**
* Options for uploading a part in a multipart upload process.
* Used with the uploadPart method.
*/
interface CommonMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to associate all uploaded parts with the same multipart upload.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
/**
* A number identifying which part is being uploaded (1-based).
* This number is used to order the parts when completing the multipart upload.
* Parts must be uploaded with consecutive part numbers starting from 1.
*/
partNumber: number;
}
type UploadPartCommandOptions = CommonMultipartUploadOptions & CommonCreateBlobOptions;
interface CreateFolderResult {
pathname: string;
url: string;
}
/**
* Creates a folder in your store. Vercel Blob has no real concept of folders, our file browser on Vercel.com displays folders based on the presence of trailing slashes in the pathname. Unless you are building a file browser system, you probably don't need to use this method.
*
* Use the resulting `url` to delete the folder, just like you would delete a blob.
* @param pathname - Can be user1/ or user1/avatars/
* @param options - Additional options like `token`
*/
declare function createFolder(pathname: string, options?: BlobCommandOptions): Promise<CreateFolderResult>;
export { type BlobCommandOptions as B, type CommonMultipartUploadOptions as C, type OnUploadProgressCallback as O, type PutBody as P, type UploadPartCommandOptions as U, type WithUploadProgress as W, type PutBlobResult as a, type Part as b, type CommonCompleteMultipartUploadOptions as c, createFolder as d, type CommonCreateBlobOptions as e, BlobError as f, type CompleteMultipartUploadCommandOptions as g, getDownloadUrl as h, type UploadProgressEvent as i, type PartInput as j };

View file

@ -0,0 +1,205 @@
import { Readable } from 'stream';
import { File } from 'undici';
interface BlobCommandOptions {
/**
* Define your blob API token.
* @defaultvalue process.env.BLOB_READ_WRITE_TOKEN
*/
token?: string;
/**
* `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
abortSignal?: AbortSignal;
}
interface CommonCreateBlobOptions extends BlobCommandOptions {
/**
* Whether the blob should be publicly accessible. The only currently allowed value is `public`.
*/
access: 'public';
/**
* Adds a random suffix to the filename.
* @defaultvalue false
*/
addRandomSuffix?: boolean;
/**
* Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists.
* @defaultvalue false
*/
allowOverwrite?: boolean;
/**
* Defines the content type of the blob. By default, this value is inferred from the pathname. Sent as the 'content-type' header when downloading a blob.
*/
contentType?: string;
/**
* Number in seconds to configure the edge and browser cache. The minimum is 1 minute. There's no maximum but keep in mind that browser and edge caches will do a best effort to respect this value.
* Detailed documentation can be found here: https://vercel.com/docs/storage/vercel-blob#caching
* @defaultvalue 30 * 24 * 60 * 60 (1 Month)
*/
cacheControlMaxAge?: number;
}
/**
* Event object passed to the onUploadProgress callback.
*/
interface UploadProgressEvent {
/**
* The number of bytes uploaded.
*/
loaded: number;
/**
* The total number of bytes to upload.
*/
total: number;
/**
* The percentage of the upload that has been completed.
*/
percentage: number;
}
/**
* Callback type for tracking upload progress.
*/
type OnUploadProgressCallback = (progressEvent: UploadProgressEvent) => void;
/**
* Interface for including upload progress tracking capabilities.
*/
interface WithUploadProgress {
/**
* Callback to track the upload progress. You will receive an object with the following properties:
* - `loaded`: The number of bytes uploaded
* - `total`: The total number of bytes to upload
* - `percentage`: The percentage of the upload that has been completed
*/
onUploadProgress?: OnUploadProgressCallback;
}
declare class BlobError extends Error {
constructor(message: string);
}
/**
* Generates a download URL for a blob.
* The download URL includes a ?download=1 parameter which causes browsers to download
* the file instead of displaying it inline.
*
* @param blobUrl - The URL of the blob to generate a download URL for
* @returns A string containing the download URL with the download parameter appended
*/
declare function getDownloadUrl(blobUrl: string): string;
/**
* Result of a successful put or copy operation.
*/
interface PutBlobResult {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content-type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
}
/**
* Represents the body content for a put operation.
* Can be one of several supported types.
*/
type PutBody = string | Readable | Buffer | Blob | ArrayBuffer | ReadableStream | File;
/**
* Input format for a multipart upload part.
* Used internally for processing multipart uploads.
*/
interface PartInput {
/**
* The part number (1-based index).
*/
partNumber: number;
/**
* The content of the part.
*/
blob: PutBody;
}
/**
* Represents a single part of a multipart upload.
* This structure is used when completing a multipart upload to specify the
* uploaded parts and their order.
*/
interface Part {
/**
* The ETag value returned when the part was uploaded.
* This value is used to verify the integrity of the uploaded part.
*/
etag: string;
/**
* The part number of this part (1-based).
* This number is used to order the parts when completing the multipart upload.
*/
partNumber: number;
}
/**
* Options for completing a multipart upload.
* Used with the completeMultipartUpload method.
*/
interface CommonCompleteMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to identify which multipart upload is being completed.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
}
type CompleteMultipartUploadCommandOptions = CommonCompleteMultipartUploadOptions & CommonCreateBlobOptions;
/**
* Options for uploading a part in a multipart upload process.
* Used with the uploadPart method.
*/
interface CommonMultipartUploadOptions {
/**
* Unique upload identifier for the multipart upload, received from createMultipartUpload.
* This ID is used to associate all uploaded parts with the same multipart upload.
*/
uploadId: string;
/**
* Unique key identifying the blob object, received from createMultipartUpload.
* This key is used to identify which blob object the parts belong to.
*/
key: string;
/**
* A number identifying which part is being uploaded (1-based).
* This number is used to order the parts when completing the multipart upload.
* Parts must be uploaded with consecutive part numbers starting from 1.
*/
partNumber: number;
}
type UploadPartCommandOptions = CommonMultipartUploadOptions & CommonCreateBlobOptions;
interface CreateFolderResult {
pathname: string;
url: string;
}
/**
* Creates a folder in your store. Vercel Blob has no real concept of folders, our file browser on Vercel.com displays folders based on the presence of trailing slashes in the pathname. Unless you are building a file browser system, you probably don't need to use this method.
*
* Use the resulting `url` to delete the folder, just like you would delete a blob.
* @param pathname - Can be user1/ or user1/avatars/
* @param options - Additional options like `token`
*/
declare function createFolder(pathname: string, options?: BlobCommandOptions): Promise<CreateFolderResult>;
export { type BlobCommandOptions as B, type CommonMultipartUploadOptions as C, type OnUploadProgressCallback as O, type PutBody as P, type UploadPartCommandOptions as U, type WithUploadProgress as W, type PutBlobResult as a, type Part as b, type CommonCompleteMultipartUploadOptions as c, createFolder as d, type CommonCreateBlobOptions as e, BlobError as f, type CompleteMultipartUploadCommandOptions as g, getDownloadUrl as h, type UploadProgressEvent as i, type PartInput as j };

7
node_modules/@vercel/blob/dist/crypto-browser.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
export function createHmac() {
throw new Error('Not implemented');
}
export function timingSafeEqual() {
throw new Error('Not implemented');
}

232
node_modules/@vercel/blob/dist/index.cjs generated vendored Normal file
View file

@ -0,0 +1,232 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkKLNTTDLTcjs = require('./chunk-KLNTTDLT.cjs');
// src/del.ts
async function del(url, options) {
await _chunkKLNTTDLTcjs.requestApi.call(void 0,
"/delete",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ urls: Array.isArray(url) ? url : [url] }),
signal: options == null ? void 0 : options.abortSignal
},
options
);
}
// src/head.ts
async function head(url, options) {
const searchParams = new URLSearchParams({ url });
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${searchParams.toString()}`,
// HEAD can't have body as a response, so we use GET
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
size: response.size,
contentType: response.contentType,
contentDisposition: response.contentDisposition,
cacheControl: response.cacheControl,
uploadedAt: new Date(response.uploadedAt)
};
}
// src/list.ts
async function list(options) {
var _a;
const searchParams = new URLSearchParams();
if (options == null ? void 0 : options.limit) {
searchParams.set("limit", options.limit.toString());
}
if (options == null ? void 0 : options.prefix) {
searchParams.set("prefix", options.prefix);
}
if (options == null ? void 0 : options.cursor) {
searchParams.set("cursor", options.cursor);
}
if (options == null ? void 0 : options.mode) {
searchParams.set("mode", options.mode);
}
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${searchParams.toString()}`,
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
if ((options == null ? void 0 : options.mode) === "folded") {
return {
folders: (_a = response.folders) != null ? _a : [],
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
return {
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
function mapBlobResult(blobResult) {
return {
url: blobResult.url,
downloadUrl: blobResult.downloadUrl,
pathname: blobResult.pathname,
size: blobResult.size,
uploadedAt: new Date(blobResult.uploadedAt)
};
}
// src/copy.ts
async function copy(fromUrl, toPathname, options) {
if (!options) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)("missing options, see usage");
}
if (options.access !== "public") {
throw new (0, _chunkKLNTTDLTcjs.BlobError)('access must be "public"');
}
if (toPathname.length > _chunkKLNTTDLTcjs.MAXIMUM_PATHNAME_LENGTH) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`pathname is too long, maximum length is ${_chunkKLNTTDLTcjs.MAXIMUM_PATHNAME_LENGTH}`
);
}
for (const invalidCharacter of _chunkKLNTTDLTcjs.disallowedPathnameCharacters) {
if (toPathname.includes(invalidCharacter)) {
throw new (0, _chunkKLNTTDLTcjs.BlobError)(
`pathname cannot contain "${invalidCharacter}", please encode it if needed`
);
}
}
const headers = {};
if (options.addRandomSuffix !== void 0) {
headers["x-add-random-suffix"] = options.addRandomSuffix ? "1" : "0";
}
if (options.allowOverwrite !== void 0) {
headers["x-allow-overwrite"] = options.allowOverwrite ? "1" : "0";
}
if (options.contentType) {
headers["x-content-type"] = options.contentType;
}
if (options.cacheControlMaxAge !== void 0) {
headers["x-cache-control-max-age"] = options.cacheControlMaxAge.toString();
}
const params = new URLSearchParams({ pathname: toPathname, fromUrl });
const response = await _chunkKLNTTDLTcjs.requestApi.call(void 0,
`?${params.toString()}`,
{
method: "PUT",
headers,
signal: options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
contentType: response.contentType,
contentDisposition: response.contentDisposition
};
}
// src/index.ts
var put = _chunkKLNTTDLTcjs.createPutMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUpload = _chunkKLNTTDLTcjs.createCreateMultipartUploadMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUploader = _chunkKLNTTDLTcjs.createCreateMultipartUploaderMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var uploadPart = _chunkKLNTTDLTcjs.createUploadPartMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var completeMultipartUpload = _chunkKLNTTDLTcjs.createCompleteMultipartUploadMethod.call(void 0, {
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
exports.BlobAccessError = _chunkKLNTTDLTcjs.BlobAccessError; exports.BlobClientTokenExpiredError = _chunkKLNTTDLTcjs.BlobClientTokenExpiredError; exports.BlobContentTypeNotAllowedError = _chunkKLNTTDLTcjs.BlobContentTypeNotAllowedError; exports.BlobError = _chunkKLNTTDLTcjs.BlobError; exports.BlobFileTooLargeError = _chunkKLNTTDLTcjs.BlobFileTooLargeError; exports.BlobNotFoundError = _chunkKLNTTDLTcjs.BlobNotFoundError; exports.BlobPathnameMismatchError = _chunkKLNTTDLTcjs.BlobPathnameMismatchError; exports.BlobRequestAbortedError = _chunkKLNTTDLTcjs.BlobRequestAbortedError; exports.BlobServiceNotAvailable = _chunkKLNTTDLTcjs.BlobServiceNotAvailable; exports.BlobServiceRateLimited = _chunkKLNTTDLTcjs.BlobServiceRateLimited; exports.BlobStoreNotFoundError = _chunkKLNTTDLTcjs.BlobStoreNotFoundError; exports.BlobStoreSuspendedError = _chunkKLNTTDLTcjs.BlobStoreSuspendedError; exports.BlobUnknownError = _chunkKLNTTDLTcjs.BlobUnknownError; exports.completeMultipartUpload = completeMultipartUpload; exports.copy = copy; exports.createFolder = _chunkKLNTTDLTcjs.createFolder; exports.createMultipartUpload = createMultipartUpload; exports.createMultipartUploader = createMultipartUploader; exports.del = del; exports.getDownloadUrl = _chunkKLNTTDLTcjs.getDownloadUrl; exports.head = head; exports.list = list; exports.put = put; exports.uploadPart = uploadPart;
//# sourceMappingURL=index.cjs.map

1
node_modules/@vercel/blob/dist/index.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

337
node_modules/@vercel/blob/dist/index.d.cts generated vendored Normal file
View file

@ -0,0 +1,337 @@
import { e as CommonCreateBlobOptions, W as WithUploadProgress, f as BlobError, B as BlobCommandOptions, P as PutBody, a as PutBlobResult, b as Part, U as UploadPartCommandOptions, g as CompleteMultipartUploadCommandOptions } from './create-folder-C02EFEPE.cjs';
export { O as OnUploadProgressCallback, j as PartInput, i as UploadProgressEvent, d as createFolder, h as getDownloadUrl } from './create-folder-C02EFEPE.cjs';
import 'stream';
import 'undici';
interface PutCommandOptions extends CommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* @defaultvalue false
*/
multipart?: boolean;
}
declare class BlobAccessError extends BlobError {
constructor();
}
declare class BlobContentTypeNotAllowedError extends BlobError {
constructor(message: string);
}
declare class BlobPathnameMismatchError extends BlobError {
constructor(message: string);
}
declare class BlobClientTokenExpiredError extends BlobError {
constructor();
}
declare class BlobFileTooLargeError extends BlobError {
constructor(message: string);
}
declare class BlobStoreNotFoundError extends BlobError {
constructor();
}
declare class BlobStoreSuspendedError extends BlobError {
constructor();
}
declare class BlobUnknownError extends BlobError {
constructor();
}
declare class BlobNotFoundError extends BlobError {
constructor();
}
declare class BlobServiceNotAvailable extends BlobError {
constructor();
}
declare class BlobServiceRateLimited extends BlobError {
readonly retryAfter: number;
constructor(seconds?: number);
}
declare class BlobRequestAbortedError extends BlobError {
constructor();
}
/**
* Deletes one or multiple blobs from your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#delete-a-blob
*
* @param url - Blob url or array of blob urls that identify the blobs to be deleted. You can only delete blobs that are located in a store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param options - Additional options for the request.
*/
declare function del(url: string[] | string, options?: BlobCommandOptions): Promise<void>;
/**
* Result of the head method containing metadata about a blob.
*/
interface HeadBlobResult {
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The cache control header value.
*/
cacheControl: string;
}
/**
* Fetches metadata of a blob object.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#get-blob-metadata
*
* @param url - Blob url to lookup.
* @param options - Additional options for the request.
*/
declare function head(url: string, options?: BlobCommandOptions): Promise<HeadBlobResult>;
/**
* Basic blob object information returned by the list method.
*/
interface ListBlobResultBlob {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
}
/**
* Result of the list method in expanded mode (default).
*/
interface ListBlobResult {
/**
* Array of blob objects in the store.
*/
blobs: ListBlobResultBlob[];
/**
* Pagination cursor for the next set of results, if hasMore is true.
*/
cursor?: string;
/**
* Indicates if there are more results available.
*/
hasMore: boolean;
}
/**
* Result of the list method in folded mode.
*/
interface ListFoldedBlobResult extends ListBlobResult {
/**
* Array of folder paths in the store.
*/
folders: string[];
}
/**
* Options for the list method.
*/
interface ListCommandOptions<M extends 'expanded' | 'folded' | undefined = undefined> extends BlobCommandOptions {
/**
* The maximum number of blobs to return.
* @defaultvalue 1000
*/
limit?: number;
/**
* Filters the result to only include blobs that start with this prefix.
* If used together with `mode: 'folded'`, make sure to include a trailing slash after the foldername.
*/
prefix?: string;
/**
* The cursor to use for pagination. Can be obtained from the response of a previous `list` request.
*/
cursor?: string;
/**
* Defines how the blobs are listed
* - `expanded` the blobs property contains all blobs.
* - `folded` the blobs property contains only the blobs at the root level of your store. Blobs that are located inside a folder get merged into a single entry in the folder response property.
* @defaultvalue 'expanded'
*/
mode?: M;
}
/**
* @internal Type helper to determine the return type based on the mode parameter.
*/
type ListCommandResult<M extends 'expanded' | 'folded' | undefined = undefined> = M extends 'folded' ? ListFoldedBlobResult : ListBlobResult;
/**
* Fetches a paginated list of blob objects from your store.
*
* @param options - Configuration options including:
* - token - (Optional) A string specifying the read-write token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - limit - (Optional) The maximum number of blobs to return. Defaults to 1000.
* - prefix - (Optional) Filters the result to only include blobs that start with this prefix. If used with mode: 'folded', include a trailing slash after the folder name.
* - cursor - (Optional) The cursor to use for pagination. Can be obtained from the response of a previous list request.
* - mode - (Optional) Defines how the blobs are listed. Can be 'expanded' (default) or 'folded'. In folded mode, blobs located inside a folder are merged into a single entry in the folders response property.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - blobs: An array of blob objects with size, uploadedAt, pathname, url, and downloadUrl properties
* - cursor: A string for pagination (if hasMore is true)
* - hasMore: A boolean indicating if there are more results available
* - folders: (Only in 'folded' mode) An array of folder paths
*/
declare function list<M extends 'expanded' | 'folded' | undefined = undefined>(options?: ListCommandOptions<M>): Promise<ListCommandResult<M>>;
type CopyCommandOptions = CommonCreateBlobOptions;
interface CopyBlobResult {
url: string;
downloadUrl: string;
pathname: string;
contentType: string;
contentDisposition: string;
}
/**
* Copies a blob to another location in your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#copy-a-blob
*
* @param fromUrl - The blob URL to copy. You can only copy blobs that are in the store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param toPathname - The pathname to copy the blob to. This includes the filename.
* @param options - Additional options. The copy method will not preserve any metadata configuration (e.g.: 'cacheControlMaxAge') of the source blob. If you want to copy the metadata, you need to define it here again.
*/
declare function copy(fromUrl: string, toPathname: string, options: CopyCommandOptions): Promise<CopyBlobResult>;
/**
* Uploads a blob into your store from your server.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* If you want to upload from the browser directly, or if you're hitting Vercel upload limits, check out the documentation for client uploads: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob like https://$storeId.public.blob.vercel-storage.com/$pathname.
* @param body - The content of your blob, can be a: string, File, Blob, Buffer or Stream. We support almost everything fetch supports: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#body.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to false. We recommend using this option to ensure there are no conflicts in your blob filenames.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: PutCommandOptions) => Promise<PutBlobResult>;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: UploadPartCommandOptions) => Promise<Part>;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: CompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
export { BlobAccessError, BlobClientTokenExpiredError, BlobContentTypeNotAllowedError, BlobError, BlobFileTooLargeError, BlobNotFoundError, BlobPathnameMismatchError, BlobRequestAbortedError, BlobServiceNotAvailable, BlobServiceRateLimited, BlobStoreNotFoundError, BlobStoreSuspendedError, BlobUnknownError, CompleteMultipartUploadCommandOptions, type CopyBlobResult, type CopyCommandOptions, type HeadBlobResult, type ListBlobResult, type ListBlobResultBlob, type ListCommandOptions, type ListFoldedBlobResult, Part, PutBlobResult, type PutCommandOptions, UploadPartCommandOptions, completeMultipartUpload, copy, createMultipartUpload, createMultipartUploader, del, head, list, put, uploadPart };

337
node_modules/@vercel/blob/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,337 @@
import { e as CommonCreateBlobOptions, W as WithUploadProgress, f as BlobError, B as BlobCommandOptions, P as PutBody, a as PutBlobResult, b as Part, U as UploadPartCommandOptions, g as CompleteMultipartUploadCommandOptions } from './create-folder-C02EFEPE.js';
export { O as OnUploadProgressCallback, j as PartInput, i as UploadProgressEvent, d as createFolder, h as getDownloadUrl } from './create-folder-C02EFEPE.js';
import 'stream';
import 'undici';
interface PutCommandOptions extends CommonCreateBlobOptions, WithUploadProgress {
/**
* Whether to use multipart upload. Use this when uploading large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* @defaultvalue false
*/
multipart?: boolean;
}
declare class BlobAccessError extends BlobError {
constructor();
}
declare class BlobContentTypeNotAllowedError extends BlobError {
constructor(message: string);
}
declare class BlobPathnameMismatchError extends BlobError {
constructor(message: string);
}
declare class BlobClientTokenExpiredError extends BlobError {
constructor();
}
declare class BlobFileTooLargeError extends BlobError {
constructor(message: string);
}
declare class BlobStoreNotFoundError extends BlobError {
constructor();
}
declare class BlobStoreSuspendedError extends BlobError {
constructor();
}
declare class BlobUnknownError extends BlobError {
constructor();
}
declare class BlobNotFoundError extends BlobError {
constructor();
}
declare class BlobServiceNotAvailable extends BlobError {
constructor();
}
declare class BlobServiceRateLimited extends BlobError {
readonly retryAfter: number;
constructor(seconds?: number);
}
declare class BlobRequestAbortedError extends BlobError {
constructor();
}
/**
* Deletes one or multiple blobs from your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#delete-a-blob
*
* @param url - Blob url or array of blob urls that identify the blobs to be deleted. You can only delete blobs that are located in a store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param options - Additional options for the request.
*/
declare function del(url: string[] | string, options?: BlobCommandOptions): Promise<void>;
/**
* Result of the head method containing metadata about a blob.
*/
interface HeadBlobResult {
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The content type of the blob.
*/
contentType: string;
/**
* The content disposition header value.
*/
contentDisposition: string;
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The cache control header value.
*/
cacheControl: string;
}
/**
* Fetches metadata of a blob object.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#get-blob-metadata
*
* @param url - Blob url to lookup.
* @param options - Additional options for the request.
*/
declare function head(url: string, options?: BlobCommandOptions): Promise<HeadBlobResult>;
/**
* Basic blob object information returned by the list method.
*/
interface ListBlobResultBlob {
/**
* The URL of the blob.
*/
url: string;
/**
* A URL that will cause browsers to download the file instead of displaying it inline.
*/
downloadUrl: string;
/**
* The pathname of the blob within the store.
*/
pathname: string;
/**
* The size of the blob in bytes.
*/
size: number;
/**
* The date when the blob was uploaded.
*/
uploadedAt: Date;
}
/**
* Result of the list method in expanded mode (default).
*/
interface ListBlobResult {
/**
* Array of blob objects in the store.
*/
blobs: ListBlobResultBlob[];
/**
* Pagination cursor for the next set of results, if hasMore is true.
*/
cursor?: string;
/**
* Indicates if there are more results available.
*/
hasMore: boolean;
}
/**
* Result of the list method in folded mode.
*/
interface ListFoldedBlobResult extends ListBlobResult {
/**
* Array of folder paths in the store.
*/
folders: string[];
}
/**
* Options for the list method.
*/
interface ListCommandOptions<M extends 'expanded' | 'folded' | undefined = undefined> extends BlobCommandOptions {
/**
* The maximum number of blobs to return.
* @defaultvalue 1000
*/
limit?: number;
/**
* Filters the result to only include blobs that start with this prefix.
* If used together with `mode: 'folded'`, make sure to include a trailing slash after the foldername.
*/
prefix?: string;
/**
* The cursor to use for pagination. Can be obtained from the response of a previous `list` request.
*/
cursor?: string;
/**
* Defines how the blobs are listed
* - `expanded` the blobs property contains all blobs.
* - `folded` the blobs property contains only the blobs at the root level of your store. Blobs that are located inside a folder get merged into a single entry in the folder response property.
* @defaultvalue 'expanded'
*/
mode?: M;
}
/**
* @internal Type helper to determine the return type based on the mode parameter.
*/
type ListCommandResult<M extends 'expanded' | 'folded' | undefined = undefined> = M extends 'folded' ? ListFoldedBlobResult : ListBlobResult;
/**
* Fetches a paginated list of blob objects from your store.
*
* @param options - Configuration options including:
* - token - (Optional) A string specifying the read-write token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - limit - (Optional) The maximum number of blobs to return. Defaults to 1000.
* - prefix - (Optional) Filters the result to only include blobs that start with this prefix. If used with mode: 'folded', include a trailing slash after the folder name.
* - cursor - (Optional) The cursor to use for pagination. Can be obtained from the response of a previous list request.
* - mode - (Optional) Defines how the blobs are listed. Can be 'expanded' (default) or 'folded'. In folded mode, blobs located inside a folder are merged into a single entry in the folders response property.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - blobs: An array of blob objects with size, uploadedAt, pathname, url, and downloadUrl properties
* - cursor: A string for pagination (if hasMore is true)
* - hasMore: A boolean indicating if there are more results available
* - folders: (Only in 'folded' mode) An array of folder paths
*/
declare function list<M extends 'expanded' | 'folded' | undefined = undefined>(options?: ListCommandOptions<M>): Promise<ListCommandResult<M>>;
type CopyCommandOptions = CommonCreateBlobOptions;
interface CopyBlobResult {
url: string;
downloadUrl: string;
pathname: string;
contentType: string;
contentDisposition: string;
}
/**
* Copies a blob to another location in your store.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#copy-a-blob
*
* @param fromUrl - The blob URL to copy. You can only copy blobs that are in the store, that your 'BLOB_READ_WRITE_TOKEN' has access to.
* @param toPathname - The pathname to copy the blob to. This includes the filename.
* @param options - Additional options. The copy method will not preserve any metadata configuration (e.g.: 'cacheControlMaxAge') of the source blob. If you want to copy the metadata, you need to define it here again.
*/
declare function copy(fromUrl: string, toPathname: string, options: CopyCommandOptions): Promise<CopyBlobResult>;
/**
* Uploads a blob into your store from your server.
* Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob
*
* If you want to upload from the browser directly, or if you're hitting Vercel upload limits, check out the documentation for client uploads: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads
*
* @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob like https://$storeId.public.blob.vercel-storage.com/$pathname.
* @param body - The content of your blob, can be a: string, File, Blob, Buffer or Stream. We support almost everything fetch supports: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#body.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to false. We recommend using this option to ensure there are no conflicts in your blob filenames.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const put: (pathname: string, body: PutBody, optionsInput: PutCommandOptions) => Promise<PutBlobResult>;
/**
* Creates a multipart upload. This is the first step in the manual multipart upload process.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an object containing:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls.
*/
declare const createMultipartUpload: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
}>;
/**
* Creates a multipart uploader that simplifies the multipart upload process.
* This is a wrapper around the manual multipart upload process that provides a more convenient API.
*
* @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs. By default an error will be thrown if you try to overwrite a blob by using the same pathname for multiple blobs.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. Falls back to application/octet-stream when no extension exists or can't be matched.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to an uploader object with the following properties and methods:
* - key: A string that identifies the blob object.
* - uploadId: A string that identifies the multipart upload.
* - uploadPart: A method to upload a part of the file.
* - complete: A method to complete the multipart upload process.
*/
declare const createMultipartUploader: (pathname: string, optionsInput: CommonCreateBlobOptions) => Promise<{
key: string;
uploadId: string;
uploadPart(partNumber: number, body: PutBody): Promise<{
etag: string;
partNumber: number;
}>;
complete(parts: Part[]): Promise<PutBlobResult>;
}>;
/**
* Uploads a part of a multipart upload.
* Used as part of the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob.
* @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - partNumber - (Required) A number identifying which part is uploaded (1-based index).
* - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure how long Blobs are cached.
* - abortSignal - (Optional) AbortSignal to cancel the running request.
* - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\})
* @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call.
*/
declare const uploadPart: (pathname: string, body: PutBody, optionsInput: UploadPartCommandOptions) => Promise<Part>;
/**
* Completes a multipart upload by combining all uploaded parts.
* This is the final step in the manual multipart upload process.
*
* @param pathname - Same value as the pathname parameter passed to createMultipartUpload.
* @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber.
* @param options - Configuration options including:
* - access - (Required) Must be 'public' as blobs are publicly accessible.
* - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload.
* - key - (Required) A string returned from createMultipartUpload which identifies the blob object.
* - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension.
* - token - (Optional) A string specifying the token to use when making requests. It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel.
* - addRandomSuffix - (Optional) A boolean specifying whether to add a random suffix to the pathname. It defaults to true.
* - allowOverwrite - (Optional) A boolean to allow overwriting blobs.
* - cacheControlMaxAge - (Optional) A number in seconds to configure the edge and browser cache. Defaults to one year.
* - abortSignal - (Optional) AbortSignal to cancel the operation.
* @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl.
*/
declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: CompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>;
export { BlobAccessError, BlobClientTokenExpiredError, BlobContentTypeNotAllowedError, BlobError, BlobFileTooLargeError, BlobNotFoundError, BlobPathnameMismatchError, BlobRequestAbortedError, BlobServiceNotAvailable, BlobServiceRateLimited, BlobStoreNotFoundError, BlobStoreSuspendedError, BlobUnknownError, CompleteMultipartUploadCommandOptions, type CopyBlobResult, type CopyCommandOptions, type HeadBlobResult, type ListBlobResult, type ListBlobResultBlob, type ListCommandOptions, type ListFoldedBlobResult, Part, PutBlobResult, type PutCommandOptions, UploadPartCommandOptions, completeMultipartUpload, copy, createMultipartUpload, createMultipartUploader, del, head, list, put, uploadPart };

232
node_modules/@vercel/blob/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,232 @@
import {
BlobAccessError,
BlobClientTokenExpiredError,
BlobContentTypeNotAllowedError,
BlobError,
BlobFileTooLargeError,
BlobNotFoundError,
BlobPathnameMismatchError,
BlobRequestAbortedError,
BlobServiceNotAvailable,
BlobServiceRateLimited,
BlobStoreNotFoundError,
BlobStoreSuspendedError,
BlobUnknownError,
MAXIMUM_PATHNAME_LENGTH,
createCompleteMultipartUploadMethod,
createCreateMultipartUploadMethod,
createCreateMultipartUploaderMethod,
createFolder,
createPutMethod,
createUploadPartMethod,
disallowedPathnameCharacters,
getDownloadUrl,
requestApi
} from "./chunk-Z56QURM6.js";
// src/del.ts
async function del(url, options) {
await requestApi(
"/delete",
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ urls: Array.isArray(url) ? url : [url] }),
signal: options == null ? void 0 : options.abortSignal
},
options
);
}
// src/head.ts
async function head(url, options) {
const searchParams = new URLSearchParams({ url });
const response = await requestApi(
`?${searchParams.toString()}`,
// HEAD can't have body as a response, so we use GET
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
size: response.size,
contentType: response.contentType,
contentDisposition: response.contentDisposition,
cacheControl: response.cacheControl,
uploadedAt: new Date(response.uploadedAt)
};
}
// src/list.ts
async function list(options) {
var _a;
const searchParams = new URLSearchParams();
if (options == null ? void 0 : options.limit) {
searchParams.set("limit", options.limit.toString());
}
if (options == null ? void 0 : options.prefix) {
searchParams.set("prefix", options.prefix);
}
if (options == null ? void 0 : options.cursor) {
searchParams.set("cursor", options.cursor);
}
if (options == null ? void 0 : options.mode) {
searchParams.set("mode", options.mode);
}
const response = await requestApi(
`?${searchParams.toString()}`,
{
method: "GET",
signal: options == null ? void 0 : options.abortSignal
},
options
);
if ((options == null ? void 0 : options.mode) === "folded") {
return {
folders: (_a = response.folders) != null ? _a : [],
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
return {
cursor: response.cursor,
hasMore: response.hasMore,
blobs: response.blobs.map(mapBlobResult)
};
}
function mapBlobResult(blobResult) {
return {
url: blobResult.url,
downloadUrl: blobResult.downloadUrl,
pathname: blobResult.pathname,
size: blobResult.size,
uploadedAt: new Date(blobResult.uploadedAt)
};
}
// src/copy.ts
async function copy(fromUrl, toPathname, options) {
if (!options) {
throw new BlobError("missing options, see usage");
}
if (options.access !== "public") {
throw new BlobError('access must be "public"');
}
if (toPathname.length > MAXIMUM_PATHNAME_LENGTH) {
throw new BlobError(
`pathname is too long, maximum length is ${MAXIMUM_PATHNAME_LENGTH}`
);
}
for (const invalidCharacter of disallowedPathnameCharacters) {
if (toPathname.includes(invalidCharacter)) {
throw new BlobError(
`pathname cannot contain "${invalidCharacter}", please encode it if needed`
);
}
}
const headers = {};
if (options.addRandomSuffix !== void 0) {
headers["x-add-random-suffix"] = options.addRandomSuffix ? "1" : "0";
}
if (options.allowOverwrite !== void 0) {
headers["x-allow-overwrite"] = options.allowOverwrite ? "1" : "0";
}
if (options.contentType) {
headers["x-content-type"] = options.contentType;
}
if (options.cacheControlMaxAge !== void 0) {
headers["x-cache-control-max-age"] = options.cacheControlMaxAge.toString();
}
const params = new URLSearchParams({ pathname: toPathname, fromUrl });
const response = await requestApi(
`?${params.toString()}`,
{
method: "PUT",
headers,
signal: options.abortSignal
},
options
);
return {
url: response.url,
downloadUrl: response.downloadUrl,
pathname: response.pathname,
contentType: response.contentType,
contentDisposition: response.contentDisposition
};
}
// src/index.ts
var put = createPutMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUpload = createCreateMultipartUploadMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var createMultipartUploader = createCreateMultipartUploaderMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var uploadPart = createUploadPartMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
var completeMultipartUpload = createCompleteMultipartUploadMethod({
allowedOptions: [
"cacheControlMaxAge",
"addRandomSuffix",
"allowOverwrite",
"contentType"
]
});
export {
BlobAccessError,
BlobClientTokenExpiredError,
BlobContentTypeNotAllowedError,
BlobError,
BlobFileTooLargeError,
BlobNotFoundError,
BlobPathnameMismatchError,
BlobRequestAbortedError,
BlobServiceNotAvailable,
BlobServiceRateLimited,
BlobStoreNotFoundError,
BlobStoreSuspendedError,
BlobUnknownError,
completeMultipartUpload,
copy,
createFolder,
createMultipartUpload,
createMultipartUploader,
del,
getDownloadUrl,
head,
list,
put,
uploadPart
};
//# sourceMappingURL=index.js.map

1
node_modules/@vercel/blob/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

11
node_modules/@vercel/blob/dist/stream-browser.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
// This file is here because Edge Functions have no support for Node.js streams by default
// It's unlikely someone would try to read/use a Node.js stream in an Edge function but we still put
// a message in case this happens
export const Readable = {
toWeb() {
throw new Error(
'Vercel Blob: Sorry, we cannot get a Readable stream in this environment. If you see this message please open an issue here: https://github.com/vercel/storage/ with details on your environment.',
);
},
};

8
node_modules/@vercel/blob/dist/undici-browser.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
// this file gets copied to the dist folder
// it makes undici work in the browser by reusing the global fetch
// it's the simplest way I've found to make http requests work in Node.js, Serverles Functions, Edge Functions, and the browser
// this should work as long as this module is used via Next.js/Webpack
// moving forward we will have to solve this problem in a more robust way
// reusing https://github.com/inrupt/universal-fetch
// or seeing how/if cross-fetch solves https://github.com/lquixada/cross-fetch/issues/69
export const fetch = globalThis.fetch.bind(globalThis);

201
node_modules/@vercel/blob/license.md generated vendored Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Vercel, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

85
node_modules/@vercel/blob/package.json generated vendored Normal file
View file

@ -0,0 +1,85 @@
{
"name": "@vercel/blob",
"version": "1.0.2",
"description": "The Vercel Blob JavaScript API client",
"homepage": "https://vercel.com/storage/blob",
"repository": {
"type": "git",
"url": "https://github.com/vercel/storage.git",
"directory": "packages/blob"
},
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./client": {
"import": "./dist/client.js",
"require": "./dist/client.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": {
"undici": "./dist/undici-browser.js",
"crypto": "./dist/crypto-browser.js",
"stream": "./dist/stream-browser.js"
},
"typesVersions": {
"*": {
"client": [
"dist/client.d.ts"
]
}
},
"files": [
"dist"
],
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"testEnvironmentOptions": {
"url": "http://localhost:3000"
}
},
"dependencies": {
"async-retry": "^1.3.3",
"is-buffer": "^2.0.5",
"is-node-process": "^1.2.0",
"throttleit": "^2.1.0",
"undici": "^5.28.4"
},
"devDependencies": {
"@edge-runtime/jest-environment": "2.3.10",
"@edge-runtime/types": "2.2.9",
"@types/async-retry": "1.4.9",
"@types/jest": "29.5.14",
"@types/node": "22.13.5",
"eslint": "8.56.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-jest": "29.2.6",
"tsup": "8.4.0",
"eslint-config-custom": "0.0.0",
"tsconfig": "0.0.0"
},
"engines": {
"node": ">=16.14"
},
"scripts": {
"build": "tsup && pnpm run copy-shims",
"copy-shims": "cp src/*-browser.js dist/",
"dev": "pnpm run copy-shims && tsup --watch --clean=false",
"lint": "eslint --max-warnings=0 .",
"prettier-check": "prettier --check .",
"publint": "npx publint",
"test": "pnpm run test:node && pnpm run test:edge && pnpm run test:browser",
"test:browser": "jest --env jsdom .browser.test.ts --setupFilesAfterEnv ./jest/setup.js",
"test:edge": "jest --env @edge-runtime/jest-environment .edge.test.ts",
"test:node": "jest --env node .node.test.ts",
"type-check": "tsc --noEmit"
}
}