@fnndsc/cumin 3.30.6 → 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.
Files changed (161) hide show
  1. package/dist/cache/checkpointWatch.d.ts +36 -0
  2. package/dist/cache/checkpointWatch.js +83 -0
  3. package/dist/cache/checkpointWatch.js.map +1 -0
  4. package/dist/cache/index.d.ts +1 -1
  5. package/dist/cache/index.js +4 -1
  6. package/dist/cache/index.js.map +1 -1
  7. package/dist/cache/listCache.d.ts +54 -2
  8. package/dist/cache/listCache.js +120 -24
  9. package/dist/cache/listCache.js.map +1 -1
  10. package/dist/cache/listCheckpoint.d.ts +5 -8
  11. package/dist/cache/listCheckpoint.js +17 -28
  12. package/dist/cache/listCheckpoint.js.map +1 -1
  13. package/dist/cache/listingInvalidation.js +11 -6
  14. package/dist/cache/listingInvalidation.js.map +1 -1
  15. package/dist/cache/procCache.d.ts +11 -0
  16. package/dist/cache/procCache.js +26 -1
  17. package/dist/cache/procCache.js.map +1 -1
  18. package/dist/cache/procCheckpoint.d.ts +11 -6
  19. package/dist/cache/procCheckpoint.js +280 -86
  20. package/dist/cache/procCheckpoint.js.map +1 -1
  21. package/dist/cache/queryIndex.d.ts +11 -0
  22. package/dist/cache/queryIndex.js +38 -2
  23. package/dist/cache/queryIndex.js.map +1 -1
  24. package/dist/cache/queryIndexCheckpoint.d.ts +32 -0
  25. package/dist/cache/queryIndexCheckpoint.js +180 -30
  26. package/dist/cache/queryIndexCheckpoint.js.map +1 -1
  27. package/dist/chrisapi/adapter.d.ts +266 -37
  28. package/dist/chrisapi/adapter.js +577 -116
  29. package/dist/chrisapi/adapter.js.map +1 -1
  30. package/dist/chrisapi/contract.d.ts +20 -20
  31. package/dist/chrisapi/contract.js +213 -60
  32. package/dist/chrisapi/contract.js.map +1 -1
  33. package/dist/chrisapi/cubeRequest.d.ts +198 -0
  34. package/dist/chrisapi/cubeRequest.js +345 -0
  35. package/dist/chrisapi/cubeRequest.js.map +1 -0
  36. package/dist/chrisapi/shape.d.ts +186 -0
  37. package/dist/chrisapi/shape.js +274 -0
  38. package/dist/chrisapi/shape.js.map +1 -0
  39. package/dist/cli.js +2 -1
  40. package/dist/cli.js.map +1 -1
  41. package/dist/compute/computeResources.d.ts +3 -0
  42. package/dist/compute/computeResources.js +5 -3
  43. package/dist/compute/computeResources.js.map +1 -1
  44. package/dist/config/config.d.ts +14 -0
  45. package/dist/config/config.js +6 -3
  46. package/dist/config/config.js.map +1 -1
  47. package/dist/connect/chrisConnection.d.ts +116 -6
  48. package/dist/connect/chrisConnection.js +418 -74
  49. package/dist/connect/chrisConnection.js.map +1 -1
  50. package/dist/connect/identityEpoch.d.ts +263 -0
  51. package/dist/connect/identityEpoch.js +414 -0
  52. package/dist/connect/identityEpoch.js.map +1 -0
  53. package/dist/connect/loginFailure.js +39 -22
  54. package/dist/connect/loginFailure.js.map +1 -1
  55. package/dist/context/chrisContext.js +36 -30
  56. package/dist/context/chrisContext.js.map +1 -1
  57. package/dist/error/errorStack.d.ts +1 -1
  58. package/dist/error/errorStack.js +1 -2
  59. package/dist/error/errorStack.js.map +1 -1
  60. package/dist/feeds/chrisAccess.d.ts +7 -2
  61. package/dist/feeds/chrisAccess.js +20 -7
  62. package/dist/feeds/chrisAccess.js.map +1 -1
  63. package/dist/feeds/chrisFeed.d.ts +8 -10
  64. package/dist/feeds/chrisFeed.js +27 -57
  65. package/dist/feeds/chrisFeed.js.map +1 -1
  66. package/dist/feeds/chrisTags.d.ts +1 -1
  67. package/dist/feeds/chrisTags.js +66 -24
  68. package/dist/feeds/chrisTags.js.map +1 -1
  69. package/dist/filebrowser/chrisFileBrowser.d.ts +0 -1
  70. package/dist/filebrowser/chrisFileBrowser.js +3 -5
  71. package/dist/filebrowser/chrisFileBrowser.js.map +1 -1
  72. package/dist/filebrowser/chrisFiles.d.ts +0 -1
  73. package/dist/filebrowser/chrisFiles.js +3 -4
  74. package/dist/filebrowser/chrisFiles.js.map +1 -1
  75. package/dist/filebrowser/chrisPACS.d.ts +4 -4
  76. package/dist/filebrowser/chrisPACS.js +10 -33
  77. package/dist/filebrowser/chrisPACS.js.map +1 -1
  78. package/dist/filebrowser/chrisPipeline.js +10 -45
  79. package/dist/filebrowser/chrisPipeline.js.map +1 -1
  80. package/dist/groups/chrisGroups.d.ts +3 -0
  81. package/dist/groups/chrisGroups.js +20 -8
  82. package/dist/groups/chrisGroups.js.map +1 -1
  83. package/dist/index.d.ts +6 -8
  84. package/dist/index.js +17 -28
  85. package/dist/index.js.map +1 -1
  86. package/dist/io/chrisIO.d.ts +81 -42
  87. package/dist/io/chrisIO.js +176 -325
  88. package/dist/io/chrisIO.js.map +1 -1
  89. package/dist/io/holderClient.d.ts +248 -0
  90. package/dist/io/holderClient.js +289 -0
  91. package/dist/io/holderClient.js.map +1 -0
  92. package/dist/io/holderFolder.d.ts +151 -0
  93. package/dist/io/holderFolder.js +311 -0
  94. package/dist/io/holderFolder.js.map +1 -0
  95. package/dist/io/holderIO.d.ts +258 -0
  96. package/dist/io/holderIO.js +557 -0
  97. package/dist/io/holderIO.js.map +1 -0
  98. package/dist/io/holderRequest.d.ts +299 -0
  99. package/dist/io/holderRequest.js +447 -0
  100. package/dist/io/holderRequest.js.map +1 -0
  101. package/dist/io/holderUpload.d.ts +62 -0
  102. package/dist/io/holderUpload.js +81 -0
  103. package/dist/io/holderUpload.js.map +1 -0
  104. package/dist/io/io.d.ts +12 -0
  105. package/dist/io/io.js.map +1 -1
  106. package/dist/io/localUpload.d.ts +59 -0
  107. package/dist/io/localUpload.js +150 -0
  108. package/dist/io/localUpload.js.map +1 -0
  109. package/dist/io/node_io.d.ts +16 -0
  110. package/dist/io/node_io.js +72 -0
  111. package/dist/io/node_io.js.map +1 -1
  112. package/dist/io/streamWatch.js +2 -2
  113. package/dist/io/streamWatch.js.map +1 -1
  114. package/dist/io/transferPool.d.ts +18 -2
  115. package/dist/io/transferPool.js +32 -7
  116. package/dist/io/transferPool.js.map +1 -1
  117. package/dist/pacs/chrisPACS.d.ts +3 -9
  118. package/dist/pacs/chrisPACS.js +102 -61
  119. package/dist/pacs/chrisPACS.js.map +1 -1
  120. package/dist/pacs/queryIndexSweep.d.ts +0 -9
  121. package/dist/pacs/queryIndexSweep.js +45 -41
  122. package/dist/pacs/queryIndexSweep.js.map +1 -1
  123. package/dist/path/chrisPath.d.ts +8 -3
  124. package/dist/path/chrisPath.js +10 -9
  125. package/dist/path/chrisPath.js.map +1 -1
  126. package/dist/pipelines/chrisPipeline.d.ts +28 -5
  127. package/dist/pipelines/chrisPipeline.js +270 -94
  128. package/dist/pipelines/chrisPipeline.js.map +1 -1
  129. package/dist/pipelines/pipelineMemo.d.ts +0 -16
  130. package/dist/pipelines/pipelineMemo.js +0 -27
  131. package/dist/pipelines/pipelineMemo.js.map +1 -1
  132. package/dist/plugins/chrisPlugins.d.ts +9 -5
  133. package/dist/plugins/chrisPlugins.js +97 -58
  134. package/dist/plugins/chrisPlugins.js.map +1 -1
  135. package/dist/resources/chrisObjContext.d.ts +7 -11
  136. package/dist/resources/chrisObjContext.js +7 -42
  137. package/dist/resources/chrisObjContext.js.map +1 -1
  138. package/dist/resources/chrisResources.d.ts +186 -74
  139. package/dist/resources/chrisResources.js +421 -117
  140. package/dist/resources/chrisResources.js.map +1 -1
  141. package/dist/resources/resourceShapes.d.ts +109 -0
  142. package/dist/resources/resourceShapes.js +22 -0
  143. package/dist/resources/resourceShapes.js.map +1 -0
  144. package/dist/users/chrisUsers.d.ts +4 -1
  145. package/dist/users/chrisUsers.js +6 -2
  146. package/dist/users/chrisUsers.js.map +1 -1
  147. package/dist/utils/keypair.js +21 -10
  148. package/dist/utils/keypair.js.map +1 -1
  149. package/package.json +10 -3
  150. package/dist/activities/chrisActivity.d.ts +0 -19
  151. package/dist/activities/chrisActivity.js +0 -29
  152. package/dist/activities/chrisActivity.js.map +0 -1
  153. package/dist/jobs/chrisJob.d.ts +0 -43
  154. package/dist/jobs/chrisJob.js +0 -174
  155. package/dist/jobs/chrisJob.js.map +0 -1
  156. package/dist/jobs/index.d.ts +0 -7
  157. package/dist/jobs/index.js +0 -24
  158. package/dist/jobs/index.js.map +0 -1
  159. package/dist/jobs/jobMonitor.d.ts +0 -46
  160. package/dist/jobs/jobMonitor.js +0 -102
  161. package/dist/jobs/jobMonitor.js.map +0 -1
@@ -0,0 +1,258 @@
1
+ /**
2
+ * @file Acting on one thing CUBE holds at a path, by how it was proved, never by finding it again.
3
+ *
4
+ * A destructive act is decided on a whole listing of the parent, and the row
5
+ * that listing gave is the thing acted on, by its id, at CUBE's own address
6
+ * for that id (`./holderRequest.js`): a folder at `filebrowser/<id>/`, a
7
+ * file at `userfiles/<id>/`, a link at `filebrowser/linkfiles/<id>/`, each
8
+ * below the API root the client was made with. No address a listing or a
9
+ * search gave is asked, a row whose address names anything else is refused
10
+ * unasked, and no request follows a redirect. Nothing here lists a parent,
11
+ * and nothing looks an id up in the last page of a collection.
12
+ *
13
+ * Whether an act is done is asked the same way, of the thing itself: its
14
+ * own address answering 404. A search is never the evidence, since CUBE
15
+ * filters what it finds by who may see it. A replacement at the same name
16
+ * is a different thing, and is left alone. Whether a folder is empty is
17
+ * asked of its own three collections, by its id, never of a path.
18
+ *
19
+ * An answer about an item is one item, of that id, at a usable path, or it
20
+ * is no answer. A request that changes anything and gets no reply has been
21
+ * asked and is not known: a delete says so (`unanswered`), and a move asks
22
+ * where the item is before it says anything. A 502, 503 or 504 to such a
23
+ * request leaves its outcome unknown, just as no reply does, and nothing is
24
+ * asked again; the words then say what CUBE answered.
25
+ *
26
+ * All of it is done on one client (`HolderClient`, `./holderClient.js`):
27
+ * the one the proof was made with, which is asked to be still the
28
+ * session's immediately before each request that changes anything.
29
+ *
30
+ * Key components:
31
+ * - ActGuard: the row's address, and the question asked before a change.
32
+ * - folder_deleteById, folder_pathById, folder_moveById, folder_isEmptyById: a folder, by id.
33
+ * - link_deleteById: a link, at CUBE's address for its id.
34
+ * - file_deleteById, file_locate, file_moveById: a file, by id.
35
+ * - holder_isGone: whether the thing a delete was asked of is gone.
36
+ * - DeleteAnswer: what a delete came to: accepted, unanswered, or (a folder) absent.
37
+ *
38
+ * Typical usage:
39
+ * ```ts
40
+ * const asked: Result<DeleteAnswer> = await folder_deleteById(client, 7, { current_is: async () => true });
41
+ * ```
42
+ *
43
+ * Dependencies: `./holderRequest.js` (CUBE's addresses and one request
44
+ * there) and cumin's error stack, where a failure's reason is left.
45
+ *
46
+ * @module
47
+ */
48
+ import { type StoreHolder } from "./holderRequest.js";
49
+ import type { Client } from "../chrisapi/adapter.js";
50
+ import { type Result } from "../utils/result.js";
51
+ export { itemHref_matches, itemHref_refusal, itemStatus_probe, itemUrl_build, type StoreHolder, type StoreKind } from "./holderRequest.js";
52
+ /**
53
+ * What an act is checked against before it is asked: the address the row
54
+ * carried (refused unless it is CUBE's own), and whether the client is still
55
+ * the session's, asked immediately before the request.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const guard: ActGuard = { href: 'https://cube/api/v1/filebrowser/7/', current_is: async () => true };
60
+ * ```
61
+ */
62
+ export interface ActGuard {
63
+ /** The address the item's row carried; null or absent when it carried none. */
64
+ readonly href?: string | null;
65
+ /** Whether the client is still the session's, so the act may be asked; false stops it, unasked. */
66
+ readonly current_is?: () => Promise<boolean>;
67
+ }
68
+ /**
69
+ * Where a folder is moved from and to.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const places: FolderPlaces = { from: '/home/ada/old', to: '/home/ada/new' };
74
+ * ```
75
+ */
76
+ export interface FolderPlaces {
77
+ /** The path it was proved at. */
78
+ readonly from: string;
79
+ /** Its new path. */
80
+ readonly to: string;
81
+ }
82
+ /**
83
+ * What a delete CUBE was asked came to: `accepted` (a 2xx), `unanswered`
84
+ * (asked, and no reply came: it may have been done), or, for a folder,
85
+ * `absent` (CUBE has no folder of that id). A definite refusal is Err.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const said: DeleteAnswer = 'unanswered';
90
+ * ```
91
+ */
92
+ export type DeleteAnswer = "accepted" | "unanswered" | "absent";
93
+ /**
94
+ * Asks CUBE to delete a folder, named by its id. CUBE accepts the request
95
+ * (202) and removes the folder after; whether it is gone is a later
96
+ * question ({@link holder_isGone}).
97
+ *
98
+ * @param client - The connected client.
99
+ * @param id - The folder's id.
100
+ * @param guard - Its row's address, and the question asked before the request.
101
+ * @returns `accepted`, `unanswered` (asked, no reply), or `absent` (CUBE has
102
+ * no folder of that id); Err when CUBE refused or nothing was asked (the
103
+ * reason stacked).
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const asked: Result<DeleteAnswer> = await folder_deleteById(client, 7);
108
+ * ```
109
+ */
110
+ export declare function folder_deleteById(client: Client, id: number, guard?: ActGuard): Promise<Result<DeleteAnswer>>;
111
+ /**
112
+ * Where a folder, named by its id, is now, asked at its own address.
113
+ *
114
+ * @param client - The connected client.
115
+ * @param id - The folder's id.
116
+ * @returns Its path with a leading slash; null when no folder has the id;
117
+ * Err when CUBE could not be asked or named no path (the reason stacked).
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const at: Result<string | null> = await folder_pathById(client, 7);
122
+ * ```
123
+ */
124
+ export declare function folder_pathById(client: Client, id: number): Promise<Result<string | null>>;
125
+ /**
126
+ * Moves (renames) a folder, named by its id, from the path it was proved
127
+ * at: the folder the id names now is asked where it is, and moved only
128
+ * when that is still the proved path.
129
+ *
130
+ * @param client - The connected client.
131
+ * @param id - The folder's id.
132
+ * @param places - The path it was proved at, and its new path.
133
+ * @param guard - Its row's address, and the question asked before the request.
134
+ * @returns Ok(true) when CUBE accepted the move (or gave no reply, and the
135
+ * folder is then seen at the new path), Ok(false) when no folder has that
136
+ * id (nothing was asked), Err when it is no longer at the proved path,
137
+ * CUBE refused, or a move with no reply is not seen done (what was found
138
+ * stacked).
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const moved: Result<boolean> = await folder_moveById(client, 7, { from: '/home/ada/old', to: '/home/ada/archive' });
143
+ * ```
144
+ */
145
+ export declare function folder_moveById(client: Client, id: number, places: FolderPlaces, guard?: ActGuard): Promise<Result<boolean>>;
146
+ /**
147
+ * Asks CUBE to delete a link file, at CUBE's own address for its id. A row
148
+ * whose `href` names any other address is refused, and nothing is asked.
149
+ *
150
+ * @param client - The connected client.
151
+ * @param id - The link's id.
152
+ * @param guard - Its row's address (checked, never asked), and the question asked before the request.
153
+ * @returns `accepted`, or `unanswered` (asked, no reply); Err when CUBE
154
+ * refused or nothing was asked (the reason stacked).
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const asked: Result<DeleteAnswer> = await link_deleteById(client, 5, { href: 'https://cube/api/v1/filebrowser/linkfiles/5/' });
159
+ * ```
160
+ */
161
+ export declare function link_deleteById(client: Client, id: number, guard?: ActGuard): Promise<Result<DeleteAnswer>>;
162
+ /**
163
+ * Deletes one file by its id, at CUBE's own address for it, without
164
+ * listing anything.
165
+ *
166
+ * @param client - The connected client.
167
+ * @param id - The file's id.
168
+ * @param guard - Its row's address, and the question asked before the request.
169
+ * @returns `accepted`, or `unanswered` (asked, no reply); Err when no file
170
+ * has the id, CUBE refused, or nothing was asked (the reason stacked).
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const asked: Result<DeleteAnswer> = await file_deleteById(client, 41);
175
+ * ```
176
+ */
177
+ export declare function file_deleteById(client: Client, id: number, guard?: ActGuard): Promise<Result<DeleteAnswer>>;
178
+ /**
179
+ * Where a file is now, asked of CUBE at the file's own address.
180
+ *
181
+ * @param client - The connected client.
182
+ * @param id - The file's id.
183
+ * @returns The file's path with a leading slash; null when CUBE says the
184
+ * file is not there (404); Err when CUBE could not be asked or would not
185
+ * say, which is neither (the reason stacked).
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * const where: Result<string | null> = await file_locate(client, 41);
190
+ * ```
191
+ */
192
+ export declare function file_locate(client: Client, id: number): Promise<Result<string | null>>;
193
+ /**
194
+ * Moves (renames) a file by its id, at CUBE's own address for it.
195
+ *
196
+ * The rename field drifted across CUBE versions: newer servers take
197
+ * `upload_path`, older ones `path` (chrisapi types neither). The current
198
+ * name is tried first. The older one is tried only when CUBE answered the
199
+ * first request and refused it as a field it does not read: a request whose
200
+ * reply was lost may have moved the file, and one refused for another
201
+ * reason will be refused again, so a second write then would be a move
202
+ * nobody checked. A request with no reply is asked where the file is, and
203
+ * that is the answer. Before the second request the caller's recheck is
204
+ * asked, and then, immediately before it, the guard's question.
205
+ *
206
+ * @param client - The connected client.
207
+ * @param id - The file's id.
208
+ * @param destPath - The target path including filename.
209
+ * @param recheck - Asked before the second spelling is tried, when given:
210
+ * whether the move may still be made. False stops the move.
211
+ * @param guard - Its row's address, and the question asked before each request.
212
+ * @returns Ok(true) when CUBE accepted the move, or gave no reply and the
213
+ * file is then seen at `destPath`; Err otherwise, which does not say the
214
+ * file stayed where it was.
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * const moved: Result<boolean> = await file_moveById(client, 41, '/home/ada/b.txt');
219
+ * ```
220
+ */
221
+ export declare function file_moveById(client: Client, id: number, destPath: string, recheck?: () => Promise<boolean>, guard?: ActGuard): Promise<Result<boolean>>;
222
+ /**
223
+ * Whether the thing a delete was asked of is gone, asked of that thing
224
+ * alone: CUBE's own address for its id answering 404 is gone, 200 is
225
+ * there. A refusal, any other status, or no answer says neither; a search
226
+ * is never asked, since CUBE filters what it finds by who may see it. A
227
+ * thing whose row's address is not CUBE's is not asked.
228
+ *
229
+ * @param client - The connected client.
230
+ * @param holder - The thing deleted, as its proof named it.
231
+ * @param signal - Ends the question early, when given.
232
+ * @returns Ok(true) when it is gone, Ok(false) when it is still there, Err
233
+ * when CUBE gave no answer that says either (nothing is stacked: a caller
234
+ * that asks again decides what an unanswered question comes to).
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const gone: Result<boolean> = await holder_isGone(client, { kind: 'file', id: 41, href: null });
239
+ * ```
240
+ */
241
+ export declare function holder_isGone(client: Client, holder: StoreHolder, signal?: AbortSignal): Promise<Result<boolean>>;
242
+ /**
243
+ * Whether a folder, named by its id, holds nothing: each of its own three
244
+ * collections, asked at its own address, must answer whole. A row in any
245
+ * is not empty; no rows with a count of zero and no next page is empty;
246
+ * anything else (a refusal, no answer, no count, a count above the rows)
247
+ * leaves the question open.
248
+ *
249
+ * @param client - The connected client.
250
+ * @param id - The folder's id.
251
+ * @returns Ok(true) empty, Ok(false) not; Err when the question stays open (the reason stacked).
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * const empty: Result<boolean> = await folder_isEmptyById(client, 7);
256
+ * ```
257
+ */
258
+ export declare function folder_isEmptyById(client: Client, id: number): Promise<Result<boolean>>;