@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
@@ -6,89 +6,27 @@
6
6
  *
7
7
  * @module
8
8
  */
9
+ import type { Dictionary, FilteredResourceData, Item, ListOptions, ResourceFieldsPerItem, ResourcesByFields, SimpleRecord, WholeWalk } from "./resourceShapes.js";
9
10
  import { type Client, type ListResource, type Resource, type ItemResource } from "../chrisapi/adapter.js";
10
- /**
11
- * A simple record with string keys and unknown values.
12
- */
13
- export interface SimpleRecord {
14
- [key: string]: unknown;
15
- }
16
- /**
17
- * Options for listing resources, including pagination.
18
- */
19
- export interface ListOptions extends SimpleRecord {
20
- limit?: number;
21
- offset?: number;
22
- }
23
- /**
24
- * Represents an item in a resource collection.
25
- */
26
- export interface Item {
27
- data: Array<{
28
- name: string;
29
- value: unknown;
30
- }>;
31
- href: string;
32
- links: Array<unknown>;
33
- }
34
- interface ResourcesFromOptions {
35
- resources: ListResource | Resource | null;
36
- options?: ListOptions | null;
37
- }
38
- /**
39
- * Contains items and the fields available for them.
40
- */
41
- export interface ResourceFieldsPerItem {
42
- items: Item[];
43
- fields: string[];
44
- }
45
- /**
46
- * Contains resources, items, options, and selected fields.
47
- */
48
- export interface ResourcesByFields extends ResourcesFromOptions {
49
- items: Item[] | null;
50
- fields: string[];
51
- }
52
- /**
53
- * Contains data filtered for table display and selected fields.
54
- */
55
- export interface FilteredResourceData {
56
- tableData: Record<string, unknown>[];
57
- selectedFields: string[];
58
- /** Total count of items in the full collection (may exceed tableData.length when paginated). */
59
- totalCount?: number;
60
- /**
61
- * Set when the walk could not finish — a page the server refused, or a
62
- * bound the caller asked for and the collection exceeded. A listing that
63
- * is short must say so; a surface that renders `tableData` without
64
- * reading this is showing a page and calling it the answer.
65
- */
66
- incomplete?: {
67
- /** How many were gathered before it stopped. */
68
- gathered: number;
69
- /** Why it stopped, in words a surface can render. */
70
- reason: string;
71
- };
72
- }
73
- /**
74
- * A dictionary with string keys and primitive values.
75
- */
76
- export interface Dictionary {
77
- [key: string]: string | number | boolean;
78
- }
11
+ export type { Dictionary, FilteredResourceData, Item, ListOptions, ResourceFieldsPerItem, ResourcesByFields, SimpleRecord, WholeWalk } from "./resourceShapes.js";
79
12
  /**
80
13
  * Base class for managing ChRIS resources.
81
14
  */
82
15
  export declare class ChRISResource {
83
- private _client;
84
16
  private _resourceName;
85
17
  private _resourceCollection;
86
18
  private _resourceArrayItems;
87
19
  private _resourceArray;
20
+ /** Whether the last read was a query naming a search or a bound: then its answer (or none) is what is read. */
21
+ private _queryAsked;
22
+ /** How many reads have been asked of this resource: only the newest one's answer is kept. */
23
+ private _readSeq;
88
24
  private _resourceItem;
89
25
  private resourceMethod;
90
26
  private _lazyMethodName;
91
27
  private _lazyObjProvider;
28
+ /** What the last `resources_getAll` walk saw. */
29
+ private _walkSeen;
92
30
  constructor();
93
31
  /**
94
32
  * Retrieves the ChRIS client instance asynchronously.
@@ -137,13 +75,158 @@ export declare class ChRISResource {
137
75
  */
138
76
  binding_applyLazy(objProvider: () => Promise<unknown>, methodName: string, resourceName?: string): void;
139
77
  private lazyBinding_resolve;
78
+ /**
79
+ * What the page last fetched says about a page after it.
80
+ *
81
+ * The SDK derives this from the collection's `next` link and names it
82
+ * `hasNextPage`. It was read here as `hasNext`, which the SDK does not
83
+ * have, so the answer was always undefined and a walk could only guess
84
+ * from the length of a page.
85
+ *
86
+ * @returns True when a `next` link is there, false when the page carries
87
+ * links and none is `next`, and null when it carries no links at all:
88
+ * such a page has said nothing either way, and the SDK's getter would
89
+ * fail on it.
90
+ */
91
+ private nextPage_read;
92
+ /** Whether the server says another page follows the one last fetched; false when it does not say. */
140
93
  get hasNextPage(): boolean;
94
+ /**
95
+ * How many rows the server sent on the page last fetched.
96
+ *
97
+ * @returns The count, or null when the page is not a list that says.
98
+ */
99
+ private rawCount_read;
141
100
  /**
142
101
  * Lists *all* resources by automatically handling pagination.
102
+ *
103
+ * The walk is steered by what the server sent. Its search is the
104
+ * server's on every page: a query the server refuses fails the walk
105
+ * (see {@link resources_getList}). Each step moves on by the number of
106
+ * rows received, since a server may send fewer than were asked for and
107
+ * still have more.
108
+ *
143
109
  * @param options - Filtering options. Limit and offset will be managed internally.
144
- * @returns A Promise resolving to FilteredResourceData containing all matching resources, or null.
110
+ * @returns Every matching resource, or null when there is none. When the
111
+ * walk could not finish, the rows it has and `incomplete`.
112
+ * @throws {Error} When the first page cannot be fetched, or the walk
113
+ * stalls with nothing gathered: neither is an empty collection.
145
114
  */
146
115
  resources_getAll(options?: Partial<ListOptions>): Promise<FilteredResourceData | null>;
116
+ /**
117
+ * Refuses a page a newer read of this resource replaced: its collection
118
+ * is the newer read's, not this walk's.
119
+ *
120
+ * @param superseded - Whether a newer read replaced the page.
121
+ * @param offset - The page's offset.
122
+ * @throws {Error} When the page was replaced.
123
+ */
124
+ private pageSuperseded_refuse;
125
+ /**
126
+ * Checks that a page of a `resources_getAll` walk, already known to be a
127
+ * list, carries an array of items, and notes it of the first page.
128
+ *
129
+ * @param offset - The page's offset.
130
+ * @throws {Error} When a later page carries no array of items.
131
+ */
132
+ private walkPageItems_check;
133
+ /**
134
+ * The page last fetched by a `resources_getWhole` walk, held to what such
135
+ * a walk needs: a list, carrying an array of items and an array of links.
136
+ *
137
+ * @param offset - The page's offset.
138
+ * @returns The page and its items.
139
+ * @throws {Error} When the page is not a list, or carries no items or no links.
140
+ */
141
+ private wholePage_read;
142
+ /**
143
+ * What a walk answers: its rows, and `incomplete` when it stopped short or
144
+ * the server counted more rows than it sent, though every page came.
145
+ *
146
+ * @param tableData - The rows kept.
147
+ * @param selectedFields - The fields they carry.
148
+ * @param stopped - Why the walk stopped short, or null when it did not.
149
+ * @returns The rows, or null when none were kept.
150
+ */
151
+ private walkAnswer_make;
152
+ /**
153
+ * How many rows the server sent on the page last fetched, whatever was
154
+ * kept of them, noted with the count that page reports for the whole
155
+ * collection.
156
+ *
157
+ * @param result - What was kept of the page: it stands in for a page that is not a list.
158
+ * @returns The rows sent.
159
+ */
160
+ private pageReceived_note;
161
+ /**
162
+ * Whether the last {@link resources_getAll} walk's first page was fetched
163
+ * and came as a list carrying an array of items, and the walk received as
164
+ * many rows as any page's count reports. Its null answers "nothing here"
165
+ * only then: a resource never bound to a fetch, a first answer that is no
166
+ * list, or a server that counts rows it did not send gives null too, and
167
+ * says nothing.
168
+ *
169
+ * @returns True when the first page came whole and no count contradicts the rows.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const empty: boolean = (await resource.resources_getAll()) === null && resource.firstPage_isWhole();
174
+ * ```
175
+ */
176
+ firstPage_isWhole(): boolean;
177
+ /**
178
+ * The collection the last fetch left, read after the fetch.
179
+ *
180
+ * A method, so the compiler does not carry what was assigned before the
181
+ * fetch across the `await` that replaced it.
182
+ *
183
+ * @returns The collection, or null when the fetch left none.
184
+ */
185
+ private collection_read;
186
+ /**
187
+ * Walks the whole collection and answers only when it has all of it.
188
+ *
189
+ * {@link resources_getAll} is forgiving, which suits a listing meant to be
190
+ * shown: a page it cannot read ends the walk with the rows it has, a page
191
+ * shorter than the bound is taken as the last, and an answer that is not
192
+ * a list reads as "nothing here". An act that destroys on the strength of
193
+ * a listing cannot use an answer like that. Here every page must be a
194
+ * list that carries an array of items, the walk follows the server's own
195
+ * word on whether more follows and never infers the end from a short
196
+ * page, and anything else is an error.
197
+ *
198
+ * The end of the walk is the server's `next` link alone. A count the
199
+ * server sends is a second witness: a walk that ends having received
200
+ * fewer rows than the largest count any page reported is `incomplete`.
201
+ * A page with no count (the SDK's -1) says nothing about the total, and
202
+ * so never stands in for the `next` link.
203
+ *
204
+ * @param options - Filtering options. Limit and offset are managed here.
205
+ * @param walk - `hrefs`: keep each row's own address, as `href`, so a
206
+ * caller can act on the row without finding it again.
207
+ * @returns Every row of the collection. `tableData` is empty, not absent,
208
+ * when the collection holds nothing; `incomplete` is set when a count
209
+ * the server reported exceeds the rows received.
210
+ * @throws {Error} When a page could not be fetched, is not a list, carries
211
+ * no array of items or of links, or says that more follows and gives no
212
+ * rows.
213
+ */
214
+ resources_getWhole(options?: Partial<ListOptions>, walk?: WholeWalk): Promise<FilteredResourceData>;
215
+ /**
216
+ * The rows of the page last fetched, each with its own address when asked.
217
+ *
218
+ * @param asked - The options the page was fetched with.
219
+ * @param walk - Whether to keep each row's address.
220
+ * @returns The rows, or null when the page gave none.
221
+ */
222
+ private pageRows_read;
223
+ /**
224
+ * The total a page reports for its whole collection.
225
+ *
226
+ * @param page - The page.
227
+ * @returns The count, or -1 when the page sends none (the SDK's own word for that).
228
+ */
229
+ private pageCount_read;
147
230
  /**
148
231
  * Lists and filters resources based on options.
149
232
  * @param options - Filtering and listing options.
@@ -160,8 +243,38 @@ export declare class ChRISResource {
160
243
  fieldSpec_resolve(fieldFilter?: string, options?: ListOptions | null): string[];
161
244
  resourceFields_get(options?: ListOptions | null, fields?: string): Promise<ResourcesByFields | null>;
162
245
  resources_getItems(options?: Partial<ListOptions>): Promise<ItemResource[] | null>;
163
- options_simplify(options: ListOptions): ListOptions;
164
- private filtering_applyAdditional;
246
+ /**
247
+ * Asks for one page as {@link resources_getList} does, and says whether it
248
+ * is still the newest read of this resource once it has answered: what the
249
+ * resource holds is then the newer read's, never this one's.
250
+ *
251
+ * @param options - The page and search.
252
+ * @returns The parameters asked with (null as `resources_getList` says),
253
+ * and whether a newer read replaced this one.
254
+ */
255
+ private page_ask;
256
+ /**
257
+ * Asks CUBE for one page of the collection, as the caller's parameters
258
+ * name it, and keeps what came as the resource's collection and rows.
259
+ *
260
+ * The search is CUBE's to answer: a query it refuses is refused here
261
+ * (thrown), never asked again without its search and redone on one page
262
+ * by a guess at what the fields mean. Nothing of an earlier question
263
+ * stays readable meanwhile: the collection and rows are cleared before
264
+ * anything is asked, so a refusal leaves none, never the last query's.
265
+ *
266
+ * @param options - The page and search, as CUBE's query parameters; no
267
+ * bound named asks for a page of {@link PAGE_SIZE}.
268
+ * @param resourceMethod - The fetch to bind, when one is given.
269
+ * @returns The parameters asked with; null when the answer was not a list,
270
+ * or when a newer read of this resource was asked before it answered.
271
+ * @throws {Error} What CUBE's answer was, when it refused or did not answer.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * await resource.resources_getList({ name: 'pl-dircopy', limit: 10 });
276
+ * ```
277
+ */
165
278
  resources_getList(options?: Partial<ListOptions>, resourceMethod?: (params: ListOptions) => Promise<ListResource | Resource>): Promise<ListOptions | null>;
166
279
  }
167
280
  /**
@@ -171,4 +284,3 @@ export declare class ChRISResource {
171
284
  * @returns A SimpleRecord of fields or null.
172
285
  */
173
286
  export declare function resourceFields_get(obj: Resource | ListResource, fields: string[]): SimpleRecord | null;
174
- export {};