@fnndsc/brasa 0.45.0 → 0.47.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/api/models.d.ts +37 -0
- package/dist/api/models.js.map +1 -1
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/fs/pull.args.d.ts +0 -10
- package/dist/builtins/fs/pull.args.js +5 -30
- package/dist/builtins/fs/pull.args.js.map +1 -1
- package/dist/builtins/fs/pull.js +25 -48
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/help.js +76 -5
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/helpSections.js +3 -3
- package/dist/builtins/helpSections.js.map +1 -1
- package/dist/builtins/net/query.d.ts +3 -21
- package/dist/builtins/net/query.js +4 -68
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/query.model.d.ts +31 -0
- package/dist/builtins/net/query.model.js +66 -0
- package/dist/builtins/net/query.model.js.map +1 -0
- package/dist/builtins/pluginExecute.d.ts +4 -1
- package/dist/builtins/pluginExecute.js +11 -12
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +38 -0
- package/dist/builtins/res/expect.js +77 -179
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/gather.d.ts +2 -2
- package/dist/builtins/res/gather.facts.d.ts +18 -0
- package/dist/builtins/res/gather.facts.js +114 -0
- package/dist/builtins/res/gather.facts.js.map +1 -0
- package/dist/builtins/res/gather.js +50 -11
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.kind.d.ts +9 -0
- package/dist/builtins/res/gather.kind.js +10 -0
- package/dist/builtins/res/gather.kind.js.map +1 -0
- package/dist/builtins/res/gather.process.d.ts +46 -0
- package/dist/builtins/res/gather.process.js +230 -0
- package/dist/builtins/res/gather.process.js.map +1 -0
- package/dist/builtins/res/gather.store.d.ts +36 -0
- package/dist/builtins/res/gather.store.js +105 -2
- package/dist/builtins/res/gather.store.js.map +1 -1
- package/dist/builtins/res/pipeline.d.ts +16 -0
- package/dist/builtins/res/pipeline.js +38 -13
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/play.d.ts +2 -0
- package/dist/builtins/res/play.js +59 -17
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugin.js +9 -30
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/runWait.d.ts +10 -0
- package/dist/builtins/res/runWait.js +14 -0
- package/dist/builtins/res/runWait.js.map +1 -1
- package/dist/builtins/sys/variables.d.ts +25 -0
- package/dist/builtins/sys/variables.js +113 -0
- package/dist/builtins/sys/variables.js.map +1 -0
- package/dist/builtins/variablesPage.d.ts +9 -0
- package/dist/builtins/variablesPage.js +56 -0
- package/dist/builtins/variablesPage.js.map +1 -0
- package/dist/chris/backend.js +2 -0
- package/dist/chris/backend.js.map +1 -1
- package/dist/chris/binExecutables.d.ts +25 -0
- package/dist/chris/binExecutables.js +28 -0
- package/dist/chris/binExecutables.js.map +1 -0
- package/dist/chris/chrisCommands.js +0 -6
- package/dist/chris/chrisCommands.js.map +1 -1
- package/dist/chris/commandFallback.js +10 -24
- package/dist/chris/commandFallback.js.map +1 -1
- package/dist/chris/expectSubjects.d.ts +3 -0
- package/dist/chris/expectSubjects.js +131 -0
- package/dist/chris/expectSubjects.js.map +1 -0
- package/dist/chris/help.d.ts +2 -2
- package/dist/chris/help.js +34 -96
- package/dist/chris/help.js.map +1 -1
- package/dist/chris/references.js +14 -75
- package/dist/chris/references.js.map +1 -1
- package/dist/core/assignment.d.ts +13 -0
- package/dist/core/assignment.js +98 -0
- package/dist/core/assignment.js.map +1 -0
- package/dist/core/backend.d.ts +38 -0
- package/dist/core/backend.js.map +1 -1
- package/dist/core/coreCommands.js +11 -0
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/dispatch.js +9 -1
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/engine.js +14 -3
- package/dist/core/engine.js.map +1 -1
- package/dist/core/expansion.d.ts +13 -7
- package/dist/core/expansion.js +36 -19
- package/dist/core/expansion.js.map +1 -1
- package/dist/core/pipeHead.d.ts +36 -0
- package/dist/core/pipeHead.js +28 -0
- package/dist/core/pipeHead.js.map +1 -0
- package/dist/core/sink.d.ts +33 -0
- package/dist/core/sink.js +48 -0
- package/dist/core/sink.js.map +1 -1
- package/dist/core/variables.d.ts +122 -0
- package/dist/core/variables.js +320 -0
- package/dist/core/variables.js.map +1 -0
- package/dist/lib/parser.js +2 -2
- package/dist/notes.json +1 -1
- package/dist/session/answerAdapters.js +12 -0
- package/dist/session/answerAdapters.js.map +1 -1
- package/package.json +5 -5
- package/dist/builtins/pronouns.d.ts +0 -8
- package/dist/builtins/pronouns.js +0 -39
- package/dist/builtins/pronouns.js.map +0 -1
- package/dist/session/recent.d.ts +0 -68
- package/dist/session/recent.js +0 -99
- package/dist/session/recent.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Builtin gather command: the session's cohort as a kernel subject.
|
|
3
3
|
*
|
|
4
|
-
* Subcommands: list (the default), add, remove, clear, name.
|
|
4
|
+
* Subcommands: list (the default), add, remove, clear, name, feed, process.
|
|
5
5
|
*
|
|
6
6
|
* Gathering was a surface gesture before it was a verb, which meant the set
|
|
7
7
|
* a session was working on could only be built by pressing on it. As a
|
|
@@ -17,10 +17,11 @@ import chalk from 'chalk';
|
|
|
17
17
|
import path from 'path';
|
|
18
18
|
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
19
19
|
import { commandArgs_process, path_resolve } from '../utils.js';
|
|
20
|
-
import { cohort_read, cohort_write, member_key, members_drop, members_merge, pathKind_determine, seriesUID_ofPath, } from './gather.store.js';
|
|
20
|
+
import { cohort_read, cohort_write, cohortModel_of, cohortFolders_resolve, member_key, members_drop, members_merge, pathKind_determine, seriesUID_ofPath, } from './gather.store.js';
|
|
21
|
+
import { placeImagery_is, seriesFacts_fill } from './gather.facts.js';
|
|
21
22
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
22
|
-
|
|
23
|
-
export
|
|
23
|
+
import { GATHER_MODEL_KIND } from './gather.kind.js';
|
|
24
|
+
export { GATHER_MODEL_KIND };
|
|
24
25
|
/**
|
|
25
26
|
* Renders a refusal.
|
|
26
27
|
*
|
|
@@ -65,7 +66,7 @@ function member_state(member) {
|
|
|
65
66
|
* @returns A success envelope carrying the rendered table and the model.
|
|
66
67
|
*/
|
|
67
68
|
function cohort_render(state) {
|
|
68
|
-
const model =
|
|
69
|
+
const model = cohortModel_of(state);
|
|
69
70
|
if (state.series.length === 0) {
|
|
70
71
|
return envelope_ok(`${chalk.gray('The cohort is empty. Gather something with `gather add <path>`.')}\n`, model);
|
|
71
72
|
}
|
|
@@ -121,12 +122,20 @@ async function gather_add(operands) {
|
|
|
121
122
|
member.seriesUID = uid;
|
|
122
123
|
member.imagery = true;
|
|
123
124
|
}
|
|
125
|
+
else if (placeImagery_is(member)) {
|
|
126
|
+
member.imagery = true;
|
|
127
|
+
}
|
|
124
128
|
incoming.push(member);
|
|
125
129
|
}
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
await seriesFacts_fill(incoming);
|
|
131
|
+
const read = await cohort_read();
|
|
132
|
+
const { members, added, merged } = members_merge(read.series, incoming);
|
|
133
|
+
read.series = members;
|
|
134
|
+
await cohort_write(read);
|
|
135
|
+
// A series CUBE already holds is known by its folder from the moment it
|
|
136
|
+
// is gathered: that folder is what a surface opens as an image and what
|
|
137
|
+
// `gather process` roots on. One CUBE read for every series still unplaced.
|
|
138
|
+
const state = await cohortFolders_resolve(read);
|
|
130
139
|
const noted = [];
|
|
131
140
|
if (added > 0)
|
|
132
141
|
noted.push(`${added} gathered`);
|
|
@@ -199,7 +208,27 @@ async function gather_name(operands) {
|
|
|
199
208
|
}
|
|
200
209
|
state.name = operands.join(' ');
|
|
201
210
|
await cohort_write(state);
|
|
202
|
-
|
|
211
|
+
// The cohort travels with the answer, as every changing verb's does, so
|
|
212
|
+
// a surface showing it takes the name from here.
|
|
213
|
+
return envelope_ok(`${chalk.green(`gather: the cohort is "${state.name}".`)}\n`, cohortModel_of(state));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Makes the cohort's feed, or names the one it has.
|
|
217
|
+
*
|
|
218
|
+
* @param words - The words after `gather feed`, raw.
|
|
219
|
+
* @returns The cohort, with its feed.
|
|
220
|
+
*/
|
|
221
|
+
async function gather_feed(words) {
|
|
222
|
+
// Loaded on demand, as `process` is: making a feed carries the pull and
|
|
223
|
+
// feed machinery, which the cohort's own verbs never need.
|
|
224
|
+
const { cohortFeed_make } = await import('./gather.process.js');
|
|
225
|
+
const made = await cohortFeed_make(words);
|
|
226
|
+
if (typeof made === 'string')
|
|
227
|
+
return gather_error(`gather feed: ${made}`);
|
|
228
|
+
const feedId = made.state.feed?.feedId;
|
|
229
|
+
const said = made.made ? `gather: the cohort's feed is ${feedId}, made now.` : `gather: the cohort's feed is ${feedId}.`;
|
|
230
|
+
const envelope = cohort_render(made.state);
|
|
231
|
+
return envelope_ok(`${chalk.green(said)}\n${envelope.rendered}`, envelope.model);
|
|
203
232
|
}
|
|
204
233
|
/**
|
|
205
234
|
* Builtin handler for the `gather` command.
|
|
@@ -232,12 +261,22 @@ export async function builtin_gather(args) {
|
|
|
232
261
|
}
|
|
233
262
|
if (subcommand === 'clear')
|
|
234
263
|
return await gather_clear();
|
|
264
|
+
// Raw words: the run's own arguments follow `--`, and a generic parser
|
|
265
|
+
// would read them as gather's options.
|
|
266
|
+
// Loaded on demand: running carries the plugin and pipeline machinery,
|
|
267
|
+
// which the cohort's own verbs never need.
|
|
268
|
+
if (subcommand === 'process') {
|
|
269
|
+
const { gather_process } = await import('./gather.process.js');
|
|
270
|
+
return await gather_process(args.slice(args.indexOf('process') + 1));
|
|
271
|
+
}
|
|
235
272
|
if (subcommand === 'name')
|
|
236
273
|
return await gather_name(operands);
|
|
274
|
+
if (subcommand === 'feed')
|
|
275
|
+
return await gather_feed(args.slice(args.indexOf('feed') + 1));
|
|
237
276
|
}
|
|
238
277
|
catch (e) {
|
|
239
278
|
return gather_error(`gather: ${e instanceof Error ? e.message : String(e)}`);
|
|
240
279
|
}
|
|
241
|
-
return gather_error(`Unknown subcommand: ${subcommand}. Usage: gather <list|add|remove|clear|name>`);
|
|
280
|
+
return gather_error(`Unknown subcommand: ${subcommand}. Usage: gather <list|add|remove|clear|name|feed|process>`);
|
|
242
281
|
}
|
|
243
282
|
//# sourceMappingURL=gather.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather.js","sourceRoot":"","sources":["../../../src/builtins/res/gather.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAqB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAuB,MAAM,yBAAyB,CAAC;AACrH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAc,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAIL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAmB,WAAW,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"gather.js","sourceRoot":"","sources":["../../../src/builtins/res/gather.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAqB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAuB,MAAM,yBA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,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,YAAY,CAAC,uBAAuB,UAAU,2DAA2D,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The model kind a cohort travels under: its own module, so a reader
|
|
3
|
+
* of the cohort (the `${gather}` reference) names it without loading the
|
|
4
|
+
* `gather` verb.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/** The model kind under which a cohort travels to a surface. */
|
|
9
|
+
export declare const GATHER_MODEL_KIND: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The model kind a cohort travels under: its own module, so a reader
|
|
3
|
+
* of the cohort (the `${gather}` reference) names it without loading the
|
|
4
|
+
* `gather` verb.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/** The model kind under which a cohort travels to a surface. */
|
|
9
|
+
export const GATHER_MODEL_KIND = 'gather.cohort';
|
|
10
|
+
//# sourceMappingURL=gather.kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gather.kind.js","sourceRoot":"","sources":["../../../src/builtins/res/gather.kind.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAW,eAAe,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
|
+
import { type GatherState } from './gather.store.js';
|
|
3
|
+
/** How `gather process` was asked for. */
|
|
4
|
+
export interface GatherProcessArgs {
|
|
5
|
+
/** The plugin or pipeline, as `/bin` names it. */
|
|
6
|
+
name: string | null;
|
|
7
|
+
/** The feed's title, when one is made. */
|
|
8
|
+
title: string | null;
|
|
9
|
+
/** Whether the line returns at once rather than waiting for the run. */
|
|
10
|
+
detach: boolean;
|
|
11
|
+
/** What follows `--`, handed to the run as its own arguments. */
|
|
12
|
+
forwarded: string[];
|
|
13
|
+
/** Why the words make no request, when they do not. */
|
|
14
|
+
error: string | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads the words after `gather process`.
|
|
18
|
+
*
|
|
19
|
+
* @param words - The words, raw.
|
|
20
|
+
* @returns The request, or why it is not one.
|
|
21
|
+
*/
|
|
22
|
+
export declare function gatherProcessArgs_parse(words: ReadonlyArray<string>): GatherProcessArgs;
|
|
23
|
+
/**
|
|
24
|
+
* `gather feed [--title T]`: the cohort's feed, made now when it has none.
|
|
25
|
+
*
|
|
26
|
+
* The feed is rooted on every member's place, so a series still at the
|
|
27
|
+
* PACS is pulled first (one `pull` over all of them); a folder or a file is
|
|
28
|
+
* already in CUBE and goes into the root as it is. The feed is noted on the
|
|
29
|
+
* cohort, which is what a later `gather process` runs off and what a
|
|
30
|
+
* surface reads it from.
|
|
31
|
+
*
|
|
32
|
+
* @param words - The words after `gather feed`, raw.
|
|
33
|
+
* @returns The cohort with its feed, and whether the feed was made now; or a refusal.
|
|
34
|
+
*/
|
|
35
|
+
export declare function cohortFeed_make(words: ReadonlyArray<string>): Promise<{
|
|
36
|
+
state: GatherState;
|
|
37
|
+
made: boolean;
|
|
38
|
+
} | string>;
|
|
39
|
+
/**
|
|
40
|
+
* `gather process <name> [--title T] [--detach] [-- args]`: runs a plugin or
|
|
41
|
+
* a pipeline once over the whole cohort.
|
|
42
|
+
*
|
|
43
|
+
* @param words - The words after `gather process`, raw.
|
|
44
|
+
* @returns The run's envelope, or a refusal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function gather_process(words: ReadonlyArray<string>): Promise<CommandEnvelope>;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `gather process`: one run over the whole cohort.
|
|
3
|
+
*
|
|
4
|
+
* A cohort is processed as a group: one feed whose `pl-dircopy` root holds
|
|
5
|
+
* every member's landed folder, and the named plugin or pipeline runs once
|
|
6
|
+
* off that root, reading the group from it. There is no loop: the iteration
|
|
7
|
+
* is in the data the plugin reads. This is the shape ARGUS's PROCESS builds
|
|
8
|
+
* from a press (#597), so a manifest and a press make the same feed.
|
|
9
|
+
*
|
|
10
|
+
* When the cohort already has a feed (`gather feed`, which ARGUS's CREATE
|
|
11
|
+
* FEED sends, noted it on the cohort), the run goes off that feed's root and
|
|
12
|
+
* nothing is copied twice; otherwise the feed is made here and noted on the
|
|
13
|
+
* cohort for the next run. The name resolves as a bare line resolves it in
|
|
14
|
+
* `/bin`. A series not pulled yet has no folder to copy, and the verb refuses
|
|
15
|
+
* by name rather than processing part of the cohort.
|
|
16
|
+
*
|
|
17
|
+
* It answers what the bare run would: `run.scheduled` for a plugin,
|
|
18
|
+
* `pipeline.scheduled` for a pipeline. Waiting, `--detach` and failure are
|
|
19
|
+
* the bare run's.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import chalk from 'chalk';
|
|
24
|
+
import { feed_create } from '@fnndsc/salsa';
|
|
25
|
+
import { envelope_error } from '@fnndsc/menu';
|
|
26
|
+
import { sink_dataLine } from '../../core/sink.js';
|
|
27
|
+
import { binExecutableMatches_get } from '../../chris/binExecutables.js';
|
|
28
|
+
import { builtin_executePlugin } from '../pluginExecute.js';
|
|
29
|
+
import { builtin_pipeline } from './pipeline.js';
|
|
30
|
+
import { newFeed_cacheAdd, run_follow } from '../feedCreation.js';
|
|
31
|
+
import { cohort_read, cohort_write, cohortFolders_resolve } from './gather.store.js';
|
|
32
|
+
/** The usage line a refusal points at. */
|
|
33
|
+
const USAGE = 'gather process <plugin|pipeline> [--title T] [--detach] [-- <its arguments>]';
|
|
34
|
+
/**
|
|
35
|
+
* Reads the words after `gather process`.
|
|
36
|
+
*
|
|
37
|
+
* @param words - The words, raw.
|
|
38
|
+
* @returns The request, or why it is not one.
|
|
39
|
+
*/
|
|
40
|
+
export function gatherProcessArgs_parse(words) {
|
|
41
|
+
const delimiter = words.indexOf('--');
|
|
42
|
+
const own = delimiter === -1 ? words : words.slice(0, delimiter);
|
|
43
|
+
const forwarded = delimiter === -1 ? [] : words.slice(delimiter + 1);
|
|
44
|
+
const parsed = { name: null, title: null, detach: false, forwarded, error: null };
|
|
45
|
+
for (let at = 0; at < own.length; at++) {
|
|
46
|
+
const word = own[at];
|
|
47
|
+
if (word === '--detach') {
|
|
48
|
+
parsed.detach = true;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (word === '--title') {
|
|
52
|
+
const title = own[at + 1];
|
|
53
|
+
if (title === undefined || title.startsWith('--') || title.trim() === '') {
|
|
54
|
+
parsed.error ??= '--title needs a title';
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
parsed.title = title.trim();
|
|
58
|
+
at++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (word.startsWith('-')) {
|
|
62
|
+
parsed.error ??= `${word}: unknown option; the run's own arguments go after --`;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (parsed.name !== null) {
|
|
66
|
+
parsed.error ??= `one plugin or pipeline at a time; ${word} is a second (its arguments go after --)`;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
parsed.name = word;
|
|
70
|
+
}
|
|
71
|
+
if (parsed.name === null)
|
|
72
|
+
parsed.error ??= `name the plugin or pipeline to run over the cohort. Usage: ${USAGE}`;
|
|
73
|
+
return parsed;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Refuses, saying why.
|
|
77
|
+
*
|
|
78
|
+
* @param message - What the operator needs to know.
|
|
79
|
+
* @returns The error envelope.
|
|
80
|
+
*/
|
|
81
|
+
function process_refuse(message) {
|
|
82
|
+
process.exitCode = 1;
|
|
83
|
+
return envelope_error('', undefined, `${chalk.red(`gather process: ${message}`)}\n`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Where a member is in CUBE: a pulled series' landed folder, a folder or
|
|
87
|
+
* file's own path; null for a series not pulled yet.
|
|
88
|
+
*
|
|
89
|
+
* @param member - The member.
|
|
90
|
+
* @returns Its CFS path, or null.
|
|
91
|
+
*/
|
|
92
|
+
function member_place(member) {
|
|
93
|
+
if (member.kind !== 'series')
|
|
94
|
+
return member.vfsPath;
|
|
95
|
+
const landed = member.folderPath;
|
|
96
|
+
return typeof landed === 'string' && landed.length > 0 ? landed : null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* What a member is called in a refusal.
|
|
100
|
+
*
|
|
101
|
+
* @param member - The member.
|
|
102
|
+
* @returns Its description, or the last part of its address.
|
|
103
|
+
*/
|
|
104
|
+
function member_word(member) {
|
|
105
|
+
return member.description ?? member.vfsPath.split('/').filter(Boolean).pop() ?? member.vfsPath;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The cohort's feed: the one noted on it, or one made now from every
|
|
109
|
+
* member's place and noted on the cohort.
|
|
110
|
+
*
|
|
111
|
+
* @param state - The cohort.
|
|
112
|
+
* @param places - Every member's CFS path.
|
|
113
|
+
* @param title - The title for a feed made now.
|
|
114
|
+
* @returns The feed and whether it was made now, or a refusal.
|
|
115
|
+
*/
|
|
116
|
+
async function cohortFeed_ensure(state, places, title) {
|
|
117
|
+
if (state.feed !== null)
|
|
118
|
+
return { feed: state.feed, made: false };
|
|
119
|
+
const feed = await feed_create(places, { title });
|
|
120
|
+
const feedId = Number(feed?.id);
|
|
121
|
+
const rootInstanceId = Number(feed?.pluginInstance?.data?.id);
|
|
122
|
+
const owner = typeof feed?.owner_username === 'string' ? feed.owner_username.trim() : '';
|
|
123
|
+
if (!Number.isInteger(feedId) || feedId <= 0 || !Number.isInteger(rootInstanceId) || rootInstanceId <= 0 || owner === '') {
|
|
124
|
+
return `could not make the cohort's feed '${title}'`;
|
|
125
|
+
}
|
|
126
|
+
newFeed_cacheAdd({ feedID: feedId, title, ownerUsername: owner, rootInstanceID: rootInstanceId });
|
|
127
|
+
run_follow(feedId);
|
|
128
|
+
const made = { feedId, rootInstanceId, path: `/home/${owner}/feeds/feed_${feedId}/pl-dircopy_${rootInstanceId}/data` };
|
|
129
|
+
await cohort_write({ ...state, feed: made });
|
|
130
|
+
sink_dataLine(chalk.green(`Feed created: ${feedId} (${places.length} member${places.length === 1 ? '' : 's'} in its root, ${rootInstanceId})`));
|
|
131
|
+
return { feed: made, made: true };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* `gather feed [--title T]`: the cohort's feed, made now when it has none.
|
|
135
|
+
*
|
|
136
|
+
* The feed is rooted on every member's place, so a series still at the
|
|
137
|
+
* PACS is pulled first (one `pull` over all of them); a folder or a file is
|
|
138
|
+
* already in CUBE and goes into the root as it is. The feed is noted on the
|
|
139
|
+
* cohort, which is what a later `gather process` runs off and what a
|
|
140
|
+
* surface reads it from.
|
|
141
|
+
*
|
|
142
|
+
* @param words - The words after `gather feed`, raw.
|
|
143
|
+
* @returns The cohort with its feed, and whether the feed was made now; or a refusal.
|
|
144
|
+
*/
|
|
145
|
+
export async function cohortFeed_make(words) {
|
|
146
|
+
let title = null;
|
|
147
|
+
for (let at = 0; at < words.length; at++) {
|
|
148
|
+
const word = words[at];
|
|
149
|
+
if (word === '--title') {
|
|
150
|
+
const given = words[at + 1];
|
|
151
|
+
if (given === undefined || given.startsWith('--') || given.trim() === '')
|
|
152
|
+
return '--title needs a title';
|
|
153
|
+
title = given.trim();
|
|
154
|
+
at++;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
return `${word}: not understood. Usage: gather feed [--title T]`;
|
|
158
|
+
}
|
|
159
|
+
let state = await cohortFolders_resolve(await cohort_read());
|
|
160
|
+
if (state.series.length === 0)
|
|
161
|
+
return 'the cohort is empty; gather add something first';
|
|
162
|
+
if (state.feed !== null)
|
|
163
|
+
return { state, made: false };
|
|
164
|
+
const away = state.series.filter((member) => member_place(member) === null);
|
|
165
|
+
if (away.length > 0) {
|
|
166
|
+
// Loaded on demand: only a cohort with series still at the PACS pulls.
|
|
167
|
+
const { builtin_pull } = await import('../fs/pull.js');
|
|
168
|
+
await builtin_pull(away.map((member) => member.vfsPath));
|
|
169
|
+
state = await cohortFolders_resolve(await cohort_read());
|
|
170
|
+
const waiting = state.series.filter((member) => member_place(member) === null);
|
|
171
|
+
if (waiting.length > 0) {
|
|
172
|
+
const named = waiting.slice(0, 5).map(member_word).join(', ') + (waiting.length > 5 ? `, and ${waiting.length - 5} more` : '');
|
|
173
|
+
return `${waiting.length} series did not land (${named}); no feed was made`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const places = state.series.map((member) => member_place(member));
|
|
177
|
+
const ensured = await cohortFeed_ensure(state, places, title ?? state.name ?? 'cohort');
|
|
178
|
+
if (typeof ensured === 'string')
|
|
179
|
+
return ensured;
|
|
180
|
+
return { state: { ...state, feed: ensured.feed }, made: ensured.made };
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* `gather process <name> [--title T] [--detach] [-- args]`: runs a plugin or
|
|
184
|
+
* a pipeline once over the whole cohort.
|
|
185
|
+
*
|
|
186
|
+
* @param words - The words after `gather process`, raw.
|
|
187
|
+
* @returns The run's envelope, or a refusal.
|
|
188
|
+
*/
|
|
189
|
+
export async function gather_process(words) {
|
|
190
|
+
const parsed = gatherProcessArgs_parse(words);
|
|
191
|
+
if (parsed.error !== null || parsed.name === null)
|
|
192
|
+
return process_refuse(parsed.error ?? USAGE);
|
|
193
|
+
const name = parsed.name;
|
|
194
|
+
// A series pulled but not yet noted on the cohort is found in CUBE, not
|
|
195
|
+
// refused as never pulled.
|
|
196
|
+
const state = await cohortFolders_resolve(await cohort_read());
|
|
197
|
+
if (state.series.length === 0)
|
|
198
|
+
return process_refuse('the cohort is empty; gather add something first');
|
|
199
|
+
const waiting = state.series.filter((member) => member_place(member) === null);
|
|
200
|
+
if (waiting.length > 0) {
|
|
201
|
+
const named = waiting.slice(0, 5).map(member_word).join(', ') + (waiting.length > 5 ? `, and ${waiting.length - 5} more` : '');
|
|
202
|
+
return process_refuse(`${waiting.length} series ${waiting.length === 1 ? 'is' : 'are'} not pulled yet (${named}); pull \${gather} first`);
|
|
203
|
+
}
|
|
204
|
+
const matches = await binExecutableMatches_get(name);
|
|
205
|
+
if (matches.plugin !== undefined && matches.pipeline !== undefined) {
|
|
206
|
+
return process_refuse(`${name} names both a plugin and a pipeline in /bin; it cannot tell which to run`);
|
|
207
|
+
}
|
|
208
|
+
if (matches.plugin === undefined && matches.pipeline === undefined) {
|
|
209
|
+
return process_refuse(`no plugin or pipeline named ${name} in /bin`);
|
|
210
|
+
}
|
|
211
|
+
const places = state.series.map((member) => member_place(member));
|
|
212
|
+
const title = parsed.title ?? state.name ?? 'cohort';
|
|
213
|
+
const ensured = await cohortFeed_ensure(state, places, title);
|
|
214
|
+
if (typeof ensured === 'string')
|
|
215
|
+
return process_refuse(ensured);
|
|
216
|
+
const { feed, made } = ensured;
|
|
217
|
+
const detach = parsed.detach ? ['--detach'] : [];
|
|
218
|
+
const envelope = matches.pipeline !== undefined
|
|
219
|
+
// By its /bin name, which names the id: a pipeline found by its CUBE
|
|
220
|
+
// name runs as exactly that one.
|
|
221
|
+
? await builtin_pipeline(['run', matches.pipeline.name, '--previous', String(feed.rootInstanceId), ...detach, ...parsed.forwarded])
|
|
222
|
+
: await builtin_executePlugin(name, [...detach, ...parsed.forwarded], feed.path);
|
|
223
|
+
// The run went off a root, so it reads as continuing a feed; when that
|
|
224
|
+
// feed was made by this line, the answer says so, as a bare run's would.
|
|
225
|
+
if (made && envelope.model !== undefined && typeof envelope.model.data === 'object' && envelope.model.data !== null) {
|
|
226
|
+
return { ...envelope, model: { ...envelope.model, data: { ...envelope.model.data, newFeed: true } } };
|
|
227
|
+
}
|
|
228
|
+
return envelope;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=gather.process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACxG,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EnvelopeModel } from '@fnndsc/menu';
|
|
1
2
|
/** Where the session keeps the cohort it is working on. */
|
|
2
3
|
export declare const COHORT_FILE: string;
|
|
3
4
|
/** The directory that holds it, created on first write. */
|
|
@@ -57,6 +58,16 @@ export interface GatherState {
|
|
|
57
58
|
}
|
|
58
59
|
/** An empty cohort: what a session that has gathered nothing holds. */
|
|
59
60
|
export declare function cohortState_empty(): GatherState;
|
|
61
|
+
/**
|
|
62
|
+
* The cohort as the model it travels in.
|
|
63
|
+
*
|
|
64
|
+
* Every verb that changes the cohort answers with it, so a surface showing
|
|
65
|
+
* the cohort redraws from the kernel's copy and never keeps one of its own.
|
|
66
|
+
*
|
|
67
|
+
* @param state - The cohort.
|
|
68
|
+
* @returns The `gather.cohort` model.
|
|
69
|
+
*/
|
|
70
|
+
export declare function cohortModel_of(state: GatherState): EnvelopeModel;
|
|
60
71
|
/**
|
|
61
72
|
* The identity of one member.
|
|
62
73
|
*
|
|
@@ -101,10 +112,35 @@ export declare function pathKind_determine(address: string): Promise<GatherKind
|
|
|
101
112
|
/**
|
|
102
113
|
* The series UID a PACS projection path names, when it names one.
|
|
103
114
|
*
|
|
115
|
+
* A query's answer names a series `Series_<uid>_<description>`; a path may
|
|
116
|
+
* also end in the bare UID.
|
|
117
|
+
*
|
|
104
118
|
* @param address - A resolved VFS path.
|
|
105
119
|
* @returns The UID, or undefined when the path is not a series projection.
|
|
106
120
|
*/
|
|
107
121
|
export declare function seriesUID_ofPath(address: string): string | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Notes on the cohort where the series a pull fetched landed.
|
|
124
|
+
*
|
|
125
|
+
* The pull knows each folder the moment CUBE files it; a member that stands
|
|
126
|
+
* for one of those series takes the folder, so the cohort reads as home
|
|
127
|
+
* without asking CUBE again.
|
|
128
|
+
*
|
|
129
|
+
* @param landed - Series UID to the CUBE folder it landed in.
|
|
130
|
+
* @returns How many members changed.
|
|
131
|
+
*/
|
|
132
|
+
export declare function cohortFolders_note(landed: ReadonlyMap<string, string>): Promise<number>;
|
|
133
|
+
/**
|
|
134
|
+
* Asks CUBE where any series member not yet known to be home landed.
|
|
135
|
+
*
|
|
136
|
+
* CUBE is the truth and the cohort file a cache of it: a series pulled
|
|
137
|
+
* earlier, by a surface or in another session, or a folder a surface's
|
|
138
|
+
* rewrite dropped, is found again here rather than read as never pulled.
|
|
139
|
+
*
|
|
140
|
+
* @param state - The cohort, changed in place.
|
|
141
|
+
* @returns The cohort, with every folder CUBE could name; written back when it changed.
|
|
142
|
+
*/
|
|
143
|
+
export declare function cohortFolders_resolve(state: GatherState): Promise<GatherState>;
|
|
108
144
|
/**
|
|
109
145
|
* Takes members into a cohort, merging what a later sighting knows.
|
|
110
146
|
*
|