@visulima/storage 1.0.0-alpha.29 → 1.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/adapter/nuxt/module.d.ts +3 -3
- package/dist/adapter/nuxt/node_modules/.bin/nuxi +2 -2
- package/dist/adapter/nuxt/node_modules/.bin/nuxt +2 -2
- package/dist/adapter/nuxt/package.json +0 -6
- package/dist/handler/http/fetch/index.d.ts +6 -6
- package/dist/handler/http/hono/index.d.ts +3 -3
- package/dist/handler/http/nextjs/index.d.ts +3 -3
- package/dist/handler/http/node/index.d.ts +6 -6
- package/dist/handler/http/solid-start/index.d.ts +3 -3
- package/dist/packem_shared/{GCSMetaStorage-DvRxZhmq.js → GCSMetaStorage-udgXA5ia.js} +1 -1
- package/dist/packem_shared/{GCStorage-U4f4WsWC.js → GCStorage-ChY6uJuO.js} +1 -1
- package/dist/packem_shared/VercelBlobStorage-s260zfFo.js +1 -0
- package/dist/packem_shared/{gcs-meta-storage-Br_I-m9X.js → gcs-meta-storage-mZiqlX-9.js} +1 -1
- package/dist/packem_shared/{media-transformer.d-j1W9HAXw.d.ts → media-transformer.d-C3QvECD7.d.ts} +1 -1
- package/dist/packem_shared/{tus-base.d-wZsb3umJ.d.ts → tus-base.d-CygntIPM.d.ts} +2 -2
- package/dist/packem_shared/{types.d-B5qPfCr5.d.ts → types.d-DxonY4XS.d.ts} +1 -1
- package/dist/packem_shared/{types.d-DzPvh74p.d.ts → types.d-cI_cMxcZ.d.ts} +1 -1
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +45 -3
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +1 -1
- package/dist/transformer/image-transformer.d.ts +1 -1
- package/dist/transformer/index.d.ts +2 -2
- package/dist/transformer/video-transformer.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packem_shared/VercelBlobStorage-C89IUiQ1.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## @visulima/storage [1.0.0-alpha.30](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.29...@visulima/storage@1.0.0-alpha.30) (2026-05-20)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **storage:** add Vercel OIDC support to vercel-blob adapter ([f6fbdd9](https://github.com/visulima/visulima/commit/f6fbdd98ac96194a944c10dd9fc4bb54c1669505))
|
|
6
|
+
|
|
7
|
+
### Continuous Integration
|
|
8
|
+
|
|
9
|
+
* build vis deps before schema drift + drop nested nuxt exports ([e217fcd](https://github.com/visulima/visulima/commit/e217fcdf3660cb73dd85514a0a387762ee52b873))
|
|
10
|
+
* tighten workflow yaml + restore missing publint dep ([b478f9a](https://github.com/visulima/visulima/commit/b478f9a9329d9c7243e694e3f360d385cc34567c))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* **@visulima/fs:** upgraded to 5.0.0-alpha.25
|
|
16
|
+
|
|
1
17
|
## @visulima/storage [1.0.0-alpha.29](https://github.com/visulima/visulima/compare/@visulima/storage@1.0.0-alpha.28...@visulima/storage@1.0.0-alpha.29) (2026-05-19)
|
|
2
18
|
|
|
3
19
|
### Features
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { U as UploadOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { U as UploadOptions } from "../../packem_shared/types.d-cI_cMxcZ.js";
|
|
2
2
|
import { U as UploadFile, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:events';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '@visulima/pagination';
|
|
7
|
-
import "../../packem_shared/media-transformer.d-
|
|
8
|
-
import "../../packem_shared/types.d-
|
|
7
|
+
import "../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
8
|
+
import "../../packem_shared/types.d-DxonY4XS.js";
|
|
9
9
|
import 'node:crypto';
|
|
10
10
|
import 'lru-cache';
|
|
11
11
|
/**
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-
|
|
13
|
+
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules/nuxt/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-
|
|
15
|
+
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules/nuxt/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../nuxt/bin/nuxt.mjs" "$@"
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-
|
|
13
|
+
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules/nuxt/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-
|
|
15
|
+
export NODE_PATH="/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules/nuxt/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/nuxt@4.4.4_@azure+storage-blob@12.31.0_@babel+core@7.29.0_@babel+plugin-proposal-decora_523dc65e70025e48d1ecd471e5f50478/node_modules:/home/runner/work/visulima/visulima/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../nuxt/bin/nuxt.mjs" "$@"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { U as UploadFile, K as UploadResponse } from "../../../packem_shared/storage.d-RteRC-cG.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { H as Handlers, R as ResponseFile, a as ResponseList, U as UploadOptions } from "../../../packem_shared/types.d-
|
|
4
|
-
export { type A as AsyncHandler, type B as BaseHandler, type M as MethodHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-
|
|
5
|
-
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-
|
|
6
|
-
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-
|
|
3
|
+
import { H as Handlers, R as ResponseFile, a as ResponseList, U as UploadOptions } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
4
|
+
export { type A as AsyncHandler, type B as BaseHandler, type M as MethodHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
5
|
+
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-CygntIPM.js";
|
|
6
|
+
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-CygntIPM.js";
|
|
7
7
|
import 'node:crypto';
|
|
8
8
|
import 'node:http';
|
|
9
9
|
import 'lru-cache';
|
|
10
10
|
import 'node:events';
|
|
11
11
|
import '@visulima/pagination';
|
|
12
|
-
import "../../../packem_shared/media-transformer.d-
|
|
13
|
-
import "../../../packem_shared/types.d-
|
|
12
|
+
import "../../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
13
|
+
import "../../../packem_shared/types.d-DxonY4XS.js";
|
|
14
14
|
/**
|
|
15
15
|
* Base handler for Web API Fetch platform (Request/Response).
|
|
16
16
|
* Extends BaseHandlerCore with Fetch-specific request/response handling.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { U as UploadFile } from "../../../packem_shared/storage.d-RteRC-cG.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { U as UploadOptions } from "../../../packem_shared/types.d-
|
|
4
|
+
import { U as UploadOptions } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
10
|
+
import "../../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
11
|
+
import "../../../packem_shared/types.d-DxonY4XS.js";
|
|
12
12
|
/**
|
|
13
13
|
* Registers upload handler routes on a Hono app instance.
|
|
14
14
|
* Automatically registers all required HTTP methods for the specified handler type.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server.js';
|
|
2
2
|
import { U as UploadFile } from "../../../packem_shared/storage.d-RteRC-cG.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { U as UploadOptions } from "../../../packem_shared/types.d-
|
|
4
|
+
import { U as UploadOptions } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
10
|
+
import "../../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
11
|
+
import "../../../packem_shared/types.d-DxonY4XS.js";
|
|
12
12
|
/**
|
|
13
13
|
* Configuration for Next.js handler.
|
|
14
14
|
*/
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { U as UploadFile, K as UploadResponse } from "../../../packem_shared/storage.d-RteRC-cG.js";
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
|
-
import { H as Handlers, A as AsyncHandler, U as UploadOptions, R as ResponseFile, a as ResponseList, M as MethodHandler } from "../../../packem_shared/types.d-
|
|
5
|
-
export { type B as BaseHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-
|
|
6
|
-
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-
|
|
7
|
-
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-
|
|
4
|
+
import { H as Handlers, A as AsyncHandler, U as UploadOptions, R as ResponseFile, a as ResponseList, M as MethodHandler } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
5
|
+
export { type B as BaseHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
6
|
+
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-CygntIPM.js";
|
|
7
|
+
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-CygntIPM.js";
|
|
8
8
|
import 'node:crypto';
|
|
9
9
|
import 'lru-cache';
|
|
10
10
|
import 'node:events';
|
|
11
11
|
import '@visulima/pagination';
|
|
12
|
-
import "../../../packem_shared/media-transformer.d-
|
|
13
|
-
import "../../../packem_shared/types.d-
|
|
12
|
+
import "../../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
13
|
+
import "../../../packem_shared/types.d-DxonY4XS.js";
|
|
14
14
|
/**
|
|
15
15
|
* Base handler for Node.js platform (IncomingMessage/ServerResponse).
|
|
16
16
|
* Extends BaseHandlerCore with Node.js-specific request/response handling.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { APIEvent } from '@solidjs/start/server';
|
|
2
2
|
import { U as UploadFile } from "../../../packem_shared/storage.d-RteRC-cG.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { U as UploadOptions } from "../../../packem_shared/types.d-
|
|
4
|
+
import { U as UploadOptions } from "../../../packem_shared/types.d-cI_cMxcZ.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
10
|
+
import "../../../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
11
|
+
import "../../../packem_shared/types.d-DxonY4XS.js";
|
|
12
12
|
/**
|
|
13
13
|
* Configuration for SolidStart handler.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:crypto";import"gaxios";import"google-auth-library";import{E as f}from"./gcs-meta-storage-
|
|
1
|
+
import"node:crypto";import"gaxios";import"google-auth-library";import{E as f}from"./gcs-meta-storage-mZiqlX-9.js";import"./MetaStorage-Y4m1dWgd.js";import"./Metadata-B6Ir0KO7.js";import"./GCSConfig-BQ0OpVhe.js";export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var y=Object.defineProperty;var h=(l,t)=>y(l,"name",{value:t,configurable:!0});import{randomUUID as w}from"node:crypto";import{request as b}from"gaxios";import{GoogleAuth as C}from"google-auth-library";import{r as R,E,b as U,g as k,d}from"./gcs-meta-storage-
|
|
1
|
+
var y=Object.defineProperty;var h=(l,t)=>y(l,"name",{value:t,configurable:!0});import{randomUUID as w}from"node:crypto";import{request as b}from"gaxios";import{GoogleAuth as C}from"google-auth-library";import{r as R,E,b as U,g as k,d}from"./gcs-meta-storage-mZiqlX-9.js";import{d as $}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as I,ERRORS as S}from"./ERRORS-CyOuSMLY.js";import{B as v,t as O}from"./storage-Dh0tJh7j.js";import{v as T}from"./local-meta-storage-Bi0mK6gD.js";import m from"./GCSConfig-BQ0OpVhe.js";import B from"./GCSFile-CDQ6IWAz.js";import{r as A,o as j}from"./part-match-B5fLLmFw.js";import{o as x}from"./has-content-Bx2p8Okx.js";var P=Object.defineProperty,G=h((l,t)=>P(l,"name",{value:t,configurable:!0}),"e");class q extends Error{static{h(this,"o")}constructor(t,a,e){super(t),this.code=a,this.config=e}code;config;static{G(this,"FetchError")}name="FetchError"}var W=Object.defineProperty,g=h((l,t)=>W(l,"name",{value:t,configurable:!0}),"m");const M=g(l=>l>=200&&l<300||l===308||l===499,"validateStatus");class f extends v{static name="gcs";checksumTypes=["md5","crc32c"];get raw(){return this.authClient}meta;bucket;authClient;storageBaseURI;uploadBaseURI;isCustomEndpoint=!1;retryOptions={};useAuthWithCustomEndpoint;userProject;constructor(t){super(t);const a=t.bucket||process.env.GCS_BUCKET;if(!a)throw new Error("GCS bucket is not defined");if(!t.projectId)throw new Error("Sorry, we cannot connect to Cloud Services without a project ID.");this.bucket=a,this.storageBaseURI=`${t.storageAPI||m.storageAPI}/${this.bucket}/o`,this.uploadBaseURI=`${t.uploadAPI||m.uploadAPI}/${this.bucket}/o`,this.isCustomEndpoint=new URL(this.storageBaseURI).hostname!=="storage.googleapis.com";const{retryOptions:e,useAuthWithCustomEndpoint:r,userProject:i}=t;this.userProject=i,this.useAuthWithCustomEndpoint=r||!1,this.retryOptions={...R,...e},t.scopes||=m.authScopes,this.authClient=new C(t);const{bucket:o,metaStorage:c,metaStorageConfig:u,projectId:s}=t;if(c)this.meta=c;else{let n={...t,...u,logger:this.logger};"directory"in n?(this.logger?.debug("Using local meta storage"),this.meta=new T(n)):(o===n.bucket&&s===n.projectId&&(n={...n,authClient:this.authClient}),this.meta=new E(n))}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(n=>{this.logger?.error("Storage access check failed: %O",n)})}normalizeError(t){if(t.config){const a=+t.code||500;return{code:`GCS${a}`,message:t.message,name:t.name,retryable:a>=499,statusCode:a}}return{code:"GenericUploadError",message:`[${this.constructor.name}] ${t.message}`,name:t.name,statusCode:500}}async create(t,a){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const s=typeof t.ttl=="string"?O(t.ttl):t.ttl;s!==void 0&&(e.expiredAt=Date.now()+s)}const r=new B(e);r.name=this.namingFunction(r),await this.validate(r);try{const s=await this.getMeta(r.id);return s.bytesWritten=await this.internalWrite(s,a),s}catch{}const i={"Content-Type":"application/json; charset=utf-8","X-Goog-Upload-Command":"start","X-Goog-Upload-Protocol":"resumable","X-Upload-Content-Length":r.size.toString(),"X-Upload-Content-Type":r.contentType},o={body:JSON.stringify({metadata:r.metadata}),headers:i,method:"POST",params:{name:r.name,size:r.size,uploadType:"resumable"},url:this.uploadBaseURI},c=await this.makeRequest(o,a);if(c.status!==200)throw new Error("Expected 200 response from GCS");const u=c.headers.get("X-Goog-Upload-Status")||c.headers.get("x-goog-upload-status");if(u!=="active")throw new Error(`X-Goog-Upload-Status response header expected 'active' got: ${u}`);return r.uri=c.headers.get("location"),this.config.clientDirectUpload?(r.GCSUploadURI=r.uri,this.logger?.debug("send uploadURI to client: %s",r.GCSUploadURI),r.status="created",r):(r.bytesWritten=0,await this.saveMeta(r),r.status="created",await this.onCreate(r),r)})}async write(t,a){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(!A(t,e))return I(S.FILE_CONFLICT);const r=await this.lock(t.id);try{if(x(t)&&(e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(!e.contentType||e.contentType==="application/octet-stream"))try{const{fileType:i,stream:o}=await $(t.body);i?.mime&&(e.contentType=i.mime),t.body=o}catch{}e.bytesWritten=await this.internalWrite({...e,...t},a),e.status=j(e),e.status==="completed"&&(e.uri=`${this.storageBaseURI}/${e.name}`,await this.internalOnComplete(e))}finally{await this.unlock(t.id,r)}return e})}async delete({id:t},a){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);if(!e.uri)throw new Error(`File ${t} does not have a valid URI`);e.status="deleted",await this.makeRequest({method:"DELETE",url:e.uri,validateStatus:M},a),await this.deleteMeta(e.id);const r={...e};return await this.onDelete(r),r})}async copy(t,a,e){return this.instrumentOperation("copy",async()=>{const r=new URL(`/${this.bucket}/${t}`,"file://"),i=new URL(encodeURI(a),r).pathname,[,o,...c]=i.split("/"),u=c.join("/"),s=`${this.storageBaseURI}/${t}/rewriteTo/b/${o}/o/${u}`;let n={};const p={body:"",headers:{"Content-Type":"application/json"},method:"POST",url:s};do p.body=n.rewriteToken?JSON.stringify({rewriteToken:n.rewriteToken}):"",n=(await this.makeRequest(p,e)).data||{};while(n.rewriteToken);return await this.getMeta(a)})}async move(t,a,e){return this.instrumentOperation("move",async()=>{const r=await this.copy(t,a,e),i=`${this.storageBaseURI}/${t}`;return await this.makeRequest({method:"DELETE",url:i},e),r})}async get({id:t},a){return this.instrumentOperation("get",async()=>{const{data:e}=await this.makeRequest({params:{alt:"json"},url:`${this.storageBaseURI}/${t}`},a);if(await this.checkIfExpired({expiredAt:e.timeDeleted}),!e.uri)throw new Error("File URI not found");const r=(await this.makeRequest({params:{alt:"media"},url:e.uri},a)).data;let i;if(typeof r=="string")i=Buffer.from(r,"utf8");else if(r&&typeof r=="object"&&"data"in r){const o=r.data;i=Buffer.from(o)}else i=Buffer.from(r);return{...e,content:i}})}async exists({id:t},a){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(t),await this.makeRequest({method:"HEAD",url:`${this.storageBaseURI}/${t}`},a),!0}catch{return!1}})}async list(t=1e3,a){return this.instrumentOperation("list",async()=>{const e=[],r=Math.min(t,1e3);let i=!0,o={params:{maxResults:r},url:this.storageBaseURI};for(;i&&e.length<t;)try{const{data:c}=await this.makeRequest(o,a);for(const{name:u,timeCreated:s,updated:n}of c?.items||[]){if(e.length>=t)break;e.push({createdAt:s,id:u,modifiedAt:n})}i=c?.nextPageToken!==void 0,i&&e.length<t&&(o={...o,params:{...o.params,maxResults:Math.min(r,t-e.length),pageToken:c.nextPageToken}})}catch(c){const u=this.normalizeError(c instanceof Error?c:new Error(String(c)));throw await this.onError(u),c}return e},{limit:t})}async internalWrite(t,a){const{body:e,bytesWritten:r,size:i,uri:o=""}=t,c=U(t),u={method:"PUT"};if(e?.on){const s=new AbortController;e.on("aborted",()=>{s.abort()}),u.body=e,u.signal=s.signal,u.retry=!1}u.headers={Accept:"application/json","Content-Range":c,...i===r?{"X-Goog-Upload-Command":"upload, finalize"}:{}};try{const s=await this.makeRequest({url:o,...u},a);if(s.status===308){const n=s.headers.get("range");return n?k(n):0}if(s.status===200)return this.logger?.debug("uploaded %O",s.data),i;throw new q(String(s.data),`GCS${s.status}`,{uri:o})}catch(s){this.logger?.error(o,s);const n=this.normalizeError(s instanceof Error?s:new Error(String(s)));throw await this.onError(n),s}}internalOnComplete=g(t=>this.deleteMeta(t.id),"internalOnComplete");static buildCallSignal(t,a){const e=[];if(a&&e.push(a),t?.signal&&e.push(t.signal),e.length!==0)return e.length===1?e[0]:AbortSignal.any(e)}async makeRequest(t,a){typeof t.url=="string"&&(t.url=t.url.replaceAll("/:",":"));const e=f.buildCallSignal(a,t.signal);let r=this.retryOptions;if(a?.retries!==void 0){const o=typeof a.retries=="number"?a.retries:a.retries.maxRetries;typeof o=="number"&&(r={...this.retryOptions,retry:o})}const i=typeof a?.timeout=="number"&&a.timeout>0?a.timeout:6e4;return t={...t,headers:{"User-Agent":`${d.name}/${d.version}`,"x-goog-api-client":`gl-node/${process.versions.node} gccl/${d.version} gccl-invocation-id/${w()}`,...t.headers},params:{...this.userProject===void 0?{}:{userProject:this.userProject},...t.params},retry:t.retry===!1?!1:a?.retries!==0,retryConfig:r,timeout:i,...e?{signal:e}:{}},this.isCustomEndpoint&&!this.useAuthWithCustomEndpoint?b(t):this.authClient.request(t)}async accessCheck(){return this.makeRequest({url:this.storageBaseURI.replace("/o","")})}}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E=Object.defineProperty;var u=(c,e)=>E(c,"name",{value:e,configurable:!0});import{put as d,list as h,del as m,copy as p}from"@vercel/blob";import{a as g}from"./detect-file-type-5JhzC9RU.js";import{B as v,t as T}from"./storage-Dh0tJh7j.js";import{v as b}from"./local-meta-storage-Bi0mK6gD.js";import f from"./VercelBlobFile-Cni_1qwD.js";import{o as w,r as B}from"./part-match-B5fLLmFw.js";import{u as _}from"./update-size-DANV7aa2.js";import{o as k}from"./has-content-Bx2p8Okx.js";var I=Object.defineProperty,C=u((c,e)=>I(c,"name",{value:e,configurable:!0}),"p");class y extends v{static name="vercel-blob";checksumTypes=["md5"];get raw(){return{copy:p,credentials:this.credentials,del:m,list:h,put:d}}meta;credentials;multipart;access;constructor(e){super(e),this.credentials=y.resolveCredentials(e),this.multipart=e.multipart??!1,this.access=e.access??"public";const{metaStorage:i,metaStorageConfig:t}=e;this.meta=i||new b(t),this.isReady=!0}static resolveCredentials(e){if(e.token)return{token:e.token};const i=e.oidcToken??process.env.VERCEL_OIDC_TOKEN,t=e.storeId??process.env.BLOB_STORE_ID,r=t?.startsWith("store_")?t.slice(6):t;if(i&&r)return{oidcToken:i,storeId:r};if(i||r)throw new Error(`Vercel Blob OIDC auth requires both \`oidcToken\` and \`storeId\` (or \`VERCEL_OIDC_TOKEN\` and \`BLOB_STORE_ID\` env vars). Got: oidcToken=${i?"set":"missing"}, storeId=${r?"set":"missing"}.`);const a=process.env.BLOB_READ_WRITE_TOKEN||process.env.VERCEL_BLOB_TOKEN;if(a)return{token:a};throw new Error("Vercel Blob credentials are required. Provide `token`, an `oidcToken`+`storeId` pair, or set BLOB_READ_WRITE_TOKEN / (VERCEL_OIDC_TOKEN + BLOB_STORE_ID) env vars.")}async create(e,i){return this.instrumentOperation("create",async()=>{const t={...e};if(e.ttl){const a=typeof e.ttl=="string"?T(e.ttl):e.ttl;t.expiredAt=a===void 0?void 0:Date.now()+a}const r=new f(t);r.name=this.namingFunction(r),await this.validate(r);try{const a=await this.getMeta(r.id);if(a.bytesWritten>=0)return a}catch{}return r.bytesWritten=0,r.status=w(r),await this.saveMeta(r),await this.onCreate(r),r})}async write(e,i){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&_(t,e.size),!B(e,t))throw new Error("File part does not match");const r=await this.lock(e.id);try{if(k(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const a=[],n=e.body;for await(const o of n)a.push(Buffer.from(o));const s=Buffer.concat(a);if((t.bytesWritten===0||Number.isNaN(t.bytesWritten))&&(!t.contentType||t.contentType==="application/octet-stream"))try{const o=await g(s);o?.mime&&(t.contentType=o.mime)}catch{}const O=new Blob([s],{type:t.contentType}),l=await this.runOperation(i,()=>d(t.name,O,{access:this.access,multipart:this.shouldUseMultipart(t),...this.credentials}));t.url=l.url,t.pathname=l.pathname,t.downloadUrl=l.downloadUrl,t.bytesWritten=s.length}return t.status=w(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,r)}})}async delete({id:e},i){return this.instrumentOperation("delete",async()=>{const t=await this.getMeta(e);if(!t.url)throw new Error(`File ${e} does not have a valid URL`);const{url:r}=t;t.status="deleted";try{await this.runOperation(i,()=>m(r,{...this.credentials}))}catch(n){this.logger?.error("Failed to delete blob from Vercel Blob:",n);const s=this.normalizeError(n instanceof Error?n:new Error(String(n)));await this.onError(s)}await this.deleteMeta(t.id);const a={...t};return await this.onDelete(a),a})}async exists({id:e},i){return this.instrumentOperation("exists",async()=>{try{const t=await this.getMeta(e);if(!t.url||t.url.length===0)return!1;const{url:r}=t;return(await this.runOperation(i,()=>fetch(r,{method:"HEAD"}))).ok}catch{return!1}})}async get({id:e},i){return this.instrumentOperation("get",async()=>{const t=await this.checkIfExpired(await this.getMeta(e));if(!t.url||t.url.length===0)throw new Error("File URL not found");const{url:r}=t,a=await this.runOperation(i,()=>fetch(r)),n=Buffer.from(await this.runOperation(i,()=>a.arrayBuffer()));return{content:n,contentType:t.contentType,ETag:t.ETag,expiredAt:t.expiredAt,id:e,metadata:t.metadata,modifiedAt:t.modifiedAt,name:t.name,originalName:t.originalName,size:t.size||n.length}})}async copy(e,i,t){return this.instrumentOperation("copy",async()=>{const r=await this.getMeta(e);if(!r.url)throw new Error("Source file URL not found");const a=r.url,n=await this.runOperation(t,()=>p(a,i,{access:"public",...this.credentials}));return{...r,id:i,name:i,pathname:n.pathname,url:n.url}})}async move(e,i,t){return this.instrumentOperation("move",async()=>{const r=await this.copy(e,i,t);return await this.delete({id:e},t),r})}async list(e=1e3,i){return this.instrumentOperation("list",async()=>(await this.runOperation(i,()=>h({limit:e,...this.credentials}))).blobs.map(t=>{const r=new f({contentType:"application/octet-stream",metadata:{},originalName:t.pathname});return r.createdAt=t.uploadedAt?.toISOString(),r.id=t.pathname,r.modifiedAt=t.uploadedAt?.toISOString(),r.name=t.pathname,r.pathname=t.pathname,r.size=t.size,r.url=t.url,r.downloadUrl=t.downloadUrl,r}),{limit:e})}internalOnComplete=C(e=>this.deleteMeta(e.id),"internalOnComplete");shouldUseMultipart(e){return typeof this.multipart=="boolean"?this.multipart:typeof this.multipart=="number"&&e.size!==void 0?e.size>=this.multipart:!1}}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=Object.defineProperty;var o=(s,t)=>g(s,"name",{value:t,configurable:!0});import{randomUUID as y}from"node:crypto";import{request as f}from"gaxios";import{GoogleAuth as C}from"google-auth-library";import v from"./MetaStorage-Y4m1dWgd.js";import{stringifyMetadata as R,parseMetadata as E}from"./Metadata-B6Ir0KO7.js";import n from"./GCSConfig-BQ0OpVhe.js";import{o as $}from"./has-content-Bx2p8Okx.js";var I="@visulima/storage",P="1.0.0-alpha.
|
|
1
|
+
var g=Object.defineProperty;var o=(s,t)=>g(s,"name",{value:t,configurable:!0});import{randomUUID as y}from"node:crypto";import{request as f}from"gaxios";import{GoogleAuth as C}from"google-auth-library";import v from"./MetaStorage-Y4m1dWgd.js";import{stringifyMetadata as R,parseMetadata as E}from"./Metadata-B6Ir0KO7.js";import n from"./GCSConfig-BQ0OpVhe.js";import{o as $}from"./has-content-Bx2p8Okx.js";var I="@visulima/storage",P="1.0.0-alpha.29";const i={name:I,version:P};var A=Object.defineProperty,u=o((s,t)=>A(s,"name",{value:t,configurable:!0}),"n");const T=u(s=>{const t=s.match(/(\d+)-(\d+)/),e=t?.[2]?+t[2]:0;return e>0?e+1:0},"getRangeEnd"),G=u(s=>{if($(s)){const t=s.contentLength?s.start+s.contentLength-1:"*";return`bytes ${s.start}-${t}/${s.size??"*"}`}return`bytes */${s.size??"*"}`},"buildContentRange"),U=u(s=>{if(s.response!==void 0){const{response:t}=s;return t?.data?.error?.errors?.map(({reason:e=""})=>e==="rateLimitExceeded"||e==="userRateLimitExceeded"?!0:!!(e&&e.includes("EAI_AGAIN"))).includes(!0)}return!1},"shouldRetry"),w={retry:3,shouldRetry:U,statusCodesToRetry:[[408,429,500,502,503,504],[100,199],[429],[500,599]]};var b=Object.defineProperty,j=o((s,t)=>b(s,"name",{value:t,configurable:!0}),"p");class N extends v{static{o(this,"E")}constructor(t){super(t),this.config=t;const{authClient:e,...a}=t,r=a.bucket||process.env.GCS_BUCKET;if(e===void 0){if(!r)throw new Error("GCS bucket is not defined");if(!a.projectId)throw new Error("Sorry, we cannot connect to Cloud Services without a project ID.");a.scopes||=n.authScopes,this.authClient=new C(a)}else this.authClient=e;this.storageBaseURI=`${a.storageAPI||n.storageAPI}/${r}/o`,this.uploadBaseURI=`${a.uploadAPI||n.uploadAPI}/${r}/o`;const h=["storage.googleapis.com"],d=new URL(this.storageBaseURI).hostname;this.isCustomEndpoint=!h.includes(d);const{retryOptions:m,useAuthWithCustomEndpoint:p,userProject:l}=t;this.userProject=l,this.useAuthWithCustomEndpoint=p||!1,this.retryOptions={...w,...m},e===void 0&&this.accessCheck().catch(c=>{throw c.code==="404"?new Error(`Bucket ${r} does not exist`):c})}config;static{j(this,"GCSMetaStorage")}authClient;storageBaseURI;uploadBaseURI;isCustomEndpoint=!1;retryOptions={};useAuthWithCustomEndpoint;userProject;async save(t,e){const a={...e};return a.metadata&&(a.metadata=R(e.metadata)),await this.makeRequest({body:JSON.stringify(a),headers:{"Content-Type":"application/json; charset=utf-8"},method:"POST",params:{name:encodeURIComponent(this.getMetaName(t)),uploadType:"media"},url:this.uploadBaseURI}),e}async delete(t){const e=this.getMetaPath(t);await this.makeRequest({method:"DELETE",url:e})}async get(t){const e=this.getMetaPath(t),{data:a}=await this.makeRequest({params:{alt:"media"},url:e});return a.metadata&&typeof a.metadata=="string"&&(a.metadata=E(a.metadata)),a}async touch(t,e){return this.save(t,e)}async accessCheck(){return this.makeRequest({url:this.storageBaseURI.replace("/o","")})}getMetaPath(t){return`${this.storageBaseURI}/${this.getMetaName(t)}`}async makeRequest(t){return typeof t.url=="string"&&(t.url=t.url.replaceAll("/:",":")),t={...t,headers:{"User-Agent":`${i.name}/${i.version}`,"x-goog-api-client":`gl-node/${process.versions.node} gccl/${i.version} gccl-invocation-id/${y()}`},params:{...this.userProject===void 0?{}:{userProject:this.userProject}},retry:!0,retryConfig:this.retryOptions,timeout:6e4},this.isCustomEndpoint&&!this.useAuthWithCustomEndpoint?f(t):this.authClient.request(t)}}export{N as E,G as b,i as d,T as g,w as r};
|
package/dist/packem_shared/{media-transformer.d-j1W9HAXw.d.ts → media-transformer.d-C3QvECD7.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as File, a as FileReturn, B as BaseStorage } from "./storage.d-RteRC-cG.js";
|
|
2
|
-
import { M as MediaTransformerConfig,
|
|
2
|
+
import { M as MediaTransformerConfig, f as MediaTransformResult } from "./types.d-DxonY4XS.js";
|
|
3
3
|
/**
|
|
4
4
|
* Unified media transformer that automatically detects media type and routes to appropriate transformer.
|
|
5
5
|
* @template TFile The file type used by this transformer.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { U as UploadFile, j as ResponseBodyType, B as BaseStorage, k as ErrorResponses } from "./storage.d-RteRC-cG.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { M as MediaTransformer } from "./media-transformer.d-
|
|
5
|
-
import { U as UploadOptions } from "./types.d-
|
|
4
|
+
import { M as MediaTransformer } from "./media-transformer.d-C3QvECD7.js";
|
|
5
|
+
import { U as UploadOptions } from "./types.d-cI_cMxcZ.js";
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:http';
|
|
8
8
|
import 'lru-cache';
|
|
@@ -717,4 +717,4 @@ interface AudioTransformerConfig extends BaseTransformerConfig {
|
|
|
717
717
|
/** Maximum audio size to process (in bytes) */
|
|
718
718
|
maxAudioSize?: number;
|
|
719
719
|
}
|
|
720
|
-
export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C,
|
|
720
|
+
export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, VideoTransformResult as F, GreyscaleOptions as G, VideoResizeOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, VideoCropOptions as K, LinearOptions as L, MediaTransformerConfig as M, VideoRotateOptions as N, VideoTransformOptions as O, PipelineColourspaceOptions as P, VideoTransformationStep as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, AudioTransformResult as a, AudioResampleOptions as b, AudioChannelMixOptions as c, AudioTransformOptions as d, AudioTransformationStep as e, MediaTransformResult as f, RotateOptions as g, ImageFormat as h, TransformOptions as i, BlurOptions as j, MedianOptions as k, CLAHEOptions as l, ConvolveOptions as m, ThresholdOptions as n, BooleanOptions as o, RecombineOptions as p, ModulateOptions as q, TintOptions as r, ColourspaceOptions as s, BandboolOptions as t, AffineOptions as u, ErodeOptions as v, ToColourspaceOptions as w, RemoveAlphaOptions as x, EnsureAlphaOptions as y, TransformationStep as z };
|
|
@@ -3,7 +3,7 @@ import { IncomingMessage } from 'node:http';
|
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
4
|
import { PaginationResult } from '@visulima/pagination';
|
|
5
5
|
import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-RteRC-cG.js";
|
|
6
|
-
import { M as MediaTransformer } from "./media-transformer.d-
|
|
6
|
+
import { M as MediaTransformer } from "./media-transformer.d-C3QvECD7.js";
|
|
7
7
|
type WebRequest = globalThis.Request;
|
|
8
8
|
type WebResponse = globalThis.Response;
|
|
9
9
|
interface BaseResponse {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/GCSConfig-BQ0OpVhe.js";import{default as t}from"../../packem_shared/GCSFile-CDQ6IWAz.js";import{E as C}from"../../packem_shared/gcs-meta-storage-
|
|
1
|
+
import{default as a}from"../../packem_shared/GCSConfig-BQ0OpVhe.js";import{default as t}from"../../packem_shared/GCSFile-CDQ6IWAz.js";import{E as C}from"../../packem_shared/gcs-meta-storage-mZiqlX-9.js";import{default as l}from"../../packem_shared/GCStorage-ChY6uJuO.js";export{a as GCSConfig,t as GCSFile,C as GCSMetaStorage,l as GCStorage};
|
|
@@ -36,7 +36,23 @@ interface VercelBlobStorageOptions extends BaseStorageOptions {
|
|
|
36
36
|
*/
|
|
37
37
|
multipart?: boolean | number;
|
|
38
38
|
/**
|
|
39
|
-
* Vercel
|
|
39
|
+
* Vercel OIDC token (`VERCEL_OIDC_TOKEN`). Short-lived, auto-rotated, and the
|
|
40
|
+
* recommended auth path for projects running on Vercel. Must be paired with
|
|
41
|
+
* {@link VercelBlobStorageOptions.storeId} (or `BLOB_STORE_ID` env). Provide
|
|
42
|
+
* explicitly for runtimes that don't expose `process.env` (e.g. Vite).
|
|
43
|
+
* @see https://vercel.com/docs/vercel-blob/using-blob-sdk#oidc-tokens-recommended
|
|
44
|
+
*/
|
|
45
|
+
oidcToken?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Vercel Blob store ID (`BLOB_STORE_ID`). Accepted in either `store_{id}`
|
|
48
|
+
* or `{id}` form — the `store_` prefix is stripped automatically. Required
|
|
49
|
+
* when authenticating via {@link VercelBlobStorageOptions.oidcToken}.
|
|
50
|
+
*/
|
|
51
|
+
storeId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Vercel Blob read-write token (`BLOB_READ_WRITE_TOKEN`). Long-lived; prefer
|
|
54
|
+
* {@link VercelBlobStorageOptions.oidcToken} on Vercel. Always wins over OIDC
|
|
55
|
+
* when both are supplied.
|
|
40
56
|
*/
|
|
41
57
|
token?: string;
|
|
42
58
|
}
|
|
@@ -78,21 +94,47 @@ declare class VercelBlobMetaStorage extends LocalMetaStorage {
|
|
|
78
94
|
* - ❌ getUploadUrl: Not implemented (Vercel Blob upload URLs handled internally)
|
|
79
95
|
* - ⚠️ Per-operation `signal`/`timeout` are best-effort: the underlying SDK does not support request cancellation, so an in-flight call may complete server-side even after abort. `retries` is honored.
|
|
80
96
|
*/
|
|
97
|
+
/**
|
|
98
|
+
* Auth credentials resolved at construction and forwarded verbatim to every
|
|
99
|
+
* `@vercel/blob` SDK call. Mirrors the SDK's `BlobCommandOptions` shape so
|
|
100
|
+
* env-based auto-pickup is never required.
|
|
101
|
+
*/
|
|
102
|
+
type VercelBlobCredentials = {
|
|
103
|
+
oidcToken: string;
|
|
104
|
+
storeId: string;
|
|
105
|
+
token?: never;
|
|
106
|
+
} | {
|
|
107
|
+
oidcToken?: never;
|
|
108
|
+
storeId?: never;
|
|
109
|
+
token: string;
|
|
110
|
+
};
|
|
81
111
|
declare class VercelBlobStorage extends BaseStorage<VercelBlobFile> {
|
|
82
112
|
static override readonly name: string;
|
|
83
113
|
override checksumTypes: string[];
|
|
84
114
|
override get raw(): {
|
|
85
115
|
copy: typeof copy;
|
|
116
|
+
credentials: VercelBlobCredentials;
|
|
86
117
|
del: typeof del;
|
|
87
118
|
list: typeof list;
|
|
88
119
|
put: typeof put;
|
|
89
|
-
token: string;
|
|
90
120
|
};
|
|
91
121
|
protected meta: MetaStorage;
|
|
92
|
-
private readonly
|
|
122
|
+
private readonly credentials;
|
|
93
123
|
private readonly multipart;
|
|
94
124
|
private readonly access;
|
|
95
125
|
constructor(config: VercelBlobStorageOptions);
|
|
126
|
+
/**
|
|
127
|
+
* Resolves auth credentials in the same precedence as `@vercel/blob`:
|
|
128
|
+
*
|
|
129
|
+
* 1. Explicit `token` (RW or client token) — always wins.
|
|
130
|
+
* 2. OIDC pair (`oidcToken` + `storeId`), from options or env.
|
|
131
|
+
* 3. `BLOB_READ_WRITE_TOKEN` / `VERCEL_BLOB_TOKEN` env.
|
|
132
|
+
*
|
|
133
|
+
* Throws if no credentials are found, or if OIDC config is partial (one of
|
|
134
|
+
* the two values present without the other) so callers fail loudly instead
|
|
135
|
+
* of silently dropping to anonymous calls that 401 at runtime.
|
|
136
|
+
*/
|
|
137
|
+
private static resolveCredentials;
|
|
96
138
|
create(config: FileInit, _options?: OperationOptions): Promise<VercelBlobFile>;
|
|
97
139
|
write(part: FilePart | FileQuery | VercelBlobFile, options?: OperationOptions): Promise<VercelBlobFile>;
|
|
98
140
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/VercelBlobFile-Cni_1qwD.js";import{default as a}from"../../packem_shared/VercelBlobMetaStorage-CwaqWucZ.js";import{default as f}from"../../packem_shared/VercelBlobStorage-
|
|
1
|
+
import{default as r}from"../../packem_shared/VercelBlobFile-Cni_1qwD.js";import{default as a}from"../../packem_shared/VercelBlobMetaStorage-CwaqWucZ.js";import{default as f}from"../../packem_shared/VercelBlobStorage-s260zfFo.js";export{r as VercelBlobFile,a as VercelBlobMetaStorage,f as VercelBlobStorage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-RteRC-cG.js";
|
|
2
|
-
import { A as AudioTransformerConfig, a as AudioTransformResult, b as AudioResampleOptions, c as AudioChannelMixOptions, d as AudioTransformOptions, e as AudioTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-
|
|
2
|
+
import { A as AudioTransformerConfig, a as AudioTransformResult, b as AudioResampleOptions, c as AudioChannelMixOptions, d as AudioTransformOptions, e as AudioTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-DxonY4XS.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-RteRC-cG.js";
|
|
3
|
-
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions,
|
|
3
|
+
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions, g as RotateOptions, h as ImageFormat, i as TransformOptions, S as SharpenOptions, j as BlurOptions, k as MedianOptions, l as CLAHEOptions, m as ConvolveOptions, n as ThresholdOptions, o as BooleanOptions, L as LinearOptions, p as RecombineOptions, q as ModulateOptions, r as TintOptions, G as GreyscaleOptions, s as ColourspaceOptions, E as ExtractChannelOptions, J as JoinChannelOptions, t as BandboolOptions, u as AffineOptions, D as DilateOptions, v as ErodeOptions, P as PipelineColourspaceOptions, w as ToColourspaceOptions, x as RemoveAlphaOptions, y as EnsureAlphaOptions, z as TransformationStep, B as BaseTransformer } from "../packem_shared/types.d-DxonY4XS.js";
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { type c as AudioChannelMixOptions, type b as AudioResampleOptions, type d as AudioTransformOptions, type a as AudioTransformResult, type e as AudioTransformationStep, type A as AudioTransformerConfig, B as BaseTransformer, type C as CropOptions, type
|
|
2
|
-
export { M as MediaTransformer } from "../packem_shared/media-transformer.d-
|
|
1
|
+
export { type c as AudioChannelMixOptions, type b as AudioResampleOptions, type d as AudioTransformOptions, type a as AudioTransformResult, type e as AudioTransformationStep, type A as AudioTransformerConfig, B as BaseTransformer, type C as CropOptions, type h as ImageFormat, type I as ImageTransformerConfig, type U as MediaTransformQuery, type f as MediaTransformResult, type W as MediaTransformationStep, type M as MediaTransformerConfig, type R as ResizeOptions, type g as RotateOptions, type i as TransformOptions, type T as TransformResult, type z as TransformationStep, type K as VideoCropOptions, type H as VideoResizeOptions, type N as VideoRotateOptions, type O as VideoTransformOptions, type F as VideoTransformResult, type Q as VideoTransformationStep, type V as VideoTransformerConfig } from "../packem_shared/types.d-DxonY4XS.js";
|
|
2
|
+
export { M as MediaTransformer } from "../packem_shared/media-transformer.d-C3QvECD7.js";
|
|
3
3
|
import { a as FileReturn } from "../packem_shared/storage.d-RteRC-cG.js";
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
import 'node:crypto';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-RteRC-cG.js";
|
|
2
|
-
import { V as VideoTransformerConfig,
|
|
2
|
+
import { V as VideoTransformerConfig, F as VideoTransformResult, H as VideoResizeOptions, K as VideoCropOptions, N as VideoRotateOptions, O as VideoTransformOptions, Q as VideoTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-DxonY4XS.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/storage",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.30",
|
|
4
4
|
"description": "Visulima upload - Store files in a web-accessible location via a simplified API. Can automatically scale and rotate images. Includes S3, Azure, GCS and local filesystem-based backends with the most convenient features of each.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
"@solidjs/start": ">=1.1.0",
|
|
292
292
|
"@supabase/storage-js": ">=2.105.0",
|
|
293
293
|
"@tanstack/ai": ">=0.16.0",
|
|
294
|
-
"@vercel/blob": ">=2.
|
|
294
|
+
"@vercel/blob": ">=2.4.0",
|
|
295
295
|
"ai": ">=5.0.0",
|
|
296
296
|
"aws-crt": ">=1.27.3",
|
|
297
297
|
"aws4fetch": ">=1.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var u=(s,e)=>g(s,"name",{value:e,configurable:!0});import{put as m,list as p,del as h,copy as d}from"@vercel/blob";import{a as O}from"./detect-file-type-5JhzC9RU.js";import{B as E,t as b}from"./storage-Dh0tJh7j.js";import{v}from"./local-meta-storage-Bi0mK6gD.js";import f from"./VercelBlobFile-Cni_1qwD.js";import{o as w,r as k}from"./part-match-B5fLLmFw.js";import{u as T}from"./update-size-DANV7aa2.js";import{o as B}from"./has-content-Bx2p8Okx.js";var A=Object.defineProperty,M=u((s,e)=>A(s,"name",{value:e,configurable:!0}),"p");class F extends E{static name="vercel-blob";checksumTypes=["md5"];get raw(){return{copy:d,del:h,list:p,put:m,token:this.token}}meta;token;multipart;access;constructor(e){if(super(e),this.token=e.token||process.env.BLOB_READ_WRITE_TOKEN||process.env.VERCEL_BLOB_TOKEN||"",!this.token)throw new Error("Vercel Blob token is required. Set BLOB_READ_WRITE_TOKEN or VERCEL_BLOB_TOKEN environment variable, or provide token in config.");this.multipart=e.multipart??!1,this.access=e.access??"public";const{metaStorage:a,metaStorageConfig:t}=e;this.meta=a||new v(t),this.isReady=!0}async create(e,a){return this.instrumentOperation("create",async()=>{const t={...e};if(e.ttl){const r=typeof e.ttl=="string"?b(e.ttl):e.ttl;t.expiredAt=r===void 0?void 0:Date.now()+r}const i=new f(t);i.name=this.namingFunction(i),await this.validate(i);try{const r=await this.getMeta(i.id);if(r.bytesWritten>=0)return r}catch{}return i.bytesWritten=0,i.status=w(i),await this.saveMeta(i),await this.onCreate(i),i})}async write(e,a){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&T(t,e.size),!k(e,t))throw new Error("File part does not match");const i=await this.lock(e.id);try{if(B(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const r=[],n=e.body;for await(const c of n)r.push(Buffer.from(c));const o=Buffer.concat(r);if((t.bytesWritten===0||Number.isNaN(t.bytesWritten))&&(!t.contentType||t.contentType==="application/octet-stream"))try{const c=await O(o);c?.mime&&(t.contentType=c.mime)}catch{}const y=new Blob([o],{type:t.contentType}),l=await this.runOperation(a,()=>m(t.name,y,{access:this.access,multipart:this.shouldUseMultipart(t)}));t.url=l.url,t.pathname=l.pathname,t.downloadUrl=l.downloadUrl,t.bytesWritten=o.length}return t.status=w(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,i)}})}async delete({id:e},a){return this.instrumentOperation("delete",async()=>{const t=await this.getMeta(e);if(!t.url)throw new Error(`File ${e} does not have a valid URL`);const{url:i}=t;t.status="deleted";try{await this.runOperation(a,()=>h(i,{token:this.token}))}catch(n){this.logger?.error("Failed to delete blob from Vercel Blob:",n);const o=this.normalizeError(n instanceof Error?n:new Error(String(n)));await this.onError(o)}await this.deleteMeta(t.id);const r={...t};return await this.onDelete(r),r})}async exists({id:e},a){return this.instrumentOperation("exists",async()=>{try{const t=await this.getMeta(e);if(!t.url||t.url.length===0)return!1;const{url:i}=t;return(await this.runOperation(a,()=>fetch(i,{method:"HEAD"}))).ok}catch{return!1}})}async get({id:e},a){return this.instrumentOperation("get",async()=>{const t=await this.checkIfExpired(await this.getMeta(e));if(!t.url||t.url.length===0)throw new Error("File URL not found");const{url:i}=t,r=await this.runOperation(a,()=>fetch(i)),n=Buffer.from(await this.runOperation(a,()=>r.arrayBuffer()));return{content:n,contentType:t.contentType,ETag:t.ETag,expiredAt:t.expiredAt,id:e,metadata:t.metadata,modifiedAt:t.modifiedAt,name:t.name,originalName:t.originalName,size:t.size||n.length}})}async copy(e,a,t){return this.instrumentOperation("copy",async()=>{const i=await this.getMeta(e);if(!i.url)throw new Error("Source file URL not found");const r=i.url,n=await this.runOperation(t,()=>d(r,a,{access:"public"}));return{...i,id:a,name:a,pathname:n.pathname,url:n.url}})}async move(e,a,t){return this.instrumentOperation("move",async()=>{const i=await this.copy(e,a,t);return await this.delete({id:e},t),i})}async list(e=1e3,a){return this.instrumentOperation("list",async()=>(await this.runOperation(a,()=>p({limit:e}))).blobs.map(t=>{const i=new f({contentType:"application/octet-stream",metadata:{},originalName:t.pathname});return i.createdAt=t.uploadedAt?.toISOString(),i.id=t.pathname,i.modifiedAt=t.uploadedAt?.toISOString(),i.name=t.pathname,i.pathname=t.pathname,i.size=t.size,i.url=t.url,i.downloadUrl=t.downloadUrl,i}),{limit:e})}internalOnComplete=M(e=>this.deleteMeta(e.id),"internalOnComplete");shouldUseMultipart(e){return typeof this.multipart=="boolean"?this.multipart:typeof this.multipart=="number"&&e.size!==void 0?e.size>=this.multipart:!1}}export{F as default};
|