@mgamadeus/ddd-clouddrive 0.0.0-stage → 0.1.0-rc.21
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/LICENSE +21 -0
- package/README.md +63 -2
- package/dist/agents/index.d.ts +56 -0
- package/dist/agents/index.js +131 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/chunk-EODL77UM.js +191 -0
- package/dist/chunk-EODL77UM.js.map +1 -0
- package/dist/index.d.ts +787 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/screen/index.d.ts +230 -0
- package/dist/screen/index.js +791 -0
- package/dist/screen/index.js.map +1 -0
- package/package.json +82 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ddd-framework
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mgamadeus/ddd-clouddrive
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The React frontend of the cloud drive for backends built with [mgamadeus/ddd](https://github.com/ddd-framework/ddd) and
|
|
4
|
+
the Composer package `mgamadeus/ddd-clouddrive` (same repository, same version, one tag publishes both).
|
|
5
|
+
|
|
6
|
+
| Entry | What it holds | Peers |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `@mgamadeus/ddd-clouddrive` | `createCloudDriveApi({ baseApi, apiPrefix, audience? })` — the drive routes of `CloudDriveControllerTrait` injected into the host's RTK Query api — and the payload types | `@mgamadeus/ddd-admin-ui` |
|
|
9
|
+
| `@mgamadeus/ddd-clouddrive/screen` | `CloudDriveScreen` (the file manager of `@mgamadeus/ddd-admin-ui/files` bound to the drive: spaces, folders, upload, versions, trash, activity, accesses, URL state, path bar), `CloudDriveSpacePicker`, `useCloudDriveFileAdapter`, the file actions and the mapping helpers | `@mgamadeus/ddd-admin-ui`, `react`, `lucide-react` |
|
|
10
|
+
| `@mgamadeus/ddd-clouddrive/agents` | `createCloudDriveCardsSource({ baseApi, apiPrefix, screenRoute? })` — the store behind the `DriveFiles` cards of `@mgamadeus/ddd-agents` — and `buildDriveScreenHref()` | `@mgamadeus/ddd-agents` (optional) |
|
|
11
|
+
|
|
12
|
+
## Drive screen
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { createCloudDriveApi } from '@mgamadeus/ddd-clouddrive';
|
|
16
|
+
import { CloudDriveScreen } from '@mgamadeus/ddd-clouddrive/screen';
|
|
17
|
+
import { useNextDrawerUrlAdapter, useNextUrlStateAdapter } from '@mgamadeus/ddd-admin-ui/next';
|
|
18
|
+
|
|
19
|
+
export const cloudDriveApi = createCloudDriveApi({ baseApi: adminApi, apiPrefix: '/api/admin/common/cloudDrive' });
|
|
20
|
+
|
|
21
|
+
<CloudDriveScreen
|
|
22
|
+
api={cloudDriveApi}
|
|
23
|
+
urlStateAdapter={useNextUrlStateAdapter({ listId: 'drive' })}
|
|
24
|
+
drawerUrlAdapter={useNextDrawerUrlAdapter()}
|
|
25
|
+
loadPdfJs={loadPdfJs}
|
|
26
|
+
/>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- The screen's state lives in the URL (`CLOUD_DRIVE_URL_KEYS`: `space`, `path`, `file`, `fileTab`, `tab`, `view`, `q`,
|
|
30
|
+
filters, `sort`; `?node=<id>` opens a node by id).
|
|
31
|
+
- Text and PDF previews fetch the store's presigned download URL from the browser: the bucket's CORS must allow GET from
|
|
32
|
+
the admin origin. PDF needs the host's `loadPdfJs`.
|
|
33
|
+
- A partner mount: `createCloudDriveApi({ baseApi, apiPrefix: <partner prefix>, audience: 'shared' })`.
|
|
34
|
+
- The texts are the keys of `@mgamadeus/ddd-admin-ui`'s translation store (English keys, the host translates).
|
|
35
|
+
- Tailwind scans the class names in `dist`: add the package to the host's sources
|
|
36
|
+
(`@source "../node_modules/@mgamadeus/ddd-clouddrive/dist";`) next to `@mgamadeus/ddd-admin-ui`.
|
|
37
|
+
|
|
38
|
+
## DriveFiles cards in the agent chat
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { registerDriveFileCardsSource } from '@mgamadeus/ddd-agents';
|
|
42
|
+
import { createCloudDriveCardsSource } from '@mgamadeus/ddd-clouddrive/agents';
|
|
43
|
+
|
|
44
|
+
export const driveCardsSource = createCloudDriveCardsSource({
|
|
45
|
+
baseApi: adminApi,
|
|
46
|
+
apiPrefix: '/api/admin/common/cloudDrive',
|
|
47
|
+
screenRoute: '/drive', // where the host mounted CloudDriveScreen (the default link of a card without adminLink)
|
|
48
|
+
});
|
|
49
|
+
registerDriveFileCardsSource(driveCardsSource);
|
|
50
|
+
// once the store exists (start-up, or an effect of the component that mounts the agent window):
|
|
51
|
+
driveCardsSource.bindDispatch(store.dispatch);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The cards are read through `POST {apiPrefix}/cards` under the viewer's rights; open and download use the card's
|
|
55
|
+
short-lived URLs (read again when they expired) or `GET {apiPrefix}/nodes/{id}/content`. A card's `adminLink`
|
|
56
|
+
(`CloudDrive.settings.adminLinkTemplate` on the server) becomes its link into the drive screen.
|
|
57
|
+
|
|
58
|
+
## Development
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm install
|
|
62
|
+
pnpm typecheck && pnpm test && pnpm build
|
|
63
|
+
test/consumer/run.sh "$(ls ../*.tgz)" npm /tmp/consumer # after pnpm pack --pack-destination ..
|
|
64
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DriveFileCardsSource, DriveFileCard } from '@mgamadeus/ddd-agents';
|
|
2
|
+
import { InjectableBaseApi } from '@mgamadeus/ddd-admin-ui/logic/pure';
|
|
3
|
+
|
|
4
|
+
/** The store's dispatch: the RTK store the host's api is mounted in. */
|
|
5
|
+
type CloudDriveCardsDispatch = (action: unknown) => unknown;
|
|
6
|
+
interface CreateCloudDriveCardsSourceOptions {
|
|
7
|
+
/** The host's RTK Query api (the same one `createCloudDriveApi` is given). */
|
|
8
|
+
baseApi: InjectableBaseApi;
|
|
9
|
+
/** The prefix of the cloud drive routes, e.g. `/api/admin/common/cloudDrive`. */
|
|
10
|
+
apiPrefix: string;
|
|
11
|
+
/**
|
|
12
|
+
* The drive screen link of a card that carries no `adminLink`: by default `buildDriveScreenHref` under `screenRoute`
|
|
13
|
+
* (space + node); `null` shows no "show in the drive" action.
|
|
14
|
+
*/
|
|
15
|
+
buildDriveScreenHref?: ((card: DriveFileCard) => string | null) | null;
|
|
16
|
+
/** The route the host mounted the drive screen at, for the default link; default `/drive`. */
|
|
17
|
+
screenRoute?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The source of the `DriveFiles` cards on the cloud drive routes, plus the binding to the host's store. */
|
|
20
|
+
interface CloudDriveCardsSource extends DriveFileCardsSource {
|
|
21
|
+
/**
|
|
22
|
+
* Binds the store's dispatch (the store the host's api is mounted in); returns the unbind. A read started before the
|
|
23
|
+
* first bind waits for it. Call it where the store is known: `cardsSource.bindDispatch(store.dispatch)` at start-up,
|
|
24
|
+
* or in an effect of the component that mounts the agent window.
|
|
25
|
+
*/
|
|
26
|
+
bindDispatch: (dispatch: CloudDriveCardsDispatch) => () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The `DriveFileCardsSource` of `@mgamadeus/ddd-agents` on the cloud drive routes: the cards of a block through
|
|
30
|
+
* `POST {apiPrefix}/cards` (the viewer's rights; a reference the server does not answer is left out), a card's
|
|
31
|
+
* content through the card's short-lived URLs (read again when they expired) or `GET {apiPrefix}/nodes/{id}/content`.
|
|
32
|
+
* Register it once: `registerDriveFileCardsSource(cardsSource)`, and bind the store (`bindDispatch`).
|
|
33
|
+
*/
|
|
34
|
+
declare const createCloudDriveCardsSource: (options: CreateCloudDriveCardsSourceOptions) => CloudDriveCardsSource;
|
|
35
|
+
|
|
36
|
+
/** A place in the drive screen; every part is optional, an empty part is left out of the link. */
|
|
37
|
+
interface DriveScreenPlace {
|
|
38
|
+
/** The drive space that holds the place. */
|
|
39
|
+
space?: string | number | null;
|
|
40
|
+
/** The folder the screen opens: a path (`/out/2026`) or a folder node id. */
|
|
41
|
+
path?: string | number | null;
|
|
42
|
+
/** The file the screen opens in its details drawer (node id). */
|
|
43
|
+
file?: string | number | null;
|
|
44
|
+
/** A file or folder by node id: the screen finds its space and folder and replaces it by space + path + file. */
|
|
45
|
+
node?: string | number | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The drive screen at a place, as a link under `route` (the route the host mounted `CloudDriveScreen` at, default
|
|
49
|
+
* `/drive`): `/drive?space=31&path=%2Fout&file=812`. The keys are the screen's URL keys.
|
|
50
|
+
*/
|
|
51
|
+
declare const buildDriveScreenHref: (place: DriveScreenPlace, route?: string) => string;
|
|
52
|
+
/** The node id inside a drive reference (`drive/812` → `812`), or `null` for a reference of another shape. */
|
|
53
|
+
declare const nodeIdOfDriveReference: (reference: string) => string | null;
|
|
54
|
+
|
|
55
|
+
export { buildDriveScreenHref, createCloudDriveCardsSource, nodeIdOfDriveReference };
|
|
56
|
+
export type { CloudDriveCardsDispatch, CloudDriveCardsSource, CreateCloudDriveCardsSourceOptions, DriveScreenPlace };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
createCloudDriveApi
|
|
4
|
+
} from "../chunk-EODL77UM.js";
|
|
5
|
+
|
|
6
|
+
// src/agents/driveScreenHref.ts
|
|
7
|
+
var SPACE_KEY = "space";
|
|
8
|
+
var PATH_KEY = "path";
|
|
9
|
+
var FILE_KEY = "file";
|
|
10
|
+
var NODE_KEY = "node";
|
|
11
|
+
var buildDriveScreenHref = (place, route = "/drive") => {
|
|
12
|
+
const query = new URLSearchParams();
|
|
13
|
+
const parts = [
|
|
14
|
+
[SPACE_KEY, place.space],
|
|
15
|
+
[PATH_KEY, place.path],
|
|
16
|
+
[FILE_KEY, place.file],
|
|
17
|
+
[NODE_KEY, place.node]
|
|
18
|
+
];
|
|
19
|
+
for (const [key, value] of parts) {
|
|
20
|
+
if (value === void 0 || value === null || String(value).trim() === "") continue;
|
|
21
|
+
query.set(key, String(value).trim());
|
|
22
|
+
}
|
|
23
|
+
const search = query.toString();
|
|
24
|
+
return search === "" ? route : `${route}?${search}`;
|
|
25
|
+
};
|
|
26
|
+
var nodeIdOfDriveReference = (reference) => {
|
|
27
|
+
const match = /^[\w-]+\/(\d+)$/.exec(reference.trim());
|
|
28
|
+
return match?.[1] ?? null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/agents/cloudDriveCardsSource.ts
|
|
32
|
+
var toAgentCard = (card) => ({
|
|
33
|
+
reference: card.reference,
|
|
34
|
+
name: card.name,
|
|
35
|
+
path: card.path,
|
|
36
|
+
isFolder: card.isFolder,
|
|
37
|
+
sizeBytes: card.sizeBytes ?? null,
|
|
38
|
+
contentType: card.contentType ?? null,
|
|
39
|
+
modifiedAt: card.modifiedAt ?? null,
|
|
40
|
+
childCount: card.childCount ?? null,
|
|
41
|
+
state: card.state ?? null,
|
|
42
|
+
thumbnailUrl: card.thumbnailUrl ?? null,
|
|
43
|
+
urlsExpireAt: card.urlsExpireAt ?? null,
|
|
44
|
+
openLink: card.adminLink ?? null,
|
|
45
|
+
driveSpaceId: card.driveSpaceId,
|
|
46
|
+
inlineUrl: card.inlineUrl ?? null,
|
|
47
|
+
downloadUrl: card.downloadUrl ?? null
|
|
48
|
+
});
|
|
49
|
+
var URL_EXPIRY_MARGIN_MS = 3e4;
|
|
50
|
+
var expiresAtMs = (value) => {
|
|
51
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})(?::(\d{2}))?$/.exec((value ?? "").trim());
|
|
52
|
+
if (!match) return null;
|
|
53
|
+
const [, year, month, day, hour, minute, second] = match;
|
|
54
|
+
return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second ?? 0));
|
|
55
|
+
};
|
|
56
|
+
var isExpired = (card, nowMs) => {
|
|
57
|
+
const at = expiresAtMs(card.urlsExpireAt);
|
|
58
|
+
return at === null || at - URL_EXPIRY_MARGIN_MS <= nowMs;
|
|
59
|
+
};
|
|
60
|
+
var createCloudDriveCardsSource = (options) => {
|
|
61
|
+
const { baseApi, apiPrefix, screenRoute = "/drive" } = options;
|
|
62
|
+
createCloudDriveApi({ baseApi, apiPrefix });
|
|
63
|
+
const endpoints = baseApi.endpoints;
|
|
64
|
+
let boundDispatch = null;
|
|
65
|
+
let announce = null;
|
|
66
|
+
let bound = new Promise((resolve) => {
|
|
67
|
+
announce = resolve;
|
|
68
|
+
});
|
|
69
|
+
const readDispatch = () => boundDispatch ? Promise.resolve(boundDispatch) : bound;
|
|
70
|
+
const run = async (endpointName, arg, initiateOptions, signal) => {
|
|
71
|
+
const dispatch = await readDispatch();
|
|
72
|
+
const endpoint = endpoints[endpointName];
|
|
73
|
+
if (!endpoint) throw new Error(`The cloud drive endpoint ${endpointName} is not injected.`);
|
|
74
|
+
const request = dispatch(endpoint.initiate(arg, initiateOptions));
|
|
75
|
+
const abort = () => request.abort?.();
|
|
76
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
77
|
+
try {
|
|
78
|
+
return await request.unwrap();
|
|
79
|
+
} finally {
|
|
80
|
+
signal?.removeEventListener("abort", abort);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const fetchCards = async (references, signal) => {
|
|
84
|
+
const response = await run("adminUiDriveFileCards", { references }, { subscribe: false, forceRefetch: true }, signal);
|
|
85
|
+
const position = (card) => references.indexOf(card.reference);
|
|
86
|
+
return (response.cards.elements ?? []).filter((card) => position(card) >= 0).sort((first, second) => position(first) - position(second)).map(toAgentCard);
|
|
87
|
+
};
|
|
88
|
+
const defaultHref = (card) => {
|
|
89
|
+
const node = nodeIdOfDriveReference(card.reference);
|
|
90
|
+
if (node === null) return null;
|
|
91
|
+
return buildDriveScreenHref({ space: card.driveSpaceId ?? null, node }, screenRoute);
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
readFileCards: (request, signal) => fetchCards(request.references, signal),
|
|
95
|
+
readFileContent: async (card, disposition) => {
|
|
96
|
+
let current = card;
|
|
97
|
+
if (isExpired(current, Date.now())) {
|
|
98
|
+
const [fresh] = await fetchCards([card.reference]);
|
|
99
|
+
if (!fresh) throw new Error("The file is no longer readable.");
|
|
100
|
+
current = fresh;
|
|
101
|
+
}
|
|
102
|
+
const url = disposition === "inline" ? current.inlineUrl : current.downloadUrl;
|
|
103
|
+
if (url) return { url, fileName: current.name };
|
|
104
|
+
const nodeId = Number(nodeIdOfDriveReference(current.reference));
|
|
105
|
+
if (!Number.isInteger(nodeId) || nodeId <= 0) throw new Error("The file has no content URL.");
|
|
106
|
+
const response = await run("adminUiDriveContent", {
|
|
107
|
+
driveNodeId: nodeId,
|
|
108
|
+
purpose: disposition === "inline" ? "INLINE" : "DOWNLOAD"
|
|
109
|
+
}, void 0);
|
|
110
|
+
return { url: response.grant.url, fileName: response.grant.fileName || current.name };
|
|
111
|
+
},
|
|
112
|
+
buildDriveScreenHref: options.buildDriveScreenHref === null ? void 0 : options.buildDriveScreenHref ?? defaultHref,
|
|
113
|
+
bindDispatch: (dispatch) => {
|
|
114
|
+
boundDispatch = dispatch;
|
|
115
|
+
announce?.(dispatch);
|
|
116
|
+
return () => {
|
|
117
|
+
if (boundDispatch !== dispatch) return;
|
|
118
|
+
boundDispatch = null;
|
|
119
|
+
bound = new Promise((resolve) => {
|
|
120
|
+
announce = resolve;
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
buildDriveScreenHref,
|
|
128
|
+
createCloudDriveCardsSource,
|
|
129
|
+
nodeIdOfDriveReference
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/agents/driveScreenHref.ts","../../src/agents/cloudDriveCardsSource.ts"],"sourcesContent":["/** The drive screen's URL keys (`CLOUD_DRIVE_URL_KEYS` and `CLOUD_DRIVE_NODE_KEY` of `./screen`), kept here so the\n * agents entry does not load the screen. */\nconst SPACE_KEY = 'space';\nconst PATH_KEY = 'path';\nconst FILE_KEY = 'file';\nconst NODE_KEY = 'node';\n\n/** A place in the drive screen; every part is optional, an empty part is left out of the link. */\nexport interface DriveScreenPlace {\n /** The drive space that holds the place. */\n space?: string | number | null;\n /** The folder the screen opens: a path (`/out/2026`) or a folder node id. */\n path?: string | number | null;\n /** The file the screen opens in its details drawer (node id). */\n file?: string | number | null;\n /** A file or folder by node id: the screen finds its space and folder and replaces it by space + path + file. */\n node?: string | number | null;\n}\n\n/**\n * The drive screen at a place, as a link under `route` (the route the host mounted `CloudDriveScreen` at, default\n * `/drive`): `/drive?space=31&path=%2Fout&file=812`. The keys are the screen's URL keys.\n */\nexport const buildDriveScreenHref = (place: DriveScreenPlace, route = '/drive'): string => {\n const query = new URLSearchParams();\n const parts: [string, DriveScreenPlace[keyof DriveScreenPlace]][] = [\n [SPACE_KEY, place.space],\n [PATH_KEY, place.path],\n [FILE_KEY, place.file],\n [NODE_KEY, place.node],\n ];\n for (const [key, value] of parts) {\n if (value === undefined || value === null || String(value).trim() === '') continue;\n query.set(key, String(value).trim());\n }\n const search = query.toString();\n return search === '' ? route : `${route}?${search}`;\n};\n\n/** The node id inside a drive reference (`drive/812` → `812`), or `null` for a reference of another shape. */\nexport const nodeIdOfDriveReference = (reference: string): string | null => {\n const match = /^[\\w-]+\\/(\\d+)$/.exec(reference.trim());\n return match?.[1] ?? null;\n};\n","import type { DriveFileCard as AgentDriveFileCard, DriveFileCardsSource, DriveFileContent, DriveFilesRequest } from '@mgamadeus/ddd-agents';\nimport type { InjectableBaseApi } from '@mgamadeus/ddd-admin-ui/logic/pure';\nimport { createCloudDriveApi } from '../api.ts';\nimport type { DriveContentGrantResponse, DriveFileCard, DriveFileCardsResponse } from '../types.ts';\nimport { buildDriveScreenHref, nodeIdOfDriveReference } from './driveScreenHref.ts';\n\n/** The store's dispatch: the RTK store the host's api is mounted in. */\nexport type CloudDriveCardsDispatch = (action: unknown) => unknown;\n\nexport interface CreateCloudDriveCardsSourceOptions {\n /** The host's RTK Query api (the same one `createCloudDriveApi` is given). */\n baseApi: InjectableBaseApi;\n /** The prefix of the cloud drive routes, e.g. `/api/admin/common/cloudDrive`. */\n apiPrefix: string;\n /**\n * The drive screen link of a card that carries no `adminLink`: by default `buildDriveScreenHref` under `screenRoute`\n * (space + node); `null` shows no \"show in the drive\" action.\n */\n buildDriveScreenHref?: ((card: AgentDriveFileCard) => string | null) | null;\n /** The route the host mounted the drive screen at, for the default link; default `/drive`. */\n screenRoute?: string;\n}\n\n/** The source of the `DriveFiles` cards on the cloud drive routes, plus the binding to the host's store. */\nexport interface CloudDriveCardsSource extends DriveFileCardsSource {\n /**\n * Binds the store's dispatch (the store the host's api is mounted in); returns the unbind. A read started before the\n * first bind waits for it. Call it where the store is known: `cardsSource.bindDispatch(store.dispatch)` at start-up,\n * or in an effect of the component that mounts the agent window.\n */\n bindDispatch: (dispatch: CloudDriveCardsDispatch) => () => void;\n}\n\n/** A card as the agents draw it: the drive's card with its screen link as `openLink`; the content URLs ride along. */\ntype DriveCardOfAgents = AgentDriveFileCard & Pick<DriveFileCard, 'inlineUrl' | 'downloadUrl'>;\n\nconst toAgentCard = (card: DriveFileCard): DriveCardOfAgents => ({\n reference: card.reference,\n name: card.name,\n path: card.path,\n isFolder: card.isFolder,\n sizeBytes: card.sizeBytes ?? null,\n contentType: card.contentType ?? null,\n modifiedAt: card.modifiedAt ?? null,\n childCount: card.childCount ?? null,\n state: card.state ?? null,\n thumbnailUrl: card.thumbnailUrl ?? null,\n urlsExpireAt: card.urlsExpireAt ?? null,\n openLink: card.adminLink ?? null,\n driveSpaceId: card.driveSpaceId,\n inlineUrl: card.inlineUrl ?? null,\n downloadUrl: card.downloadUrl ?? null,\n});\n\n/** How long before `urlsExpireAt` a URL counts as expired: the click, the redirect and the bucket's clock. */\nconst URL_EXPIRY_MARGIN_MS = 30_000;\n\nconst expiresAtMs = (value: string | null | undefined): number | null => {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})[ T](\\d{2}):(\\d{2})(?::(\\d{2}))?$/.exec((value ?? '').trim());\n if (!match) return null;\n const [, year, month, day, hour, minute, second] = match;\n return Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second ?? 0));\n};\n\nconst isExpired = (card: { urlsExpireAt?: string | null }, nowMs: number): boolean => {\n const at = expiresAtMs(card.urlsExpireAt);\n return at === null || at - URL_EXPIRY_MARGIN_MS <= nowMs;\n};\n\ninterface InitiatedRequest<TData> {\n unwrap: () => Promise<TData>;\n abort?: () => void;\n}\n\ninterface InjectedEndpoints {\n endpoints: Record<string, { initiate: (arg: unknown, options?: unknown) => (dispatch: never, getState: never) => unknown }>;\n}\n\n/**\n * The `DriveFileCardsSource` of `@mgamadeus/ddd-agents` on the cloud drive routes: the cards of a block through\n * `POST {apiPrefix}/cards` (the viewer's rights; a reference the server does not answer is left out), a card's\n * content through the card's short-lived URLs (read again when they expired) or `GET {apiPrefix}/nodes/{id}/content`.\n * Register it once: `registerDriveFileCardsSource(cardsSource)`, and bind the store (`bindDispatch`).\n */\nexport const createCloudDriveCardsSource = (options: CreateCloudDriveCardsSourceOptions): CloudDriveCardsSource => {\n const { baseApi, apiPrefix, screenRoute = '/drive' } = options;\n // the endpoints are injected once per api and prefix (the same injection `createCloudDriveApi` does)\n createCloudDriveApi({ baseApi, apiPrefix });\n const endpoints = (baseApi as unknown as InjectedEndpoints).endpoints;\n\n let boundDispatch: CloudDriveCardsDispatch | null = null;\n let announce: ((dispatch: CloudDriveCardsDispatch) => void) | null = null;\n let bound = new Promise<CloudDriveCardsDispatch>(resolve => {\n announce = resolve;\n });\n const readDispatch = (): Promise<CloudDriveCardsDispatch> => (boundDispatch ? Promise.resolve(boundDispatch) : bound);\n\n const run = async <TData>(endpointName: string, arg: unknown, initiateOptions: unknown, signal?: AbortSignal): Promise<TData> => {\n const dispatch = await readDispatch();\n const endpoint = endpoints[endpointName];\n if (!endpoint) throw new Error(`The cloud drive endpoint ${endpointName} is not injected.`);\n const request = dispatch(endpoint.initiate(arg, initiateOptions)) as InitiatedRequest<TData>;\n const abort = () => request.abort?.();\n signal?.addEventListener('abort', abort, { once: true });\n try {\n return await request.unwrap();\n } finally {\n signal?.removeEventListener('abort', abort);\n }\n };\n\n const fetchCards = async (references: string[], signal?: AbortSignal): Promise<DriveCardOfAgents[]> => {\n const response = await run<DriveFileCardsResponse>('adminUiDriveFileCards', { references }, { subscribe: false, forceRefetch: true }, signal);\n const position = (card: DriveFileCard) => references.indexOf(card.reference);\n return (response.cards.elements ?? [])\n .filter(card => position(card) >= 0)\n .sort((first, second) => position(first) - position(second))\n .map(toAgentCard);\n };\n\n const defaultHref = (card: AgentDriveFileCard): string | null => {\n const node = nodeIdOfDriveReference(card.reference);\n if (node === null) return null;\n return buildDriveScreenHref({ space: card.driveSpaceId ?? null, node }, screenRoute);\n };\n\n return {\n readFileCards: (request: DriveFilesRequest, signal: AbortSignal) => fetchCards(request.references, signal),\n\n readFileContent: async (card, disposition): Promise<DriveFileContent> => {\n let current = card as DriveCardOfAgents;\n if (isExpired(current, Date.now())) {\n const [fresh] = await fetchCards([card.reference]);\n if (!fresh) throw new Error('The file is no longer readable.');\n current = fresh;\n }\n const url = disposition === 'inline' ? current.inlineUrl : current.downloadUrl;\n if (url) return { url, fileName: current.name };\n const nodeId = Number(nodeIdOfDriveReference(current.reference));\n if (!Number.isInteger(nodeId) || nodeId <= 0) throw new Error('The file has no content URL.');\n const response = await run<DriveContentGrantResponse>('adminUiDriveContent', {\n driveNodeId: nodeId,\n purpose: disposition === 'inline' ? 'INLINE' : 'DOWNLOAD',\n }, undefined);\n return { url: response.grant.url, fileName: response.grant.fileName || current.name };\n },\n\n buildDriveScreenHref: options.buildDriveScreenHref === null ? undefined : (options.buildDriveScreenHref ?? defaultHref),\n\n bindDispatch: dispatch => {\n boundDispatch = dispatch;\n announce?.(dispatch);\n return () => {\n if (boundDispatch !== dispatch) return;\n boundDispatch = null;\n bound = new Promise<CloudDriveCardsDispatch>(resolve => {\n announce = resolve;\n });\n };\n },\n };\n};\n"],"mappings":";;;;;;AAEA,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,WAAW;AACjB,IAAM,WAAW;AAkBV,IAAM,uBAAuB,CAAC,OAAyB,QAAQ,aAAqB;AACzF,QAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAM,QAA8D;AAAA,IAClE,CAAC,WAAW,MAAM,KAAK;AAAA,IACvB,CAAC,UAAU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X,YAAI,kBAAkB,SAAU;AAChC,wBAAgB;AAChB,gBAAQ,IAAI,QAAiC,aAAW;AACtD,qBAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/api.ts
|
|
4
|
+
import {
|
|
5
|
+
injectEndpointsOnce,
|
|
6
|
+
staticMutationHook,
|
|
7
|
+
staticQueryHook,
|
|
8
|
+
toQueryString,
|
|
9
|
+
trimApiPrefix
|
|
10
|
+
} from "@mgamadeus/ddd-admin-ui/logic/pure";
|
|
11
|
+
var CLOUD_DRIVE_TAG = "AdminUiCloudDrive";
|
|
12
|
+
var idOf = (id) => encodeURIComponent(String(id));
|
|
13
|
+
var buildCloudDriveRequests = (apiPrefix) => {
|
|
14
|
+
const prefix = trimApiPrefix(apiPrefix);
|
|
15
|
+
return {
|
|
16
|
+
spaces: () => ({ url: `${prefix}/spaces/list` }),
|
|
17
|
+
children: ({ driveSpaceId, folderNodeId, cursor, limit, includeSystem, recursive, query, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }) => ({
|
|
18
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/children${toQueryString({
|
|
19
|
+
folderNodeId,
|
|
20
|
+
cursor,
|
|
21
|
+
limit,
|
|
22
|
+
includeSystem,
|
|
23
|
+
recursive,
|
|
24
|
+
query,
|
|
25
|
+
family,
|
|
26
|
+
createdFrom,
|
|
27
|
+
createdTo,
|
|
28
|
+
createdByMe,
|
|
29
|
+
orderBy,
|
|
30
|
+
orderDirection
|
|
31
|
+
})}`
|
|
32
|
+
}),
|
|
33
|
+
search: ({ driveSpaceId, query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }) => ({
|
|
34
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/search${toQueryString({ query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection })}`
|
|
35
|
+
}),
|
|
36
|
+
space: ({ driveSpaceId }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}` }),
|
|
37
|
+
trashList: ({ driveSpaceId, cursor, limit }) => ({
|
|
38
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/trash${toQueryString({ cursor, limit })}`
|
|
39
|
+
}),
|
|
40
|
+
folders: ({ driveSpaceId, includeSystem }) => ({
|
|
41
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/folders${toQueryString({ includeSystem })}`
|
|
42
|
+
}),
|
|
43
|
+
versions: ({ driveNodeId }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/versions` }),
|
|
44
|
+
events: ({ driveNodeId, limit, eventGroup, eventTypes }) => ({
|
|
45
|
+
url: `${prefix}/nodes/${idOf(driveNodeId)}/events${toQueryString({ limit, eventGroup, eventTypes })}`
|
|
46
|
+
}),
|
|
47
|
+
resolve: ({ driveSpaceId, path }) => ({
|
|
48
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/resolve${toQueryString({ path })}`
|
|
49
|
+
}),
|
|
50
|
+
restoreVersion: ({ driveNodeId, driveFileVersionId }) => ({
|
|
51
|
+
url: `${prefix}/nodes/${idOf(driveNodeId)}/versions/${idOf(driveFileVersionId)}/restore`,
|
|
52
|
+
method: "POST"
|
|
53
|
+
}),
|
|
54
|
+
metadata: ({ driveNodeId, ...body }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/metadata`, method: "POST", body }),
|
|
55
|
+
bulkMove: ({ driveSpaceId, ...body }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/move`, method: "POST", body }),
|
|
56
|
+
bulkTrash: ({ driveSpaceId, ...body }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/trash`, method: "POST", body }),
|
|
57
|
+
bulkRestore: ({ driveSpaceId, ...body }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/restore`, method: "POST", body }),
|
|
58
|
+
bulkPurge: ({ driveSpaceId, ...body }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/purge`, method: "POST", body }),
|
|
59
|
+
emptyTrash: ({ driveSpaceId }) => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/trash/empty`, method: "POST" }),
|
|
60
|
+
node: ({ driveNodeId }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}` }),
|
|
61
|
+
createFolder: ({ driveSpaceId, ...body }) => ({
|
|
62
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/folders`,
|
|
63
|
+
method: "POST",
|
|
64
|
+
body
|
|
65
|
+
}),
|
|
66
|
+
reserveUpload: ({ driveSpaceId, ...body }) => ({
|
|
67
|
+
url: `${prefix}/spaces/${idOf(driveSpaceId)}/uploads`,
|
|
68
|
+
method: "POST",
|
|
69
|
+
body
|
|
70
|
+
}),
|
|
71
|
+
completeUpload: ({ driveBlobId, ...body }) => ({
|
|
72
|
+
url: `${prefix}/uploads/${idOf(driveBlobId)}/complete`,
|
|
73
|
+
method: "POST",
|
|
74
|
+
body
|
|
75
|
+
}),
|
|
76
|
+
content: ({ driveNodeId, purpose, versionId }) => ({
|
|
77
|
+
url: `${prefix}/nodes/${idOf(driveNodeId)}/content${toQueryString({ purpose, versionId })}`
|
|
78
|
+
}),
|
|
79
|
+
move: ({ driveNodeId, ...body }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/move`, method: "POST", body }),
|
|
80
|
+
trash: ({ driveNodeId }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/trash`, method: "POST" }),
|
|
81
|
+
restore: ({ driveNodeId }) => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/restore`, method: "POST" }),
|
|
82
|
+
cards: (body) => ({ url: `${prefix}/cards`, method: "POST", body })
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
var SPACES = { type: CLOUD_DRIVE_TAG, id: "SPACES" };
|
|
86
|
+
var NODES = { type: CLOUD_DRIVE_TAG, id: "NODES" };
|
|
87
|
+
var cloudDriveEndpointDefinitions = (apiPrefix) => {
|
|
88
|
+
const requests = buildCloudDriveRequests(apiPrefix);
|
|
89
|
+
return {
|
|
90
|
+
adminUiDriveSpaces: { kind: "query", request: requests.spaces, providesTags: [SPACES] },
|
|
91
|
+
adminUiDriveChildren: { kind: "query", request: requests.children, providesTags: [NODES] },
|
|
92
|
+
adminUiDriveSearch: { kind: "query", request: requests.search, providesTags: [NODES] },
|
|
93
|
+
adminUiDriveNode: { kind: "query", request: requests.node, providesTags: [NODES] },
|
|
94
|
+
adminUiDriveFileCards: { kind: "query", request: requests.cards, providesTags: [NODES] },
|
|
95
|
+
adminUiDriveFolderCreate: { kind: "mutation", request: requests.createFolder, invalidatesTags: [NODES, SPACES] },
|
|
96
|
+
adminUiDriveUploadReserve: { kind: "mutation", request: requests.reserveUpload },
|
|
97
|
+
adminUiDriveUploadComplete: { kind: "mutation", request: requests.completeUpload, invalidatesTags: [NODES, SPACES] },
|
|
98
|
+
adminUiDriveContent: { kind: "mutation", request: requests.content },
|
|
99
|
+
adminUiDriveNodeMove: { kind: "mutation", request: requests.move, invalidatesTags: [NODES] },
|
|
100
|
+
adminUiDriveNodeTrash: { kind: "mutation", request: requests.trash, invalidatesTags: [NODES, SPACES] },
|
|
101
|
+
adminUiDriveNodeRestore: { kind: "mutation", request: requests.restore, invalidatesTags: [NODES, SPACES] },
|
|
102
|
+
adminUiDriveSpace: { kind: "query", request: requests.space, providesTags: [SPACES] },
|
|
103
|
+
adminUiDriveTrash: { kind: "query", request: requests.trashList, providesTags: [NODES] },
|
|
104
|
+
adminUiDriveFolders: { kind: "query", request: requests.folders, providesTags: [NODES] },
|
|
105
|
+
adminUiDriveVersions: { kind: "query", request: requests.versions, providesTags: [NODES] },
|
|
106
|
+
adminUiDriveEvents: { kind: "query", request: requests.events, providesTags: [NODES] },
|
|
107
|
+
adminUiDriveVersionRestore: { kind: "mutation", request: requests.restoreVersion, invalidatesTags: [NODES, SPACES] },
|
|
108
|
+
adminUiDriveNodeMetadata: { kind: "mutation", request: requests.metadata, invalidatesTags: [NODES] },
|
|
109
|
+
adminUiDriveNodesMove: { kind: "mutation", request: requests.bulkMove, invalidatesTags: [NODES, SPACES] },
|
|
110
|
+
adminUiDriveNodesTrash: { kind: "mutation", request: requests.bulkTrash, invalidatesTags: [NODES, SPACES] },
|
|
111
|
+
adminUiDriveNodesRestore: { kind: "mutation", request: requests.bulkRestore, invalidatesTags: [NODES, SPACES] },
|
|
112
|
+
adminUiDriveNodesPurge: { kind: "mutation", request: requests.bulkPurge, invalidatesTags: [NODES, SPACES] },
|
|
113
|
+
adminUiDriveTrashEmpty: { kind: "mutation", request: requests.emptyTrash, invalidatesTags: [NODES, SPACES] },
|
|
114
|
+
adminUiDriveResolve: { kind: "mutation", request: requests.resolve }
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
var createCloudDriveApi = ({ baseApi, apiPrefix, audience }) => {
|
|
118
|
+
const hooks = injectCloudDriveEndpoints(baseApi, apiPrefix);
|
|
119
|
+
return audience ? { ...hooks, audience } : hooks;
|
|
120
|
+
};
|
|
121
|
+
var injectCloudDriveEndpoints = (baseApi, apiPrefix) => injectEndpointsOnce(baseApi, `clouddrive:${trimApiPrefix(apiPrefix)}`, [CLOUD_DRIVE_TAG], cloudDriveEndpointDefinitions(apiPrefix), (hookOf) => ({
|
|
122
|
+
useDriveSpacesQuery: hookOf("adminUiDriveSpaces"),
|
|
123
|
+
useDriveChildrenQuery: hookOf("adminUiDriveChildren"),
|
|
124
|
+
useDriveSearchQuery: hookOf("adminUiDriveSearch"),
|
|
125
|
+
useDriveNodeQuery: hookOf("adminUiDriveNode"),
|
|
126
|
+
useDriveFileCardsQuery: hookOf("adminUiDriveFileCards"),
|
|
127
|
+
useCreateDriveFolderMutation: hookOf("adminUiDriveFolderCreate"),
|
|
128
|
+
useReserveDriveUploadMutation: hookOf("adminUiDriveUploadReserve"),
|
|
129
|
+
useCompleteDriveUploadMutation: hookOf("adminUiDriveUploadComplete"),
|
|
130
|
+
useDriveContentMutation: hookOf("adminUiDriveContent"),
|
|
131
|
+
useMoveDriveNodeMutation: hookOf("adminUiDriveNodeMove"),
|
|
132
|
+
useTrashDriveNodeMutation: hookOf("adminUiDriveNodeTrash"),
|
|
133
|
+
useRestoreDriveNodeMutation: hookOf("adminUiDriveNodeRestore"),
|
|
134
|
+
useDriveSpaceQuery: hookOf("adminUiDriveSpace"),
|
|
135
|
+
useDriveTrashQuery: hookOf("adminUiDriveTrash"),
|
|
136
|
+
useDriveFoldersQuery: hookOf("adminUiDriveFolders"),
|
|
137
|
+
useDriveVersionsQuery: hookOf("adminUiDriveVersions"),
|
|
138
|
+
useDriveEventsQuery: hookOf("adminUiDriveEvents"),
|
|
139
|
+
useRestoreDriveVersionMutation: hookOf("adminUiDriveVersionRestore"),
|
|
140
|
+
useUpdateDriveNodeMetadataMutation: hookOf("adminUiDriveNodeMetadata"),
|
|
141
|
+
useMoveDriveNodesMutation: hookOf("adminUiDriveNodesMove"),
|
|
142
|
+
useTrashDriveNodesMutation: hookOf("adminUiDriveNodesTrash"),
|
|
143
|
+
useRestoreDriveNodesMutation: hookOf("adminUiDriveNodesRestore"),
|
|
144
|
+
usePurgeDriveNodesMutation: hookOf("adminUiDriveNodesPurge"),
|
|
145
|
+
useEmptyDriveTrashMutation: hookOf("adminUiDriveTrashEmpty"),
|
|
146
|
+
useResolveDriveLocationMutation: hookOf("adminUiDriveResolve")
|
|
147
|
+
}));
|
|
148
|
+
var NOT_AVAILABLE = () => {
|
|
149
|
+
throw { status: 403, data: { error: "Not available in this preview" } };
|
|
150
|
+
};
|
|
151
|
+
var createStaticCloudDriveApi = (data) => ({
|
|
152
|
+
useDriveSpacesQuery: staticQueryHook(() => data.spaces),
|
|
153
|
+
useDriveChildrenQuery: staticQueryHook((arg) => data.children?.(arg)),
|
|
154
|
+
useDriveSearchQuery: staticQueryHook((arg) => data.search?.(arg)),
|
|
155
|
+
useDriveNodeQuery: staticQueryHook((arg) => data.node?.(arg)),
|
|
156
|
+
useDriveFileCardsQuery: staticQueryHook((arg) => data.cards?.(arg)),
|
|
157
|
+
useCreateDriveFolderMutation: staticMutationHook(NOT_AVAILABLE),
|
|
158
|
+
useReserveDriveUploadMutation: staticMutationHook(NOT_AVAILABLE),
|
|
159
|
+
useCompleteDriveUploadMutation: staticMutationHook(NOT_AVAILABLE),
|
|
160
|
+
useDriveContentMutation: staticMutationHook(NOT_AVAILABLE),
|
|
161
|
+
useMoveDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),
|
|
162
|
+
useTrashDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),
|
|
163
|
+
useRestoreDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),
|
|
164
|
+
useDriveSpaceQuery: staticQueryHook((arg) => data.space?.(arg)),
|
|
165
|
+
useDriveTrashQuery: staticQueryHook((arg) => data.trash?.(arg)),
|
|
166
|
+
useDriveFoldersQuery: staticQueryHook((arg) => data.folders?.(arg)),
|
|
167
|
+
useDriveVersionsQuery: staticQueryHook((arg) => data.versions?.(arg)),
|
|
168
|
+
useDriveEventsQuery: staticQueryHook((arg) => data.events?.(arg)),
|
|
169
|
+
useRestoreDriveVersionMutation: staticMutationHook(NOT_AVAILABLE),
|
|
170
|
+
useUpdateDriveNodeMetadataMutation: staticMutationHook(NOT_AVAILABLE),
|
|
171
|
+
useMoveDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),
|
|
172
|
+
useTrashDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),
|
|
173
|
+
useRestoreDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),
|
|
174
|
+
usePurgeDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),
|
|
175
|
+
useEmptyDriveTrashMutation: staticMutationHook(NOT_AVAILABLE),
|
|
176
|
+
useResolveDriveLocationMutation: staticMutationHook((arg) => {
|
|
177
|
+
const answer = data.resolve?.(arg);
|
|
178
|
+
if (!answer) throw { status: 404, data: { error: "Not found", missingSegment: arg.path } };
|
|
179
|
+
return answer;
|
|
180
|
+
}),
|
|
181
|
+
...data.audience ? { audience: data.audience } : {}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
CLOUD_DRIVE_TAG,
|
|
186
|
+
buildCloudDriveRequests,
|
|
187
|
+
cloudDriveEndpointDefinitions,
|
|
188
|
+
createCloudDriveApi,
|
|
189
|
+
createStaticCloudDriveApi
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=chunk-EODL77UM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api.ts"],"sourcesContent":["import {\n type ApiMutationHook,\n type ApiQueryHook,\n type InjectableBaseApi,\n type InjectedEndpointDefinition,\n type InjectedRequest,\n injectEndpointsOnce,\n type StaticQueryFailure,\n staticMutationHook,\n staticQueryHook,\n toQueryString,\n trimApiPrefix,\n} from '@mgamadeus/ddd-admin-ui/logic/pure';\nimport type {\n DriveChangeEventListItem,\n DriveChildrenArg,\n DriveContentArg,\n DriveEventsArg,\n DriveFileVersionListItem,\n DriveFoldersArg,\n DriveFoldersResponse,\n DriveListItemsResponse,\n DriveNodeBulkResponse,\n DriveNodeMetadataArg,\n DriveNodesBulkArg,\n DriveNodesBulkMoveArg,\n DriveSpaceIdArg,\n DriveSpaceResponse,\n DriveTrashArg,\n DriveVersionRestoreArg,\n DriveContentGrantResponse,\n DriveFileCardsArg,\n DriveFileCardsResponse,\n DriveFolderCreateArg,\n DriveNodeIdArg,\n DriveNodeMoveArg,\n DriveNodeResponse,\n DriveNodesResponse,\n DriveSearchArg,\n DriveSpacesResponse,\n DriveUploadCompleteArg,\n DriveUploadReservationResponse,\n DriveUploadReserveArg,\n CloudDriveAudience,\n DriveLocationResolveArg,\n DriveLocationResolveResponse,\n} from './types.ts';\n\n/** The cache tag type of the cloud drive operations (ids `SPACES`, `NODES`). */\nexport const CLOUD_DRIVE_TAG = 'AdminUiCloudDrive';\n\n/** The hooks `createCloudDriveApi` returns; the drive screen takes them as its `api`. */\nexport interface CloudDriveApi {\n /** `GET /spaces/list`: the spaces the viewer may read. */\n useDriveSpacesQuery: ApiQueryHook<void, DriveSpacesResponse>;\n /** `GET /spaces/{id}/children?folderNodeId&cursor&limit&includeSystem`: one page of a folder. */\n useDriveChildrenQuery: ApiQueryHook<DriveChildrenArg, DriveNodesResponse>;\n /** `GET /spaces/{id}/search?query&limit`: names containing the query. */\n useDriveSearchQuery: ApiQueryHook<DriveSearchArg, DriveNodesResponse>;\n /** `GET /nodes/{id}`: one file or folder with its path and versions. */\n useDriveNodeQuery: ApiQueryHook<DriveNodeIdArg, DriveNodeResponse>;\n /** `POST /spaces/{id}/folders`. */\n useCreateDriveFolderMutation: ApiMutationHook<DriveFolderCreateArg, DriveNodeResponse>;\n /** `POST /spaces/{id}/uploads`: one presigned PUT or the parts of a multipart upload. */\n useReserveDriveUploadMutation: ApiMutationHook<DriveUploadReserveArg, DriveUploadReservationResponse>;\n /** `POST /uploads/{blobId}/complete`: the file (a conflict answers `isConflict`). */\n useCompleteDriveUploadMutation: ApiMutationHook<DriveUploadCompleteArg, DriveNodeResponse>;\n /** `GET /nodes/{id}/content?purpose&versionId`: a short-lived content URL (not cached). */\n useDriveContentMutation: ApiMutationHook<DriveContentArg, DriveContentGrantResponse>;\n /** `POST /nodes/{id}/move`. */\n useMoveDriveNodeMutation: ApiMutationHook<DriveNodeMoveArg, DriveNodeResponse>;\n /** `POST /nodes/{id}/trash`. */\n useTrashDriveNodeMutation: ApiMutationHook<DriveNodeIdArg, DriveNodeResponse>;\n /** `POST /nodes/{id}/restore`. */\n useRestoreDriveNodeMutation: ApiMutationHook<DriveNodeIdArg, DriveNodeResponse>;\n /** `POST /cards`: file cards with open, download and thumbnail URLs (the `DriveFiles` widget). */\n useDriveFileCardsQuery: ApiQueryHook<DriveFileCardsArg, DriveFileCardsResponse>;\n /** `GET /spaces/{id}`: one space with display name, quota and the viewer's rights. */\n useDriveSpaceQuery: ApiQueryHook<DriveSpaceIdArg, DriveSpaceResponse>;\n /** `GET /spaces/{id}/trash?cursor&limit`: the trashed top-level nodes, newest first. */\n useDriveTrashQuery: ApiQueryHook<DriveTrashArg, DriveNodesResponse>;\n /** `GET /spaces/{id}/folders?includeSystem`: every live folder of the space (root included), flat. */\n useDriveFoldersQuery: ApiQueryHook<DriveFoldersArg, DriveFoldersResponse>;\n /** `GET /nodes/{id}/versions`: the versions of a file, newest first. */\n useDriveVersionsQuery: ApiQueryHook<DriveNodeIdArg, DriveListItemsResponse<DriveFileVersionListItem>>;\n /** `GET /nodes/{id}/events?limit`: the newest changes of a node. */\n useDriveEventsQuery: ApiQueryHook<DriveEventsArg, DriveListItemsResponse<DriveChangeEventListItem>>;\n /** `POST /nodes/{id}/versions/{versionId}/restore`: a new current version with an older version's content. */\n useRestoreDriveVersionMutation: ApiMutationHook<DriveVersionRestoreArg, DriveNodeResponse>;\n /** `POST /nodes/{id}/metadata`: description and tags. */\n useUpdateDriveNodeMetadataMutation: ApiMutationHook<DriveNodeMetadataArg, DriveNodeResponse>;\n /** `POST /spaces/{id}/nodes/move`: up to 200 nodes into one folder (omitted = the root). */\n useMoveDriveNodesMutation: ApiMutationHook<DriveNodesBulkMoveArg, DriveNodeBulkResponse>;\n /** `POST /spaces/{id}/nodes/trash`. */\n useTrashDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;\n /** `POST /spaces/{id}/nodes/restore`. */\n useRestoreDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;\n /** `POST /spaces/{id}/nodes/purge` (manage right): deletes trashed nodes for good. */\n usePurgeDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;\n /** `POST /spaces/{id}/trash/empty` (manage right): one batch; `hasMore` asks for another call. */\n useEmptyDriveTrashMutation: ApiMutationHook<DriveSpaceIdArg, DriveNodeBulkResponse>;\n /** `GET /spaces/{id}/resolve?path=`: where a path, `drive/<id>` or a workspace path leads (not cached; 404 = a miss). */\n useResolveDriveLocationMutation: ApiMutationHook<DriveLocationResolveArg, DriveLocationResolveResponse>;\n /** Who the drive answers as (`createCloudDriveApi({ audience })`); absent = staff. */\n audience?: CloudDriveAudience;\n}\n\nexport interface CreateCloudDriveApiOptions {\n /** The host's RTK Query api (`createApi` with the React hooks module). */\n baseApi: InjectableBaseApi;\n /** Where the host mounts `CloudDriveControllerTrait`, without a trailing slash (`/api/admin/common/cloudDrive`). */\n apiPrefix: string;\n /**\n * `shared`: the prefix is a partner mount (`getDriveAudience()` SHARED): the screen shows no staff-only control\n * (purge, empty trash, space settings and maintenance). Default `internal`.\n */\n audience?: CloudDriveAudience;\n}\n\nconst idOf = (id: number): string => encodeURIComponent(String(id));\n\n/** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */\nexport const buildCloudDriveRequests = (apiPrefix: string) => {\n const prefix = trimApiPrefix(apiPrefix);\n return {\n spaces: (): InjectedRequest => ({ url: `${prefix}/spaces/list` }),\n children: ({ driveSpaceId, folderNodeId, cursor, limit, includeSystem, recursive, query, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveChildrenArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/children${toQueryString({\n folderNodeId, cursor, limit, includeSystem, recursive, query, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection,\n })}`,\n }),\n search: ({ driveSpaceId, query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveSearchArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/search${toQueryString({ query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection })}`,\n }),\n space: ({ driveSpaceId }: DriveSpaceIdArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}` }),\n trashList: ({ driveSpaceId, cursor, limit }: DriveTrashArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/trash${toQueryString({ cursor, limit })}`,\n }),\n folders: ({ driveSpaceId, includeSystem }: DriveFoldersArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/folders${toQueryString({ includeSystem })}`,\n }),\n versions: ({ driveNodeId }: DriveNodeIdArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/versions` }),\n events: ({ driveNodeId, limit, eventGroup, eventTypes }: DriveEventsArg): InjectedRequest => ({\n url: `${prefix}/nodes/${idOf(driveNodeId)}/events${toQueryString({ limit, eventGroup, eventTypes })}`,\n }),\n resolve: ({ driveSpaceId, path }: DriveLocationResolveArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/resolve${toQueryString({ path })}`,\n }),\n restoreVersion: ({ driveNodeId, driveFileVersionId }: DriveVersionRestoreArg): InjectedRequest => ({\n url: `${prefix}/nodes/${idOf(driveNodeId)}/versions/${idOf(driveFileVersionId)}/restore`, method: 'POST',\n }),\n metadata: ({ driveNodeId, ...body }: DriveNodeMetadataArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/metadata`, method: 'POST', body }),\n bulkMove: ({ driveSpaceId, ...body }: DriveNodesBulkMoveArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/move`, method: 'POST', body }),\n bulkTrash: ({ driveSpaceId, ...body }: DriveNodesBulkArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/trash`, method: 'POST', body }),\n bulkRestore: ({ driveSpaceId, ...body }: DriveNodesBulkArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/restore`, method: 'POST', body }),\n bulkPurge: ({ driveSpaceId, ...body }: DriveNodesBulkArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/nodes/purge`, method: 'POST', body }),\n emptyTrash: ({ driveSpaceId }: DriveSpaceIdArg): InjectedRequest => ({ url: `${prefix}/spaces/${idOf(driveSpaceId)}/trash/empty`, method: 'POST' }),\n node: ({ driveNodeId }: DriveNodeIdArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}` }),\n createFolder: ({ driveSpaceId, ...body }: DriveFolderCreateArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/folders`, method: 'POST', body,\n }),\n reserveUpload: ({ driveSpaceId, ...body }: DriveUploadReserveArg): InjectedRequest => ({\n url: `${prefix}/spaces/${idOf(driveSpaceId)}/uploads`, method: 'POST', body,\n }),\n completeUpload: ({ driveBlobId, ...body }: DriveUploadCompleteArg): InjectedRequest => ({\n url: `${prefix}/uploads/${idOf(driveBlobId)}/complete`, method: 'POST', body,\n }),\n content: ({ driveNodeId, purpose, versionId }: DriveContentArg): InjectedRequest => ({\n url: `${prefix}/nodes/${idOf(driveNodeId)}/content${toQueryString({ purpose, versionId })}`,\n }),\n move: ({ driveNodeId, ...body }: DriveNodeMoveArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/move`, method: 'POST', body }),\n trash: ({ driveNodeId }: DriveNodeIdArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/trash`, method: 'POST' }),\n restore: ({ driveNodeId }: DriveNodeIdArg): InjectedRequest => ({ url: `${prefix}/nodes/${idOf(driveNodeId)}/restore`, method: 'POST' }),\n cards: (body: DriveFileCardsArg): InjectedRequest => ({ url: `${prefix}/cards`, method: 'POST', body }),\n };\n};\n\nconst SPACES = { type: CLOUD_DRIVE_TAG, id: 'SPACES' } as const;\nconst NODES = { type: CLOUD_DRIVE_TAG, id: 'NODES' } as const;\n\n/** The operations as injected. Every write invalidates `NODES` and `SPACES` (counters); content URLs are never cached. */\nexport const cloudDriveEndpointDefinitions = (apiPrefix: string) => {\n const requests = buildCloudDriveRequests(apiPrefix);\n return {\n adminUiDriveSpaces: { kind: 'query', request: requests.spaces, providesTags: [SPACES] },\n adminUiDriveChildren: { kind: 'query', request: requests.children, providesTags: [NODES] },\n adminUiDriveSearch: { kind: 'query', request: requests.search, providesTags: [NODES] },\n adminUiDriveNode: { kind: 'query', request: requests.node, providesTags: [NODES] },\n adminUiDriveFileCards: { kind: 'query', request: requests.cards, providesTags: [NODES] },\n adminUiDriveFolderCreate: { kind: 'mutation', request: requests.createFolder, invalidatesTags: [NODES, SPACES] },\n adminUiDriveUploadReserve: { kind: 'mutation', request: requests.reserveUpload },\n adminUiDriveUploadComplete: { kind: 'mutation', request: requests.completeUpload, invalidatesTags: [NODES, SPACES] },\n adminUiDriveContent: { kind: 'mutation', request: requests.content },\n adminUiDriveNodeMove: { kind: 'mutation', request: requests.move, invalidatesTags: [NODES] },\n adminUiDriveNodeTrash: { kind: 'mutation', request: requests.trash, invalidatesTags: [NODES, SPACES] },\n adminUiDriveNodeRestore: { kind: 'mutation', request: requests.restore, invalidatesTags: [NODES, SPACES] },\n adminUiDriveSpace: { kind: 'query', request: requests.space, providesTags: [SPACES] },\n adminUiDriveTrash: { kind: 'query', request: requests.trashList, providesTags: [NODES] },\n adminUiDriveFolders: { kind: 'query', request: requests.folders, providesTags: [NODES] },\n adminUiDriveVersions: { kind: 'query', request: requests.versions, providesTags: [NODES] },\n adminUiDriveEvents: { kind: 'query', request: requests.events, providesTags: [NODES] },\n adminUiDriveVersionRestore: { kind: 'mutation', request: requests.restoreVersion, invalidatesTags: [NODES, SPACES] },\n adminUiDriveNodeMetadata: { kind: 'mutation', request: requests.metadata, invalidatesTags: [NODES] },\n adminUiDriveNodesMove: { kind: 'mutation', request: requests.bulkMove, invalidatesTags: [NODES, SPACES] },\n adminUiDriveNodesTrash: { kind: 'mutation', request: requests.bulkTrash, invalidatesTags: [NODES, SPACES] },\n adminUiDriveNodesRestore: { kind: 'mutation', request: requests.bulkRestore, invalidatesTags: [NODES, SPACES] },\n adminUiDriveNodesPurge: { kind: 'mutation', request: requests.bulkPurge, invalidatesTags: [NODES, SPACES] },\n adminUiDriveTrashEmpty: { kind: 'mutation', request: requests.emptyTrash, invalidatesTags: [NODES, SPACES] },\n adminUiDriveResolve: { kind: 'mutation', request: requests.resolve },\n } as const satisfies Record<string, InjectedEndpointDefinition<never>>;\n};\n\n/**\n * Injects the cloud drive operations into the host's RTK Query api and returns their hooks. Call it once at module\n * scope: `export const cloudDriveApi = createCloudDriveApi({ baseApi: adminApi, apiPrefix: '/api/admin/common/cloudDrive' });`\n */\nexport const createCloudDriveApi = ({ baseApi, apiPrefix, audience }: CreateCloudDriveApiOptions): CloudDriveApi => {\n const hooks = injectCloudDriveEndpoints(baseApi, apiPrefix);\n return audience ? { ...hooks, audience } : hooks;\n};\n\nconst injectCloudDriveEndpoints = (baseApi: InjectableBaseApi, apiPrefix: string): CloudDriveApi =>\n injectEndpointsOnce(baseApi, `clouddrive:${trimApiPrefix(apiPrefix)}`, [CLOUD_DRIVE_TAG], cloudDriveEndpointDefinitions(apiPrefix), hookOf => ({\n useDriveSpacesQuery: hookOf('adminUiDriveSpaces') as CloudDriveApi['useDriveSpacesQuery'],\n useDriveChildrenQuery: hookOf('adminUiDriveChildren') as CloudDriveApi['useDriveChildrenQuery'],\n useDriveSearchQuery: hookOf('adminUiDriveSearch') as CloudDriveApi['useDriveSearchQuery'],\n useDriveNodeQuery: hookOf('adminUiDriveNode') as CloudDriveApi['useDriveNodeQuery'],\n useDriveFileCardsQuery: hookOf('adminUiDriveFileCards') as CloudDriveApi['useDriveFileCardsQuery'],\n useCreateDriveFolderMutation: hookOf('adminUiDriveFolderCreate') as CloudDriveApi['useCreateDriveFolderMutation'],\n useReserveDriveUploadMutation: hookOf('adminUiDriveUploadReserve') as CloudDriveApi['useReserveDriveUploadMutation'],\n useCompleteDriveUploadMutation: hookOf('adminUiDriveUploadComplete') as CloudDriveApi['useCompleteDriveUploadMutation'],\n useDriveContentMutation: hookOf('adminUiDriveContent') as CloudDriveApi['useDriveContentMutation'],\n useMoveDriveNodeMutation: hookOf('adminUiDriveNodeMove') as CloudDriveApi['useMoveDriveNodeMutation'],\n useTrashDriveNodeMutation: hookOf('adminUiDriveNodeTrash') as CloudDriveApi['useTrashDriveNodeMutation'],\n useRestoreDriveNodeMutation: hookOf('adminUiDriveNodeRestore') as CloudDriveApi['useRestoreDriveNodeMutation'],\n useDriveSpaceQuery: hookOf('adminUiDriveSpace') as CloudDriveApi['useDriveSpaceQuery'],\n useDriveTrashQuery: hookOf('adminUiDriveTrash') as CloudDriveApi['useDriveTrashQuery'],\n useDriveFoldersQuery: hookOf('adminUiDriveFolders') as CloudDriveApi['useDriveFoldersQuery'],\n useDriveVersionsQuery: hookOf('adminUiDriveVersions') as CloudDriveApi['useDriveVersionsQuery'],\n useDriveEventsQuery: hookOf('adminUiDriveEvents') as CloudDriveApi['useDriveEventsQuery'],\n useRestoreDriveVersionMutation: hookOf('adminUiDriveVersionRestore') as CloudDriveApi['useRestoreDriveVersionMutation'],\n useUpdateDriveNodeMetadataMutation: hookOf('adminUiDriveNodeMetadata') as CloudDriveApi['useUpdateDriveNodeMetadataMutation'],\n useMoveDriveNodesMutation: hookOf('adminUiDriveNodesMove') as CloudDriveApi['useMoveDriveNodesMutation'],\n useTrashDriveNodesMutation: hookOf('adminUiDriveNodesTrash') as CloudDriveApi['useTrashDriveNodesMutation'],\n useRestoreDriveNodesMutation: hookOf('adminUiDriveNodesRestore') as CloudDriveApi['useRestoreDriveNodesMutation'],\n usePurgeDriveNodesMutation: hookOf('adminUiDriveNodesPurge') as CloudDriveApi['usePurgeDriveNodesMutation'],\n useEmptyDriveTrashMutation: hookOf('adminUiDriveTrashEmpty') as CloudDriveApi['useEmptyDriveTrashMutation'],\n useResolveDriveLocationMutation: hookOf('adminUiDriveResolve') as CloudDriveApi['useResolveDriveLocationMutation'],\n }));\n\n/** Fixed answers of a `createStaticCloudDriveApi`; a query without one stays loading. */\nexport interface StaticCloudDriveData {\n spaces?: DriveSpacesResponse | StaticQueryFailure;\n children?: (arg: DriveChildrenArg) => DriveNodesResponse | StaticQueryFailure | undefined;\n search?: (arg: DriveSearchArg) => DriveNodesResponse | StaticQueryFailure | undefined;\n node?: (arg: DriveNodeIdArg) => DriveNodeResponse | StaticQueryFailure | undefined;\n cards?: (arg: DriveFileCardsArg) => DriveFileCardsResponse | StaticQueryFailure | undefined;\n space?: (arg: DriveSpaceIdArg) => DriveSpaceResponse | StaticQueryFailure | undefined;\n trash?: (arg: DriveTrashArg) => DriveNodesResponse | StaticQueryFailure | undefined;\n folders?: (arg: DriveFoldersArg) => DriveFoldersResponse | StaticQueryFailure | undefined;\n versions?: (arg: DriveNodeIdArg) => DriveListItemsResponse<DriveFileVersionListItem> | StaticQueryFailure | undefined;\n events?: (arg: DriveEventsArg) => DriveListItemsResponse<DriveChangeEventListItem> | StaticQueryFailure | undefined;\n /** The answer of a path lookup; `undefined` = not found. */\n resolve?: (arg: DriveLocationResolveArg) => DriveLocationResolveResponse | undefined;\n /** The audience the static api answers as. */\n audience?: CloudDriveAudience;\n}\n\nconst NOT_AVAILABLE = (): never => {\n throw { status: 403, data: { error: 'Not available in this preview' } };\n};\n\n/** A `CloudDriveApi` answering fixed payloads, without a store or a request; writes are refused. */\nexport const createStaticCloudDriveApi = (data: StaticCloudDriveData): CloudDriveApi => ({\n useDriveSpacesQuery: staticQueryHook(() => data.spaces),\n useDriveChildrenQuery: staticQueryHook(arg => data.children?.(arg)),\n useDriveSearchQuery: staticQueryHook(arg => data.search?.(arg)),\n useDriveNodeQuery: staticQueryHook(arg => data.node?.(arg)),\n useDriveFileCardsQuery: staticQueryHook(arg => data.cards?.(arg)),\n useCreateDriveFolderMutation: staticMutationHook(NOT_AVAILABLE),\n useReserveDriveUploadMutation: staticMutationHook(NOT_AVAILABLE),\n useCompleteDriveUploadMutation: staticMutationHook(NOT_AVAILABLE),\n useDriveContentMutation: staticMutationHook(NOT_AVAILABLE),\n useMoveDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),\n useTrashDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),\n useRestoreDriveNodeMutation: staticMutationHook(NOT_AVAILABLE),\n useDriveSpaceQuery: staticQueryHook(arg => data.space?.(arg)),\n useDriveTrashQuery: staticQueryHook(arg => data.trash?.(arg)),\n useDriveFoldersQuery: staticQueryHook(arg => data.folders?.(arg)),\n useDriveVersionsQuery: staticQueryHook(arg => data.versions?.(arg)),\n useDriveEventsQuery: staticQueryHook(arg => data.events?.(arg)),\n useRestoreDriveVersionMutation: staticMutationHook(NOT_AVAILABLE),\n useUpdateDriveNodeMetadataMutation: staticMutationHook(NOT_AVAILABLE),\n useMoveDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),\n useTrashDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),\n useRestoreDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),\n usePurgeDriveNodesMutation: staticMutationHook(NOT_AVAILABLE),\n useEmptyDriveTrashMutation: staticMutationHook(NOT_AVAILABLE),\n useResolveDriveLocationMutation: staticMutationHook((arg: DriveLocationResolveArg) => {\n const answer = data.resolve?.(arg);\n if (!answer) throw { status: 404, data: { error: 'Not found', missingSegment: arg.path } };\n return answer;\n }),\n ...(data.audience ? { audience: data.audience } : {}),\n});\n"],"mappings":";;;AAAA;AAAA,EAME;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqCA,IAAM,kBAAkB;AAsE/B,IAAM,OAAO,CAAC,OAAuB,mBAAmB,OAAO,EAAE,CAAC;AAG3D,IAAM,0BAA0B,CAAC,cAAsB;AAC5D,QAAM,SAAS,cAAc,SAAS;AACtC,SAAO;AAAA,IACL,QAAQ,OAAwB,EAAE,KAAK,GAAG,MAAM,eAAe;AAAA,IAC/D,UAAU,CAAC,EAAE,cAAc,cAAc,QAAQ,OAAO,eAAe,WAAW,OAAO,QAAQ,aAAa,WAAW,aAAa,SAAS,eAAe,OAA0C;AAAA,MACtM,KAAK,GAAG,MAAM,WAAW,KAAK,YAAY,CAAC,YAAY,cAAc;AAAA,QACnE;AAAA,QAAc;AAAA,QAAQ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