New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vercel/blob

Package Overview
Dependencies
Maintainers
9
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/blob - npm Package Compare versions

Comparing version 0.16.1 to 0.17.0-c2239f49-20231218111237

dist/chunk-GKMMM3RQ.cjs

20

dist/client.d.ts

@@ -1,4 +0,4 @@

import * as stream from 'stream';
import { P as PutBody, b as PutBlobResult, B as BlobCommandOptions } from './put-qfP2CvGp.js';
import { IncomingMessage } from 'node:http';
import { a as PutBlobResult, B as BlobCommandOptions } from './put-FLtdezzu.js';
import 'stream';

@@ -10,3 +10,3 @@ interface ClientPutCommandOptions {

}
declare const put: (pathname: string, body: string | stream.Readable | Blob | ArrayBuffer | FormData | ReadableStream<any> | File, options?: ClientPutCommandOptions | undefined) => Promise<PutBlobResult>;
declare const put: (pathname: string, body: PutBody, options?: ClientPutCommandOptions | undefined) => Promise<PutBlobResult>;
interface UploadOptions {

@@ -29,2 +29,3 @@ /**

clientPayload?: string;
multipart?: boolean;
}

@@ -41,3 +42,3 @@ /**

*/
declare const upload: (pathname: string, body: string | stream.Readable | Blob | ArrayBuffer | FormData | ReadableStream<any> | File, options?: UploadOptions | undefined) => Promise<PutBlobResult>;
declare const upload: (pathname: string, body: PutBody, options?: UploadOptions | undefined) => Promise<PutBlobResult>;
type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & {

@@ -56,3 +57,4 @@ validUntil: number;

callbackUrl: string;
clientPayload?: string;
multipart: boolean;
clientPayload: string | null;
};

@@ -64,3 +66,3 @@ }

blob: PutBlobResult;
tokenPayload?: string;
tokenPayload?: string | null;
};

@@ -72,4 +74,4 @@ }

body: HandleUploadBody;
onBeforeGenerateToken: (pathname: string, clientPayload?: string) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'cacheControlMaxAge'> & {
tokenPayload?: string;
onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'cacheControlMaxAge'> & {
tokenPayload?: string | null;
}>;

@@ -92,3 +94,3 @@ onUploadCompleted: (body: UploadCompletedEvent['payload']) => Promise<void>;

callbackUrl: string;
tokenPayload?: string;
tokenPayload?: string | null;
};

@@ -95,0 +97,0 @@ maximumSizeInBytes?: number;

@@ -5,3 +5,3 @@ import {

getTokenFromOptionsOrEnv
} from "./chunk-TNXTKW4D.js";
} from "./chunk-UQNACE5H.js";

@@ -55,6 +55,8 @@ // src/client.ts

async getToken(pathname, options) {
var _a, _b;
const clientToken = await retrieveClientToken({
handleUploadUrl: options.handleUploadUrl,
pathname,
clientPayload: options.clientPayload
clientPayload: (_a = options.clientPayload) != null ? _a : null,
multipart: (_b = options.multipart) != null ? _b : false
});

@@ -131,3 +133,3 @@ return clientToken;

}) {
var _a, _b, _c;
var _a, _b, _c, _d;
const resolvedToken = getTokenFromOptionsOrEnv({ token });

@@ -137,5 +139,12 @@ const type = body.type;

case "blob.generate-client-token": {
const { pathname, callbackUrl, clientPayload } = body.payload;
const payload = await onBeforeGenerateToken(pathname, clientPayload);
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 {

@@ -150,3 +159,4 @@ type,

tokenPayload
}
},
validUntil
})

@@ -157,3 +167,3 @@ };

const signatureHeader = "x-vercel-signature";
const signature = "credentials" in request ? (_b = request.headers.get(signatureHeader)) != null ? _b : "" : (_c = request.headers[signatureHeader]) != null ? _c : "";
const signature = "credentials" in request ? (_c = request.headers.get(signatureHeader)) != null ? _c : "" : (_d = request.headers[signatureHeader]) != null ? _d : "";
if (!signature) {

@@ -185,3 +195,4 @@ throw new BlobError("Missing callback signature");

callbackUrl: url,
clientPayload: options.clientPayload
clientPayload: options.clientPayload,
multipart: options.multipart
}

@@ -188,0 +199,0 @@ };

@@ -1,4 +0,4 @@

import { B as BlobCommandOptions, C as CreateBlobCommandOptions, P as PutCommandOptions, a as PutBlobResult } from './put-FLtdezzu.js';
export { b as BlobAccessError, c as BlobError, d as BlobNotFoundError, h as BlobServiceNotAvailable, e as BlobStoreNotFoundError, f as BlobStoreSuspendedError, g as BlobUnknownError } from './put-FLtdezzu.js';
import * as stream from 'stream';
import { B as BlobCommandOptions, C as CreateBlobCommandOptions, P as PutBody, a as PutCommandOptions, b as PutBlobResult } from './put-qfP2CvGp.js';
export { c as BlobAccessError, d as BlobError, e as BlobNotFoundError, i as BlobServiceNotAvailable, f as BlobStoreNotFoundError, g as BlobStoreSuspendedError, h as BlobUnknownError } from './put-qfP2CvGp.js';
import 'stream';

@@ -106,4 +106,4 @@ /**

*/
declare const put: (pathname: string, body: string | stream.Readable | Blob | ArrayBuffer | FormData | ReadableStream<any> | File, options?: PutCommandOptions | undefined) => Promise<PutBlobResult>;
declare const put: (pathname: string, body: PutBody, options?: PutCommandOptions | undefined) => Promise<PutBlobResult>;
export { type CopyBlobResult, type CopyCommandOptions, type HeadBlobResult, type ListBlobResult, type ListBlobResultBlob, type ListCommandOptions, type ListFoldedBlobResult, PutBlobResult, PutCommandOptions, copy, del, head, list, put };

@@ -14,3 +14,3 @@ import {

validateBlobApiResponse
} from "./chunk-TNXTKW4D.js";
} from "./chunk-UQNACE5H.js";

@@ -17,0 +17,0 @@ // src/del.ts

{
"name": "@vercel/blob",
"version": "0.16.1",
"version": "0.17.0-c2239f49-20231218111237",
"description": "The Vercel Blob JavaScript API client",

@@ -28,3 +28,4 @@ "homepage": "https://vercel.com/storage/blob",

"undici": "./dist/undici-browser.js",
"crypto": "./dist/crypto-browser.js"
"crypto": "./dist/crypto-browser.js",
"stream": "./dist/stream-browser.js"
},

@@ -49,2 +50,4 @@ "typesVersions": {

"dependencies": {
"async-retry": "1.3.3",
"bytes": "3.1.2",
"undici": "5.28.2"

@@ -55,2 +58,4 @@ },

"@edge-runtime/types": "2.2.7",
"@types/async-retry": "1.4.8",
"@types/bytes": "3.1.4",
"@types/jest": "29.5.11",

@@ -71,3 +76,3 @@ "@types/node": "20.10.4",

"build": "tsup && pnpm run copy-shims",
"copy-shims": "cp src/undici-browser.js dist/undici-browser.js && cp src/crypto-browser.js dist/crypto-browser.js",
"copy-shims": "cp src/*-browser.js dist/",
"dev": "pnpm run copy-shims && tsup --watch --clean=false",

@@ -74,0 +79,0 @@ "lint": "eslint --max-warnings=0 .",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc