@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,151 @@
1
+ /**
2
+ * @file A folder found at a path now, on one client, and its listings read whole by its id.
3
+ *
4
+ * The session keeps a memo of folder lookups by path, and a memo can be
5
+ * stale: the folder a path named when it was filled may have been replaced
6
+ * by another at that path since. A listing made for showing may use it; a
7
+ * proof that an act will destroy or overwrite on may not. Here the folder
8
+ * at a path is asked of CUBE now, on the client given (never through the
9
+ * memo), and each of its three collections is then read by that id, at
10
+ * CUBE's own address for it, every page, through cumin's whole walk.
11
+ *
12
+ * Key components:
13
+ * - FolderAsset: which of a folder's three listings (`dirs`, `files`, `links`).
14
+ * - FreshFolder: the folder found, and its listings read whole by its id.
15
+ * - FolderOpening: found, missing (no folder at the path for this client), or refused.
16
+ * - folder_openFresh: find the folder at a path now.
17
+ * - folder_openById: a folder a whole listing named, read by its id.
18
+ * - FolderPosted: what a folder post came to (made, there already, or there with its maker unknown).
19
+ * - folder_post: ask CUBE to make a folder (and its missing parents) at a path.
20
+ *
21
+ * Typical usage:
22
+ * ```ts
23
+ * const opened: FolderOpening = await folder_openFresh(client, '/home/ada');
24
+ * if (opened.kind === 'found') rows = await opened.folder.listing_readWhole('files');
25
+ * ```
26
+ *
27
+ * Dependencies: `./holderRequest.js` (CUBE's addresses and one request
28
+ * there), the adapter's page wrapper, and cumin's resource walk
29
+ * (`resources_getWhole`). Paths are absolute CUBE paths.
30
+ *
31
+ * @module
32
+ */
33
+ import { type Client } from "../chrisapi/adapter.js";
34
+ import { type FilteredResourceData } from "../resources/chrisResources.js";
35
+ import { type Result } from "../utils/result.js";
36
+ /** Which of a folder's three listings. */
37
+ export type FolderAsset = "dirs" | "files" | "links";
38
+ /**
39
+ * A folder found at a path now, and its listings read by its id.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const data: FilteredResourceData = await folder.listing_readWhole('dirs');
44
+ * ```
45
+ */
46
+ export interface FreshFolder {
47
+ /** The folder's id in CUBE. */
48
+ readonly id: number;
49
+ /**
50
+ * One of its listings, every page, each row with its own address.
51
+ *
52
+ * @throws {Error} When a page could not be read, or is not a whole list (the walk's own words).
53
+ */
54
+ listing_readWhole(asset: FolderAsset): Promise<FilteredResourceData>;
55
+ }
56
+ /** One folder is at the path, found now. */
57
+ interface FolderFound {
58
+ /** The opening's kind. */
59
+ readonly kind: "found";
60
+ /** The folder. */
61
+ readonly folder: FreshFolder;
62
+ }
63
+ /** No folder is at the path that this client may see: a whole, empty answer. */
64
+ interface FolderMissing {
65
+ /** The opening's kind. */
66
+ readonly kind: "missing";
67
+ }
68
+ /** CUBE would not say which folder is at the path. */
69
+ interface FolderRefused {
70
+ /** The opening's kind. */
71
+ readonly kind: "refused";
72
+ /** Why, in words. */
73
+ readonly reason: string;
74
+ }
75
+ /**
76
+ * The folder at a path, found now.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const opened: FolderOpening = { kind: 'missing' };
81
+ * ```
82
+ */
83
+ export type FolderOpening = FolderFound | FolderMissing | FolderRefused;
84
+ /**
85
+ * A folder known by its id (a row of a whole listing gave it), its listings
86
+ * read whole by that id on the client: never found again by a path.
87
+ *
88
+ * @param client - The client.
89
+ * @param id - The folder's id.
90
+ * @returns The folder.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const rows: FilteredResourceData = await folder_openById(client, 70).listing_readWhole('files');
95
+ * ```
96
+ */
97
+ export declare function folder_openById(client: Client, id: number): FreshFolder;
98
+ /**
99
+ * Finds the folder at a path now, on the client given: CUBE's search for
100
+ * that path, asked at its own address, never the session's memo of
101
+ * lookups. One folder at the path is found; a whole, empty answer is
102
+ * missing (no folder there this client may see); anything else (no
103
+ * answer, a refusal, a page not whole, several folders, a row of another
104
+ * path or no usable id) is refused.
105
+ *
106
+ * @param client - The client.
107
+ * @param folderPath - The folder's path.
108
+ * @returns What was found.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const opened: FolderOpening = await folder_openFresh(client, '/home/ada');
113
+ * ```
114
+ */
115
+ export declare function folder_openFresh(client: Client, folderPath: string): Promise<FolderOpening>;
116
+ /**
117
+ * What a folder post came to: `made` (CUBE's answer names that one folder),
118
+ * `existed` (CUBE refused it as already there), or `present` (the post was
119
+ * sent and its answer said nothing, and a folder is at the path now: who
120
+ * made it, this post or another, is not known).
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const posted: FolderPosted = 'present';
125
+ * ```
126
+ */
127
+ export type FolderPosted = "made" | "existed" | "present";
128
+ /**
129
+ * Asks CUBE, on the client given, to make a folder at a path. CUBE makes
130
+ * the folder's missing parents with it, and answers a folder already there
131
+ * with a refusal that says so. The guard is asked after the folder list is
132
+ * read and immediately before the post; false posts nothing. A post whose
133
+ * outcome is not known (a server's error, or a request sent with no reply)
134
+ * is settled by a fresh proof of the path on the same client; an error
135
+ * raised before the request was sent is an error, and nothing is asked.
136
+ *
137
+ * @param client - The client.
138
+ * @param folderPath - The folder's path.
139
+ * @param stillCurrent - Whether the client is still the session's, asked immediately before the post.
140
+ * @returns Ok('made') when CUBE's answer names exactly that one folder,
141
+ * Ok('existed') when CUBE says it is already there, Ok('present') when
142
+ * the answer said nothing and a folder is found there after; Err
143
+ * otherwise (the reason stacked).
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * const made: Result<FolderPosted> = await folder_post(client, '/home/ada/new');
148
+ * ```
149
+ */
150
+ export declare function folder_post(client: Client, folderPath: string, stillCurrent?: () => Promise<boolean>): Promise<Result<FolderPosted>>;
151
+ export {};
@@ -0,0 +1,311 @@
1
+ "use strict";
2
+ /**
3
+ * @file A folder found at a path now, on one client, and its listings read whole by its id.
4
+ *
5
+ * The session keeps a memo of folder lookups by path, and a memo can be
6
+ * stale: the folder a path named when it was filled may have been replaced
7
+ * by another at that path since. A listing made for showing may use it; a
8
+ * proof that an act will destroy or overwrite on may not. Here the folder
9
+ * at a path is asked of CUBE now, on the client given (never through the
10
+ * memo), and each of its three collections is then read by that id, at
11
+ * CUBE's own address for it, every page, through cumin's whole walk.
12
+ *
13
+ * Key components:
14
+ * - FolderAsset: which of a folder's three listings (`dirs`, `files`, `links`).
15
+ * - FreshFolder: the folder found, and its listings read whole by its id.
16
+ * - FolderOpening: found, missing (no folder at the path for this client), or refused.
17
+ * - folder_openFresh: find the folder at a path now.
18
+ * - folder_openById: a folder a whole listing named, read by its id.
19
+ * - FolderPosted: what a folder post came to (made, there already, or there with its maker unknown).
20
+ * - folder_post: ask CUBE to make a folder (and its missing parents) at a path.
21
+ *
22
+ * Typical usage:
23
+ * ```ts
24
+ * const opened: FolderOpening = await folder_openFresh(client, '/home/ada');
25
+ * if (opened.kind === 'found') rows = await opened.folder.listing_readWhole('files');
26
+ * ```
27
+ *
28
+ * Dependencies: `./holderRequest.js` (CUBE's addresses and one request
29
+ * there), the adapter's page wrapper, and cumin's resource walk
30
+ * (`resources_getWhole`). Paths are absolute CUBE paths.
31
+ *
32
+ * @module
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.folder_openById = folder_openById;
36
+ exports.folder_openFresh = folder_openFresh;
37
+ exports.folder_post = folder_post;
38
+ const holderRequest_js_1 = require("./holderRequest.js");
39
+ const adapter_js_1 = require("../chrisapi/adapter.js");
40
+ const errorStack_js_1 = require("../error/errorStack.js");
41
+ const chrisResources_js_1 = require("../resources/chrisResources.js");
42
+ const result_js_1 = require("../utils/result.js");
43
+ /** Each listing's collection below the folder's address, and its word. */
44
+ const ASSET_LISTS = {
45
+ dirs: ["children", "Directories"],
46
+ files: ["files", "Files"],
47
+ links: ["linkfiles", "Links"],
48
+ };
49
+ /** The rows a page asks for: the whole walk's own page size. */
50
+ const PAGE_ROWS = 100;
51
+ /** The status CUBE answers for a resource that is there. */
52
+ const HTTP_OK = 200;
53
+ /**
54
+ * A path as CUBE spells a folder's, for comparing: no slash at either end.
55
+ *
56
+ * @param raw - The path.
57
+ * @returns It, without its end slashes.
58
+ */
59
+ function folderPath_bare(raw) {
60
+ return raw.replace(/^\/+|\/+$/g, "");
61
+ }
62
+ /**
63
+ * One page of one of a folder's collections, asked at CUBE's own address
64
+ * for it, held as the SDK holds a page.
65
+ *
66
+ * @param client - The client.
67
+ * @param id - The folder's id.
68
+ * @param asset - Which listing.
69
+ * @param params - The page the walk asks for.
70
+ * @returns The page.
71
+ * @throws {Error} When no answer came, CUBE refused, or the answer is no collection.
72
+ */
73
+ async function folderPage_get(client, id, asset, params) {
74
+ const [list, word] = ASSET_LISTS[asset];
75
+ const url = (0, holderRequest_js_1.folderListUrl_build)(client, id, list, { limit: params.limit ?? PAGE_ROWS, offset: params.offset ?? 0 });
76
+ const answer = url === null ? null : await (0, holderRequest_js_1.cube_ask)(client, url, "GET");
77
+ if (url === null || answer === null)
78
+ throw new Error(`${word}: CUBE could not be asked for folder ID ${String(id)}, or did not answer in time`);
79
+ if (answer.status !== HTTP_OK)
80
+ throw new Error(`${word}: CUBE answered ${String(answer.status)} for folder ID ${String(id)}`);
81
+ const collection = answer.body !== null && typeof answer.body === "object" ? Reflect.get(answer.body, "collection") : null;
82
+ if (collection === null || typeof collection !== "object")
83
+ throw new Error(`${word}: CUBE's answer for folder ID ${String(id)} is not a list`);
84
+ return (0, adapter_js_1.listResource_wrap)(url, client, collection);
85
+ }
86
+ /**
87
+ * The folder found, its listings walked whole by its id on the client.
88
+ *
89
+ * @param client - The client.
90
+ * @param id - The folder's id.
91
+ * @returns The folder.
92
+ */
93
+ function freshFolder_make(client, id) {
94
+ return {
95
+ id,
96
+ listing_readWhole: async (asset) => {
97
+ const resource = new chrisResources_js_1.ChRISResource();
98
+ resource.binding_applyGet(null, async (params) => folderPage_get(client, id, asset, params), ASSET_LISTS[asset][1]);
99
+ return resource.resources_getWhole(undefined, { hrefs: true });
100
+ },
101
+ };
102
+ }
103
+ /**
104
+ * A folder known by its id (a row of a whole listing gave it), its listings
105
+ * read whole by that id on the client: never found again by a path.
106
+ *
107
+ * @param client - The client.
108
+ * @param id - The folder's id.
109
+ * @returns The folder.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const rows: FilteredResourceData = await folder_openById(client, 70).listing_readWhole('files');
114
+ * ```
115
+ */
116
+ function folder_openById(client, id) {
117
+ return freshFolder_make(client, id);
118
+ }
119
+ /**
120
+ * The one folder a search's page names at a path: exactly one row, its id
121
+ * a positive whole number, its path the one asked.
122
+ *
123
+ * @param page - The search's page.
124
+ * @param folderPath - The path asked.
125
+ * @returns The id, or the refusal's words.
126
+ */
127
+ function searchRow_read(page, folderPath) {
128
+ if (page.items.length !== 1)
129
+ return `CUBE names ${String(page.items.length)} folders at ${folderPath}`;
130
+ const fields = (0, holderRequest_js_1.itemFields_read)(page.items[0]);
131
+ const id = fields?.id;
132
+ if (typeof id !== "number" || !Number.isSafeInteger(id) || id <= 0)
133
+ return `the folder CUBE names at ${folderPath} has no usable id`;
134
+ const at = fields?.path;
135
+ if (typeof at !== "string" || folderPath_bare(at) !== folderPath_bare(folderPath))
136
+ return `the folder CUBE names for ${folderPath} is at ${typeof at === "string" ? at : "no path"}`;
137
+ return id;
138
+ }
139
+ /**
140
+ * Finds the folder at a path now, on the client given: CUBE's search for
141
+ * that path, asked at its own address, never the session's memo of
142
+ * lookups. One folder at the path is found; a whole, empty answer is
143
+ * missing (no folder there this client may see); anything else (no
144
+ * answer, a refusal, a page not whole, several folders, a row of another
145
+ * path or no usable id) is refused.
146
+ *
147
+ * @param client - The client.
148
+ * @param folderPath - The folder's path.
149
+ * @returns What was found.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * const opened: FolderOpening = await folder_openFresh(client, '/home/ada');
154
+ * ```
155
+ */
156
+ async function folder_openFresh(client, folderPath) {
157
+ const url = (0, holderRequest_js_1.folderSearchUrl_build)(client, folderPath);
158
+ const answer = url === null ? null : await (0, holderRequest_js_1.cube_ask)(client, url, "GET");
159
+ if (answer === null)
160
+ return { kind: "refused", reason: `the folder at ${folderPath} could not be asked for, or CUBE did not answer in time` };
161
+ if (answer.status !== HTTP_OK)
162
+ return { kind: "refused", reason: `CUBE answered ${String(answer.status)} when asked for the folder at ${folderPath}` };
163
+ const page = (0, holderRequest_js_1.answerList_read)(answer.body);
164
+ if (page === null)
165
+ return { kind: "refused", reason: `CUBE's answer for the folder at ${folderPath} is not a list` };
166
+ if (page.items.length === 0 && !page.more && (page.total === null || page.total === 0))
167
+ return { kind: "missing" };
168
+ if (page.more || (page.total !== null && page.total !== page.items.length))
169
+ return { kind: "refused", reason: `CUBE's answer for the folder at ${folderPath} was not whole` };
170
+ const found = searchRow_read(page, folderPath);
171
+ return typeof found === "string" ? { kind: "refused", reason: found } : { kind: "found", folder: freshFolder_make(client, found) };
172
+ }
173
+ /** The status CUBE answers a request it read and refused for what it carried. */
174
+ const HTTP_BAD_REQUEST = 400;
175
+ /** The first status of a server's error: an answer that does not say what was done. */
176
+ const HTTP_SERVER_ERROR = 500;
177
+ /**
178
+ * The response an SDK error carries, when CUBE answered.
179
+ *
180
+ * @param error - What the request threw.
181
+ * @returns The response, or undefined when none came.
182
+ */
183
+ function errorResponse_read(error) {
184
+ const response = error !== null && typeof error === "object" ? Reflect.get(error, "response") : undefined;
185
+ return response !== null && typeof response === "object" ? response : undefined;
186
+ }
187
+ /**
188
+ * Whether a refused folder post says the folder is already there: a 400
189
+ * whose `path` field's first message says so.
190
+ *
191
+ * @param error - What the post threw.
192
+ * @returns True for CUBE's "already exists".
193
+ */
194
+ function folderExists_detect(error) {
195
+ const response = errorResponse_read(error);
196
+ if (response === undefined || Reflect.get(response, "status") !== HTTP_BAD_REQUEST)
197
+ return false;
198
+ const data = Reflect.get(response, "data");
199
+ const said = data !== null && typeof data === "object" ? Reflect.get(data, "path") : undefined;
200
+ const first = Array.isArray(said) ? said[0] : undefined;
201
+ return typeof first === "string" && first.includes("already exists");
202
+ }
203
+ /**
204
+ * What a post that threw says of what was done: nothing known, for a
205
+ * server's error (5xx) or a request sent with no reply; null for an answer
206
+ * that refused it, and for an error raised before anything was sent (the
207
+ * SDK's own error then carries a null request and a null response).
208
+ *
209
+ * @param error - What the post threw.
210
+ * @returns `CUBE answered 503` or `CUBE gave no reply`; null for a refusal or nothing sent.
211
+ */
212
+ function postUnknown_say(error) {
213
+ const response = errorResponse_read(error);
214
+ if (response === undefined) {
215
+ const request = error !== null && typeof error === "object" ? Reflect.get(error, "request") : undefined;
216
+ return request !== undefined && request !== null ? "CUBE gave no reply" : null;
217
+ }
218
+ const status = Reflect.get(response, "status");
219
+ return typeof status === "number" && status >= HTTP_SERVER_ERROR ? `CUBE answered ${String(status)}` : null;
220
+ }
221
+ /**
222
+ * Whether the answer to a folder post names the folder made: exactly one
223
+ * item, its id a positive whole number, its path the one asked.
224
+ *
225
+ * @param response - What the post resolved to.
226
+ * @param folderPath - The path asked.
227
+ * @returns True only for such an answer.
228
+ */
229
+ function folderMade_read(response, folderPath) {
230
+ const data = response !== null && typeof response === "object" ? Reflect.get(response, "data") : undefined;
231
+ if (!Array.isArray(data) || data.length !== 1)
232
+ return false;
233
+ const made = data[0];
234
+ const id = made !== null && typeof made === "object" ? Reflect.get(made, "id") : undefined;
235
+ const at = made !== null && typeof made === "object" ? Reflect.get(made, "path") : undefined;
236
+ return typeof id === "number" && Number.isSafeInteger(id) && id > 0 && typeof at === "string" && folderPath_bare(at) === folderPath_bare(folderPath);
237
+ }
238
+ /**
239
+ * A folder post whose outcome is not known: settled by a fresh proof of
240
+ * the path, on the same client. A folder there is `present`, never `made`:
241
+ * its being there does not say this post made it. Anything else is an
242
+ * error that says what was found.
243
+ *
244
+ * @param client - The client the post was made on.
245
+ * @param folderPath - The folder's path.
246
+ * @param said - What CUBE answered, in words.
247
+ * @returns Ok('present') when a folder is there; Err otherwise (the reason stacked).
248
+ */
249
+ async function folderPostUnknown_settle(client, folderPath, said) {
250
+ const opened = await folder_openFresh(client, folderPath);
251
+ if (opened.kind === "found")
252
+ return (0, result_js_1.Ok)("present");
253
+ const found = opened.kind === "missing" ? "no folder is there now" : opened.reason;
254
+ errorStack_js_1.errorStack.stack_push("error", `The folder ${folderPath} was asked to be made and ${said}: ${found}`);
255
+ return (0, result_js_1.Err)();
256
+ }
257
+ /**
258
+ * Asks CUBE, on the client given, to make a folder at a path. CUBE makes
259
+ * the folder's missing parents with it, and answers a folder already there
260
+ * with a refusal that says so. The guard is asked after the folder list is
261
+ * read and immediately before the post; false posts nothing. A post whose
262
+ * outcome is not known (a server's error, or a request sent with no reply)
263
+ * is settled by a fresh proof of the path on the same client; an error
264
+ * raised before the request was sent is an error, and nothing is asked.
265
+ *
266
+ * @param client - The client.
267
+ * @param folderPath - The folder's path.
268
+ * @param stillCurrent - Whether the client is still the session's, asked immediately before the post.
269
+ * @returns Ok('made') when CUBE's answer names exactly that one folder,
270
+ * Ok('existed') when CUBE says it is already there, Ok('present') when
271
+ * the answer said nothing and a folder is found there after; Err
272
+ * otherwise (the reason stacked).
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * const made: Result<FolderPosted> = await folder_post(client, '/home/ada/new');
277
+ * ```
278
+ */
279
+ async function folder_post(client, folderPath, stillCurrent) {
280
+ let folders;
281
+ try {
282
+ folders = await client.getFileBrowserFolders();
283
+ }
284
+ catch (error) {
285
+ errorStack_js_1.errorStack.stack_push("error", `Did not make the folder ${folderPath}: CUBE's list of folders could not be read (${error instanceof Error ? error.message : String(error)}); nothing was asked`);
286
+ return (0, result_js_1.Err)();
287
+ }
288
+ if (stillCurrent !== undefined && !await stillCurrent()) {
289
+ errorStack_js_1.errorStack.stack_push("error", `Did not make the folder ${folderPath}: the connection to CUBE changed after the place was proved; nothing was asked`);
290
+ return (0, result_js_1.Err)();
291
+ }
292
+ try {
293
+ if (folderMade_read(await folders.post({ path: folderPath }), folderPath))
294
+ return (0, result_js_1.Ok)("made");
295
+ errorStack_js_1.errorStack.stack_push("error", `Failed to create folder: ${folderPath}. CUBE's answer does not name that one folder.`);
296
+ return (0, result_js_1.Err)();
297
+ }
298
+ catch (error) {
299
+ if (folderExists_detect(error)) {
300
+ errorStack_js_1.errorStack.stack_push("warning", `Folder '${folderPath}' already exists.`);
301
+ return (0, result_js_1.Ok)("existed");
302
+ }
303
+ const unknown = postUnknown_say(error);
304
+ if (unknown !== null)
305
+ return folderPostUnknown_settle(client, folderPath, unknown);
306
+ const errorMessage = error instanceof Error ? error.message : String(error);
307
+ errorStack_js_1.errorStack.stack_push("error", `Error creating folder '${folderPath}': ${errorMessage}`);
308
+ return (0, result_js_1.Err)();
309
+ }
310
+ }
311
+ //# sourceMappingURL=holderFolder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holderFolder.js","sourceRoot":"","sources":["../../src/io/holderFolder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;AA0IH,0CAEC;AAqCD,4CAWC;AAgID,kCA2BC;AArVD,yDAA6K;AAC7K,uDAA2F;AAC3F,0DAAoD;AACpD,sEAA4G;AAC5G,kDAA0D;AAK1D,0EAA0E;AAC1E,MAAM,WAAW,GAAiE;IAChF,IAAI,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;IACjC,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,gEAAgE;AAChE,MAAM,SAAS,GAAW,GAAG,CAAC;AAE9B,4DAA4D;AAC5D,MAAM,OAAO,GAAW,GAAG,CAAC;AAqD5B;;;;;GAKG;AACH,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,EAAU,EAAE,KAAkB,EAAE,MAAmB;IAC/F,MAAM,CAAC,IAAI,EAAE,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