@fnndsc/cumin 3.25.0 → 3.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/listCache.d.ts +35 -0
- package/dist/cache/listCache.js +62 -0
- package/dist/cache/listCache.js.map +1 -1
- package/dist/chrisapi/adapter.d.ts +1 -1
- package/dist/chrisapi/adapter.js.map +1 -1
- package/dist/chrisapi/contract.js +9 -1
- package/dist/chrisapi/contract.js.map +1 -1
- package/dist/connect/chrisConnection.js +7 -1
- package/dist/connect/chrisConnection.js.map +1 -1
- package/dist/feeds/chrisAccess.d.ts +44 -0
- package/dist/feeds/chrisAccess.js +156 -0
- package/dist/feeds/chrisAccess.js.map +1 -0
- package/dist/feeds/chrisTags.d.ts +94 -0
- package/dist/feeds/chrisTags.js +336 -0
- package/dist/feeds/chrisTags.js.map +1 -0
- package/dist/filebrowser/folderMemo.d.ts +20 -0
- package/dist/filebrowser/folderMemo.js +32 -0
- package/dist/filebrowser/folderMemo.js.map +1 -0
- package/dist/groups/chrisGroups.js +51 -4
- package/dist/groups/chrisGroups.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/net/requestLedger.d.ts +78 -0
- package/dist/net/requestLedger.js +158 -0
- package/dist/net/requestLedger.js.map +1 -0
- package/dist/pipelines/chrisPipeline.d.ts +5 -0
- package/dist/pipelines/chrisPipeline.js +107 -40
- package/dist/pipelines/chrisPipeline.js.map +1 -1
- package/dist/pipelines/pipelineMemo.d.ts +63 -0
- package/dist/pipelines/pipelineMemo.js +94 -0
- package/dist/pipelines/pipelineMemo.js.map +1 -0
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ __exportStar(require("./"), exports);
|
|
|
30
30
|
__exportStar(require("./error/errorStack"), exports);
|
|
31
31
|
__exportStar(require("./config/config"), exports);
|
|
32
32
|
__exportStar(require("./feeds/chrisFeed"), exports);
|
|
33
|
+
__exportStar(require("./feeds/chrisTags"), exports);
|
|
34
|
+
__exportStar(require("./feeds/chrisAccess"), exports);
|
|
33
35
|
__exportStar(require("./connect/chrisConnection"), exports);
|
|
34
36
|
__exportStar(require("./context/chrisContext"), exports);
|
|
35
37
|
__exportStar(require("./plugins/chrisPlugins"), exports);
|
|
@@ -43,10 +45,12 @@ __exportStar(require("./resources/chrisResourceGroup"), exports);
|
|
|
43
45
|
__exportStar(require("./resources/chrisObjContext"), exports);
|
|
44
46
|
__exportStar(require("./resources/chrisEmbeddedResourceGroup"), exports);
|
|
45
47
|
__exportStar(require("./filebrowser/chrisFileBrowser"), exports);
|
|
48
|
+
__exportStar(require("./filebrowser/folderMemo"), exports);
|
|
46
49
|
__exportStar(require("./filebrowser/chrisFiles"), exports);
|
|
47
50
|
__exportStar(require("./filebrowser/chrisPACS"), exports);
|
|
48
51
|
__exportStar(require("./filebrowser/chrisPipeline"), exports);
|
|
49
52
|
__exportStar(require("./io/chrisIO"), exports);
|
|
53
|
+
__exportStar(require("./net/requestLedger"), exports);
|
|
50
54
|
__exportStar(require("./io/io"), exports);
|
|
51
55
|
__exportStar(require("./io/node_io"), exports);
|
|
52
56
|
__exportStar(require("./utils/keypair"), exports);
|
|
@@ -57,6 +61,7 @@ __exportStar(require("./utils/envelope"), exports);
|
|
|
57
61
|
__exportStar(require("./cache"), exports);
|
|
58
62
|
__exportStar(require("./path/chrisPath"), exports);
|
|
59
63
|
__exportStar(require("./pipelines/chrisPipeline"), exports);
|
|
64
|
+
__exportStar(require("./pipelines/pipelineMemo"), exports);
|
|
60
65
|
__exportStar(require("./users/chrisUsers"), exports);
|
|
61
66
|
__exportStar(require("./tags/chrisTags"), exports);
|
|
62
67
|
__exportStar(require("./groups/chrisGroups"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;GAQG;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,wGAAA,YAAY,OAAA;AACZ,uHAAA,2BAA2B,OAAA;AAC3B,qHAAA,yBAAyB,OAAA;AACzB,gHAAA,oBAAoB,OAAA;AACpB,0GAAA,cAAc,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AACtC,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AAsDrB;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CAAC,GAAW;IAChD,MAAM,OAAO,GAAW,OAAO,CAAC;IAChC,wCAAwC;IACxC,6CAA6C;IAC7C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC5B,CAAC;AAED,gEAAgE;AAChE,qCAAqC;AACrC,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** One request as the ledger saw it. */
|
|
2
|
+
export interface LedgerEntry {
|
|
3
|
+
/** Milliseconds since the ledger started. */
|
|
4
|
+
at: number;
|
|
5
|
+
method: string;
|
|
6
|
+
/** The endpoint family: `filebrowser/search`, `filebrowser/:id/children`, `plugins`, … */
|
|
7
|
+
family: string;
|
|
8
|
+
/** The path with its query, as sent (capped). */
|
|
9
|
+
path: string;
|
|
10
|
+
/** The response status; 0 when the request failed before one. */
|
|
11
|
+
status: number;
|
|
12
|
+
/** How long it took, request to response headers. */
|
|
13
|
+
ms: number;
|
|
14
|
+
}
|
|
15
|
+
/** A family's tally. */
|
|
16
|
+
export interface LedgerFamily {
|
|
17
|
+
family: string;
|
|
18
|
+
count: number;
|
|
19
|
+
/** Milliseconds spent, summed. */
|
|
20
|
+
ms: number;
|
|
21
|
+
}
|
|
22
|
+
/** What `netstat` reads out. */
|
|
23
|
+
export interface LedgerSnapshot {
|
|
24
|
+
/** When the count began: the session, or the last reset (ISO 8601). */
|
|
25
|
+
since: string;
|
|
26
|
+
/** Requests since then. */
|
|
27
|
+
total: number;
|
|
28
|
+
/** Milliseconds spent on them, summed. */
|
|
29
|
+
ms: number;
|
|
30
|
+
/** By family, most requests first. */
|
|
31
|
+
families: LedgerFamily[];
|
|
32
|
+
/** The last requests, oldest first. */
|
|
33
|
+
last: LedgerEntry[];
|
|
34
|
+
}
|
|
35
|
+
/** How many entries the ledger keeps. */
|
|
36
|
+
export declare const LEDGER_KEPT: number;
|
|
37
|
+
/**
|
|
38
|
+
* Names a request's endpoint family: the path below `/api/v1/`, ids
|
|
39
|
+
* replaced by `:id`, the query dropped, trailing slash dropped.
|
|
40
|
+
*
|
|
41
|
+
* @param path - The request path, query and all.
|
|
42
|
+
* @returns The family, or `root` for the API root.
|
|
43
|
+
*/
|
|
44
|
+
export declare function requestFamily_of(path: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Notes a request as it starts.
|
|
47
|
+
*
|
|
48
|
+
* @param request - The request object the channel carried (the key).
|
|
49
|
+
* @param method - Its method.
|
|
50
|
+
* @param path - Its path.
|
|
51
|
+
*/
|
|
52
|
+
export declare function ledger_requestStart(request: object, method: string, path: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Notes a request as it ends, however it ended.
|
|
55
|
+
*
|
|
56
|
+
* @param request - The request object the channel carried.
|
|
57
|
+
* @param status - The response status, or 0 for a failure.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ledger_requestEnd(request: object, status: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Starts listening. Idempotent: the connection calls it as it is made,
|
|
62
|
+
* and a second call changes nothing.
|
|
63
|
+
*/
|
|
64
|
+
export declare function requestLedger_start(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Forgets the count: the next snapshot counts from now. The last entries
|
|
67
|
+
* are kept so a reset mid-navigation still shows what just happened.
|
|
68
|
+
*/
|
|
69
|
+
export declare function requestLedger_reset(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Reads the ledger.
|
|
72
|
+
*
|
|
73
|
+
* @param options - `last`: how many recent entries to carry (default 20).
|
|
74
|
+
* @returns The snapshot, families most-requested first.
|
|
75
|
+
*/
|
|
76
|
+
export declare function requestLedger_snapshot(options?: {
|
|
77
|
+
last?: number;
|
|
78
|
+
}): LedgerSnapshot;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEDGER_KEPT = void 0;
|
|
4
|
+
exports.requestFamily_of = requestFamily_of;
|
|
5
|
+
exports.ledger_requestStart = ledger_requestStart;
|
|
6
|
+
exports.ledger_requestEnd = ledger_requestEnd;
|
|
7
|
+
exports.requestLedger_start = requestLedger_start;
|
|
8
|
+
exports.requestLedger_reset = requestLedger_reset;
|
|
9
|
+
exports.requestLedger_snapshot = requestLedger_snapshot;
|
|
10
|
+
/**
|
|
11
|
+
* @file The request ledger: every call the kernel makes to CUBE, counted.
|
|
12
|
+
*
|
|
13
|
+
* A navigation that felt slow turned out to be fourteen requests where
|
|
14
|
+
* four would do, and nothing in the session could say so — the count was
|
|
15
|
+
* found with a preload hack on a private daemon. The ledger makes the
|
|
16
|
+
* wire a readout: how many requests since the session (or the last
|
|
17
|
+
* reset), by endpoint family, with the last ones timed. `netstat` reads
|
|
18
|
+
* it; smoke asserts budgets against it; an operator on a slow day asks
|
|
19
|
+
* it before guessing.
|
|
20
|
+
*
|
|
21
|
+
* It listens on Node's own diagnostics channels — the http client (what
|
|
22
|
+
* axios rides) and undici (what fetch rides) — so nothing is patched and
|
|
23
|
+
* every caller is seen.
|
|
24
|
+
*/
|
|
25
|
+
const node_diagnostics_channel_1 = require("node:diagnostics_channel");
|
|
26
|
+
/** How many entries the ledger keeps. */
|
|
27
|
+
exports.LEDGER_KEPT = 200;
|
|
28
|
+
/** A path longer than this is cut, with an ellipsis. */
|
|
29
|
+
const PATH_KEPT = 160;
|
|
30
|
+
let started = false;
|
|
31
|
+
let origin = Date.now();
|
|
32
|
+
let since = new Date(origin).toISOString();
|
|
33
|
+
let total = 0;
|
|
34
|
+
let msTotal = 0;
|
|
35
|
+
const families = new Map();
|
|
36
|
+
const entries = [];
|
|
37
|
+
const open = new WeakMap();
|
|
38
|
+
/**
|
|
39
|
+
* Names a request's endpoint family: the path below `/api/v1/`, ids
|
|
40
|
+
* replaced by `:id`, the query dropped, trailing slash dropped.
|
|
41
|
+
*
|
|
42
|
+
* @param path - The request path, query and all.
|
|
43
|
+
* @returns The family, or `root` for the API root.
|
|
44
|
+
*/
|
|
45
|
+
function requestFamily_of(path) {
|
|
46
|
+
const bare = path.split('?')[0] ?? '';
|
|
47
|
+
const below = bare.replace(/^.*?\/api\/v1\/?/, '').replace(/\/+$/, '');
|
|
48
|
+
if (below === '')
|
|
49
|
+
return 'root';
|
|
50
|
+
return below.split('/').map((segment) => (/^\d+$/.test(segment) ? ':id' : segment)).join('/');
|
|
51
|
+
}
|
|
52
|
+
const path_cap = (path) => (path.length > PATH_KEPT ? `${path.slice(0, PATH_KEPT - 1)}…` : path);
|
|
53
|
+
function entry_record(method, path, status, t0) {
|
|
54
|
+
const ms = Math.round(performance.now() - t0);
|
|
55
|
+
const family = requestFamily_of(path);
|
|
56
|
+
total += 1;
|
|
57
|
+
msTotal += ms;
|
|
58
|
+
const tally = families.get(family) ?? { family, count: 0, ms: 0 };
|
|
59
|
+
tally.count += 1;
|
|
60
|
+
tally.ms += ms;
|
|
61
|
+
families.set(family, tally);
|
|
62
|
+
entries.push({ at: Date.now() - origin, method, family, path: path_cap(path), status, ms });
|
|
63
|
+
if (entries.length > exports.LEDGER_KEPT)
|
|
64
|
+
entries.splice(0, entries.length - exports.LEDGER_KEPT);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Notes a request as it starts.
|
|
68
|
+
*
|
|
69
|
+
* @param request - The request object the channel carried (the key).
|
|
70
|
+
* @param method - Its method.
|
|
71
|
+
* @param path - Its path.
|
|
72
|
+
*/
|
|
73
|
+
function ledger_requestStart(request, method, path) {
|
|
74
|
+
open.set(request, { t0: performance.now(), method, path });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Notes a request as it ends, however it ended.
|
|
78
|
+
*
|
|
79
|
+
* @param request - The request object the channel carried.
|
|
80
|
+
* @param status - The response status, or 0 for a failure.
|
|
81
|
+
*/
|
|
82
|
+
function ledger_requestEnd(request, status) {
|
|
83
|
+
const begun = open.get(request);
|
|
84
|
+
if (begun === undefined)
|
|
85
|
+
return;
|
|
86
|
+
open.delete(request);
|
|
87
|
+
entry_record(begun.method, begun.path, status, begun.t0);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Starts listening. Idempotent: the connection calls it as it is made,
|
|
91
|
+
* and a second call changes nothing.
|
|
92
|
+
*/
|
|
93
|
+
function requestLedger_start() {
|
|
94
|
+
if (started)
|
|
95
|
+
return;
|
|
96
|
+
started = true;
|
|
97
|
+
const method_of = (request) => (typeof request.method === 'string' ? request.method : 'GET');
|
|
98
|
+
const path_of = (request) => (typeof request.path === 'string' ? request.path : '');
|
|
99
|
+
(0, node_diagnostics_channel_1.subscribe)('http.client.request.start', (message) => {
|
|
100
|
+
const { request } = message;
|
|
101
|
+
if (request !== undefined && request !== null)
|
|
102
|
+
ledger_requestStart(request, method_of(request), path_of(request));
|
|
103
|
+
});
|
|
104
|
+
(0, node_diagnostics_channel_1.subscribe)('http.client.response.finish', (message) => {
|
|
105
|
+
const { request, response } = message;
|
|
106
|
+
if (request !== undefined && request !== null)
|
|
107
|
+
ledger_requestEnd(request, typeof response?.statusCode === 'number' ? response.statusCode : 0);
|
|
108
|
+
});
|
|
109
|
+
(0, node_diagnostics_channel_1.subscribe)('http.client.request.error', (message) => {
|
|
110
|
+
const { request } = message;
|
|
111
|
+
if (request !== undefined && request !== null)
|
|
112
|
+
ledger_requestEnd(request, 0);
|
|
113
|
+
});
|
|
114
|
+
(0, node_diagnostics_channel_1.subscribe)('undici:request:create', (message) => {
|
|
115
|
+
const { request } = message;
|
|
116
|
+
if (request !== undefined && request !== null)
|
|
117
|
+
ledger_requestStart(request, method_of(request), path_of(request));
|
|
118
|
+
});
|
|
119
|
+
(0, node_diagnostics_channel_1.subscribe)('undici:request:headers', (message) => {
|
|
120
|
+
const { request, response } = message;
|
|
121
|
+
if (request !== undefined && request !== null)
|
|
122
|
+
ledger_requestEnd(request, typeof response?.statusCode === 'number' ? response.statusCode : 0);
|
|
123
|
+
});
|
|
124
|
+
(0, node_diagnostics_channel_1.subscribe)('undici:request:error', (message) => {
|
|
125
|
+
const { request } = message;
|
|
126
|
+
if (request !== undefined && request !== null)
|
|
127
|
+
ledger_requestEnd(request, 0);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Forgets the count: the next snapshot counts from now. The last entries
|
|
132
|
+
* are kept so a reset mid-navigation still shows what just happened.
|
|
133
|
+
*/
|
|
134
|
+
function requestLedger_reset() {
|
|
135
|
+
origin = Date.now();
|
|
136
|
+
since = new Date(origin).toISOString();
|
|
137
|
+
total = 0;
|
|
138
|
+
msTotal = 0;
|
|
139
|
+
families.clear();
|
|
140
|
+
entries.length = 0;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Reads the ledger.
|
|
144
|
+
*
|
|
145
|
+
* @param options - `last`: how many recent entries to carry (default 20).
|
|
146
|
+
* @returns The snapshot, families most-requested first.
|
|
147
|
+
*/
|
|
148
|
+
function requestLedger_snapshot(options = {}) {
|
|
149
|
+
const last = Math.max(0, Math.min(exports.LEDGER_KEPT, options.last ?? 20));
|
|
150
|
+
return {
|
|
151
|
+
since,
|
|
152
|
+
total,
|
|
153
|
+
ms: msTotal,
|
|
154
|
+
families: [...families.values()].sort((a, b) => b.count - a.count || a.family.localeCompare(b.family)),
|
|
155
|
+
last: entries.slice(-last),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=requestLedger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestLedger.js","sourceRoot":"","sources":["../../src/net/requestLedger.ts"],"names":[],"mappings":";;;AA2EA,4CAKC;AAwBD,kDAEC;AAQD,8CAKC;AAMD,kDA6BC;AAMD,kDAOC;AAQD,wDASC;AAxLD;;;;;;;;;;;;;;GAcG;AACH,uEAAqD;AAuCrD,yCAAyC;AAC5B,QAAA,WAAW,GAAW,GAAG,CAAC;AACvC,wDAAwD;AACxD,MAAM,SAAS,GAAW,GAAG,CAAC;AAE9B,IAAI,OAAO,GAAY,KAAK,CAAC;AAC7B,IAAI,MAAM,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,KAAK,GAAW,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;AACnD,IAAI,KAAK,GAAW,CAAC,CAAC;AACtB,IAAI,OAAO,GAAW,CAAC,CAAC;AACxB,MAAM,QAAQ,GAA8B,IAAI,GAAG,EAAE,CAAC;AACtD,MAAM,OAAO,GAAkB,EAAE,CAAC;AAClC,MAAM,IAAI,GAAkE,IAAI,OAAO,EAAE,CAAC;AAE1F;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAW,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/E,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IAChC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG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AAC,KAAK,CAAC,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -76,6 +76,11 @@ export declare function pipelines_list(search?: string): Promise<Result<Pipeline
|
|
|
76
76
|
/**
|
|
77
77
|
* Resolves a pipeline by name (exact match first, then substring) or numeric ID string.
|
|
78
78
|
*
|
|
79
|
+
* One resolution per specifier per session: the answer is kept on the
|
|
80
|
+
* connection's client (see pipelineMemo), so a diagram asked again — the
|
|
81
|
+
* browser asks one per pipeline card on every visit to /bin — costs no
|
|
82
|
+
* search. A miss is never kept.
|
|
83
|
+
*
|
|
79
84
|
* @param nameOrId - Pipeline name or numeric ID.
|
|
80
85
|
* @returns Result containing the matched PipelineRecord.
|
|
81
86
|
*/
|
|
@@ -18,10 +18,13 @@ exports.pipeline_resolve = pipeline_resolve;
|
|
|
18
18
|
exports.pipeline_createWorkflow = pipeline_createWorkflow;
|
|
19
19
|
const chrisConnection_js_1 = require("../connect/chrisConnection.js");
|
|
20
20
|
const adapter_js_1 = require("../chrisapi/adapter.js");
|
|
21
|
+
const pipelineMemo_js_1 = require("./pipelineMemo.js");
|
|
21
22
|
const contract_js_1 = require("../chrisapi/contract.js");
|
|
22
23
|
const chrisResourceGroup_js_1 = require("../resources/chrisResourceGroup.js");
|
|
23
24
|
const errorStack_js_1 = require("../error/errorStack.js");
|
|
24
25
|
const result_js_1 = require("../utils/result.js");
|
|
26
|
+
/** How many pipelines a name search reads: exact names seldom collide. */
|
|
27
|
+
const PIPELINE_SEARCH_LIMIT = 100;
|
|
25
28
|
/**
|
|
26
29
|
* Group handler for ChRIS pipelines.
|
|
27
30
|
*/
|
|
@@ -55,18 +58,54 @@ async function pipelines_list(search) {
|
|
|
55
58
|
/**
|
|
56
59
|
* Resolves a pipeline by name (exact match first, then substring) or numeric ID string.
|
|
57
60
|
*
|
|
61
|
+
* One resolution per specifier per session: the answer is kept on the
|
|
62
|
+
* connection's client (see pipelineMemo), so a diagram asked again — the
|
|
63
|
+
* browser asks one per pipeline card on every visit to /bin — costs no
|
|
64
|
+
* search. A miss is never kept.
|
|
65
|
+
*
|
|
58
66
|
* @param nameOrId - Pipeline name or numeric ID.
|
|
59
67
|
* @returns Result containing the matched PipelineRecord.
|
|
60
68
|
*/
|
|
61
69
|
async function pipeline_resolve(nameOrId) {
|
|
70
|
+
const client = await chrisConnection_js_1.chrisConnection.client_get();
|
|
71
|
+
if (!client) {
|
|
72
|
+
errorStack_js_1.errorStack.stack_push('error', 'Not connected to ChRIS');
|
|
73
|
+
return (0, result_js_1.Err)();
|
|
74
|
+
}
|
|
75
|
+
const kept = (0, pipelineMemo_js_1.pipelineRecord_recall)(client, nameOrId);
|
|
76
|
+
if (kept !== null)
|
|
77
|
+
return (0, result_js_1.Ok)(kept);
|
|
78
|
+
const resolved = await pipelineResolve_fetch(client, nameOrId);
|
|
79
|
+
if (resolved.ok)
|
|
80
|
+
(0, pipelineMemo_js_1.pipelineRecord_keep)(client, nameOrId, resolved.value);
|
|
81
|
+
return resolved;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Keeps the chrisapi items a pipeline listing served, by id, so the
|
|
85
|
+
* pipings can be read off them without listing the pipeline again.
|
|
86
|
+
*
|
|
87
|
+
* @param client - The connection's client.
|
|
88
|
+
* @param page - The list response.
|
|
89
|
+
*/
|
|
90
|
+
function pipelineItems_keep(client, page) {
|
|
91
|
+
const items = (0, adapter_js_1.items_get)(page);
|
|
92
|
+
for (const item of items) {
|
|
93
|
+
const data = (0, adapter_js_1.itemData_get)(item);
|
|
94
|
+
if (data && typeof data.id === 'number')
|
|
95
|
+
(0, pipelineMemo_js_1.pipelineResource_keep)(client, data.id, item);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a pipeline against CUBE: the wire half of pipeline_resolve.
|
|
100
|
+
*
|
|
101
|
+
* @param client - The connection's client.
|
|
102
|
+
* @param nameOrId - Pipeline name or numeric ID.
|
|
103
|
+
* @returns Result containing the matched PipelineRecord.
|
|
104
|
+
*/
|
|
105
|
+
async function pipelineResolve_fetch(client, nameOrId) {
|
|
62
106
|
const isNumericID = /^\d+$/.test(nameOrId);
|
|
63
107
|
if (isNumericID) {
|
|
64
108
|
const numericId = parseInt(nameOrId, 10);
|
|
65
|
-
const client = await chrisConnection_js_1.chrisConnection.client_get();
|
|
66
|
-
if (!client) {
|
|
67
|
-
errorStack_js_1.errorStack.stack_push('error', 'Not connected to ChRIS');
|
|
68
|
-
return (0, result_js_1.Err)();
|
|
69
|
-
}
|
|
70
109
|
try {
|
|
71
110
|
const pipeline = await client.getPipeline(numericId);
|
|
72
111
|
const data = (0, adapter_js_1.itemData_get)(pipeline);
|
|
@@ -74,6 +113,7 @@ async function pipeline_resolve(nameOrId) {
|
|
|
74
113
|
errorStack_js_1.errorStack.stack_push('error', `Pipeline with ID ${numericId} not found`);
|
|
75
114
|
return (0, result_js_1.Err)();
|
|
76
115
|
}
|
|
116
|
+
(0, pipelineMemo_js_1.pipelineResource_keep)(client, data.id, pipeline);
|
|
77
117
|
return (0, result_js_1.Ok)(data);
|
|
78
118
|
}
|
|
79
119
|
catch (error) {
|
|
@@ -82,52 +122,79 @@ async function pipeline_resolve(nameOrId) {
|
|
|
82
122
|
return (0, result_js_1.Err)();
|
|
83
123
|
}
|
|
84
124
|
}
|
|
85
|
-
|
|
86
|
-
|
|
125
|
+
// A /bin slug names its pipeline's id (`<base>_id<N>`, minted by the
|
|
126
|
+
// listing from the record), so the id is the identity: one list by id
|
|
127
|
+
// answers, where a name search for the slug is a certain miss and the
|
|
128
|
+
// id only its fallback — two requests. A pipeline CUBE itself named
|
|
129
|
+
// `..._idN` is listed in /bin under its own id, so a bare slug never
|
|
130
|
+
// means it.
|
|
131
|
+
const slugID = nameOrId.match(/_id(\d+)$/);
|
|
132
|
+
if (slugID) {
|
|
133
|
+
try {
|
|
134
|
+
const pipeline = await client.getPipeline(parseInt(slugID[1], 10));
|
|
135
|
+
const data = (0, adapter_js_1.itemData_get)(pipeline);
|
|
136
|
+
if (data) {
|
|
137
|
+
(0, pipelineMemo_js_1.pipelineResource_keep)(client, data.id, pipeline);
|
|
138
|
+
return (0, result_js_1.Ok)(data);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (_e) { }
|
|
142
|
+
}
|
|
143
|
+
// The search is read as a page, not through pipelines_list, so the items
|
|
144
|
+
// it served can be kept: a pipeline's pipings hang off its item.
|
|
145
|
+
let page;
|
|
146
|
+
try {
|
|
147
|
+
page = await (0, adapter_js_1.resource_call)(client, 'getPipelines', { name: nameOrId, limit: PIPELINE_SEARCH_LIMIT });
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
151
|
+
errorStack_js_1.errorStack.stack_push('error', `pipelines_list: ${msg}`);
|
|
87
152
|
return (0, result_js_1.Err)();
|
|
88
|
-
|
|
153
|
+
}
|
|
154
|
+
pipelineItems_keep(client, page);
|
|
155
|
+
const found = (0, adapter_js_1.listData_get)(page);
|
|
156
|
+
const exact = found.find((p) => p.name === nameOrId);
|
|
89
157
|
if (exact)
|
|
90
158
|
return (0, result_js_1.Ok)(exact);
|
|
91
|
-
if (
|
|
92
|
-
return (0, result_js_1.Ok)(
|
|
93
|
-
if (
|
|
94
|
-
const fallbackClient =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const directId = parseInt(idSuffixMatch[1], 10);
|
|
100
|
-
try {
|
|
101
|
-
const pipeline = await fallbackClient.getPipeline(directId);
|
|
102
|
-
const directData = (0, adapter_js_1.itemData_get)(pipeline);
|
|
103
|
-
if (directData) {
|
|
104
|
-
return (0, result_js_1.Ok)(directData);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (_e) { }
|
|
108
|
-
}
|
|
109
|
-
// Slug fallback: treat nameOrId as a source file fname fragment
|
|
159
|
+
if (found.length === 1)
|
|
160
|
+
return (0, result_js_1.Ok)(found[0]);
|
|
161
|
+
if (found.length === 0) {
|
|
162
|
+
const fallbackClient = client;
|
|
163
|
+
// ID-suffix fallback: slug of form "{name}_id{N}" generated for pipelines without source files
|
|
164
|
+
const idSuffixMatch = nameOrId.match(/_id(\d+)$/);
|
|
165
|
+
if (idSuffixMatch) {
|
|
166
|
+
const directId = parseInt(idSuffixMatch[1], 10);
|
|
110
167
|
try {
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (sfItems.length > 0 && sfItems[0].data.pipeline_name) {
|
|
117
|
-
const byName = await pipelines_list(sfItems[0].data.pipeline_name);
|
|
118
|
-
if (byName.ok) {
|
|
119
|
-
const exactByName = byName.value.find((p) => p.name === sfItems[0].data.pipeline_name);
|
|
120
|
-
if (exactByName)
|
|
121
|
-
return (0, result_js_1.Ok)(exactByName);
|
|
122
|
-
}
|
|
168
|
+
const pipeline = await fallbackClient.getPipeline(directId);
|
|
169
|
+
const directData = (0, adapter_js_1.itemData_get)(pipeline);
|
|
170
|
+
if (directData) {
|
|
171
|
+
(0, pipelineMemo_js_1.pipelineResource_keep)(client, directData.id, pipeline);
|
|
172
|
+
return (0, result_js_1.Ok)(directData);
|
|
123
173
|
}
|
|
124
174
|
}
|
|
125
175
|
catch (_e) { }
|
|
126
176
|
}
|
|
177
|
+
// Slug fallback: treat nameOrId as a source file fname fragment
|
|
178
|
+
try {
|
|
179
|
+
const sfList = await (0, adapter_js_1.resource_call)(fallbackClient, 'getPipelineSourceFiles', { fname: nameOrId, limit: 1 });
|
|
180
|
+
const sfItems = (0, adapter_js_1.items_get)(sfList).filter((item) => {
|
|
181
|
+
const base = item.data.fname.split('/').pop() ?? '';
|
|
182
|
+
return base.replace(/\.(ya?ml)$/i, '') === nameOrId;
|
|
183
|
+
});
|
|
184
|
+
if (sfItems.length > 0 && sfItems[0].data.pipeline_name) {
|
|
185
|
+
const byName = await pipelines_list(sfItems[0].data.pipeline_name);
|
|
186
|
+
if (byName.ok) {
|
|
187
|
+
const exactByName = byName.value.find((p) => p.name === sfItems[0].data.pipeline_name);
|
|
188
|
+
if (exactByName)
|
|
189
|
+
return (0, result_js_1.Ok)(exactByName);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (_e) { }
|
|
127
194
|
errorStack_js_1.errorStack.stack_push('error', `No pipeline matching '${nameOrId}'`);
|
|
128
195
|
return (0, result_js_1.Err)();
|
|
129
196
|
}
|
|
130
|
-
errorStack_js_1.errorStack.stack_push('error', `Ambiguous: ${
|
|
197
|
+
errorStack_js_1.errorStack.stack_push('error', `Ambiguous: ${found.length} pipelines match '${nameOrId}'. Use ID or full name.`);
|
|
131
198
|
return (0, result_js_1.Err)();
|
|
132
199
|
}
|
|
133
200
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrisPipeline.js","sourceRoot":"","sources":["../../src/pipelines/chrisPipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;
|
|
1
|
+
{"version":3,"file":"chrisPipeline.js","sourceRoot":"","sources":["../../src/pipelines/chrisPipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAoGH,wCAcC;AAaD,4CAaC;AA0ID,0DAoEC;AAxVD,sEAAgE;AAChE,uDAA2G;AAC3G,uDAAsG;AACtG,yDAAyE;AACzE,8EAAwE;AACxE,0DAAoD;AACpD,kDAAqD;AAwBrD,0EAA0E;AAC1E,MAAM,qBAAqB,GAAW,GAAG,CAAC;AAG1C;;GAEG;AACH,MAAa,kBAAmB,SAAQ,0CAAkB;IACxD;QACE,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACrC,CAAC;CACF;AAJD,gDAIC;AAmDD;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,KAAK,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAC3D,MAAM,MAAM,G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EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3C,CAAC;QAEF,OAAO,IAAA,cAAE,EAAC,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,GAAG,GAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3E,0BAAU,CAAC,UAAU,CAAC,OAAO,EAAE,4BAA4B,GAAG,EAAE,CAAC,CAAC;QAClE,OAAO,IAAA,eAAG,GAAE,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file One pipeline resolution per specifier per session.
|
|
3
|
+
*
|
|
4
|
+
* A pipeline diagram cost CUBE a name search, then the same pipeline listed
|
|
5
|
+
* again by id (chrisapi's `getPipeline` is a list-by-id), then its pipings
|
|
6
|
+
* and defaults — and the browser's PREVIEW projection asks for a diagram
|
|
7
|
+
* per pipeline card on every visit to /bin. A registered pipeline's record
|
|
8
|
+
* (id, name) is immutable, as its topology is, so a resolution is kept for
|
|
9
|
+
* the life of the connection's client, and the chrisapi item the search
|
|
10
|
+
* served is kept beside it: the pipings hang off that item, and nothing
|
|
11
|
+
* need list the pipeline a second time to reach them. A miss is never
|
|
12
|
+
* kept, so a pipeline registered after the memo was filled still resolves.
|
|
13
|
+
*/
|
|
14
|
+
import type { PipelineRecord } from './chrisPipeline.js';
|
|
15
|
+
/**
|
|
16
|
+
* Recalls a resolution.
|
|
17
|
+
*
|
|
18
|
+
* @param client - The connection's chrisapi client.
|
|
19
|
+
* @param specifier - The name or id string that was asked.
|
|
20
|
+
* @returns The record, or null when this session never resolved it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function pipelineRecord_recall(client: object, specifier: string): PipelineRecord | null;
|
|
23
|
+
/**
|
|
24
|
+
* Keeps a resolution under the specifier asked and under the record's own
|
|
25
|
+
* name and id, so any of the three answers next time.
|
|
26
|
+
*
|
|
27
|
+
* @param client - The connection's chrisapi client.
|
|
28
|
+
* @param specifier - The name or id string that was asked.
|
|
29
|
+
* @param record - The record it resolved to.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pipelineRecord_keep(client: object, specifier: string, record: PipelineRecord): void;
|
|
32
|
+
/**
|
|
33
|
+
* Recalls the chrisapi item of a pipeline.
|
|
34
|
+
*
|
|
35
|
+
* @param client - The connection's chrisapi client.
|
|
36
|
+
* @param pipelineID - The pipeline's id.
|
|
37
|
+
* @returns The item, or null when none was served this session.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pipelineResource_recall(client: object, pipelineID: number): object | null;
|
|
40
|
+
/**
|
|
41
|
+
* Keeps the chrisapi item a search or a get served.
|
|
42
|
+
*
|
|
43
|
+
* @param client - The connection's chrisapi client.
|
|
44
|
+
* @param pipelineID - The pipeline's id.
|
|
45
|
+
* @param resource - The chrisapi pipeline item.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pipelineResource_keep(client: object, pipelineID: number, resource: object): void;
|
|
48
|
+
/**
|
|
49
|
+
* Forgets one pipeline: its item and every specifier that resolved to it.
|
|
50
|
+
* Called when an item kept turns out not to answer (the pipeline was
|
|
51
|
+
* removed under the session), so the next ask resolves afresh.
|
|
52
|
+
*
|
|
53
|
+
* @param client - The connection's chrisapi client.
|
|
54
|
+
* @param pipelineID - The pipeline's id.
|
|
55
|
+
*/
|
|
56
|
+
export declare function pipeline_forget(client: object, pipelineID: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* How many resolutions a client's memo holds (for tests and readouts).
|
|
59
|
+
*
|
|
60
|
+
* @param client - The connection's chrisapi client.
|
|
61
|
+
* @returns The count of specifiers kept.
|
|
62
|
+
*/
|
|
63
|
+
export declare function pipelineMemo_count(client: object): number;
|