@fnndsc/cumin 3.30.5 → 3.31.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/dist/cache/checkpointWatch.d.ts +36 -0
- package/dist/cache/checkpointWatch.js +83 -0
- package/dist/cache/checkpointWatch.js.map +1 -0
- package/dist/cache/index.d.ts +1 -1
- package/dist/cache/index.js +4 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/listCache.d.ts +54 -2
- package/dist/cache/listCache.js +120 -24
- package/dist/cache/listCache.js.map +1 -1
- package/dist/cache/listCheckpoint.d.ts +5 -8
- package/dist/cache/listCheckpoint.js +17 -28
- package/dist/cache/listCheckpoint.js.map +1 -1
- package/dist/cache/listingInvalidation.js +11 -6
- package/dist/cache/listingInvalidation.js.map +1 -1
- package/dist/cache/procCache.d.ts +11 -0
- package/dist/cache/procCache.js +26 -1
- package/dist/cache/procCache.js.map +1 -1
- package/dist/cache/procCheckpoint.d.ts +11 -6
- package/dist/cache/procCheckpoint.js +280 -86
- package/dist/cache/procCheckpoint.js.map +1 -1
- package/dist/cache/queryIndex.d.ts +11 -0
- package/dist/cache/queryIndex.js +38 -2
- package/dist/cache/queryIndex.js.map +1 -1
- package/dist/cache/queryIndexCheckpoint.d.ts +32 -0
- package/dist/cache/queryIndexCheckpoint.js +180 -30
- package/dist/cache/queryIndexCheckpoint.js.map +1 -1
- package/dist/chrisapi/adapter.d.ts +266 -37
- package/dist/chrisapi/adapter.js +577 -116
- package/dist/chrisapi/adapter.js.map +1 -1
- package/dist/chrisapi/contract.d.ts +20 -20
- package/dist/chrisapi/contract.js +213 -60
- package/dist/chrisapi/contract.js.map +1 -1
- package/dist/chrisapi/cubeRequest.d.ts +198 -0
- package/dist/chrisapi/cubeRequest.js +345 -0
- package/dist/chrisapi/cubeRequest.js.map +1 -0
- package/dist/chrisapi/shape.d.ts +186 -0
- package/dist/chrisapi/shape.js +274 -0
- package/dist/chrisapi/shape.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/compute/computeResources.d.ts +3 -0
- package/dist/compute/computeResources.js +5 -3
- package/dist/compute/computeResources.js.map +1 -1
- package/dist/config/config.d.ts +14 -0
- package/dist/config/config.js +6 -3
- package/dist/config/config.js.map +1 -1
- package/dist/connect/chrisConnection.d.ts +116 -6
- package/dist/connect/chrisConnection.js +418 -74
- package/dist/connect/chrisConnection.js.map +1 -1
- package/dist/connect/identityEpoch.d.ts +263 -0
- package/dist/connect/identityEpoch.js +414 -0
- package/dist/connect/identityEpoch.js.map +1 -0
- package/dist/connect/loginFailure.js +39 -22
- package/dist/connect/loginFailure.js.map +1 -1
- package/dist/context/chrisContext.js +36 -30
- package/dist/context/chrisContext.js.map +1 -1
- package/dist/error/errorStack.d.ts +1 -1
- package/dist/error/errorStack.js +1 -2
- package/dist/error/errorStack.js.map +1 -1
- package/dist/feeds/chrisAccess.d.ts +7 -2
- package/dist/feeds/chrisAccess.js +20 -7
- package/dist/feeds/chrisAccess.js.map +1 -1
- package/dist/feeds/chrisFeed.d.ts +8 -10
- package/dist/feeds/chrisFeed.js +27 -57
- package/dist/feeds/chrisFeed.js.map +1 -1
- package/dist/feeds/chrisTags.d.ts +1 -1
- package/dist/feeds/chrisTags.js +66 -24
- package/dist/feeds/chrisTags.js.map +1 -1
- package/dist/filebrowser/chrisFileBrowser.d.ts +0 -1
- package/dist/filebrowser/chrisFileBrowser.js +3 -5
- package/dist/filebrowser/chrisFileBrowser.js.map +1 -1
- package/dist/filebrowser/chrisFiles.d.ts +0 -1
- package/dist/filebrowser/chrisFiles.js +3 -4
- package/dist/filebrowser/chrisFiles.js.map +1 -1
- package/dist/filebrowser/chrisPACS.d.ts +4 -4
- package/dist/filebrowser/chrisPACS.js +10 -33
- package/dist/filebrowser/chrisPACS.js.map +1 -1
- package/dist/filebrowser/chrisPipeline.js +10 -45
- package/dist/filebrowser/chrisPipeline.js.map +1 -1
- package/dist/groups/chrisGroups.d.ts +3 -0
- package/dist/groups/chrisGroups.js +20 -8
- package/dist/groups/chrisGroups.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +18 -28
- package/dist/index.js.map +1 -1
- package/dist/io/chrisIO.d.ts +81 -42
- package/dist/io/chrisIO.js +176 -325
- package/dist/io/chrisIO.js.map +1 -1
- package/dist/io/holderClient.d.ts +248 -0
- package/dist/io/holderClient.js +289 -0
- package/dist/io/holderClient.js.map +1 -0
- package/dist/io/holderFolder.d.ts +151 -0
- package/dist/io/holderFolder.js +311 -0
- package/dist/io/holderFolder.js.map +1 -0
- package/dist/io/holderIO.d.ts +258 -0
- package/dist/io/holderIO.js +557 -0
- package/dist/io/holderIO.js.map +1 -0
- package/dist/io/holderRequest.d.ts +299 -0
- package/dist/io/holderRequest.js +447 -0
- package/dist/io/holderRequest.js.map +1 -0
- package/dist/io/holderUpload.d.ts +62 -0
- package/dist/io/holderUpload.js +81 -0
- package/dist/io/holderUpload.js.map +1 -0
- package/dist/io/io.d.ts +12 -0
- package/dist/io/io.js.map +1 -1
- package/dist/io/localUpload.d.ts +59 -0
- package/dist/io/localUpload.js +150 -0
- package/dist/io/localUpload.js.map +1 -0
- package/dist/io/node_io.d.ts +16 -0
- package/dist/io/node_io.js +72 -0
- package/dist/io/node_io.js.map +1 -1
- package/dist/io/streamWatch.js +2 -2
- package/dist/io/streamWatch.js.map +1 -1
- package/dist/io/transferPool.d.ts +150 -0
- package/dist/io/transferPool.js +196 -0
- package/dist/io/transferPool.js.map +1 -0
- package/dist/pacs/chrisPACS.d.ts +3 -9
- package/dist/pacs/chrisPACS.js +102 -61
- package/dist/pacs/chrisPACS.js.map +1 -1
- package/dist/pacs/queryIndexSweep.d.ts +0 -9
- package/dist/pacs/queryIndexSweep.js +45 -41
- package/dist/pacs/queryIndexSweep.js.map +1 -1
- package/dist/path/chrisPath.d.ts +8 -3
- package/dist/path/chrisPath.js +10 -9
- package/dist/path/chrisPath.js.map +1 -1
- package/dist/pipelines/chrisPipeline.d.ts +28 -5
- package/dist/pipelines/chrisPipeline.js +270 -94
- package/dist/pipelines/chrisPipeline.js.map +1 -1
- package/dist/pipelines/pipelineMemo.d.ts +0 -16
- package/dist/pipelines/pipelineMemo.js +0 -27
- package/dist/pipelines/pipelineMemo.js.map +1 -1
- package/dist/plugins/chrisPlugins.d.ts +9 -5
- package/dist/plugins/chrisPlugins.js +97 -58
- package/dist/plugins/chrisPlugins.js.map +1 -1
- package/dist/resources/chrisObjContext.d.ts +7 -11
- package/dist/resources/chrisObjContext.js +7 -42
- package/dist/resources/chrisObjContext.js.map +1 -1
- package/dist/resources/chrisResources.d.ts +186 -74
- package/dist/resources/chrisResources.js +421 -117
- package/dist/resources/chrisResources.js.map +1 -1
- package/dist/resources/resourceShapes.d.ts +109 -0
- package/dist/resources/resourceShapes.js +22 -0
- package/dist/resources/resourceShapes.js.map +1 -0
- package/dist/users/chrisUsers.d.ts +4 -1
- package/dist/users/chrisUsers.js +6 -2
- package/dist/users/chrisUsers.js.map +1 -1
- package/dist/utils/keypair.js +21 -10
- package/dist/utils/keypair.js.map +1 -1
- package/package.json +15 -3
- package/dist/activities/chrisActivity.d.ts +0 -19
- package/dist/activities/chrisActivity.js +0 -29
- package/dist/activities/chrisActivity.js.map +0 -1
- package/dist/jobs/chrisJob.d.ts +0 -43
- package/dist/jobs/chrisJob.js +0 -174
- package/dist/jobs/chrisJob.js.map +0 -1
- package/dist/jobs/index.d.ts +0 -7
- package/dist/jobs/index.js +0 -24
- package/dist/jobs/index.js.map +0 -1
- package/dist/jobs/jobMonitor.d.ts +0 -46
- package/dist/jobs/jobMonitor.js +0 -102
- package/dist/jobs/jobMonitor.js.map +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file CUBE's own address for one thing it holds, and one request there.
|
|
3
|
+
*
|
|
4
|
+
* Every request that acts on a proved holder, or asks after one, goes to an
|
|
5
|
+
* address built here from three things alone: the API root the client was
|
|
6
|
+
* made with, CUBE's route for the kind (CUBE's `core/api.py`), and the
|
|
7
|
+
* proved id. An address a listing row or a search row carried is never
|
|
8
|
+
* asked: it came from a listing, the token goes with every request, and a
|
|
9
|
+
* row whose address names anything else is refused before anything is
|
|
10
|
+
* asked. No request follows a redirect, and none waits longer than
|
|
11
|
+
* chrisapi's own default (30 s).
|
|
12
|
+
*
|
|
13
|
+
* Key components:
|
|
14
|
+
* - StoreKind, StoreHolder: what holds a path, as a proof names it.
|
|
15
|
+
* - itemUrl_build, itemHref_matches, itemHref_refusal: CUBE's address for an item, and a row's address checked against it.
|
|
16
|
+
* - userFilesUrl_build: CUBE's address for a new user file.
|
|
17
|
+
* - folderListUrl_build, folderSearchUrl_build: a folder's own collections, and the search for the folder at a path.
|
|
18
|
+
* - cube_ask: one request, with the client's token, no redirect followed, a deadline held.
|
|
19
|
+
* - answerItem_read, itemFields_read, answerRefusal_read, refusalWords_read, answerList_read: what an answer carries.
|
|
20
|
+
* - itemStatus_probe: what CUBE answers at an item's address.
|
|
21
|
+
*
|
|
22
|
+
* Typical usage:
|
|
23
|
+
* ```ts
|
|
24
|
+
* const url: string | null = itemUrl_build(client, 'file', 41);
|
|
25
|
+
* const answer: CubeAnswer | null = url === null ? null : await cube_ask(client, url, 'GET');
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Dependencies: the chrisapi adapter (the client's token and API root) and
|
|
29
|
+
* the platform's `fetch`.
|
|
30
|
+
*
|
|
31
|
+
* @module
|
|
32
|
+
*/
|
|
33
|
+
import { type Client } from "../chrisapi/adapter.js";
|
|
34
|
+
/** How long one request may take: chrisapi's own default. */
|
|
35
|
+
export declare const REQUEST_TIMEOUT_MS: number;
|
|
36
|
+
/** What CUBE holds at a path: a folder, a file or a link. */
|
|
37
|
+
export type StoreKind = "dir" | "file" | "link";
|
|
38
|
+
/**
|
|
39
|
+
* One thing holding a path, as a whole listing of its parent named it.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const holder: StoreHolder = { kind: 'link', id: 5, href: 'https://cube/api/v1/filebrowser/linkfiles/5/' };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export interface StoreHolder {
|
|
47
|
+
/** A folder, a file or a link. */
|
|
48
|
+
readonly kind: StoreKind;
|
|
49
|
+
/** Its id in CUBE. */
|
|
50
|
+
readonly id: number;
|
|
51
|
+
/** Its own REST address, as its listing row carried it; null when the row carried none. */
|
|
52
|
+
readonly href: string | null;
|
|
53
|
+
}
|
|
54
|
+
/** A folder's own collections, below its address (`children/`, `files/`, `linkfiles/`). */
|
|
55
|
+
export type FolderList = "children" | "files" | "linkfiles";
|
|
56
|
+
/**
|
|
57
|
+
* What CUBE answered one request with.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const answer: CubeAnswer = { status: 404, body: null };
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export interface CubeAnswer {
|
|
65
|
+
/** The HTTP status (a redirect's own). */
|
|
66
|
+
readonly status: number;
|
|
67
|
+
/** The body, read as JSON; null when there was none, or it was not JSON. */
|
|
68
|
+
readonly body: unknown;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What one request may carry, and what may end it early.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const asked: CubeRequest = { template: { upload_path: '/home/ada/b.txt' } };
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export interface CubeRequest {
|
|
79
|
+
/** The fields a PUT sends, as a collection+json template. */
|
|
80
|
+
readonly template?: Readonly<Record<string, string>>;
|
|
81
|
+
/** Ends the request early, beside its own deadline. */
|
|
82
|
+
readonly signal?: AbortSignal;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* CUBE's own address for one item: the client's API root, the kind's route,
|
|
86
|
+
* and the id.
|
|
87
|
+
*
|
|
88
|
+
* @param client - The client the item was proved with.
|
|
89
|
+
* @param kind - What the item is.
|
|
90
|
+
* @param id - Its id.
|
|
91
|
+
* @returns The address, or null for an id that is not a positive whole number or a client with no usable root.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* itemUrl_build(client, 'link', 5); // 'https://cube/api/v1/filebrowser/linkfiles/5/'
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function itemUrl_build(client: Client, kind: StoreKind, id: number): string | null;
|
|
99
|
+
/**
|
|
100
|
+
* CUBE's own address for a new user file: the client's API root and the
|
|
101
|
+
* file route, never the address the root's own answer advertised.
|
|
102
|
+
*
|
|
103
|
+
* @param client - The client the upload is made on.
|
|
104
|
+
* @returns The address, or null for a client with no usable root.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* userFilesUrl_build(client); // 'https://cube/api/v1/userfiles/'
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function userFilesUrl_build(client: Client): string | null;
|
|
112
|
+
/**
|
|
113
|
+
* One page of a folder's collection: how many rows, from which.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const page: PageAsk = { limit: 100, offset: 200 };
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export interface PageAsk {
|
|
121
|
+
/** The rows the page holds at most. */
|
|
122
|
+
readonly limit: number;
|
|
123
|
+
/** The rows before it; none named when absent. */
|
|
124
|
+
readonly offset?: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The address of one of a folder's own collections: the folder's address
|
|
128
|
+
* and the collection's name, never the link a row gave. Asked for one row
|
|
129
|
+
* unless a page is named.
|
|
130
|
+
*
|
|
131
|
+
* @param client - The client.
|
|
132
|
+
* @param id - The folder's id.
|
|
133
|
+
* @param list - Which collection.
|
|
134
|
+
* @param page - The page asked for; one row when not given.
|
|
135
|
+
* @returns The address, or null as {@link itemUrl_build}.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* folderListUrl_build(client, 7, 'files'); // 'https://cube/api/v1/filebrowser/7/files/?limit=1'
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function folderListUrl_build(client: Client, id: number, list: FolderList, page?: PageAsk): string | null;
|
|
143
|
+
/**
|
|
144
|
+
* The address of CUBE's search for the folder at one path.
|
|
145
|
+
*
|
|
146
|
+
* @param client - The client.
|
|
147
|
+
* @param folderPath - The folder's path, as a proof spells it.
|
|
148
|
+
* @returns The address, or null for a client with no usable root.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* folderSearchUrl_build(client, '/home/ada'); // 'https://cube/api/v1/filebrowser/search/?path=%2Fhome%2Fada'
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export declare function folderSearchUrl_build(client: Client, folderPath: string): string | null;
|
|
156
|
+
/**
|
|
157
|
+
* Whether an address a listing gave is CUBE's own for an item: the client's
|
|
158
|
+
* origin, and exactly one of the kind's routes for that id, with nothing after.
|
|
159
|
+
*
|
|
160
|
+
* @param client - The client.
|
|
161
|
+
* @param kind - What the item is.
|
|
162
|
+
* @param id - Its id.
|
|
163
|
+
* @param href - The address the listing gave.
|
|
164
|
+
* @returns True only for such an address.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* itemHref_matches(client, 'link', 5, 'https://elsewhere/api/v1/filebrowser/linkfiles/5/'); // false
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function itemHref_matches(client: Client, kind: StoreKind, id: number, href: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Why an act on an item is not asked: no address of CUBE's own can be built
|
|
174
|
+
* for it, or its row named another, the refusal naming both origins.
|
|
175
|
+
*
|
|
176
|
+
* @param client - The client.
|
|
177
|
+
* @param holder - The item, as its proof named it.
|
|
178
|
+
* @param act - The act, for the words (`delete`, `move`).
|
|
179
|
+
* @returns The refusal's words, or null when the act may be asked.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* itemHref_refusal(client, { kind: 'file', id: 41, href: 'https://elsewhere/x/' }, 'delete');
|
|
184
|
+
* // "Did not delete file ID 41: its row's address is at https://elsewhere, and CUBE's own for that file is at https://cube; nothing was asked"
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function itemHref_refusal(client: Client, holder: StoreHolder, act: string): string | null;
|
|
188
|
+
/**
|
|
189
|
+
* One request to an address of CUBE's own, with the client's token,
|
|
190
|
+
* following no redirect and ending at its deadline.
|
|
191
|
+
*
|
|
192
|
+
* @param client - The client.
|
|
193
|
+
* @param url - The address, built here.
|
|
194
|
+
* @param method - `GET`, `PUT` or `DELETE`.
|
|
195
|
+
* @param asked - A PUT's fields, and a signal that ends the request early.
|
|
196
|
+
* @returns What CUBE answered, or null when no answer came (none could be asked, or none in time).
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const answer: CubeAnswer | null = await cube_ask(client, url, 'PUT', { template: { path: '/home/ada/new' } });
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export declare function cube_ask(client: Client, url: string, method: "GET" | "PUT" | "DELETE", asked?: CubeRequest): Promise<CubeAnswer | null>;
|
|
204
|
+
/**
|
|
205
|
+
* The fields of the one item an answer for an item carries: exactly one,
|
|
206
|
+
* since a detail address that answers with none, or with several, has not
|
|
207
|
+
* said which thing it is.
|
|
208
|
+
*
|
|
209
|
+
* @param body - The answer's body.
|
|
210
|
+
* @returns Its fields by name, or null when it carries no item, or more than one.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* answerItem_read(answer.body)?.fname; // 'home/ada/a.txt'
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
export declare function answerItem_read(body: unknown): Record<string, unknown> | null;
|
|
218
|
+
/**
|
|
219
|
+
* The fields of one collection+json item, by name.
|
|
220
|
+
*
|
|
221
|
+
* @param item - The item, as a collection carries it.
|
|
222
|
+
* @returns Its fields, or null when it is no item.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* itemFields_read({ data: [{ name: 'id', value: 7 }] }); // { id: 7 }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export declare function itemFields_read(item: unknown): Record<string, unknown> | null;
|
|
230
|
+
/**
|
|
231
|
+
* A refusal's words, short: the message of a collection's error, or a body
|
|
232
|
+
* that is no collection; nothing for anything else.
|
|
233
|
+
*
|
|
234
|
+
* @param body - The answer's body.
|
|
235
|
+
* @returns The words, or an empty string.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* refusalWords_read(answer.body); // '{"path":["This field is required."]}'
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function refusalWords_read(body: unknown): string;
|
|
243
|
+
/**
|
|
244
|
+
* What a refusal says, as CUBE's serializers said it: the message of a
|
|
245
|
+
* collection's error, read as JSON when it is (CUBE writes a field's
|
|
246
|
+
* refusals so), else the body as it came.
|
|
247
|
+
*
|
|
248
|
+
* @param body - The refusal's body.
|
|
249
|
+
* @returns What it says.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* answerRefusal_read(answer.body); // { path: ['This field is required.'] }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export declare function answerRefusal_read(body: unknown): unknown;
|
|
257
|
+
/**
|
|
258
|
+
* One page of a collection, as an answer carries it.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* const page: ListPage = { items: [], more: false, total: 0 };
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export interface ListPage {
|
|
266
|
+
/** The rows on the page. */
|
|
267
|
+
readonly items: readonly unknown[];
|
|
268
|
+
/** Whether a link of rel `next` says a page follows. */
|
|
269
|
+
readonly more: boolean;
|
|
270
|
+
/** The count CUBE reported; null when it reported none. */
|
|
271
|
+
readonly total: number | null;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The page a collection's answer carries.
|
|
275
|
+
*
|
|
276
|
+
* @param body - The answer's body.
|
|
277
|
+
* @returns The page, or null when it carries no items and links to read.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* const empty: boolean = answerList_read(answer.body)?.items.length === 0;
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
export declare function answerList_read(body: unknown): ListPage | null;
|
|
285
|
+
/**
|
|
286
|
+
* What CUBE answers at an item's own address, as the client it was proved with.
|
|
287
|
+
*
|
|
288
|
+
* @param client - The client.
|
|
289
|
+
* @param kind - What the item is.
|
|
290
|
+
* @param id - Its id.
|
|
291
|
+
* @param signal - Ends the question early, when given.
|
|
292
|
+
* @returns The HTTP status, or null when it could not be asked.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* const gone: boolean = (await itemStatus_probe(client, 'file', 41)) === 404;
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
export declare function itemStatus_probe(client: Client, kind: StoreKind, id: number, signal?: AbortSignal): Promise<number | null>;
|