@galaxyproject/galaxy-api-client 25.0.0-dev.0 → 25.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galaxyproject/galaxy-api-client",
3
- "version": "25.0.0-dev.0",
3
+ "version": "25.0.4",
4
4
  "description": "A client library for the Galaxy API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file re-exports the types we want to use from the Galaxy API.
4
- * It serves as a compatibility layer to avoid importing directly from the
5
- * symlinked files, which would require all of Galaxy's dependencies.
6
- */
7
- exports.__esModule = true;
8
- exports.isInaccessible =
9
- exports.hasDetails =
10
- exports.isDatasetElement =
11
- exports.isCollectionElement =
12
- exports.isDCE =
13
- exports.isHDCA =
14
- exports.isHDA =
15
- void 0;
16
- // Utility functions
17
- function isHDA(entry) {
18
- return entry !== undefined && "history_content_type" in entry && entry.history_content_type === "dataset";
19
- }
20
- exports.isHDA = isHDA;
21
- function isHDCA(entry) {
22
- return (
23
- entry !== undefined && "history_content_type" in entry && entry.history_content_type === "dataset_collection"
24
- );
25
- }
26
- exports.isHDCA = isHDCA;
27
- function isDCE(item) {
28
- return item && "element_type" in item;
29
- }
30
- exports.isDCE = isDCE;
31
- function isCollectionElement(element) {
32
- return element.element_type === "dataset_collection";
33
- }
34
- exports.isCollectionElement = isCollectionElement;
35
- function isDatasetElement(element) {
36
- return element.element_type === "hda";
37
- }
38
- exports.isDatasetElement = isDatasetElement;
39
- function hasDetails(entry) {
40
- return "peek" in entry;
41
- }
42
- exports.hasDetails = hasDetails;
43
- function isInaccessible(entry) {
44
- return "accessible" in entry && !entry.accessible;
45
- }
46
- exports.isInaccessible = isInaccessible;
@@ -1,258 +0,0 @@
1
- "use strict";
2
- var __awaiter =
3
- (this && this.__awaiter) ||
4
- function (thisArg, _arguments, P, generator) {
5
- function adopt(value) {
6
- return value instanceof P
7
- ? value
8
- : new P(function (resolve) {
9
- resolve(value);
10
- });
11
- }
12
- return new (P || (P = Promise))(function (resolve, reject) {
13
- function fulfilled(value) {
14
- try {
15
- step(generator.next(value));
16
- } catch (e) {
17
- reject(e);
18
- }
19
- }
20
- function rejected(value) {
21
- try {
22
- step(generator["throw"](value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- }
27
- function step(result) {
28
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
29
- }
30
- step((generator = generator.apply(thisArg, _arguments || [])).next());
31
- });
32
- };
33
- var __generator =
34
- (this && this.__generator) ||
35
- function (thisArg, body) {
36
- var _ = {
37
- label: 0,
38
- sent: function () {
39
- if (t[0] & 1) throw t[1];
40
- return t[1];
41
- },
42
- trys: [],
43
- ops: [],
44
- },
45
- f,
46
- y,
47
- t,
48
- g;
49
- return (
50
- (g = { next: verb(0), throw: verb(1), return: verb(2) }),
51
- typeof Symbol === "function" &&
52
- (g[Symbol.iterator] = function () {
53
- return this;
54
- }),
55
- g
56
- );
57
- function verb(n) {
58
- return function (v) {
59
- return step([n, v]);
60
- };
61
- }
62
- function step(op) {
63
- if (f) throw new TypeError("Generator is already executing.");
64
- while (_)
65
- try {
66
- if (
67
- ((f = 1),
68
- y &&
69
- (t =
70
- op[0] & 2
71
- ? y["return"]
72
- : op[0]
73
- ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
74
- : y.next) &&
75
- !(t = t.call(y, op[1])).done)
76
- )
77
- return t;
78
- if (((y = 0), t)) op = [op[0] & 2, t.value];
79
- switch (op[0]) {
80
- case 0:
81
- case 1:
82
- t = op;
83
- break;
84
- case 4:
85
- _.label++;
86
- return { value: op[1], done: false };
87
- case 5:
88
- _.label++;
89
- y = op[1];
90
- op = [0];
91
- continue;
92
- case 7:
93
- op = _.ops.pop();
94
- _.trys.pop();
95
- continue;
96
- default:
97
- if (
98
- !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
99
- (op[0] === 6 || op[0] === 2)
100
- ) {
101
- _ = 0;
102
- continue;
103
- }
104
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
105
- _.label = op[1];
106
- break;
107
- }
108
- if (op[0] === 6 && _.label < t[1]) {
109
- _.label = t[1];
110
- t = op;
111
- break;
112
- }
113
- if (t && _.label < t[2]) {
114
- _.label = t[2];
115
- _.ops.push(op);
116
- break;
117
- }
118
- if (t[2]) _.ops.pop();
119
- _.trys.pop();
120
- continue;
121
- }
122
- op = body.call(thisArg, _);
123
- } catch (e) {
124
- op = [6, e];
125
- y = 0;
126
- } finally {
127
- f = t = 0;
128
- }
129
- if (op[0] & 5) throw op[1];
130
- return { value: op[0] ? op[1] : void 0, done: true };
131
- }
132
- };
133
- exports.__esModule = true;
134
- exports.createDataset = exports.getToolById = exports.getTools = void 0;
135
- // Example usage of the Galaxy API client
136
- var index_1 = require("./index");
137
- //
138
- // Basic usage - just provide a base URL
139
- //
140
- var basicApi = index_1.createGalaxyApi("https://usegalaxy.org");
141
- //
142
- // Advanced usage - with API key authentication and custom headers
143
- //
144
- var authenticatedApi = index_1.createGalaxyApi({
145
- baseUrl: "https://usegalaxy.org",
146
- apiKey: "your-api-key-here",
147
- headers: {
148
- Accept: "application/json",
149
- "User-Agent": "GalaxyClientApp/1.0",
150
- },
151
- });
152
- //
153
- // Example with request options (timeouts, credentials, etc.)
154
- //
155
- var apiWithOptions = index_1.createGalaxyApi({
156
- baseUrl: "https://usegalaxy.org",
157
- fetchOptions: {
158
- credentials: "include",
159
- cache: "no-cache",
160
- timeout: 30000,
161
- },
162
- });
163
- // Example function to get a list of tools
164
- function getTools() {
165
- return __awaiter(this, void 0, void 0, function () {
166
- var _a, data, error, sections, _i, data_1, tool, section;
167
- return __generator(this, function (_b) {
168
- switch (_b.label) {
169
- case 0:
170
- return [4 /*yield*/, basicApi.GET("/api/tools")];
171
- case 1:
172
- (_a = _b.sent()), (data = _a.data), (error = _a.error);
173
- if (error) {
174
- console.error("Error fetching tools:", error);
175
- return [2 /*return*/, []];
176
- }
177
- // Log tool count
178
- console.log("Found " + data.length + " tools");
179
- sections = {};
180
- for (_i = 0, data_1 = data; _i < data_1.length; _i++) {
181
- tool = data_1[_i];
182
- section = tool.panel_section_name || "Ungrouped";
183
- if (!sections[section]) sections[section] = [];
184
- sections[section].push(tool);
185
- }
186
- // Print summary
187
- Object.keys(sections).forEach(function (section) {
188
- console.log(section + ": " + sections[section].length + " tools");
189
- });
190
- return [2 /*return*/, data];
191
- }
192
- });
193
- });
194
- }
195
- exports.getTools = getTools;
196
- // Example function to get a specific tool by ID
197
- function getToolById(id) {
198
- return __awaiter(this, void 0, void 0, function () {
199
- var _a, data, error;
200
- return __generator(this, function (_b) {
201
- switch (_b.label) {
202
- case 0:
203
- return [
204
- 4 /*yield*/,
205
- authenticatedApi.GET("/api/tools/{tool_id}", {
206
- params: {
207
- path: {
208
- tool_id: id,
209
- },
210
- },
211
- }),
212
- ];
213
- case 1:
214
- (_a = _b.sent()), (data = _a.data), (error = _a.error);
215
- if (error || !data) {
216
- console.error("Error fetching tool:", error);
217
- return [2 /*return*/, null];
218
- }
219
- return [2 /*return*/, data];
220
- }
221
- });
222
- });
223
- }
224
- exports.getToolById = getToolById;
225
- // Example function to create a dataset in a history
226
- function createDataset(historyId, name, content) {
227
- return __awaiter(this, void 0, void 0, function () {
228
- var _a, data, error;
229
- return __generator(this, function (_b) {
230
- switch (_b.label) {
231
- case 0:
232
- return [
233
- 4 /*yield*/,
234
- apiWithOptions.POST("/api/histories/{history_id}/contents", {
235
- params: {
236
- path: {
237
- history_id: historyId,
238
- },
239
- },
240
- body: {
241
- name: name,
242
- content: content,
243
- type: "file",
244
- },
245
- }),
246
- ];
247
- case 1:
248
- (_a = _b.sent()), (data = _a.data), (error = _a.error);
249
- if (error) {
250
- console.error("Error creating dataset:", error);
251
- return [2 /*return*/, null];
252
- }
253
- return [2 /*return*/, data];
254
- }
255
- });
256
- });
257
- }
258
- exports.createDataset = createDataset;