Vercel Postgres, KV, Blob, and Edge Config
APACHE-2.0 License
Bot releases are visible (Hide)
Published by github-actions[bot] 7 months ago
contentType
field of the PutBlobResult is now optional which might break TS builds. This aligns the SDK typings with the actual Response of the Blob API.Published by github-actions[bot] 7 months ago
Published by github-actions[bot] 7 months ago
Published by github-actions[bot] 8 months ago
@opentelemetry/api
optional and expose a setTracerProvider
functionPublished by github-actions[bot] 8 months ago
Published by github-actions[bot] 8 months ago
Published by github-actions[bot] 8 months ago
Published by github-actions[bot] 8 months ago
fcdc55e: - BREAKING CHANGE Return values are now read-only to improve in-memory caching
It used to be possible to change the returned value as shown in this example:
import { get } from '@vercel/edge-config';
const countries = await get('allowedCountryCodes');
countries.DE = true; // Will now cause TypeScript to error
Moving forward, modifications like the above will cause a type error.
If there is a need to modify the value, then the clone
function can be used to clone the data and make it modifiable.
import { get, clone } from '@vercel/edge-config';
const myArray = await get('listOfAllowedIPs');
const myArrayClone = clone(myArray); // Clones the data to make it modifiable
myArrayClone.push('127.0.0.1'); // The `push` operation will work now
BREAKING CHANGE SDK now throws underlying errors
Previous versions of the @vercel/edge-config
package would catch most errors thrown by native functions and throw a generic network error instead - even if the underlying issue wasn't a network error. The new version will throw the original errors.
Note applications which rely on the @vercel/edge-config: Unexpected error
and @vercel/edge-config: Network error
errors must adapt to the new implementation by ensuring other types of errors are handled as well.
The SDK now uses stale-while-revalidate semantics during development
When @vercel/edge-config
is used during development, with NODE_ENV
being set to development
, any read operation will fetch the entire Edge Config once and keep it in-memory to quickly resolve all other read operations for other keys, without waiting for the network. Subsequent reads will update the in-memory data in the background.
This behaviour can be disabled by setting the environment variable EDGE_CONFIG_DISABLE_DEVELOPMENT_SWR
to 1
, or by using the disableDevelopmentCache
option on the createClient
function.
Published by github-actions[bot] 8 months ago
Published by github-actions[bot] 9 months ago
8e278f2: # feat(blob): add advanced multipart upload methods
This exposes the three different multipart steps as functions of the SDK. Before this change every multipart upload was uncontrolled, meaning the full data was passed to the SDK and the SDK took care of chunking and uploading.
Now it's possible to manually upload chunks and start and complete the multipart upload. All of the new functions can be used both on the server and the browser. There are two different API's that can be used.
All parts uploaded must be at least 5MB in size, except for the last part. The last part can be smaller than 5MB. If you have a single part, it can be any size. All parts must be the same size, except for the last part.
Use createMultipartUpload
, uploadPart
and completeMultipartUpload
to manage the upload.
const { key, uploadId } = await vercelBlob.createMultipartUpload(
'big-file.txt',
{ access: 'public' },
);
const part1 = await vercelBlob.uploadPart(fullPath, 'first part', {
access: 'public',
key,
uploadId,
partNumber: 1,
});
const part2 = await vercelBlob.uploadPart(fullPath, 'second part', {
access: 'public',
key,
uploadId,
partNumber: 2,
});
const blob = await vercelBlob.completeMultipartUpload(
fullPath,
[part1, part2],
{
access: 'public',
key,
uploadId,
},
);
For multipart methods, since some of the data remains consistent (uploadId, key), you can make use of the createMultipartUploader
. This function stores certain data internally, making it possible to offer convinient put
and complete
functions.
const uploader = await vercelBlob.createMultipartUploader('big-file.txt', {
access: 'public',
});
const part1 = await uploader.uploadPart(1, createReadStream(fullPath));
const part2 = await uploader.uploadPart(2, createReadStream(fullPath));
const blob = await uploader.complete([part1, part2]);
Published by github-actions[bot] 9 months ago
5d71dda: # feat(blob): add downloadUrl
and getDownloadUrl
Adds a new blob property called downloadUrl
. This URL will have the content-disposition
set to attachment
meaning it will force browsers to start a download instead of showing a preview. This URL can be used to implement download links. In addition to this new field the sdk is also exposing a new util function called getDownloadUrl
which can also be used to derive a download URL from a blob URL.
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
d44bd3b: feat(blob): add retry to all blob requests
This change generalizes the way we request the internal Blob API. This moves api version, authorization, response validation and error handling all into one place.
Also this adds a retry mechanism to the API requests
Published by github-actions[bot] 9 months ago
Published by github-actions[bot] 9 months ago
dc7ba0e: feat(blob): allow inline content disposition for certain blobs
Once you use this new version, then most common medias won't be automatically
downloading but rather will display the content inline.
Already uploaded files will not change their behavior.
You can reupload them if you want to change their behavior.
Fixes #509
Published by github-actions[bot] 9 months ago