@edgestore/react 0.5.7 → 0.6.0-canary.1
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/dist/errors/index.cjs +11 -0
- package/dist/errors/index.d.cts +9 -0
- package/dist/errors/index.d.cts.map +1 -0
- package/dist/errors/index.d.mts +9 -0
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/index.mjs +4 -2
- package/dist/index.cjs +425 -0
- package/dist/index.d.cts +131 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +131 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +369 -436
- package/dist/index.mjs.map +1 -0
- package/dist/shared/index.cjs +11 -0
- package/dist/shared/index.d.cts +11 -0
- package/dist/shared/index.d.cts.map +1 -0
- package/dist/shared/index.d.mts +11 -0
- package/dist/shared/index.d.mts.map +1 -0
- package/dist/shared/index.mjs +7 -5
- package/dist/shared/index.mjs.map +1 -0
- package/dist/uploadAbortedError-1Hka0_24.mjs +11 -0
- package/dist/uploadAbortedError-1Hka0_24.mjs.map +1 -0
- package/dist/uploadAbortedError-CyhLukhg.cjs +16 -0
- package/dist/utils/index.cjs +40 -0
- package/dist/utils/{index.d.ts → index.d.cts} +6 -3
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +17 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +33 -28
- package/dist/utils/index.mjs.map +1 -0
- package/errors/package.json +1 -0
- package/package.json +48 -29
- package/shared/package.json +1 -0
- package/utils/package.json +1 -0
- package/dist/contextProvider.d.ts +0 -65
- package/dist/contextProvider.d.ts.map +0 -1
- package/dist/createNextProxy.d.ts +0 -71
- package/dist/createNextProxy.d.ts.map +0 -1
- package/dist/errors/index.d.ts +0 -3
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -488
- package/dist/libs/errors/EdgeStoreClientError.d.ts +0 -5
- package/dist/libs/errors/EdgeStoreClientError.d.ts.map +0 -1
- package/dist/libs/errors/handleError.d.ts +0 -2
- package/dist/libs/errors/handleError.d.ts.map +0 -1
- package/dist/libs/errors/uploadAbortedError.d.ts +0 -4
- package/dist/libs/errors/uploadAbortedError.d.ts.map +0 -1
- package/dist/shared/index.d.ts +0 -7
- package/dist/shared/index.d.ts.map +0 -1
- package/dist/shared/index.js +0 -13
- package/dist/uploadAbortedError-a628b025.js +0 -8
- package/dist/uploadAbortedError-e1379bb0.mjs +0 -8
- package/dist/uploadAbortedError-fbfcc57b.js +0 -10
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -39
- package/errors/index.d.ts +0 -1
- package/errors/index.js +0 -1
- package/shared/index.d.ts +0 -1
- package/shared/index.js +0 -1
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["json: any","EdgeStoreClientError","EdgeStoreClientError","uploadingParts: {\n partNumber: number;\n progress: number;\n }[]","params","results: TRes[]","this","tasks: Promise<void>[]","value: EdgeStoreContextValue<TRouter>","EdgeStoreClientError"],"sources":["../src/libs/errors/EdgeStoreClientError.ts","../src/libs/errors/handleError.ts","../src/createNextProxy.ts","../src/contextProvider.tsx"],"sourcesContent":["class EdgeStoreClientError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'EdgeStoreError';\n }\n}\n\nexport default EdgeStoreClientError;\n","import { EdgeStoreApiClientError } from '@edgestore/shared';\nimport EdgeStoreClientError from './EdgeStoreClientError';\n\nexport async function handleError(res: Response): Promise<never> {\n let json: any = {};\n try {\n json = await res.json();\n } catch (err) {\n throw new EdgeStoreClientError(\n `Failed to parse response. Make sure the api is correctly configured at ${res.url}`,\n );\n }\n throw new EdgeStoreApiClientError({ response: json });\n}\n","import {\n type AnyRouter,\n type InferBucketPathObject,\n type InferMetadataObject,\n type SharedRequestUploadRes,\n type UploadOptions,\n} from '@edgestore/shared';\nimport { type z } from 'zod';\nimport EdgeStoreClientError from './libs/errors/EdgeStoreClientError';\nimport { handleError } from './libs/errors/handleError';\nimport { UploadAbortedError } from './libs/errors/uploadAbortedError';\n\n/**\n * @internal\n * @see https://www.totaltypescript.com/concepts/the-prettify-helper\n */\nexport type Prettify<TType> = {\n [K in keyof TType]: TType[K];\n // eslint-disable-next-line @typescript-eslint/ban-types\n} & {};\n\nexport type BucketFunctions<TRouter extends AnyRouter> = {\n [K in keyof TRouter['buckets']]: {\n /**\n * Upload a file to the bucket\n *\n * @example\n * await edgestore.myBucket.upload({\n * file: file,\n * signal: abortController.signal, // if you want to be able to cancel the ongoing upload\n * onProgressChange: (progress) => { console.log(progress) }, // if you want to show the progress of the upload\n * input: {...} // if the bucket has an input schema\n * options: {\n * manualFileName: file.name, // if you want to use a custom file name\n * replaceTargetUrl: url, // if you want to replace an existing file\n * temporary: true, // if you want to delete the file after 24 hours\n * }\n * })\n */\n upload: (\n params: z.infer<TRouter['buckets'][K]['_def']['input']> extends never\n ? {\n file: File;\n signal?: AbortSignal;\n onProgressChange?: OnProgressChangeHandler;\n options?: UploadOptions;\n }\n : {\n file: File;\n signal?: AbortSignal;\n input: z.infer<TRouter['buckets'][K]['_def']['input']>;\n onProgressChange?: OnProgressChangeHandler;\n options?: UploadOptions;\n },\n ) => Promise<\n TRouter['buckets'][K]['_def']['type'] extends 'IMAGE'\n ? {\n url: string;\n thumbnailUrl: string | null;\n size: number;\n uploadedAt: Date;\n metadata: InferMetadataObject<TRouter['buckets'][K]>;\n path: InferBucketPathObject<TRouter['buckets'][K]>;\n pathOrder: Prettify<\n keyof InferBucketPathObject<TRouter['buckets'][K]>\n >[];\n }\n : {\n url: string;\n size: number;\n uploadedAt: Date;\n metadata: InferMetadataObject<TRouter['buckets'][K]>;\n path: InferBucketPathObject<TRouter['buckets'][K]>;\n pathOrder: Prettify<\n keyof InferBucketPathObject<TRouter['buckets'][K]>\n >[];\n }\n >;\n confirmUpload: (params: { url: string }) => Promise<void>;\n delete: (params: { url: string }) => Promise<void>;\n };\n};\n\ntype OnProgressChangeHandler = (progress: number) => void;\n\nexport function createNextProxy<TRouter extends AnyRouter>({\n apiPath,\n uploadingCountRef,\n maxConcurrentUploads = 5,\n disableDevProxy,\n}: {\n apiPath: string;\n uploadingCountRef: React.MutableRefObject<number>;\n maxConcurrentUploads?: number;\n disableDevProxy?: boolean;\n}) {\n return new Proxy<BucketFunctions<TRouter>>({} as BucketFunctions<TRouter>, {\n get(_, prop) {\n const bucketName = prop as keyof TRouter['buckets'];\n const bucketFunctions: BucketFunctions<TRouter>[string] = {\n upload: async (params) => {\n try {\n params.onProgressChange?.(0);\n\n // This handles the case where the user cancels the upload while it's waiting in the queue\n const abortPromise = new Promise<void>((resolve) => {\n params.signal?.addEventListener(\n 'abort',\n () => {\n resolve();\n },\n { once: true },\n );\n });\n\n while (\n uploadingCountRef.current >= maxConcurrentUploads &&\n uploadingCountRef.current > 0\n ) {\n await Promise.race([\n new Promise((resolve) => setTimeout(resolve, 300)),\n abortPromise,\n ]);\n if (params.signal?.aborted) {\n throw new UploadAbortedError('File upload aborted');\n }\n }\n\n uploadingCountRef.current++;\n const fileInfo = await uploadFile(\n params,\n {\n bucketName: bucketName as string,\n apiPath,\n },\n disableDevProxy,\n );\n return fileInfo;\n } finally {\n uploadingCountRef.current--;\n }\n },\n confirmUpload: async (params: { url: string }) => {\n const { success } = await confirmUpload(params, {\n bucketName: bucketName as string,\n apiPath,\n });\n if (!success) {\n throw new EdgeStoreClientError('Failed to confirm upload');\n }\n },\n delete: async (params: { url: string }) => {\n const { success } = await deleteFile(params, {\n bucketName: bucketName as string,\n apiPath,\n });\n if (!success) {\n throw new EdgeStoreClientError('Failed to delete file');\n }\n },\n };\n return bucketFunctions;\n },\n });\n}\n\nasync function uploadFile(\n {\n file,\n signal,\n input,\n onProgressChange,\n options,\n }: {\n file: File;\n signal?: AbortSignal;\n input?: object;\n onProgressChange?: OnProgressChangeHandler;\n options?: UploadOptions;\n },\n {\n apiPath,\n bucketName,\n }: {\n apiPath: string;\n bucketName: string;\n },\n disableDevProxy?: boolean,\n) {\n try {\n onProgressChange?.(0);\n const res = await fetch(`${apiPath}/request-upload`, {\n method: 'POST',\n credentials: 'include',\n signal: signal,\n body: JSON.stringify({\n bucketName,\n input,\n fileInfo: {\n extension: file.name.split('.').pop(),\n type: file.type,\n size: file.size,\n fileName: options?.manualFileName,\n replaceTargetUrl: options?.replaceTargetUrl,\n temporary: options?.temporary,\n },\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (!res.ok) {\n await handleError(res);\n }\n const json = (await res.json()) as SharedRequestUploadRes;\n if ('multipart' in json) {\n await multipartUpload({\n bucketName,\n multipartInfo: json.multipart,\n onProgressChange,\n signal,\n file,\n apiPath,\n });\n } else if ('uploadUrl' in json) {\n // Single part upload\n // Upload the file to the signed URL and get the progress\n await uploadFileInner({\n file,\n uploadUrl: json.uploadUrl,\n onProgressChange,\n signal,\n });\n } else {\n throw new EdgeStoreClientError('An error occurred');\n }\n return {\n url: getUrl(json.accessUrl, apiPath, disableDevProxy),\n thumbnailUrl: json.thumbnailUrl\n ? getUrl(json.thumbnailUrl, apiPath, disableDevProxy)\n : null,\n size: json.size,\n uploadedAt: new Date(json.uploadedAt),\n path: json.path as any,\n pathOrder: json.pathOrder as any,\n metadata: json.metadata as any,\n };\n } catch (e) {\n if (e instanceof Error && e.name === 'AbortError') {\n throw new UploadAbortedError('File upload aborted');\n }\n onProgressChange?.(0);\n throw e;\n }\n}\n\n/**\n * Protected files need third-party cookies to work.\n * Since third party cookies don't work on localhost,\n * we need to proxy the file through the server.\n */\nfunction getUrl(url: string, apiPath: string, disableDevProxy?: boolean) {\n const mode =\n typeof process !== 'undefined'\n ? process.env.NODE_ENV\n : // @ts-expect-error - DEV is injected by Vite\n import.meta.env?.DEV\n ? 'development'\n : 'production';\n if (\n mode === 'development' &&\n !url.includes('/_public/') &&\n !disableDevProxy\n ) {\n const proxyUrl = new URL(window.location.origin);\n proxyUrl.pathname = `${apiPath}/proxy-file`;\n proxyUrl.search = new URLSearchParams({\n url,\n }).toString();\n return proxyUrl.toString();\n }\n return url;\n}\n\nasync function uploadFileInner(props: {\n file: File | Blob;\n uploadUrl: string;\n onProgressChange?: OnProgressChangeHandler;\n signal?: AbortSignal;\n}) {\n const { file, uploadUrl, onProgressChange, signal } = props;\n const promise = new Promise<string | null>((resolve, reject) => {\n if (signal?.aborted) {\n reject(new UploadAbortedError('File upload aborted'));\n return;\n }\n\n const request = new XMLHttpRequest();\n request.open('PUT', uploadUrl);\n // This is for Azure provider. Specifies the blob type\n request.setRequestHeader('x-ms-blob-type', 'BlockBlob');\n request.addEventListener('loadstart', () => {\n onProgressChange?.(0);\n });\n request.upload.addEventListener('progress', (e) => {\n if (e.lengthComputable) {\n // 2 decimal progress\n const progress = Math.round((e.loaded / e.total) * 10000) / 100;\n onProgressChange?.(progress);\n }\n });\n request.addEventListener('error', () => {\n reject(new Error('Error uploading file'));\n });\n request.addEventListener('abort', () => {\n reject(new UploadAbortedError('File upload aborted'));\n });\n request.addEventListener('loadend', () => {\n // Return the ETag header (needed to complete multipart upload)\n resolve(request.getResponseHeader('ETag'));\n });\n\n if (signal) {\n signal.addEventListener('abort', () => {\n request.abort();\n });\n }\n\n request.send(file);\n });\n return promise;\n}\n\nasync function multipartUpload(params: {\n bucketName: string;\n multipartInfo: Extract<\n SharedRequestUploadRes,\n { multipart: any }\n >['multipart'];\n onProgressChange: OnProgressChangeHandler | undefined;\n file: File;\n signal: AbortSignal | undefined;\n apiPath: string;\n}) {\n const { bucketName, multipartInfo, onProgressChange, file, signal, apiPath } =\n params;\n const { partSize, parts, totalParts, uploadId, key } = multipartInfo;\n const uploadingParts: {\n partNumber: number;\n progress: number;\n }[] = [];\n const uploadPart = async (params: {\n part: (typeof parts)[number];\n chunk: Blob;\n }) => {\n const { part, chunk } = params;\n const { uploadUrl } = part;\n const eTag = await uploadFileInner({\n file: chunk,\n uploadUrl,\n signal,\n onProgressChange: (progress) => {\n const uploadingPart = uploadingParts.find(\n (p) => p.partNumber === part.partNumber,\n );\n if (uploadingPart) {\n uploadingPart.progress = progress;\n } else {\n uploadingParts.push({\n partNumber: part.partNumber,\n progress,\n });\n }\n const totalProgress =\n Math.round(\n uploadingParts.reduce((acc, p) => acc + p.progress * 100, 0) /\n totalParts,\n ) / 100;\n onProgressChange?.(totalProgress);\n },\n });\n if (!eTag) {\n throw new EdgeStoreClientError(\n 'Could not get ETag from multipart response',\n );\n }\n return {\n partNumber: part.partNumber,\n eTag,\n };\n };\n\n // Upload the parts in parallel\n const completedParts = await queuedPromises({\n items: parts.map((part) => ({\n part,\n chunk: file.slice(\n (part.partNumber - 1) * partSize,\n part.partNumber * partSize,\n ),\n })),\n fn: uploadPart,\n maxParallel: 5,\n maxRetries: 10, // retry 10 times per part\n });\n\n // Complete multipart upload\n const res = await fetch(`${apiPath}/complete-multipart-upload`, {\n method: 'POST',\n credentials: 'include',\n body: JSON.stringify({\n bucketName,\n uploadId,\n key,\n parts: completedParts,\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (!res.ok) {\n await handleError(res);\n }\n}\n\nasync function confirmUpload(\n {\n url,\n }: {\n url: string;\n },\n {\n apiPath,\n bucketName,\n }: {\n apiPath: string;\n bucketName: string;\n },\n) {\n const res = await fetch(`${apiPath}/confirm-upload`, {\n method: 'POST',\n credentials: 'include',\n body: JSON.stringify({\n url,\n bucketName,\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (!res.ok) {\n await handleError(res);\n }\n return res.json();\n}\n\nasync function deleteFile(\n {\n url,\n }: {\n url: string;\n },\n {\n apiPath,\n bucketName,\n }: {\n apiPath: string;\n bucketName: string;\n },\n) {\n const res = await fetch(`${apiPath}/delete-file`, {\n method: 'POST',\n credentials: 'include',\n body: JSON.stringify({\n url,\n bucketName,\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (!res.ok) {\n await handleError(res);\n }\n return res.json();\n}\n\nasync function queuedPromises<TType, TRes>({\n items,\n fn,\n maxParallel,\n maxRetries = 0,\n}: {\n items: TType[];\n fn: (item: TType) => Promise<TRes>;\n maxParallel: number;\n maxRetries?: number;\n}): Promise<TRes[]> {\n const results: TRes[] = new Array(items.length);\n\n const executeWithRetry = async (\n func: () => Promise<TRes>,\n retries: number,\n ): Promise<TRes> => {\n try {\n return await func();\n } catch (error) {\n if (error instanceof UploadAbortedError) {\n throw error;\n }\n if (retries > 0) {\n await new Promise((resolve) => setTimeout(resolve, 5000));\n return executeWithRetry(func, retries - 1);\n } else {\n throw error;\n }\n }\n };\n\n const semaphore = {\n count: maxParallel,\n async wait() {\n // If we've reached our maximum concurrency, or it's the last item, wait\n while (this.count <= 0)\n await new Promise((resolve) => setTimeout(resolve, 500));\n this.count--;\n },\n signal() {\n this.count++;\n },\n };\n\n const tasks: Promise<void>[] = items.map((item, i) =>\n (async () => {\n await semaphore.wait();\n\n try {\n const result = await executeWithRetry(() => fn(item), maxRetries);\n results[i] = result;\n } finally {\n semaphore.signal();\n }\n })(),\n );\n\n await Promise.all(tasks);\n return results;\n}\n","import { type AnyRouter } from '@edgestore/shared';\nimport * as React from 'react';\nimport { createNextProxy, type BucketFunctions } from './createNextProxy';\nimport EdgeStoreClientError from './libs/errors/EdgeStoreClientError';\nimport { handleError } from './libs/errors/handleError';\n\nconst DEFAULT_BASE_URL =\n (typeof process !== 'undefined'\n ? process.env.NEXT_PUBLIC_EDGE_STORE_BASE_URL\n : // @ts-expect-error - In Vite, the env variables are available on `import.meta`.\n import.meta.env?.EDGE_STORE_BASE_URL) ?? 'https://files.edgestore.dev';\n\ntype EdgeStoreContextValue<TRouter extends AnyRouter> = {\n edgestore: BucketFunctions<TRouter>;\n /**\n * This will re-run the EdgeStore initialization process,\n * which will run the `createContext` function again.\n *\n * Can be used after a sign-in or sign-out, for example.\n */\n reset: () => Promise<void>;\n /**\n * The current state of the EdgeStore provider.\n *\n * You can use this to wait for the provider to be initialized\n * before trying to show private images on your app.\n */\n state: ProviderState;\n};\n\nexport function createEdgeStoreProvider<TRouter extends AnyRouter>(opts?: {\n /**\n * The maximum number of concurrent uploads.\n *\n * Uploads will automatically be queued if this limit is reached.\n *\n * @default 5\n */\n maxConcurrentUploads?: number;\n /**\n * Accessing EdgeStore protected files in development mode requires a proxy.\n * You might want to disable this for other providers if you are overwriting the path.\n *\n * @default false\n */\n disableDevProxy?: boolean;\n}) {\n const EdgeStoreContext = React.createContext<\n EdgeStoreContextValue<TRouter> | undefined\n >(undefined);\n\n const EdgeStoreProvider = ({\n children,\n basePath,\n }: {\n children: React.ReactNode;\n /**\n * In case your app is not hosted at the root of your domain, you can specify the base path here.\n * If you set this, make sure to set the full path to the EdgeStore API.\n * e.g. `/my-app/api/edgestore` or `https://example.com/my-app/api/edgestore`\n *\n * @example - If your app is hosted at `https://example.com/my-app`, you can set the `basePath` to `/my-app/api/edgestore`.\n */\n basePath?: string;\n }) => {\n return EdgeStoreProviderInner<TRouter>({\n children,\n context: EdgeStoreContext,\n basePath,\n maxConcurrentUploads: opts?.maxConcurrentUploads,\n disableDevProxy: opts?.disableDevProxy,\n });\n };\n\n function useEdgeStore() {\n if (!EdgeStoreContext) {\n throw new Error('React Context is unavailable in Server Components');\n }\n\n // @ts-expect-error - We know that the context value should not be undefined\n const value: EdgeStoreContextValue<TRouter> =\n React.useContext(EdgeStoreContext);\n if (!value && process.env.NODE_ENV !== 'production') {\n throw new Error(\n '[edgestore]: `useEdgeStore` must be wrapped in a <EdgeStoreProvider />',\n );\n }\n\n return value;\n }\n\n return {\n EdgeStoreProvider,\n useEdgeStore,\n };\n}\n\ntype ProviderState =\n | {\n loading: true;\n initialized: false;\n error: false;\n }\n | {\n loading: false;\n initialized: false;\n error: true;\n }\n | {\n loading: false;\n initialized: true;\n error: false;\n };\n\nfunction EdgeStoreProviderInner<TRouter extends AnyRouter>({\n children,\n context,\n basePath,\n maxConcurrentUploads,\n disableDevProxy,\n}: {\n children: React.ReactNode;\n context: React.Context<EdgeStoreContextValue<TRouter> | undefined>;\n basePath?: string;\n maxConcurrentUploads?: number;\n disableDevProxy?: boolean;\n}) {\n const apiPath = basePath ? `${basePath}` : '/api/edgestore';\n const [state, setState] = React.useState<ProviderState>({\n loading: true,\n initialized: false,\n error: false,\n });\n const uploadingCountRef = React.useRef(0);\n const initExecuted = React.useRef(false); // to make sure we don't run init twice\n React.useEffect(() => {\n if (!initExecuted.current) {\n void init();\n }\n\n return () => {\n initExecuted.current = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n async function init() {\n try {\n setState({\n loading: true,\n initialized: false,\n error: false,\n });\n const res = await fetch(`${apiPath}/init`, {\n method: 'POST',\n credentials: 'include',\n });\n if (res.ok) {\n const json = await res.json();\n\n // Only call _init API if provider is edgestore\n if (json.providerName === 'edgestore') {\n const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {\n method: 'GET',\n credentials: 'include',\n headers: {\n 'x-edgestore-token': json.token,\n },\n });\n if (innerRes.ok) {\n // update state\n setState({\n loading: false,\n initialized: true,\n error: false,\n });\n } else {\n setState({\n loading: false,\n initialized: false,\n error: true,\n });\n throw new EdgeStoreClientError(\"Couldn't initialize EdgeStore.\");\n }\n } else {\n // For non-edgestore providers, just update state without calling _init\n setState({\n loading: false,\n initialized: true,\n error: false,\n });\n }\n } else {\n setState({\n loading: false,\n initialized: false,\n error: true,\n });\n await handleError(res);\n }\n } catch (err) {\n setState({\n loading: false,\n initialized: false,\n error: true,\n });\n throw err;\n }\n }\n\n async function reset() {\n await init();\n }\n\n return (\n <>\n <context.Provider\n value={{\n edgestore: createNextProxy<TRouter>({\n apiPath,\n uploadingCountRef,\n maxConcurrentUploads,\n disableDevProxy,\n }),\n reset,\n state,\n }}\n >\n {children}\n </context.Provider>\n </>\n );\n}\n"],"mappings":";;;;;AAAA,IAAM,uBAAN,cAAmC,MAAM;CACvC,YAAY,SAAi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OAAO;KACR,CAAC;AACF,UAAM,YAAY,IAAI;;WAEjB,KAAK;AACZ,YAAS;IACP,SAAS;IACT,aAAa;IACb,OAAO;IACR,CAAC;AACF,SAAM;;;CAIV,eAAe,QAAQ;AACrB,QAAM,MAAM;;AAGd,QACE,0DACE,oCAAC,QAAQ,YACP,OAAO;EACL,WAAW,gBAAyB;GAClC;GACA;GACA;GACA;GACD,CAAC;EACF;EACA;EACD,IAEA,SACgB,CAClB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_index = require('../index.cjs');
|
|
2
|
+
let _edgestore_shared = require("@edgestore/shared");
|
|
3
|
+
|
|
4
|
+
//#region src/shared/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated import from `@edgestore/react/errors` instead.
|
|
7
|
+
*/
|
|
8
|
+
var EdgeStoreApiClientError = class extends _edgestore_shared.EdgeStoreApiClientError {};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.EdgeStoreApiClientError = EdgeStoreApiClientError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EdgeStoreApiClientError as EdgeStoreApiClientError$1 } from "@edgestore/shared";
|
|
2
|
+
|
|
3
|
+
//#region src/shared/index.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated import from `@edgestore/react/errors` instead.
|
|
7
|
+
*/
|
|
8
|
+
declare class EdgeStoreApiClientError extends EdgeStoreApiClientError$1 {}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { EdgeStoreApiClientError };
|
|
11
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/shared/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;cAAa,uBAAA,SAAgC,yBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EdgeStoreApiClientError as EdgeStoreApiClientError$1 } from "@edgestore/shared";
|
|
2
|
+
|
|
3
|
+
//#region src/shared/index.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated import from `@edgestore/react/errors` instead.
|
|
7
|
+
*/
|
|
8
|
+
declare class EdgeStoreApiClientError extends EdgeStoreApiClientError$1 {}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { EdgeStoreApiClientError };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/shared/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAMA;cAAa,uBAAA,SAAgC,yBAAA"}
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { EdgeStoreApiClientError as EdgeStoreApiClientError$1 } from
|
|
1
|
+
import { EdgeStoreApiClientError as EdgeStoreApiClientError$1 } from "@edgestore/shared";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//#region src/shared/index.ts
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
5
|
+
* @deprecated import from `@edgestore/react/errors` instead.
|
|
6
|
+
*/
|
|
7
|
+
var EdgeStoreApiClientError = class extends EdgeStoreApiClientError$1 {};
|
|
8
8
|
|
|
9
|
+
//#endregion
|
|
9
10
|
export { EdgeStoreApiClientError };
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["DeprecatedEdgeStoreApiClientError"],"sources":["../../src/shared/index.ts"],"sourcesContent":["// TODO: delete this file on next major release (moved to \"errors\")\nimport { EdgeStoreApiClientError as DeprecatedEdgeStoreApiClientError } from '@edgestore/shared';\n\n/**\n * @deprecated import from `@edgestore/react/errors` instead.\n */\nexport class EdgeStoreApiClientError extends DeprecatedEdgeStoreApiClientError {}\n"],"mappings":";;;;;;AAMA,IAAa,0BAAb,cAA6CA,0BAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/libs/errors/uploadAbortedError.ts
|
|
2
|
+
var UploadAbortedError = class extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "UploadAbortedError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { UploadAbortedError as t };
|
|
11
|
+
//# sourceMappingURL=uploadAbortedError-1Hka0_24.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadAbortedError-1Hka0_24.mjs","names":[],"sources":["../src/libs/errors/uploadAbortedError.ts"],"sourcesContent":["export class UploadAbortedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UploadAbortedError';\n }\n}\n"],"mappings":";AAAA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/libs/errors/uploadAbortedError.ts
|
|
3
|
+
var UploadAbortedError = class extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "UploadAbortedError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, 'UploadAbortedError', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return UploadAbortedError;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* This will add the necessary query param to the url
|
|
5
|
+
* to make the browser download the file instead of opening it.
|
|
6
|
+
*
|
|
7
|
+
* You can also override the name of the file by passing the name param.
|
|
8
|
+
*/
|
|
9
|
+
function getDownloadUrl(url, name) {
|
|
10
|
+
const urlObj = new URL(url);
|
|
11
|
+
urlObj.searchParams.set("download", name !== null && name !== void 0 ? name : "true");
|
|
12
|
+
return urlObj.toString();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This will format the file size to a human-readable format.
|
|
16
|
+
*
|
|
17
|
+
* @example 1024 => 1 KB
|
|
18
|
+
*/
|
|
19
|
+
function formatFileSize(bytes) {
|
|
20
|
+
if (!bytes) return "0 B";
|
|
21
|
+
const k = 1024;
|
|
22
|
+
const dm = 2;
|
|
23
|
+
const sizes = [
|
|
24
|
+
"B",
|
|
25
|
+
"KB",
|
|
26
|
+
"MB",
|
|
27
|
+
"GB",
|
|
28
|
+
"TB",
|
|
29
|
+
"PB",
|
|
30
|
+
"EB",
|
|
31
|
+
"ZB",
|
|
32
|
+
"YB"
|
|
33
|
+
];
|
|
34
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
35
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.formatFileSize = formatFileSize;
|
|
40
|
+
exports.getDownloadUrl = getDownloadUrl;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
//#region src/utils/index.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* This will add the necessary query param to the url
|
|
3
4
|
* to make the browser download the file instead of opening it.
|
|
4
5
|
*
|
|
5
6
|
* You can also override the name of the file by passing the name param.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare function getDownloadUrl(url: string, name?: string): string;
|
|
8
9
|
/**
|
|
9
10
|
* This will format the file size to a human-readable format.
|
|
10
11
|
*
|
|
11
12
|
* @example 1024 => 1 KB
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
//#
|
|
14
|
+
declare function formatFileSize(bytes?: number): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { formatFileSize, getDownloadUrl };
|
|
17
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":[],"mappings":";;AAMA;AAWA;;;;iBAXgB,cAAA;;;;;;iBAWA,cAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* This will add the necessary query param to the url
|
|
4
|
+
* to make the browser download the file instead of opening it.
|
|
5
|
+
*
|
|
6
|
+
* You can also override the name of the file by passing the name param.
|
|
7
|
+
*/
|
|
8
|
+
declare function getDownloadUrl(url: string, name?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* This will format the file size to a human-readable format.
|
|
11
|
+
*
|
|
12
|
+
* @example 1024 => 1 KB
|
|
13
|
+
*/
|
|
14
|
+
declare function formatFileSize(bytes?: number): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { formatFileSize, getDownloadUrl };
|
|
17
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":[],"mappings":";;AAMA;AAWA;;;;iBAXgB,cAAA;;;;;;iBAWA,cAAA"}
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
+
//#region src/utils/index.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
* This will add the necessary query param to the url
|
|
4
|
+
* to make the browser download the file instead of opening it.
|
|
5
|
+
*
|
|
6
|
+
* You can also override the name of the file by passing the name param.
|
|
7
|
+
*/
|
|
8
|
+
function getDownloadUrl(url, name) {
|
|
9
|
+
const urlObj = new URL(url);
|
|
10
|
+
urlObj.searchParams.set("download", name !== null && name !== void 0 ? name : "true");
|
|
11
|
+
return urlObj.toString();
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
* This will format the file size to a human-readable format.
|
|
15
|
+
*
|
|
16
|
+
* @example 1024 => 1 KB
|
|
17
|
+
*/
|
|
18
|
+
function formatFileSize(bytes) {
|
|
19
|
+
if (!bytes) return "0 B";
|
|
20
|
+
const k = 1024;
|
|
21
|
+
const dm = 2;
|
|
22
|
+
const sizes = [
|
|
23
|
+
"B",
|
|
24
|
+
"KB",
|
|
25
|
+
"MB",
|
|
26
|
+
"GB",
|
|
27
|
+
"TB",
|
|
28
|
+
"PB",
|
|
29
|
+
"EB",
|
|
30
|
+
"ZB",
|
|
31
|
+
"YB"
|
|
32
|
+
];
|
|
33
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
34
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
//#endregion
|
|
34
38
|
export { formatFileSize, getDownloadUrl };
|
|
39
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["/**\n * This will add the necessary query param to the url\n * to make the browser download the file instead of opening it.\n *\n * You can also override the name of the file by passing the name param.\n */\nexport function getDownloadUrl(url: string, name?: string) {\n const urlObj = new URL(url);\n urlObj.searchParams.set('download', name ?? 'true');\n return urlObj.toString();\n}\n\n/**\n * This will format the file size to a human-readable format.\n *\n * @example 1024 => 1 KB\n */\nexport function formatFileSize(bytes?: number) {\n if (!bytes) return '0 B';\n const k = 1024;\n const dm = 2;\n const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAe,KAAa,MAAe;CACzD,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,QAAO,aAAa,IAAI,YAAY,0CAAQ,OAAO;AACnD,QAAO,OAAO,UAAU;;;;;;;AAQ1B,SAAgB,eAAe,OAAgB;AAC7C,KAAI,CAAC,MAAO,QAAO;CACnB,MAAM,IAAI;CACV,MAAM,KAAK;CACX,MAAM,QAAQ;EAAC;EAAK;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;EAAK;CACnE,MAAM,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;AACnD,QAAO,GAAG,YAAY,QAAQ,KAAK,IAAI,GAAG,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../dist/errors/index.cjs","module":"../dist/errors/index.mjs","types":"../dist/errors/index.d.cts"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgestore/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-canary.1",
|
|
4
4
|
"description": "Upload files with ease from React/Next.js",
|
|
5
5
|
"homepage": "https://edgestore.dev",
|
|
6
6
|
"repository": "https://github.com/edgestorejs/edgestore.git",
|
|
7
7
|
"author": "Ravi <me@ravi.com>",
|
|
8
|
-
"main": "dist/index.
|
|
9
|
-
"module": "dist/index.mjs",
|
|
10
|
-
"
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.cts",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"react",
|
|
13
13
|
"nodejs",
|
|
@@ -19,33 +19,47 @@
|
|
|
19
19
|
"edgestore",
|
|
20
20
|
"edge-store"
|
|
21
21
|
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "rollup --config rollup.config.ts --configPlugin rollup-plugin-swc3",
|
|
24
|
-
"dev": "pnpm build --watch",
|
|
25
|
-
"codegen:entrypoints": "tsx entrypoints.script.ts",
|
|
26
|
-
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore --report-unused-disable-directives src"
|
|
27
|
-
},
|
|
28
22
|
"exports": {
|
|
29
23
|
"./package.json": "./package.json",
|
|
30
24
|
".": {
|
|
31
|
-
"import":
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/index.d.cts",
|
|
31
|
+
"default": "./dist/index.cjs"
|
|
32
|
+
}
|
|
34
33
|
},
|
|
35
|
-
"./
|
|
36
|
-
"import":
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
"./errors": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/errors/index.d.mts",
|
|
37
|
+
"default": "./dist/errors/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/errors/index.d.cts",
|
|
41
|
+
"default": "./dist/errors/index.cjs"
|
|
42
|
+
}
|
|
39
43
|
},
|
|
40
44
|
"./shared": {
|
|
41
|
-
"import":
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./dist/shared/index.d.mts",
|
|
47
|
+
"default": "./dist/shared/index.mjs"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./dist/shared/index.d.cts",
|
|
51
|
+
"default": "./dist/shared/index.cjs"
|
|
52
|
+
}
|
|
44
53
|
},
|
|
45
|
-
"./
|
|
46
|
-
"import":
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
"./utils": {
|
|
55
|
+
"import": {
|
|
56
|
+
"types": "./dist/utils/index.d.mts",
|
|
57
|
+
"default": "./dist/utils/index.mjs"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"types": "./dist/utils/index.d.cts",
|
|
61
|
+
"default": "./dist/utils/index.cjs"
|
|
62
|
+
}
|
|
49
63
|
}
|
|
50
64
|
},
|
|
51
65
|
"files": [
|
|
@@ -54,9 +68,9 @@
|
|
|
54
68
|
"README.md",
|
|
55
69
|
"LICENSE",
|
|
56
70
|
"package.json",
|
|
57
|
-
"utils",
|
|
58
|
-
"shared",
|
|
59
71
|
"errors",
|
|
72
|
+
"shared",
|
|
73
|
+
"utils",
|
|
60
74
|
"!**/*.test.*"
|
|
61
75
|
],
|
|
62
76
|
"private": false,
|
|
@@ -67,7 +81,7 @@
|
|
|
67
81
|
"dependencies": {
|
|
68
82
|
"@aws-sdk/client-s3": "^3.294.0",
|
|
69
83
|
"@aws-sdk/s3-request-presigner": "^3.294.0",
|
|
70
|
-
"@edgestore/shared": "0.
|
|
84
|
+
"@edgestore/shared": "0.6.0-canary.1",
|
|
71
85
|
"@panva/hkdf": "^1.0.4",
|
|
72
86
|
"cookie": "^0.7.0",
|
|
73
87
|
"jose": "^4.13.1",
|
|
@@ -91,5 +105,10 @@
|
|
|
91
105
|
"typescript": "^5",
|
|
92
106
|
"zod": "3.25.42"
|
|
93
107
|
},
|
|
94
|
-
"gitHead": "
|
|
95
|
-
|
|
108
|
+
"gitHead": "a223c4cb8df50e6b64f9db5dc2daf93848748da9",
|
|
109
|
+
"scripts": {
|
|
110
|
+
"build": "tsdown",
|
|
111
|
+
"dev": "tsdown --watch",
|
|
112
|
+
"lint": "eslint --cache --ext \".js,.ts,.tsx\" --ignore-path ../../.gitignore --report-unused-disable-directives src"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../dist/shared/index.cjs","module":"../dist/shared/index.mjs","types":"../dist/shared/index.d.cts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../dist/utils/index.cjs","module":"../dist/utils/index.mjs","types":"../dist/utils/index.d.cts"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { type AnyRouter } from '@edgestore/shared';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { type BucketFunctions } from './createNextProxy';
|
|
4
|
-
type EdgeStoreContextValue<TRouter extends AnyRouter> = {
|
|
5
|
-
edgestore: BucketFunctions<TRouter>;
|
|
6
|
-
/**
|
|
7
|
-
* This will re-run the EdgeStore initialization process,
|
|
8
|
-
* which will run the `createContext` function again.
|
|
9
|
-
*
|
|
10
|
-
* Can be used after a sign-in or sign-out, for example.
|
|
11
|
-
*/
|
|
12
|
-
reset: () => Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* The current state of the EdgeStore provider.
|
|
15
|
-
*
|
|
16
|
-
* You can use this to wait for the provider to be initialized
|
|
17
|
-
* before trying to show private images on your app.
|
|
18
|
-
*/
|
|
19
|
-
state: ProviderState;
|
|
20
|
-
};
|
|
21
|
-
export declare function createEdgeStoreProvider<TRouter extends AnyRouter>(opts?: {
|
|
22
|
-
/**
|
|
23
|
-
* The maximum number of concurrent uploads.
|
|
24
|
-
*
|
|
25
|
-
* Uploads will automatically be queued if this limit is reached.
|
|
26
|
-
*
|
|
27
|
-
* @default 5
|
|
28
|
-
*/
|
|
29
|
-
maxConcurrentUploads?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Accessing EdgeStore protected files in development mode requires a proxy.
|
|
32
|
-
* You might want to disable this for other providers if you are overwriting the path.
|
|
33
|
-
*
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
disableDevProxy?: boolean;
|
|
37
|
-
}): {
|
|
38
|
-
EdgeStoreProvider: ({ children, basePath, }: {
|
|
39
|
-
children: React.ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* In case your app is not hosted at the root of your domain, you can specify the base path here.
|
|
42
|
-
* If you set this, make sure to set the full path to the EdgeStore API.
|
|
43
|
-
* e.g. `/my-app/api/edgestore` or `https://example.com/my-app/api/edgestore`
|
|
44
|
-
*
|
|
45
|
-
* @example - If your app is hosted at `https://example.com/my-app`, you can set the `basePath` to `/my-app/api/edgestore`.
|
|
46
|
-
*/
|
|
47
|
-
basePath?: string;
|
|
48
|
-
}) => React.JSX.Element;
|
|
49
|
-
useEdgeStore: () => EdgeStoreContextValue<TRouter>;
|
|
50
|
-
};
|
|
51
|
-
type ProviderState = {
|
|
52
|
-
loading: true;
|
|
53
|
-
initialized: false;
|
|
54
|
-
error: false;
|
|
55
|
-
} | {
|
|
56
|
-
loading: false;
|
|
57
|
-
initialized: false;
|
|
58
|
-
error: true;
|
|
59
|
-
} | {
|
|
60
|
-
loading: false;
|
|
61
|
-
initialized: true;
|
|
62
|
-
error: false;
|
|
63
|
-
};
|
|
64
|
-
export {};
|
|
65
|
-
//# sourceMappingURL=contextProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextProvider.d.ts","sourceRoot":"","sources":["../src/contextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAU1E,KAAK,qBAAqB,CAAC,OAAO,SAAS,SAAS,IAAI;IACtD,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACpC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAAE,IAAI,CAAC,EAAE;IACxE;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;iDAQI;QACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B;;;;;;WAMG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;;EA+BF;AAED,KAAK,aAAa,GACd;IACE,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,KAAK,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;CACd,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,WAAW,EAAE,KAAK,CAAC;IACnB,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,WAAW,EAAE,IAAI,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { type AnyRouter, type InferBucketPathObject, type InferMetadataObject, type UploadOptions } from '@edgestore/shared';
|
|
2
|
-
import { type z } from 'zod';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
* @see https://www.totaltypescript.com/concepts/the-prettify-helper
|
|
6
|
-
*/
|
|
7
|
-
export type Prettify<TType> = {
|
|
8
|
-
[K in keyof TType]: TType[K];
|
|
9
|
-
} & {};
|
|
10
|
-
export type BucketFunctions<TRouter extends AnyRouter> = {
|
|
11
|
-
[K in keyof TRouter['buckets']]: {
|
|
12
|
-
/**
|
|
13
|
-
* Upload a file to the bucket
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* await edgestore.myBucket.upload({
|
|
17
|
-
* file: file,
|
|
18
|
-
* signal: abortController.signal, // if you want to be able to cancel the ongoing upload
|
|
19
|
-
* onProgressChange: (progress) => { console.log(progress) }, // if you want to show the progress of the upload
|
|
20
|
-
* input: {...} // if the bucket has an input schema
|
|
21
|
-
* options: {
|
|
22
|
-
* manualFileName: file.name, // if you want to use a custom file name
|
|
23
|
-
* replaceTargetUrl: url, // if you want to replace an existing file
|
|
24
|
-
* temporary: true, // if you want to delete the file after 24 hours
|
|
25
|
-
* }
|
|
26
|
-
* })
|
|
27
|
-
*/
|
|
28
|
-
upload: (params: z.infer<TRouter['buckets'][K]['_def']['input']> extends never ? {
|
|
29
|
-
file: File;
|
|
30
|
-
signal?: AbortSignal;
|
|
31
|
-
onProgressChange?: OnProgressChangeHandler;
|
|
32
|
-
options?: UploadOptions;
|
|
33
|
-
} : {
|
|
34
|
-
file: File;
|
|
35
|
-
signal?: AbortSignal;
|
|
36
|
-
input: z.infer<TRouter['buckets'][K]['_def']['input']>;
|
|
37
|
-
onProgressChange?: OnProgressChangeHandler;
|
|
38
|
-
options?: UploadOptions;
|
|
39
|
-
}) => Promise<TRouter['buckets'][K]['_def']['type'] extends 'IMAGE' ? {
|
|
40
|
-
url: string;
|
|
41
|
-
thumbnailUrl: string | null;
|
|
42
|
-
size: number;
|
|
43
|
-
uploadedAt: Date;
|
|
44
|
-
metadata: InferMetadataObject<TRouter['buckets'][K]>;
|
|
45
|
-
path: InferBucketPathObject<TRouter['buckets'][K]>;
|
|
46
|
-
pathOrder: Prettify<keyof InferBucketPathObject<TRouter['buckets'][K]>>[];
|
|
47
|
-
} : {
|
|
48
|
-
url: string;
|
|
49
|
-
size: number;
|
|
50
|
-
uploadedAt: Date;
|
|
51
|
-
metadata: InferMetadataObject<TRouter['buckets'][K]>;
|
|
52
|
-
path: InferBucketPathObject<TRouter['buckets'][K]>;
|
|
53
|
-
pathOrder: Prettify<keyof InferBucketPathObject<TRouter['buckets'][K]>>[];
|
|
54
|
-
}>;
|
|
55
|
-
confirmUpload: (params: {
|
|
56
|
-
url: string;
|
|
57
|
-
}) => Promise<void>;
|
|
58
|
-
delete: (params: {
|
|
59
|
-
url: string;
|
|
60
|
-
}) => Promise<void>;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
type OnProgressChangeHandler = (progress: number) => void;
|
|
64
|
-
export declare function createNextProxy<TRouter extends AnyRouter>({ apiPath, uploadingCountRef, maxConcurrentUploads, disableDevProxy, }: {
|
|
65
|
-
apiPath: string;
|
|
66
|
-
uploadingCountRef: React.MutableRefObject<number>;
|
|
67
|
-
maxConcurrentUploads?: number;
|
|
68
|
-
disableDevProxy?: boolean;
|
|
69
|
-
}): BucketFunctions<TRouter>;
|
|
70
|
-
export {};
|
|
71
|
-
//# sourceMappingURL=createNextProxy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNextProxy.d.ts","sourceRoot":"","sources":["../src/createNextProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,KAAK,IAAI;KAC3B,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAE7B,GAAG,EAAE,CAAC;AAEP,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,SAAS,IAAI;KACtD,CAAC,IAAI,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG;QAC/B;;;;;;;;;;;;;;;WAeG;QACH,MAAM,EAAE,CACN,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,GACjE;YACE,IAAI,EAAE,IAAI,CAAC;YACX,MAAM,CAAC,EAAE,WAAW,CAAC;YACrB,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;YAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;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QACF,aAAa,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD;CACF,CAAC;AAEF,KAAK,uBAAuB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1D,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,EACzD,OAAO,EACP,iBAAiB,EACjB,oBAAwB,EACxB,eAAe,GAChB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,4BAqEA"}
|
package/dist/errors/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/dist/errors/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var shared = require('@edgestore/shared');
|
|
6
|
-
var uploadAbortedError = require('../uploadAbortedError-fbfcc57b.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, 'EdgeStoreApiClientError', {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return shared.EdgeStoreApiClientError; }
|
|
13
|
-
});
|
|
14
|
-
exports.UploadAbortedError = uploadAbortedError.UploadAbortedError;
|