@dimah-s3/react 1.7.0 → 2.0.0-beta.0
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/README.md +53 -13
- package/dist/api.d.ts +24 -15
- package/dist/api.d.ts.map +1 -1
- package/dist/chunk-SPUUNLXI.js +824 -0
- package/dist/chunk-SPUUNLXI.js.map +1 -0
- package/dist/create-s3-client.d.ts +1 -1
- package/dist/create-s3-client.d.ts.map +1 -1
- package/dist/engine.d.ts +15 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +204 -512
- package/dist/engine.js.map +1 -1
- package/dist/helpers/format-accept-labels.d.ts +15 -2
- package/dist/helpers/format-accept-labels.d.ts.map +1 -1
- package/dist/helpers/format-date.d.ts +7 -0
- package/dist/helpers/format-date.d.ts.map +1 -0
- package/dist/helpers/format-dimah-error.d.ts +12 -2
- package/dist/helpers/format-dimah-error.d.ts.map +1 -1
- package/dist/helpers/format-file-size.d.ts +20 -0
- package/dist/helpers/format-file-size.d.ts.map +1 -0
- package/dist/helpers/format-speed.d.ts +1 -1
- package/dist/helpers/format-speed.d.ts.map +1 -1
- package/dist/helpers/format-upload-progress.d.ts +1 -1
- package/dist/helpers/format-upload-progress.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +5 -8
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/load-route-catalog.d.ts +32 -8
- package/dist/helpers/load-route-catalog.d.ts.map +1 -1
- package/dist/helpers/throttled-speed.d.ts +2 -2
- package/dist/helpers/throttled-speed.d.ts.map +1 -1
- package/dist/helpers/to-timestamp.d.ts +5 -0
- package/dist/helpers/to-timestamp.d.ts.map +1 -0
- package/dist/helpers/truncate-file-name.d.ts +8 -0
- package/dist/helpers/truncate-file-name.d.ts.map +1 -0
- package/dist/helpers/use-format-accept-labels.d.ts +12 -0
- package/dist/helpers/use-format-accept-labels.d.ts.map +1 -0
- package/dist/helpers/use-format-eta.d.ts +14 -0
- package/dist/helpers/use-format-eta.d.ts.map +1 -0
- package/dist/helpers/use-format-speed.d.ts +12 -0
- package/dist/helpers/use-format-speed.d.ts.map +1 -0
- package/dist/hooks/use-delete.d.ts +6 -44
- package/dist/hooks/use-delete.d.ts.map +1 -1
- package/dist/hooks/use-download.d.ts +7 -117
- package/dist/hooks/use-download.d.ts.map +1 -1
- package/dist/hooks/use-fetch-download.d.ts +8 -0
- package/dist/hooks/use-fetch-download.d.ts.map +1 -0
- package/dist/hooks/use-file-intake.d.ts +43 -29
- package/dist/hooks/use-file-intake.d.ts.map +1 -1
- package/dist/hooks/use-file-upload.d.ts +38 -34
- package/dist/hooks/use-file-upload.d.ts.map +1 -1
- package/dist/hooks/use-object-list-selection.d.ts +78 -0
- package/dist/hooks/use-object-list-selection.d.ts.map +1 -0
- package/dist/hooks/use-object-list.d.ts +66 -16
- package/dist/hooks/use-object-list.d.ts.map +1 -1
- package/dist/hooks/use-object-url.d.ts +27 -10
- package/dist/hooks/use-object-url.d.ts.map +1 -1
- package/dist/hooks/use-route-upload-policy.d.ts +22 -14
- package/dist/hooks/use-route-upload-policy.d.ts.map +1 -1
- package/dist/hooks/use-upload.d.ts +72 -65
- package/dist/hooks/use-upload.d.ts.map +1 -1
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2420 -2164
- package/dist/index.js.map +1 -1
- package/dist/internal/abortable.d.ts +9 -0
- package/dist/internal/abortable.d.ts.map +1 -0
- package/dist/internal/browser-download.d.ts +15 -0
- package/dist/internal/browser-download.d.ts.map +1 -0
- package/dist/internal/callbacks.d.ts +54 -0
- package/dist/internal/callbacks.d.ts.map +1 -0
- package/dist/internal/client-error.d.ts +15 -0
- package/dist/internal/client-error.d.ts.map +1 -0
- package/dist/internal/hooks.d.ts +27 -0
- package/dist/internal/hooks.d.ts.map +1 -0
- package/dist/internal/lru.d.ts +13 -0
- package/dist/internal/lru.d.ts.map +1 -0
- package/dist/internal/operations.d.ts +74 -0
- package/dist/internal/operations.d.ts.map +1 -0
- package/dist/internal/pool.d.ts +8 -0
- package/dist/internal/pool.d.ts.map +1 -0
- package/dist/list/entries.d.ts +14 -0
- package/dist/list/entries.d.ts.map +1 -0
- package/dist/list/memory-object-source.d.ts +60 -0
- package/dist/list/memory-object-source.d.ts.map +1 -0
- package/dist/list/types.d.ts +123 -11
- package/dist/list/types.d.ts.map +1 -1
- package/dist/s3-provider.d.ts +3 -2
- package/dist/s3-provider.d.ts.map +1 -1
- package/dist/store/local-storage-store.d.ts +5 -4
- package/dist/store/local-storage-store.d.ts.map +1 -1
- package/dist/store/memory-store.d.ts +3 -4
- package/dist/store/memory-store.d.ts.map +1 -1
- package/dist/translations/types.d.ts +105 -23
- package/dist/translations/types.d.ts.map +1 -1
- package/dist/types/delete.d.ts +98 -9
- package/dist/types/delete.d.ts.map +1 -1
- package/dist/types/download.d.ts +152 -23
- package/dist/types/download.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/operation.d.ts +38 -0
- package/dist/types/operation.d.ts.map +1 -0
- package/dist/types/upload-store.d.ts +30 -40
- package/dist/types/upload-store.d.ts.map +1 -1
- package/dist/types/upload.d.ts +177 -130
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort.d.ts +10 -0
- package/dist/upload/abort.d.ts.map +1 -0
- package/dist/upload/constants.d.ts +8 -3
- package/dist/upload/constants.d.ts.map +1 -1
- package/dist/upload/index.d.ts +3 -2
- package/dist/upload/index.d.ts.map +1 -1
- package/dist/upload/multipart.d.ts +14 -4
- package/dist/upload/multipart.d.ts.map +1 -1
- package/dist/upload/part-pool.d.ts +16 -0
- package/dist/upload/part-pool.d.ts.map +1 -0
- package/dist/upload/presigned-http.d.ts +5 -14
- package/dist/upload/presigned-http.d.ts.map +1 -1
- package/dist/upload/progress.d.ts +7 -0
- package/dist/upload/progress.d.ts.map +1 -0
- package/dist/upload/request.d.ts +9 -0
- package/dist/upload/request.d.ts.map +1 -0
- package/dist/upload/resume-key.d.ts +7 -3
- package/dist/upload/resume-key.d.ts.map +1 -1
- package/dist/upload/retry.d.ts +27 -2
- package/dist/upload/retry.d.ts.map +1 -1
- package/dist/upload/stored-upload.d.ts +7 -0
- package/dist/upload/stored-upload.d.ts.map +1 -0
- package/dist/upload/upload-file.d.ts +10 -11
- package/dist/upload/upload-file.d.ts.map +1 -1
- package/dist/upload/upload-part.d.ts +6 -3
- package/dist/upload/upload-part.d.ts.map +1 -1
- package/dist/upload/xhr-upload.d.ts +10 -2
- package/dist/upload/xhr-upload.d.ts.map +1 -1
- package/package.json +7 -8
- package/dist/helpers/format-eta.d.ts +0 -13
- package/dist/helpers/format-eta.d.ts.map +0 -1
- package/dist/helpers/format-validate-file-error.d.ts +0 -9
- package/dist/helpers/format-validate-file-error.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/internal-helpers.d.ts +0 -10
- package/dist/internal-helpers.d.ts.map +0 -1
- package/dist/store/use-immer-state.d.ts +0 -8
- package/dist/store/use-immer-state.d.ts.map +0 -1
- package/dist/types/error.d.ts +0 -27
- package/dist/types/error.d.ts.map +0 -1
- package/dist/upload/upload-files.d.ts +0 -26
- package/dist/upload/upload-files.d.ts.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settles like `promise`, or rejects with `signal.reason` when the signal
|
|
3
|
+
* aborts first. Use it for work that does not take a signal itself, such as
|
|
4
|
+
* a consumer callback. Once aborted, a later rejection of `promise` is ignored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function abortable<T>(promise: PromiseLike<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
7
|
+
/** Resolves after `ms`, or rejects with `signal.reason` when the signal aborts first. */
|
|
8
|
+
export declare function delay(ms: number, signal?: AbortSignal): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=abortable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abortable.d.ts","sourceRoot":"","sources":["../../src/internal/abortable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED,yFAAyF;AACzF,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB3E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hands `url` to the browser through a temporary link, like a navigation.
|
|
3
|
+
* The response's `Content-Disposition` decides whether it saves or opens.
|
|
4
|
+
*/
|
|
5
|
+
export declare function startBrowserDownload(url: string): void;
|
|
6
|
+
/** Saves `blob` as a file named `fileName` through an object URL. */
|
|
7
|
+
export declare function saveBlob(blob: Blob, fileName: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Reads a fetch response body into a Blob typed with its `Content-Type`.
|
|
10
|
+
* `onChunk` receives the bytes read so far after each chunk. A failed read
|
|
11
|
+
* becomes `NETWORK_ERROR`; once `signal` is aborted it rejects with the abort
|
|
12
|
+
* reason instead. A throw from `onChunk` is rethrown as is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readResponseBlob(response: Response, signal: AbortSignal, onChunk?: (loaded: number) => void): Promise<Blob>;
|
|
15
|
+
//# sourceMappingURL=browser-download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-download.d.ts","sourceRoot":"","sources":["../../src/internal/browser-download.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI3D;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type APIError } from "@dimah-s3/core";
|
|
2
|
+
import type { OperationOutcome } from "../types/operation.js";
|
|
3
|
+
/** What a `before*` callback decided. */
|
|
4
|
+
export type BeforeCallbackResult = {
|
|
5
|
+
status: "allowed";
|
|
6
|
+
} | {
|
|
7
|
+
status: "blocked";
|
|
8
|
+
} | {
|
|
9
|
+
status: "error";
|
|
10
|
+
error: APIError;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Runs a `before*` callback once for a call. Returning `false` blocks the
|
|
14
|
+
* call. A throw or rejection becomes `HOOK_FAILED` with the error as `cause`.
|
|
15
|
+
* A missing callback allows the call.
|
|
16
|
+
*/
|
|
17
|
+
export declare function runBeforeCallback<TArgs extends unknown[]>(name: string, callback: ((...args: TArgs) => boolean | Promise<boolean>) | undefined, ...args: TArgs): Promise<BeforeCallbackResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Runs an `on*Start` callback. Returns `HOOK_FAILED` when it throws, so the
|
|
20
|
+
* caller can fail the call, and `null` otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runStartCallback<TArgs extends unknown[]>(name: string, callback: ((...args: TArgs) => void) | undefined, ...args: TArgs): APIError | null;
|
|
23
|
+
/**
|
|
24
|
+
* Runs and awaits an after-callback (`onSuccess`, `onError`, `onSettled`).
|
|
25
|
+
* A throw or rejection goes to {@link reportCallbackError} and never changes
|
|
26
|
+
* the outcome.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runAfterCallback<TArgs extends unknown[]>(callback: ((...args: TArgs) => void | Promise<void>) | undefined, ...args: TArgs): Promise<void>;
|
|
29
|
+
/** The after-callbacks of a hook whose calls settle one key each. */
|
|
30
|
+
export type OperationCallbacks<TData> = {
|
|
31
|
+
onError?: (error: APIError, key: string) => void | Promise<void>;
|
|
32
|
+
onSuccess?: (data: TData, key: string) => void | Promise<void>;
|
|
33
|
+
onSettled?: (outcome: OperationOutcome<TData>) => void | Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Runs the after-callbacks for one settled single-key call: `onError` or
|
|
37
|
+
* `onSuccess`, then `onSettled`. Call it once the key is free, so a callback
|
|
38
|
+
* can start the same key again.
|
|
39
|
+
*/
|
|
40
|
+
export declare function reportOperationOutcome<TData>({ onError, onSuccess, onSettled }: OperationCallbacks<TData>, outcome: OperationOutcome<TData>): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Runs a progress-style callback (`onProgress`, `onFileReject`, ...)
|
|
43
|
+
* synchronously. A throw goes to {@link reportCallbackError}, never rethrown.
|
|
44
|
+
*/
|
|
45
|
+
export declare function notify<TArgs extends unknown[]>(callback: ((...args: TArgs) => void) | undefined, ...args: TArgs): void;
|
|
46
|
+
/**
|
|
47
|
+
* Reports an error thrown by a consumer callback without rethrowing it:
|
|
48
|
+
* through the global `reportError` when the runtime has one (browsers), and
|
|
49
|
+
* `console.error` otherwise.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reportCallbackError(error: unknown): void;
|
|
52
|
+
/** `HOOK_FAILED` for a consumer callback named `hook` that threw `cause`. */
|
|
53
|
+
export declare function hookFailed(hook: string, cause: unknown): APIError;
|
|
54
|
+
//# sourceMappingURL=callbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/internal/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;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,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAChD,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAC5D,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,OAAO,EAAE,EAC5C,QAAQ,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,EAChD,GAAG,IAAI,EAAE,KAAK,GACb,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMxD;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,CAEjE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { APIError, type S3Api } from "@dimah-s3/core";
|
|
2
|
+
/** A better-call error, such as one a custom backend rethrows: its code is in `body`. */
|
|
3
|
+
export declare function isRawAPIError(error: unknown): error is Error & {
|
|
4
|
+
statusCode?: unknown;
|
|
5
|
+
body?: unknown;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes a thrown value to an {@link APIError} with a stable `code`.
|
|
9
|
+
* A raw better-call error is rebuilt from its body, because it keeps its code
|
|
10
|
+
* only in `body.code`. Anything else becomes `UNKNOWN_ERROR`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function toClientError(error: unknown): APIError;
|
|
13
|
+
/** The hook's `api` option or the provider's, else a setup error naming the hook. */
|
|
14
|
+
export declare function requireApi(api: S3Api | null | undefined, hook: string): S3Api;
|
|
15
|
+
//# sourceMappingURL=client-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-error.d.ts","sourceRoot":"","sources":["../../src/internal/client-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE3E,yFAAyF;AACzF,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,KAAK,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAwBtD;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAK7E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type KeyedOperation, type OperationStore } from "./operations";
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a ref in sync with the latest value after each render.
|
|
4
|
+
*
|
|
5
|
+
* Use inside `useCallback(fn, [ref])` to read the latest prop / option value
|
|
6
|
+
* without making the callback depend on it (stale-closure-free stable refs).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLiveRef<T>(value: T): import("react").RefObject<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Controlled when `value` is not `undefined`, otherwise local state.
|
|
11
|
+
* The setter calls `onChange` only when the value changes (`isEqual`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T | (() => T), onChange: ((value: T) => void) | undefined, isEqual?: (a: T, b: T) => boolean): [T, (next: T) => void];
|
|
14
|
+
/** State and store returned by {@link useOperationStore}. */
|
|
15
|
+
export type UseOperationStoreReturn<TOp extends KeyedOperation, TOutcome> = {
|
|
16
|
+
/** Stable for the life of the component. Start, join and cancel calls here. */
|
|
17
|
+
store: OperationStore<TOp, TOutcome>;
|
|
18
|
+
/** Operations in creation order, as of this render. */
|
|
19
|
+
operations: readonly TOp[];
|
|
20
|
+
/** Keys with a running call, as of this render. */
|
|
21
|
+
pendingKeys: readonly string[];
|
|
22
|
+
/** The newest operation for `key`, as of this render. */
|
|
23
|
+
get: (key: string) => TOp | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** A per-component {@link OperationStore}, re-rendering on every change. */
|
|
26
|
+
export declare function useOperationStore<TOp extends KeyedOperation, TOutcome>(): UseOperationStoreReturn<TOp, TOutcome>;
|
|
27
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/internal/hooks.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,gCAMrC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EAC1C,OAAO,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAmB,GAC3C,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAoBxB;AAED,6DAA6D;AAC7D,MAAM,MAAM,uBAAuB,CAAC,GAAG,SAAS,cAAc,EAAE,QAAQ,IAAI;IAC1E,+EAA+E;IAC/E,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACrC,uDAAuD;IACvD,UAAU,EAAE,SAAS,GAAG,EAAE,CAAC;IAC3B,mDAAmD;IACnD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,yDAAyD;IACzD,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAC/B,GAAG,SAAS,cAAc,EAC1B,QAAQ,KACL,uBAAuB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAY1C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A size-bounded cache that evicts the least recently used entry. */
|
|
2
|
+
export type LruCache<K, V> = {
|
|
3
|
+
/** The value for `key`, marking it as the most recently used. */
|
|
4
|
+
get: (key: K) => V | undefined;
|
|
5
|
+
/** Stores `value` as the most recently used entry, evicting the oldest past `maxSize`. */
|
|
6
|
+
set: (key: K, value: V) => void;
|
|
7
|
+
delete: (key: K) => boolean;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
readonly size: number;
|
|
10
|
+
};
|
|
11
|
+
/** Creates an empty {@link LruCache} holding at most `maxSize` entries. */
|
|
12
|
+
export declare function createLruCache<K, V>(maxSize: number): LruCache<K, V>;
|
|
13
|
+
//# sourceMappingURL=lru.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru.d.ts","sourceRoot":"","sources":["../../src/internal/lru.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI;IAC3B,iEAAiE;IACjE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IAC/B,0FAA0F;IAC1F,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAChC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAgCpE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** One unit of work for one key. The store assigns `id`. */
|
|
2
|
+
export type KeyedOperation = {
|
|
3
|
+
id: string;
|
|
4
|
+
key: string;
|
|
5
|
+
};
|
|
6
|
+
/** The fields a call sets on its operation. The store owns `id` and `key`. */
|
|
7
|
+
export type OperationFields<TOp extends KeyedOperation> = Omit<TOp, "id" | "key">;
|
|
8
|
+
/** Immutable store state. A change replaces the whole snapshot. */
|
|
9
|
+
export type OperationSnapshot<TOp extends KeyedOperation> = {
|
|
10
|
+
/** Operations in creation order, so `id`s ascend. */
|
|
11
|
+
operations: readonly TOp[];
|
|
12
|
+
/** Keys with a running call, in start order. */
|
|
13
|
+
pendingKeys: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Runs after a call settled and its key is free, before joined callers get
|
|
17
|
+
* the outcome. For after-callbacks such as `onSuccess` and `onSettled`.
|
|
18
|
+
* A throw or rejection rejects every caller, so run consumer callbacks
|
|
19
|
+
* through `runAfterCallback`.
|
|
20
|
+
*/
|
|
21
|
+
export type OperationAfter<TOutcome> = (outcome: TOutcome) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* A running call for one key, from {@link OperationStore.claim}. Other calls
|
|
24
|
+
* for the key join it until its outcome is known.
|
|
25
|
+
*/
|
|
26
|
+
export type OperationClaim<TOp extends KeyedOperation, TOutcome> = {
|
|
27
|
+
readonly key: string;
|
|
28
|
+
/** Aborted by `cancel(key)` or `cancel()` on the store. */
|
|
29
|
+
readonly signal: AbortSignal;
|
|
30
|
+
/** Settles with the call's outcome. Joined calls get this same promise. */
|
|
31
|
+
readonly promise: Promise<TOutcome>;
|
|
32
|
+
/** The operation this call published, if any. */
|
|
33
|
+
readonly operation: TOp | undefined;
|
|
34
|
+
/** Publishes this call's operation. A call publishes at most once. */
|
|
35
|
+
publish: (fields: OperationFields<TOp>) => TOp;
|
|
36
|
+
/** Patches the published operation. Does nothing before `publish`. */
|
|
37
|
+
update: (patch: Partial<OperationFields<TOp>>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Ends the call with `outcome` (or a promise of it). The key is freed as
|
|
40
|
+
* soon as the outcome is known, then `after` runs, then `promise`
|
|
41
|
+
* settles. So `after` can start a new call for the same key. Later calls
|
|
42
|
+
* do nothing.
|
|
43
|
+
*/
|
|
44
|
+
settle: (outcome: TOutcome | PromiseLike<TOutcome>, after?: OperationAfter<TOutcome>) => Promise<TOutcome>;
|
|
45
|
+
};
|
|
46
|
+
/** Per-key operations with same-key joins. Create one per hook instance. */
|
|
47
|
+
export type OperationStore<TOp extends KeyedOperation, TOutcome> = {
|
|
48
|
+
subscribe: (listener: () => void) => () => void;
|
|
49
|
+
getSnapshot: () => OperationSnapshot<TOp>;
|
|
50
|
+
/** The newest operation for `key`. */
|
|
51
|
+
get: (key: string) => TOp | undefined;
|
|
52
|
+
/** The running call's promise for `key`, to join it. */
|
|
53
|
+
join: (key: string) => Promise<TOutcome> | undefined;
|
|
54
|
+
/** Starts a call for a free `key`. Throws when the key is running. */
|
|
55
|
+
claim: (key: string) => OperationClaim<TOp, TOutcome>;
|
|
56
|
+
/**
|
|
57
|
+
* Joins the running call for `key`, or claims the key and settles it with
|
|
58
|
+
* `task` and `after` (see {@link OperationClaim.settle}). A throw or
|
|
59
|
+
* rejection from `task` rejects every joined caller.
|
|
60
|
+
*/
|
|
61
|
+
run: (key: string, task: (claim: OperationClaim<TOp, TOutcome>) => Promise<TOutcome>, after?: OperationAfter<TOutcome>) => Promise<TOutcome>;
|
|
62
|
+
/**
|
|
63
|
+
* Aborts the running call for `key`, or every running call. Without a
|
|
64
|
+
* `reason` the signal aborts with an `AbortError` `DOMException`.
|
|
65
|
+
*/
|
|
66
|
+
cancel: (key?: string, reason?: unknown) => void;
|
|
67
|
+
/** Removes settled operations for `key`, or all settled operations. */
|
|
68
|
+
reset: (key?: string) => void;
|
|
69
|
+
};
|
|
70
|
+
/** The newest operation for `key` in creation-ordered `operations`. */
|
|
71
|
+
export declare function newestOperation<TOp extends KeyedOperation>(operations: readonly TOp[], key: string): TOp | undefined;
|
|
72
|
+
/** Creates an empty {@link OperationStore}. */
|
|
73
|
+
export declare function createOperationStore<TOp extends KeyedOperation, TOutcome>(): OperationStore<TOp, TOutcome>;
|
|
74
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/internal/operations.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,MAAM,eAAe,CAAC,GAAG,SAAS,cAAc,IAAI,IAAI,CAC5D,GAAG,EACH,IAAI,GAAG,KAAK,CACb,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,CAAC,GAAG,SAAS,cAAc,IAAI;IAC1D,qDAAqD;IACrD,UAAU,EAAE,SAAS,GAAG,EAAE,CAAC;IAC3B,gDAAgD;IAChD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,GAAG,SAAS,cAAc,EAAE,QAAQ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EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EACjE,KAAK,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,KAC7B,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB;;;OAGG;IACH,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,uEAAuE;IACvE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,GAAG,SAAS,cAAc,EACxD,UAAU,EAAE,SAAS,GAAG,EAAE,EAC1B,GAAG,EAAE,MAAM,GACV,GAAG,GAAG,SAAS,CAEjB;AAWD,+CAA+C;AAC/C,wBAAgB,oBAAoB,CAClC,GAAG,SAAS,cAAc,EAC1B,QAAQ,KACL,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAwHjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `task` for every item with at most `concurrency` tasks at once.
|
|
3
|
+
* Results keep the order of `items`. The first rejection rejects the whole
|
|
4
|
+
* run, and no new task starts after it; tasks already running are not
|
|
5
|
+
* stopped, so pass them a signal to cancel them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], concurrency: number, task: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
8
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/internal/pool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,CAAC,EAAE,CAAC,CAoBd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ObjectListEntry, ObjectListFile, ObjectListFolder } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Entry key for a file or folder id. Matches `entry.key`, so a selection can
|
|
4
|
+
* be built from ids you already have.
|
|
5
|
+
*/
|
|
6
|
+
export declare function objectListEntryKey(kind: ObjectListEntry<unknown>["kind"], id: string): string;
|
|
7
|
+
/** Folders first, then files. */
|
|
8
|
+
export declare function createObjectListEntries<TItem>(folders: readonly ObjectListFolder[], items: readonly TItem[], getKey: (item: TItem) => string, getFile: (item: TItem) => ObjectListFile): ObjectListEntry<TItem>[];
|
|
9
|
+
/** Stored key for a file entry: `file.objectKey`, else the item key. */
|
|
10
|
+
export declare function objectKeyOf(entry: {
|
|
11
|
+
id: string;
|
|
12
|
+
file: Pick<ObjectListFile, "objectKey">;
|
|
13
|
+
}): string;
|
|
14
|
+
//# sourceMappingURL=entries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/list/entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EACtC,EAAE,EAAE,MAAM,GACT,MAAM,CAER;AAED,iCAAiC;AACjC,wBAAgB,uBAAuB,CAAC,KAAK,EAC3C,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,EAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,cAAc,GACvC,eAAe,CAAC,KAAK,CAAC,EAAE,CAwB1B;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;CACzC,GAAG,MAAM,CAET"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ObjectListFile, ObjectListSource } from "./types";
|
|
2
|
+
type SortValue = string | number | null | undefined;
|
|
3
|
+
/** Options for {@link memoryObjectSource}. */
|
|
4
|
+
export type MemoryObjectSourceOptions<TItem> = {
|
|
5
|
+
/** Stable id for a record. */
|
|
6
|
+
getKey: (item: TItem) => string;
|
|
7
|
+
/** Name, object key, size, type, and date for a record. */
|
|
8
|
+
getFile: (item: TItem) => ObjectListFile;
|
|
9
|
+
/**
|
|
10
|
+
* `/`-separated folder path, or `null` for the root. Omit it and every
|
|
11
|
+
* record sits at the root.
|
|
12
|
+
*/
|
|
13
|
+
getFolder?: (item: TItem) => string | null | undefined;
|
|
14
|
+
/** Files per page. @default 50 */
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Send `usage` with each page: the byte total from `getFile().size` and
|
|
18
|
+
* the record count, over every record — not only the open folder.
|
|
19
|
+
* @default true when `limits` is set, otherwise false
|
|
20
|
+
*/
|
|
21
|
+
usage?: boolean;
|
|
22
|
+
/** Caps sent as `usage.maxBytes` and `usage.maxFiles`. */
|
|
23
|
+
limits?: {
|
|
24
|
+
maxBytes?: number;
|
|
25
|
+
maxFiles?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Whether a record matches the search text. Defaults to the file name
|
|
29
|
+
* containing it, ignoring case and accents. Folder names always match
|
|
30
|
+
* that way.
|
|
31
|
+
*/
|
|
32
|
+
matches?: (item: TItem, search: string) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Value to order by for a field other than `name`, `size`, and
|
|
35
|
+
* `updatedAt`. `null` sorts last.
|
|
36
|
+
*/
|
|
37
|
+
sortValue?: (item: TItem, field: string) => SortValue;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A `useObjectList` source over records you already hold: folders from
|
|
41
|
+
* `getFolder`, then search, sort, and pages on the client.
|
|
42
|
+
*
|
|
43
|
+
* Pass a function to read the latest records on each request, for example
|
|
44
|
+
* from a ref you append to after an upload.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const list = useObjectList(
|
|
48
|
+
* memoryObjectSource(files, {
|
|
49
|
+
* getKey: (file) => file.id,
|
|
50
|
+
* getFile: (file) => ({ name: file.name, size: file.size }),
|
|
51
|
+
* getFolder: (file) => file.folder,
|
|
52
|
+
* }),
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function memoryObjectSource<TItem>(records: readonly TItem[] | (() => readonly TItem[]), options: MemoryObjectSourceOptions<TItem>): ObjectListSource<TItem> & {
|
|
57
|
+
getFile: (item: TItem) => ObjectListFile;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=memory-object-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-object-source.d.ts","sourceRoot":"","sources":["../../src/list/memory-object-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EAGd,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAIjB,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpD,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI;IAC7C,8BAA8B;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IAChC,2DAA2D;IAC3D,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,cAAc,CAAC;IACzC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACnD;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EACtC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,CAAC,MAAM,SAAS,KAAK,EAAE,CAAC,EACpD,OAAO,EAAE,yBAAyB,CAAC,KAAK,CAAC,GACxC,gBAAgB,CAAC,KAAK,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,cAAc,CAAA;CAAE,CAmDxE"}
|
package/dist/list/types.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import type { UploadRequestOptions } from "../types/upload.js";
|
|
1
2
|
/**
|
|
2
|
-
* Bytes and file count for the catalog.
|
|
3
|
-
* Scope-wide when the source is `
|
|
3
|
+
* Bytes and file count for the catalog, with the caps the server enforces.
|
|
4
|
+
* Scope-wide when the source is `dbObjectSource`. A custom query can use the
|
|
4
5
|
* same shape for its own totals.
|
|
5
6
|
*/
|
|
6
7
|
export type ObjectListUsage = {
|
|
7
8
|
totalBytes: number;
|
|
8
9
|
objectCount: number;
|
|
10
|
+
/** Byte cap. Omit when there is none. */
|
|
11
|
+
maxBytes?: number;
|
|
12
|
+
/** File-count cap. Omit when there is none. */
|
|
13
|
+
maxFiles?: number;
|
|
9
14
|
};
|
|
10
15
|
/** One folder the catalog can open. `id` is opaque to the hook. */
|
|
11
16
|
export type ObjectListFolder = {
|
|
@@ -14,13 +19,51 @@ export type ObjectListFolder = {
|
|
|
14
19
|
/** Label for the row and the breadcrumb. */
|
|
15
20
|
name: string;
|
|
16
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* What the list knows about one file. `getFile` reads it from your item.
|
|
24
|
+
* Only `name` is required; the rest fills the default row, tile, menu, and
|
|
25
|
+
* bulk actions when present.
|
|
26
|
+
*/
|
|
27
|
+
export type ObjectListFile = {
|
|
28
|
+
/** Label, accessible name, and the name the type glyph reads. */
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* Stored S3 object key. Download, Copy link, and Delete use it.
|
|
32
|
+
* Falls back to the item key from `getKey`.
|
|
33
|
+
*/
|
|
34
|
+
objectKey?: string | null;
|
|
35
|
+
/** Size in bytes. */
|
|
36
|
+
size?: number | null;
|
|
37
|
+
/** MIME type. Picks the glyph when the name has no extension. */
|
|
38
|
+
contentType?: string | null;
|
|
39
|
+
/** Last change: a `Date`, an ISO string, or epoch milliseconds. */
|
|
40
|
+
updatedAt?: Date | string | number | null;
|
|
41
|
+
/** Image thumbnail. The name stays the accessible label. */
|
|
42
|
+
previewUrl?: string | null;
|
|
43
|
+
};
|
|
44
|
+
export type ObjectListSortDirection = "asc" | "desc";
|
|
45
|
+
/**
|
|
46
|
+
* Sort order sent to the query. `field` is opaque to the hook. The UI has
|
|
47
|
+
* labels for `name`, `size`, and `updatedAt`.
|
|
48
|
+
*/
|
|
49
|
+
export type ObjectListSort = {
|
|
50
|
+
field: string;
|
|
51
|
+
direction: ObjectListSortDirection;
|
|
52
|
+
};
|
|
17
53
|
/** Arguments for one page of {@link ObjectListQuery}. */
|
|
18
54
|
export type ObjectListQueryInput = {
|
|
19
55
|
/** Current folder id. `null` is the root. */
|
|
20
56
|
parent: string | null;
|
|
21
57
|
/** Cursor from the previous page. `null` on the first page. */
|
|
22
58
|
cursor: string | null;
|
|
23
|
-
/**
|
|
59
|
+
/** Requested order. `null` leaves the order to the source. */
|
|
60
|
+
sort: ObjectListSort | null;
|
|
61
|
+
/** Trimmed search text. Empty when nothing is searched. */
|
|
62
|
+
search: string;
|
|
63
|
+
/**
|
|
64
|
+
* Aborted when the folder, sort, search, or `queryKey` changes, when the
|
|
65
|
+
* list refreshes, or when the hook unmounts.
|
|
66
|
+
*/
|
|
24
67
|
signal: AbortSignal;
|
|
25
68
|
};
|
|
26
69
|
/** One page returned by an {@link ObjectListQuery}. */
|
|
@@ -35,8 +78,7 @@ export type ObjectListPage<TItem> = {
|
|
|
35
78
|
nextCursor?: string | null;
|
|
36
79
|
/**
|
|
37
80
|
* Totals for the catalog. A later page may omit this; the hook keeps the
|
|
38
|
-
* previous value. A first page
|
|
39
|
-
* clears the line.
|
|
81
|
+
* previous value. A first page that omits it clears the usage line.
|
|
40
82
|
*/
|
|
41
83
|
usage?: ObjectListUsage;
|
|
42
84
|
};
|
|
@@ -45,9 +87,65 @@ export type ObjectListPage<TItem> = {
|
|
|
45
87
|
* plugin, a route handler, or an in-memory list.
|
|
46
88
|
*/
|
|
47
89
|
export type ObjectListQuery<TItem> = (input: ObjectListQueryInput) => Promise<ObjectListPage<TItem>>;
|
|
48
|
-
/**
|
|
49
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Where the rows come from and how to read one.
|
|
92
|
+
* `dbObjectSource` and `memoryObjectSource` return this shape, so it can be
|
|
93
|
+
* spread straight into `useObjectList`.
|
|
94
|
+
*/
|
|
95
|
+
export type ObjectListSource<TItem> = {
|
|
50
96
|
query: ObjectListQuery<TItem>;
|
|
97
|
+
/** Stable id for a file row. Unique among the files of one listing. */
|
|
98
|
+
getKey: (item: TItem) => string;
|
|
99
|
+
/**
|
|
100
|
+
* Name, object key, size, and the other fields the UI shows.
|
|
101
|
+
* Keep it pure. Defaults to `{ name: getKey(item) }`.
|
|
102
|
+
*/
|
|
103
|
+
getFile?: (item: TItem) => ObjectListFile;
|
|
104
|
+
/**
|
|
105
|
+
* Request options for files uploaded into `parent` (`null` is the root).
|
|
106
|
+
* Enables drop-on-folder.
|
|
107
|
+
*/
|
|
108
|
+
uploadOptions?: (parent: string | null) => UploadRequestOptions;
|
|
109
|
+
/** Creates an empty folder. Enables "New folder". */
|
|
110
|
+
createFolder?: (input: {
|
|
111
|
+
parent: string | null;
|
|
112
|
+
name: string;
|
|
113
|
+
}) => Promise<ObjectListFolder>;
|
|
114
|
+
};
|
|
115
|
+
/** A folder row in {@link ObjectListEntry} order. */
|
|
116
|
+
export type ObjectListFolderEntry = {
|
|
117
|
+
kind: "folder";
|
|
118
|
+
/** Unique across files and folders. Selection uses it. */
|
|
119
|
+
key: string;
|
|
120
|
+
/** The folder id. */
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
folder: ObjectListFolder;
|
|
124
|
+
};
|
|
125
|
+
/** A file row in {@link ObjectListEntry} order. */
|
|
126
|
+
export type ObjectListFileEntry<TItem> = {
|
|
127
|
+
kind: "file";
|
|
128
|
+
/** Unique across files and folders. Selection uses it. */
|
|
129
|
+
key: string;
|
|
130
|
+
/** `getKey(item)`. */
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
item: TItem;
|
|
134
|
+
/** `getFile(item)`. */
|
|
135
|
+
file: ObjectListFile;
|
|
136
|
+
};
|
|
137
|
+
/** Folders first, then files, in the order the query returned them. */
|
|
138
|
+
export type ObjectListEntry<TItem> = ObjectListFolderEntry | ObjectListFileEntry<TItem>;
|
|
139
|
+
/**
|
|
140
|
+
* - `idle`: `enabled` is false.
|
|
141
|
+
* - `loading`: the first page is in flight and there is nothing to show.
|
|
142
|
+
* - `refreshing`: a reload, sort, or search is in flight; current rows stay.
|
|
143
|
+
* - `loading-more`: the next page is in flight.
|
|
144
|
+
* - `error`: the last request failed. Rows that loaded before stay.
|
|
145
|
+
*/
|
|
146
|
+
export type ObjectListStatus = "idle" | "loading" | "refreshing" | "loading-more" | "ready" | "error";
|
|
147
|
+
/** Options for `useObjectList`. */
|
|
148
|
+
export type UseObjectListOptions<TItem> = ObjectListSource<TItem> & {
|
|
51
149
|
/**
|
|
52
150
|
* Folder id. Pass it with `onParentChange` to control navigation
|
|
53
151
|
* (for example from the URL). Omit both and the hook owns the folder.
|
|
@@ -58,13 +156,27 @@ export type UseObjectListOptions<TItem> = {
|
|
|
58
156
|
/** Uncontrolled starting folder. Ignored when `parent` is set. */
|
|
59
157
|
defaultParent?: string | null;
|
|
60
158
|
/**
|
|
61
|
-
*
|
|
62
|
-
* set, the last id should be that folder.
|
|
159
|
+
* Starting path, root excluded. Labels the breadcrumb. When
|
|
160
|
+
* `defaultParent` or `parent` is also set, the last id should be that folder.
|
|
63
161
|
*/
|
|
64
162
|
defaultTrail?: readonly ObjectListFolder[];
|
|
65
163
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
164
|
+
* Controlled order. Pass it with `onSortChange`. `null` is a controlled
|
|
165
|
+
* "source order".
|
|
166
|
+
*/
|
|
167
|
+
sort?: ObjectListSort | null;
|
|
168
|
+
onSortChange?: (sort: ObjectListSort | null) => void;
|
|
169
|
+
/** Uncontrolled starting order. @default null */
|
|
170
|
+
defaultSort?: ObjectListSort | null;
|
|
171
|
+
/** Controlled search text. Pass it with `onSearchChange`. */
|
|
172
|
+
search?: string;
|
|
173
|
+
onSearchChange?: (search: string) => void;
|
|
174
|
+
/** Uncontrolled starting search text. @default "" */
|
|
175
|
+
defaultSearch?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Extra identity for the first-page fetch, such as a route or a filter.
|
|
178
|
+
* Changing it clears the rows and loads again. JSON-serializable. The
|
|
179
|
+
* folder, sort, and search are already included.
|
|
68
180
|
*/
|
|
69
181
|
queryKey?: readonly unknown[];
|
|
70
182
|
/** When false, do not fetch. @default true */
|
package/dist/list/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/list/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/list/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mEAAmE;IACnE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,uB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AC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC3C;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,iDAAiD;IACjD,WAAW,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC9B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
package/dist/s3-provider.d.ts
CHANGED
|
@@ -25,8 +25,9 @@ export type S3ProviderProps<TApi extends S3Api = S3Api> = {
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* Provides an `S3Api` (optionally extended with client plugins) to child hooks
|
|
28
|
-
* and UI.
|
|
29
|
-
*
|
|
28
|
+
* and UI. Children are always wrapped in a Fuma `TranslationProvider`, so the
|
|
29
|
+
* tree keeps its shape when `translations` changes. Its map extends any
|
|
30
|
+
* `TranslationProvider` above it; without one, English source keys are used.
|
|
30
31
|
*
|
|
31
32
|
* Prefer {@link createS3Client} when using client plugins — it returns the
|
|
32
33
|
* API object itself plus a bound `Provider` / typed `useApi()`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-provider.d.ts","sourceRoot":"","sources":["../src/s3-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,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BAUvB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,SAAS,KAAK,GAAG,KAAK,KAAK,IAAI,CAQzD"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { UploadStore } from "../types/upload-store.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* An `UploadStore` backed by `localStorage`, with one pending upload per
|
|
4
|
+
* resume identity (`multipartResumeKey`). A record with an unknown shape,
|
|
5
|
+
* such as one written by 1.x, is ignored and deleted.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* Does nothing when `localStorage` is unavailable (SSR, private browsing, or
|
|
8
|
+
* a full quota).
|
|
8
9
|
*/
|
|
9
10
|
export declare function createLocalStorageStore(): UploadStore;
|
|
10
11
|
//# sourceMappingURL=local-storage-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage-store.d.ts","sourceRoot":"","sources":["../../src/store/local-storage-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-storage-store.d.ts","sourceRoot":"","sources":["../../src/store/local-storage-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAqCrD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { UploadStore } from "../types/upload-store.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* when you want session-scoped resume without touching `localStorage`.
|
|
3
|
+
* An in-memory `UploadStore`, safe for SSR. Records are lost on reload, so
|
|
4
|
+
* uploads resume only within the page session. Useful for tests, or for
|
|
5
|
+
* resuming without `localStorage`.
|
|
7
6
|
*
|
|
8
7
|
* @example
|
|
9
8
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/store/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/store/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAiB/C"}
|