@galaxy-tool-util/core 0.2.0 → 1.0.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/README.md +33 -0
- package/dist/cache/cache-index.d.ts +16 -12
- package/dist/cache/cache-index.d.ts.map +1 -1
- package/dist/cache/cache-index.js +34 -55
- package/dist/cache/cache-index.js.map +1 -1
- package/dist/cache/cache-key.d.ts +2 -1
- package/dist/cache/cache-key.d.ts.map +1 -1
- package/dist/cache/cache-key.js +7 -3
- package/dist/cache/cache-key.js.map +1 -1
- package/dist/cache/index.d.ts +5 -1
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +3 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/node.d.ts +30 -0
- package/dist/cache/node.d.ts.map +1 -0
- package/dist/cache/node.js +37 -0
- package/dist/cache/node.js.map +1 -0
- package/dist/cache/storage/filesystem.d.ts +17 -0
- package/dist/cache/storage/filesystem.d.ts.map +1 -0
- package/dist/cache/storage/filesystem.js +61 -0
- package/dist/cache/storage/filesystem.js.map +1 -0
- package/dist/cache/storage/indexeddb.d.ts +21 -0
- package/dist/cache/storage/indexeddb.d.ts.map +1 -0
- package/dist/cache/storage/indexeddb.js +87 -0
- package/dist/cache/storage/indexeddb.js.map +1 -0
- package/dist/cache/storage/interface.d.ts +17 -0
- package/dist/cache/storage/interface.d.ts.map +1 -0
- package/dist/cache/storage/interface.js +2 -0
- package/dist/cache/storage/interface.js.map +1 -0
- package/dist/cache/tool-cache-defaults.d.ts +7 -0
- package/dist/cache/tool-cache-defaults.d.ts.map +1 -0
- package/dist/cache/tool-cache-defaults.js +7 -0
- package/dist/cache/tool-cache-defaults.js.map +1 -0
- package/dist/cache/tool-cache.d.ts +16 -21
- package/dist/cache/tool-cache.d.ts.map +1 -1
- package/dist/cache/tool-cache.js +33 -47
- package/dist/cache/tool-cache.js.map +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/toolshed.d.ts +1 -1
- package/dist/client/toolshed.js +1 -1
- package/dist/client/trs.d.ts +32 -0
- package/dist/client/trs.d.ts.map +1 -0
- package/dist/client/trs.js +66 -0
- package/dist/client/trs.js.map +1 -0
- package/dist/config-node.d.ts +7 -0
- package/dist/config-node.d.ts.map +1 -0
- package/dist/config-node.js +14 -0
- package/dist/config-node.js.map +1 -0
- package/dist/config.d.ts +75 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +12 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +11 -0
- package/dist/node.js.map +1 -0
- package/dist/tool-info.d.ts +10 -3
- package/dist/tool-info.d.ts.map +1 -1
- package/dist/tool-info.js +34 -16
- package/dist/tool-info.js.map +1 -1
- package/package.json +18 -6
- package/dist/models/parsed-tool.d.ts +0 -46
- package/dist/models/parsed-tool.d.ts.map +0 -1
- package/dist/models/parsed-tool.js +0 -41
- package/dist/models/parsed-tool.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Default Galaxy ToolShed URL. */
|
|
2
|
+
export declare const DEFAULT_TOOLSHED_URL = "https://toolshed.g2.bx.psu.edu";
|
|
3
|
+
/** Environment variable to override the default ToolShed URL. */
|
|
4
|
+
export declare const TOOLSHED_URL_ENV_VAR = "GALAXY_TOOLSHED_URL";
|
|
5
|
+
/** Environment variable to override the cache directory. */
|
|
6
|
+
export declare const CACHE_DIR_ENV_VAR = "GALAXY_TOOL_CACHE_DIR";
|
|
7
|
+
//# sourceMappingURL=tool-cache-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-cache-defaults.d.ts","sourceRoot":"","sources":["../../src/cache/tool-cache-defaults.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,mCAAmC,CAAC;AACrE,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAC1D,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Default Galaxy ToolShed URL. */
|
|
2
|
+
export const DEFAULT_TOOLSHED_URL = "https://toolshed.g2.bx.psu.edu";
|
|
3
|
+
/** Environment variable to override the default ToolShed URL. */
|
|
4
|
+
export const TOOLSHED_URL_ENV_VAR = "GALAXY_TOOLSHED_URL";
|
|
5
|
+
/** Environment variable to override the cache directory. */
|
|
6
|
+
export const CACHE_DIR_ENV_VAR = "GALAXY_TOOL_CACHE_DIR";
|
|
7
|
+
//# sourceMappingURL=tool-cache-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-cache-defaults.js","sourceRoot":"","sources":["../../src/cache/tool-cache-defaults.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AACrE,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAC1D,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC"}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import { ParsedTool } from "
|
|
1
|
+
import { ParsedTool } from "@galaxy-tool-util/schema";
|
|
2
2
|
import { CacheIndex } from "./cache-index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
/** Default Galaxy ToolShed URL. */
|
|
8
|
-
export declare const DEFAULT_TOOLSHED_URL = "https://toolshed.g2.bx.psu.edu";
|
|
9
|
-
/** Environment variable to override the default ToolShed URL. */
|
|
10
|
-
export declare const TOOLSHED_URL_ENV_VAR = "GALAXY_TOOLSHED_URL";
|
|
11
|
-
/** Resolve cache directory: explicit override > env var > default. */
|
|
12
|
-
export declare function getCacheDir(override?: string): string;
|
|
13
|
-
interface ResolvedCoordinates {
|
|
3
|
+
import type { CacheStorage } from "./storage/interface.js";
|
|
4
|
+
import { DEFAULT_TOOLSHED_URL, TOOLSHED_URL_ENV_VAR } from "./tool-cache-defaults.js";
|
|
5
|
+
export { DEFAULT_TOOLSHED_URL, TOOLSHED_URL_ENV_VAR };
|
|
6
|
+
export interface ResolvedCoordinates {
|
|
14
7
|
toolshedUrl: string;
|
|
15
8
|
trsToolId: string;
|
|
16
9
|
version: string | null;
|
|
17
10
|
readableId: string;
|
|
18
11
|
}
|
|
19
12
|
/**
|
|
20
|
-
* Two-layer cache (memory +
|
|
13
|
+
* Two-layer cache (memory + storage) for parsed Galaxy tool metadata.
|
|
21
14
|
* Resolves tool IDs to cache keys, loads/saves tool JSON, and manages the cache index.
|
|
15
|
+
*
|
|
16
|
+
* `storage` is required — pass a `FilesystemCacheStorage` (Node.js) or
|
|
17
|
+
* `IndexedDBCacheStorage` (browser). Node callers can use `makeNodeToolCache`
|
|
18
|
+
* from `@galaxy-tool-util/core/node` to get the default filesystem setup.
|
|
22
19
|
*/
|
|
23
20
|
export declare class ToolCache {
|
|
24
|
-
readonly cacheDir: string;
|
|
25
21
|
readonly defaultToolshedUrl: string;
|
|
26
22
|
readonly index: CacheIndex;
|
|
23
|
+
private readonly storage;
|
|
27
24
|
private memoryCache;
|
|
28
|
-
constructor(opts
|
|
29
|
-
|
|
25
|
+
constructor(opts: {
|
|
26
|
+
storage: CacheStorage;
|
|
30
27
|
defaultToolshedUrl?: string;
|
|
31
28
|
});
|
|
32
29
|
resolveToolCoordinates(toolId: string, toolVersion?: string | null): ResolvedCoordinates;
|
|
33
|
-
|
|
34
|
-
hasCached(toolId: string, toolVersion?: string | null): boolean;
|
|
30
|
+
hasCached(toolId: string, toolVersion?: string | null): Promise<boolean>;
|
|
35
31
|
loadCached(key: string): Promise<ParsedTool | null>;
|
|
36
32
|
saveTool(key: string, parsedTool: ParsedTool, toolId: string, toolVersion: string, source: string, sourceUrl?: string): Promise<void>;
|
|
37
|
-
listCached(): Array<{
|
|
33
|
+
listCached(): Promise<Array<{
|
|
38
34
|
cache_key: string;
|
|
39
35
|
tool_id: string;
|
|
40
36
|
tool_version: string;
|
|
41
37
|
source: string;
|
|
42
38
|
source_url: string;
|
|
43
39
|
cached_at: string;
|
|
44
|
-
}
|
|
40
|
+
}>>;
|
|
45
41
|
clearCache(toolIdPrefix?: string): Promise<void>;
|
|
46
42
|
}
|
|
47
|
-
export {};
|
|
48
43
|
//# sourceMappingURL=tool-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-cache.d.ts","sourceRoot":"","sources":["../../src/cache/tool-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-cache.d.ts","sourceRoot":"","sources":["../../src/cache/tool-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;AAStD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,WAAW,CAAiC;gBAExC,IAAI,EAAE;QAAE,OAAO,EAAE,YAAY,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE;IAMxE,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,mBAAmB;IAkBlF,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;IAOxE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAoBnD,QAAQ,CACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAW,GACrB,OAAO,CAAC,IAAI,CAAC;IAMV,UAAU,IAAI,OAAO,CACzB,KAAK,CAAC;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;IAIK,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBvD"}
|
package/dist/cache/tool-cache.js
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdir, unlink } from "node:fs/promises";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
1
|
import * as S from "effect/Schema";
|
|
6
|
-
import { ParsedTool } from "
|
|
2
|
+
import { ParsedTool } from "@galaxy-tool-util/schema";
|
|
7
3
|
import { CacheIndex } from "./cache-index.js";
|
|
8
4
|
import { cacheKey } from "./cache-key.js";
|
|
9
5
|
import { parseToolshedToolId, toolIdFromTrs } from "./tool-id.js";
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const TOOLSHED_URL_ENV_VAR = "GALAXY_TOOLSHED_URL";
|
|
18
|
-
/** Resolve cache directory: explicit override > env var > default. */
|
|
19
|
-
export function getCacheDir(override) {
|
|
20
|
-
return override ?? process.env[CACHE_DIR_ENV_VAR] ?? DEFAULT_CACHE_DIR;
|
|
6
|
+
import { DEFAULT_TOOLSHED_URL, TOOLSHED_URL_ENV_VAR } from "./tool-cache-defaults.js";
|
|
7
|
+
export { DEFAULT_TOOLSHED_URL, TOOLSHED_URL_ENV_VAR };
|
|
8
|
+
function envToolshedUrl() {
|
|
9
|
+
if (typeof process !== "undefined" && process.env) {
|
|
10
|
+
return process.env[TOOLSHED_URL_ENV_VAR];
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
21
13
|
}
|
|
22
14
|
/**
|
|
23
|
-
* Two-layer cache (memory +
|
|
15
|
+
* Two-layer cache (memory + storage) for parsed Galaxy tool metadata.
|
|
24
16
|
* Resolves tool IDs to cache keys, loads/saves tool JSON, and manages the cache index.
|
|
17
|
+
*
|
|
18
|
+
* `storage` is required — pass a `FilesystemCacheStorage` (Node.js) or
|
|
19
|
+
* `IndexedDBCacheStorage` (browser). Node callers can use `makeNodeToolCache`
|
|
20
|
+
* from `@galaxy-tool-util/core/node` to get the default filesystem setup.
|
|
25
21
|
*/
|
|
26
22
|
export class ToolCache {
|
|
27
|
-
cacheDir;
|
|
28
23
|
defaultToolshedUrl;
|
|
29
24
|
index;
|
|
25
|
+
storage;
|
|
30
26
|
memoryCache = new Map();
|
|
31
27
|
constructor(opts) {
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
this.index = new CacheIndex(this.cacheDir);
|
|
28
|
+
this.defaultToolshedUrl = opts.defaultToolshedUrl ?? envToolshedUrl() ?? DEFAULT_TOOLSHED_URL;
|
|
29
|
+
this.storage = opts.storage;
|
|
30
|
+
this.index = new CacheIndex(this.storage);
|
|
36
31
|
}
|
|
37
32
|
resolveToolCoordinates(toolId, toolVersion) {
|
|
38
33
|
const parsed = parseToolshedToolId(toolId);
|
|
@@ -51,29 +46,25 @@ export class ToolCache {
|
|
|
51
46
|
readableId: toolIdFromTrs(this.defaultToolshedUrl, toolId),
|
|
52
47
|
};
|
|
53
48
|
}
|
|
54
|
-
|
|
55
|
-
return join(this.cacheDir, `${key}.json`);
|
|
56
|
-
}
|
|
57
|
-
hasCached(toolId, toolVersion) {
|
|
49
|
+
async hasCached(toolId, toolVersion) {
|
|
58
50
|
const coords = this.resolveToolCoordinates(toolId, toolVersion);
|
|
59
51
|
if (coords.version === null)
|
|
60
52
|
return false;
|
|
61
|
-
const key = cacheKey(coords.toolshedUrl, coords.trsToolId, coords.version);
|
|
62
|
-
return this.memoryCache.has(key) ||
|
|
53
|
+
const key = await cacheKey(coords.toolshedUrl, coords.trsToolId, coords.version);
|
|
54
|
+
return this.memoryCache.has(key) || (await this.storage.load(key)) !== null;
|
|
63
55
|
}
|
|
64
56
|
async loadCached(key) {
|
|
65
57
|
if (this.memoryCache.has(key)) {
|
|
66
58
|
return this.memoryCache.get(key);
|
|
67
59
|
}
|
|
68
|
-
const path = this.cachePath(key);
|
|
69
|
-
if (!existsSync(path))
|
|
70
|
-
return null;
|
|
71
60
|
try {
|
|
72
|
-
const
|
|
73
|
-
|
|
61
|
+
const data = await this.storage.load(key);
|
|
62
|
+
if (data === null)
|
|
63
|
+
return null;
|
|
74
64
|
const parsedTool = S.decodeUnknownSync(ParsedTool)(data);
|
|
75
|
-
if (!this.index.has(key)) {
|
|
76
|
-
|
|
65
|
+
if (!(await this.index.has(key))) {
|
|
66
|
+
const d = data;
|
|
67
|
+
await this.index.add(key, d.id ?? "unknown", d.version ?? "unknown", "unknown");
|
|
77
68
|
}
|
|
78
69
|
this.memoryCache.set(key, parsedTool);
|
|
79
70
|
return parsedTool;
|
|
@@ -84,32 +75,27 @@ export class ToolCache {
|
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
async saveTool(key, parsedTool, toolId, toolVersion, source, sourceUrl = "") {
|
|
87
|
-
await
|
|
88
|
-
const path = this.cachePath(key);
|
|
89
|
-
await writeFile(path, JSON.stringify(parsedTool, null, 2));
|
|
78
|
+
await this.storage.save(key, parsedTool);
|
|
90
79
|
await this.index.add(key, toolId, toolVersion, source, sourceUrl);
|
|
91
80
|
this.memoryCache.set(key, parsedTool);
|
|
92
81
|
}
|
|
93
|
-
listCached() {
|
|
82
|
+
async listCached() {
|
|
94
83
|
return this.index.listAll();
|
|
95
84
|
}
|
|
96
85
|
async clearCache(toolIdPrefix) {
|
|
97
86
|
if (toolIdPrefix === undefined) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
await unlink(path);
|
|
87
|
+
const keys = await this.storage.list();
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
await this.storage.delete(key);
|
|
102
90
|
}
|
|
103
91
|
await this.index.clear();
|
|
104
92
|
this.memoryCache.clear();
|
|
105
93
|
}
|
|
106
94
|
else {
|
|
107
95
|
const prefix = toolIdPrefix.replace(/\*$/, "");
|
|
108
|
-
const toRemove = this.index.listAll().filter((e) => e.tool_id.startsWith(prefix));
|
|
96
|
+
const toRemove = (await this.index.listAll()).filter((e) => e.tool_id.startsWith(prefix));
|
|
109
97
|
for (const entry of toRemove) {
|
|
110
|
-
|
|
111
|
-
if (existsSync(path))
|
|
112
|
-
await unlink(path);
|
|
98
|
+
await this.storage.delete(entry.cache_key);
|
|
113
99
|
await this.index.remove(entry.cache_key);
|
|
114
100
|
this.memoryCache.delete(entry.cache_key);
|
|
115
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-cache.js","sourceRoot":"","sources":["../../src/cache/tool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-cache.js","sourceRoot":"","sources":["../../src/cache/tool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,CAAC;AAEtD,SAAS,cAAc;IACrB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AASD;;;;;;;GAOG;AACH,MAAM,OAAO,SAAS;IACX,kBAAkB,CAAS;IAC3B,KAAK,CAAa;IACV,OAAO,CAAe;IAC/B,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEpD,YAAY,IAA4D;QACtE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,IAAI,cAAc,EAAE,IAAI,oBAAoB,CAAC;QAC9F,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,sBAAsB,CAAC,MAAc,EAAE,WAA2B;QAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI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YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjC,CAAC;YACD,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1F,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;gBAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAC3C,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACzC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/client/index.js
CHANGED
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParsedTool } from "
|
|
1
|
+
import { ParsedTool } from "@galaxy-tool-util/schema";
|
|
2
2
|
/** Error thrown when fetching a tool from a remote source fails. */
|
|
3
3
|
export declare class ToolFetchError extends Error {
|
|
4
4
|
/** The URL that was requested. */
|
package/dist/client/toolshed.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as S from "effect/Schema";
|
|
2
|
-
import { ParsedTool } from "
|
|
2
|
+
import { ParsedTool } from "@galaxy-tool-util/schema";
|
|
3
3
|
/** Error thrown when fetching a tool from a remote source fails. */
|
|
4
4
|
export class ToolFetchError extends Error {
|
|
5
5
|
url;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subset of a TRS `ToolVersion` object as returned by Tool Shed's
|
|
3
|
+
* `/api/ga4gh/trs/v2/tools/{id}/versions` endpoint. Only the fields we
|
|
4
|
+
* actually consume downstream are typed strictly; the rest are kept as
|
|
5
|
+
* unknown so unexpected nulls or new additions don't cause decode failures.
|
|
6
|
+
*/
|
|
7
|
+
export interface TRSToolVersion {
|
|
8
|
+
/** TRS version id (e.g. `"0.74+galaxy0"`). */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Display name, often `null` on Tool Shed. */
|
|
11
|
+
name: string | null;
|
|
12
|
+
/** Repository URL. */
|
|
13
|
+
url: string;
|
|
14
|
+
/** Declared descriptor types (e.g. `["GALAXY"]`). */
|
|
15
|
+
descriptor_type: string[];
|
|
16
|
+
/** Author list. */
|
|
17
|
+
author: string[];
|
|
18
|
+
[extra: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the list of TRS tool versions for a given `trsToolId`
|
|
22
|
+
* (`<owner>~<repo>~<toolId>` form). Returns the raw server order —
|
|
23
|
+
* Tool Shed typically returns newest first.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getTRSToolVersions(toolshedUrl: string, trsToolId: string, fetcher?: typeof fetch): Promise<TRSToolVersion[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch the latest TRS tool version id. Returns `null` if the tool has no
|
|
28
|
+
* published versions. Tool Shed returns versions newest-first; we take the
|
|
29
|
+
* first entry.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getLatestTRSToolVersion(toolshedUrl: string, trsToolId: string, fetcher?: typeof fetch): Promise<string | null>;
|
|
32
|
+
//# sourceMappingURL=trs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trs.d.ts","sourceRoot":"","sources":["../../src/client/trs.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,qDAAqD;IACrD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AA6BD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,OAAO,KAAwB,GACvC,OAAO,CAAC,cAAc,EAAE,CAAC,CAyC3B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,OAAO,KAAwB,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGxB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ToolFetchError } from "./toolshed.js";
|
|
2
|
+
const REQUEST_TIMEOUT_MS = 30_000;
|
|
3
|
+
function coerceTRSVersion(value, index) {
|
|
4
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
5
|
+
throw new Error(`TRS versions response: entries[${index}] must be an object`);
|
|
6
|
+
}
|
|
7
|
+
const v = value;
|
|
8
|
+
if (typeof v.id !== "string") {
|
|
9
|
+
throw new Error(`TRS versions response: entries[${index}].id must be a string`);
|
|
10
|
+
}
|
|
11
|
+
if (v.name !== null && typeof v.name !== "string") {
|
|
12
|
+
throw new Error(`TRS versions response: entries[${index}].name must be a string or null`);
|
|
13
|
+
}
|
|
14
|
+
if (typeof v.url !== "string") {
|
|
15
|
+
throw new Error(`TRS versions response: entries[${index}].url must be a string`);
|
|
16
|
+
}
|
|
17
|
+
if (!Array.isArray(v.descriptor_type) || v.descriptor_type.some((x) => typeof x !== "string")) {
|
|
18
|
+
throw new Error(`TRS versions response: entries[${index}].descriptor_type must be a string array`);
|
|
19
|
+
}
|
|
20
|
+
if (!Array.isArray(v.author) || v.author.some((x) => typeof x !== "string")) {
|
|
21
|
+
throw new Error(`TRS versions response: entries[${index}].author must be a string array`);
|
|
22
|
+
}
|
|
23
|
+
return v;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fetch the list of TRS tool versions for a given `trsToolId`
|
|
27
|
+
* (`<owner>~<repo>~<toolId>` form). Returns the raw server order —
|
|
28
|
+
* Tool Shed typically returns newest first.
|
|
29
|
+
*/
|
|
30
|
+
export async function getTRSToolVersions(toolshedUrl, trsToolId, fetcher = globalThis.fetch) {
|
|
31
|
+
const url = `${toolshedUrl}/api/ga4gh/trs/v2/tools/${encodeURIComponent(trsToolId)}/versions`;
|
|
32
|
+
let response;
|
|
33
|
+
try {
|
|
34
|
+
response = await fetcher(url, {
|
|
35
|
+
headers: { Accept: "application/json" },
|
|
36
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
throw new ToolFetchError(`TRS versions request to ${url} failed: ${err.message}`, url);
|
|
41
|
+
}
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
const body = await response.text().catch(() => "");
|
|
44
|
+
throw new ToolFetchError(`TRS versions request to ${url} failed: ${response.status} ${body.slice(0, 200)}`, url, response.status);
|
|
45
|
+
}
|
|
46
|
+
const json = await response.json();
|
|
47
|
+
if (!Array.isArray(json)) {
|
|
48
|
+
throw new ToolFetchError(`TRS versions response from ${url} was not an array`, url, response.status);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
return json.map(coerceTRSVersion);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
throw new ToolFetchError(`TRS versions response from ${url} was malformed: ${err.message}`, url, response.status);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Fetch the latest TRS tool version id. Returns `null` if the tool has no
|
|
59
|
+
* published versions. Tool Shed returns versions newest-first; we take the
|
|
60
|
+
* first entry.
|
|
61
|
+
*/
|
|
62
|
+
export async function getLatestTRSToolVersion(toolshedUrl, trsToolId, fetcher = globalThis.fetch) {
|
|
63
|
+
const versions = await getTRSToolVersions(toolshedUrl, trsToolId, fetcher);
|
|
64
|
+
return versions.length > 0 ? versions[0].id : null;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=trs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trs.js","sourceRoot":"","sources":["../../src/client/trs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAsBlC,SAAS,gBAAgB,CAAC,KAAc,EAAE,KAAa;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,qBAAqB,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,CAAC,GAAG,KAAgC,CAAC;IAE3C,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,uBAAuB,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,iCAAiC,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,wBAAwB,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,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AG,CAAC,EAAE,EACjF,GAAG,EACH,QAAQ,CAAC,MAAM,CAChB,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,cAAc,CACtB,8BAA8B,GAAG,mBAAmB,EACpD,GAAG,EACH,QAAQ,CAAC,MAAM,CAChB,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,cAAc,CACtB,8BAA8B,GAAG,mBAAoB,GAAa,CAAC,OAAO,EAAE,EAC5E,GAAG,EACH,QAAQ,CAAC,MAAM,CAChB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAmB,EACnB,SAAiB,EACjB,UAAwB,UAAU,CAAC,KAAK;IAExC,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WorkflowToolConfig } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Load the shared tool configuration portion from a YAML file.
|
|
4
|
+
* Unknown fields (e.g. `port`, `host`) are silently ignored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadWorkflowToolConfig(configPath: string): Promise<WorkflowToolConfig>;
|
|
7
|
+
//# sourceMappingURL=config-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-node.d.ts","sourceRoot":"","sources":["../src/config-node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAI5F"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import * as S from "effect/Schema";
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
import { WorkflowToolConfig } from "./config.js";
|
|
5
|
+
/**
|
|
6
|
+
* Load the shared tool configuration portion from a YAML file.
|
|
7
|
+
* Unknown fields (e.g. `port`, `host`) are silently ignored.
|
|
8
|
+
*/
|
|
9
|
+
export async function loadWorkflowToolConfig(configPath) {
|
|
10
|
+
const raw = await readFile(configPath, "utf-8");
|
|
11
|
+
const parsed = YAML.parse(raw);
|
|
12
|
+
return S.decodeUnknownSync(WorkflowToolConfig)(parsed);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=config-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-node.js","sourceRoot":"","sources":["../src/config-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAkB;IAC7D,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IAC1C,OAAO,CAAC,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared YAML configuration schema for Galaxy workflow tool settings.
|
|
3
|
+
*
|
|
4
|
+
* Both `galaxy-tool-proxy` and `gxwf-web` read the same `galaxy.workflows.*`
|
|
5
|
+
* sections from their config files. This module defines those shared schemas
|
|
6
|
+
* so the field names, types, and defaults stay in sync.
|
|
7
|
+
*
|
|
8
|
+
* Each server may extend this with its own fields (e.g. `port`/`host` for the
|
|
9
|
+
* proxy). Use `S.Struct({ ...WorkflowToolConfig.fields, myField: ... })`.
|
|
10
|
+
*/
|
|
11
|
+
import * as S from "effect/Schema";
|
|
12
|
+
import type { ToolSource } from "./tool-info.js";
|
|
13
|
+
/** Effect Schema for a tool source entry. */
|
|
14
|
+
export declare const ToolSourceConfig: S.Struct<{
|
|
15
|
+
type: S.Union<[S.Literal<["toolshed"]>, S.Literal<["galaxy"]>]>;
|
|
16
|
+
url: typeof S.String;
|
|
17
|
+
/** Whether the source is active. Disabled sources are skipped at runtime. */
|
|
18
|
+
enabled: S.optionalWith<typeof S.Boolean, {
|
|
19
|
+
default: () => true;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
export type ToolSourceConfig = S.Schema.Type<typeof ToolSourceConfig>;
|
|
23
|
+
/** Effect Schema for the cache directory setting. */
|
|
24
|
+
export declare const ToolCacheConfig: S.Struct<{
|
|
25
|
+
directory: S.optional<typeof S.String>;
|
|
26
|
+
}>;
|
|
27
|
+
export type ToolCacheConfig = S.Schema.Type<typeof ToolCacheConfig>;
|
|
28
|
+
/**
|
|
29
|
+
* Shared Galaxy workflow tool configuration — the portion of the YAML config
|
|
30
|
+
* common to both `galaxy-tool-proxy` and `gxwf-web`.
|
|
31
|
+
*
|
|
32
|
+
* ```yaml
|
|
33
|
+
* galaxy.workflows.toolSources:
|
|
34
|
+
* - type: toolshed
|
|
35
|
+
* url: https://toolshed.g2.bx.psu.edu
|
|
36
|
+
* - type: galaxy
|
|
37
|
+
* url: https://usegalaxy.org
|
|
38
|
+
* enabled: false
|
|
39
|
+
* galaxy.workflows.toolCache:
|
|
40
|
+
* directory: /tmp/galaxy-tool-cache
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const WorkflowToolConfig: S.Struct<{
|
|
44
|
+
"galaxy.workflows.toolSources": S.optionalWith<S.Array$<S.Struct<{
|
|
45
|
+
type: S.Union<[S.Literal<["toolshed"]>, S.Literal<["galaxy"]>]>;
|
|
46
|
+
url: typeof S.String;
|
|
47
|
+
/** Whether the source is active. Disabled sources are skipped at runtime. */
|
|
48
|
+
enabled: S.optionalWith<typeof S.Boolean, {
|
|
49
|
+
default: () => true;
|
|
50
|
+
}>;
|
|
51
|
+
}>>, {
|
|
52
|
+
default: () => never[];
|
|
53
|
+
}>;
|
|
54
|
+
"galaxy.workflows.toolCache": S.optionalWith<S.Struct<{
|
|
55
|
+
directory: S.optional<typeof S.String>;
|
|
56
|
+
}>, {
|
|
57
|
+
default: () => S.Schema.Type<typeof ToolCacheConfig>;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
export type WorkflowToolConfig = S.Schema.Type<typeof WorkflowToolConfig>;
|
|
61
|
+
/**
|
|
62
|
+
* Config-derived runtime options. Narrow subset of tool-info + cache options
|
|
63
|
+
* that come from a YAML config, without any backend/storage choice.
|
|
64
|
+
*/
|
|
65
|
+
export interface ConfigToolInfoOptions {
|
|
66
|
+
cacheDir?: string;
|
|
67
|
+
sources?: ToolSource[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Convert a WorkflowToolConfig to runtime options. Filters out disabled sources.
|
|
71
|
+
* Node callers pair this with `makeNodeToolInfoService` (from `/node`) to
|
|
72
|
+
* construct a ToolInfoService with filesystem storage.
|
|
73
|
+
*/
|
|
74
|
+
export declare function toolInfoOptionsFromConfig(config: WorkflowToolConfig): ConfigToolInfoOptions;
|
|
75
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB;;;IAG3B,6EAA6E;;;;EAE7E,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEtE,qDAAqD;AACrD,eAAO,MAAM,eAAe;;EAE1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB;;;;QA1B7B,6EAA6E;;;;;;;;;;uBA+BpD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;;EAE9D,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,qBAAqB,CAQ3F"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared YAML configuration schema for Galaxy workflow tool settings.
|
|
3
|
+
*
|
|
4
|
+
* Both `galaxy-tool-proxy` and `gxwf-web` read the same `galaxy.workflows.*`
|
|
5
|
+
* sections from their config files. This module defines those shared schemas
|
|
6
|
+
* so the field names, types, and defaults stay in sync.
|
|
7
|
+
*
|
|
8
|
+
* Each server may extend this with its own fields (e.g. `port`/`host` for the
|
|
9
|
+
* proxy). Use `S.Struct({ ...WorkflowToolConfig.fields, myField: ... })`.
|
|
10
|
+
*/
|
|
11
|
+
import * as S from "effect/Schema";
|
|
12
|
+
/** Effect Schema for a tool source entry. */
|
|
13
|
+
export const ToolSourceConfig = S.Struct({
|
|
14
|
+
type: S.Union(S.Literal("toolshed"), S.Literal("galaxy")),
|
|
15
|
+
url: S.String,
|
|
16
|
+
/** Whether the source is active. Disabled sources are skipped at runtime. */
|
|
17
|
+
enabled: S.optionalWith(S.Boolean, { default: () => true }),
|
|
18
|
+
});
|
|
19
|
+
/** Effect Schema for the cache directory setting. */
|
|
20
|
+
export const ToolCacheConfig = S.Struct({
|
|
21
|
+
directory: S.optional(S.String),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Shared Galaxy workflow tool configuration — the portion of the YAML config
|
|
25
|
+
* common to both `galaxy-tool-proxy` and `gxwf-web`.
|
|
26
|
+
*
|
|
27
|
+
* ```yaml
|
|
28
|
+
* galaxy.workflows.toolSources:
|
|
29
|
+
* - type: toolshed
|
|
30
|
+
* url: https://toolshed.g2.bx.psu.edu
|
|
31
|
+
* - type: galaxy
|
|
32
|
+
* url: https://usegalaxy.org
|
|
33
|
+
* enabled: false
|
|
34
|
+
* galaxy.workflows.toolCache:
|
|
35
|
+
* directory: /tmp/galaxy-tool-cache
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const WorkflowToolConfig = S.Struct({
|
|
39
|
+
"galaxy.workflows.toolSources": S.optionalWith(S.Array(ToolSourceConfig), {
|
|
40
|
+
default: () => [],
|
|
41
|
+
}),
|
|
42
|
+
"galaxy.workflows.toolCache": S.optionalWith(ToolCacheConfig, {
|
|
43
|
+
default: () => ({}),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Convert a WorkflowToolConfig to runtime options. Filters out disabled sources.
|
|
48
|
+
* Node callers pair this with `makeNodeToolInfoService` (from `/node`) to
|
|
49
|
+
* construct a ToolInfoService with filesystem storage.
|
|
50
|
+
*/
|
|
51
|
+
export function toolInfoOptionsFromConfig(config) {
|
|
52
|
+
const enabledSources = config["galaxy.workflows.toolSources"]
|
|
53
|
+
.filter((s) => s.enabled)
|
|
54
|
+
.map((s) => ({ type: s.type, url: s.url }));
|
|
55
|
+
return {
|
|
56
|
+
cacheDir: config["galaxy.workflows.toolCache"]?.directory,
|
|
57
|
+
sources: enabledSources.length > 0 ? enabledSources : undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAGnC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,GAAG,EAAE,CAAC,CAAC,MAAM;IACb,6EAA6E;IAC7E,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;CAC5D,CAAC,CAAC;AAGH,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;CAChC,CAAC,CAAC;AAGH;;;;;;;;;;;;;;GAcG;AACH,MAAM,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