@oore/client 0.12.0 → 0.14.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 +37 -0
- package/dist/cli/config.js +57 -0
- package/dist/cli/main.js +17 -0
- package/dist/cli/qr.js +327 -0
- package/dist/cli/run.js +438 -0
- package/dist/generated/@tanstack/react-query.gen.d.ts +35 -4
- package/dist/generated/@tanstack/react-query.gen.js +25 -4
- package/dist/generated/msw.gen.d.ts +13 -1
- package/dist/generated/msw.gen.js +23 -0
- package/dist/generated/sdk.gen.d.ts +8 -2
- package/dist/generated/sdk.gen.js +12 -1
- package/dist/generated/types.gen.d.ts +85 -0
- package/dist/generated/valibot/v-create-notification-channel-body.d.ts +4 -0
- package/dist/generated/valibot/v-create-notification-channel-request.d.ts +4 -0
- package/dist/generated/valibot/v-create-notification-channel-request.js +2 -0
- package/dist/generated/valibot/v-create-notification-channel-response.d.ts +4 -0
- package/dist/generated/valibot/v-get-notification-channel-response.d.ts +4 -0
- package/dist/generated/valibot/v-list-build-actors-query.d.ts +6 -0
- package/dist/generated/valibot/v-list-build-actors-query.js +11 -0
- package/dist/generated/valibot/v-list-build-actors-response.d.ts +4 -0
- package/dist/generated/valibot/v-list-build-actors-response.js +5 -0
- package/dist/generated/valibot/v-list-build-actors-response2.d.ts +4 -0
- package/dist/generated/valibot/v-list-build-actors-response2.js +3 -0
- package/dist/generated/valibot/v-list-builds-query.d.ts +4 -0
- package/dist/generated/valibot/v-list-builds-query.js +12 -0
- package/dist/generated/valibot/v-list-notification-channels-response.d.ts +4 -0
- package/dist/generated/valibot/v-list-notification-channels-response2.d.ts +4 -0
- package/dist/generated/valibot/v-notification-channel-response.d.ts +4 -0
- package/dist/generated/valibot/v-notification-channel.d.ts +4 -0
- package/dist/generated/valibot/v-notification-channel.js +2 -0
- package/dist/generated/valibot/v-slack-mention.d.ts +5 -0
- package/dist/generated/valibot/v-slack-mention.js +6 -0
- package/dist/generated/valibot/v-update-notification-channel-body.d.ts +4 -0
- package/dist/generated/valibot/v-update-notification-channel-request.d.ts +4 -0
- package/dist/generated/valibot/v-update-notification-channel-request.js +2 -0
- package/dist/generated/valibot/v-update-notification-channel-response.d.ts +4 -0
- package/dist/msw-scenarios.d.ts +12 -1
- package/dist/msw-scenarios.js +345 -1
- package/dist/msw.d.ts +2 -2
- package/dist/msw.js +1 -1
- package/dist/react-query.d.ts +1 -1
- package/dist/react-query.js +1 -1
- package/dist/valibot.d.ts +4 -0
- package/dist/valibot.js +4 -0
- package/openapi/openapi.json +163 -1
- package/package.json +5 -2
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { createOoreClient, isOoreApiError } from '../client.js';
|
|
3
|
+
import { createArtifactInstallLink, createBuild, createStreamToken, getBuild, getBuildLogs, getMe, getPipeline, listBuildArtifacts, listBuilds, listPipelines, listProjects, } from '../generated/sdk.gen.js';
|
|
4
|
+
import { streamBuildLogEvents } from '../logs.js';
|
|
5
|
+
import { configPath, readConfig, resolveInstance, writeConfig, } from './config.js';
|
|
6
|
+
import { encodeQr, renderQr } from './qr.js';
|
|
7
|
+
export const CLI_NAME = 'oore-dev';
|
|
8
|
+
const USAGE = `Usage: ${CLI_NAME} <command> [options]
|
|
9
|
+
|
|
10
|
+
Commands:
|
|
11
|
+
run <pipeline> Queue a build (pipeline ID or name)
|
|
12
|
+
--branch <name> Branch to build (default: the project's default)
|
|
13
|
+
--platform <name> android, ios or macos; repeat or comma-separate
|
|
14
|
+
--project <id|name> Narrow pipeline lookup to one project
|
|
15
|
+
-f, --follow Follow the build's logs; exit non-zero if it fails
|
|
16
|
+
logs <build> Print a build's logs
|
|
17
|
+
-f, --follow Keep streaming until the build finishes
|
|
18
|
+
install <build> Print a device install link and its QR code
|
|
19
|
+
--platform <name> android or ios, when the build has both
|
|
20
|
+
--artifact <id> A specific artifact
|
|
21
|
+
--no-qr Print the link only
|
|
22
|
+
status Show the instance, your account and recent builds
|
|
23
|
+
--project <id|name> Only this project's builds
|
|
24
|
+
--limit <n> Number of builds (default 10)
|
|
25
|
+
login Save an instance to the config file
|
|
26
|
+
--url <url> Daemon URL (required)
|
|
27
|
+
--token <token> API token; else OORE_TOKEN or piped stdin
|
|
28
|
+
--name <name> Instance name (default: "default")
|
|
29
|
+
--project <id|name> Default project for this instance
|
|
30
|
+
|
|
31
|
+
Global options:
|
|
32
|
+
--instance <name> Instance from the config file (env: OORE_INSTANCE)
|
|
33
|
+
--url, --token Override the instance (env: OORE_URL, OORE_TOKEN)
|
|
34
|
+
-h, --help Show this help
|
|
35
|
+
|
|
36
|
+
Config file: $OORE_DEV_CONFIG, else $XDG_CONFIG_HOME/oore-dev/config.json,
|
|
37
|
+
else ~/.config/oore-dev/config.json. Create an API token in the web app
|
|
38
|
+
under Settings → API tokens.`;
|
|
39
|
+
/** A failure with a message meant for the terminal, not a stack trace. */
|
|
40
|
+
export class CliError extends Error {
|
|
41
|
+
exitCode;
|
|
42
|
+
constructor(message, exitCode = 1) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.exitCode = exitCode;
|
|
45
|
+
this.name = 'CliError';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const TERMINAL_STATUSES = [
|
|
49
|
+
'succeeded',
|
|
50
|
+
'failed',
|
|
51
|
+
'canceled',
|
|
52
|
+
'timed_out',
|
|
53
|
+
'expired',
|
|
54
|
+
];
|
|
55
|
+
const isFinished = (status) => TERMINAL_STATUSES.includes(status);
|
|
56
|
+
const PLATFORMS = ['android', 'ios', 'macos'];
|
|
57
|
+
/** Runs the CLI and resolves to the process exit code. */
|
|
58
|
+
export async function runCli(argv, io) {
|
|
59
|
+
try {
|
|
60
|
+
return await dispatch(argv, io);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error instanceof CliError) {
|
|
64
|
+
io.stderr(`${CLI_NAME}: ${error.message}\n`);
|
|
65
|
+
return error.exitCode;
|
|
66
|
+
}
|
|
67
|
+
if (isOoreApiError(error)) {
|
|
68
|
+
const hint = error.status === 401
|
|
69
|
+
? ' (is the token valid? run `oore-dev login` again)'
|
|
70
|
+
: '';
|
|
71
|
+
io.stderr(`${CLI_NAME}: ${error.message} [HTTP ${error.status}]${hint}\n`);
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
75
|
+
// Node's fetch reports "fetch failed" and keeps the reason in `cause`.
|
|
76
|
+
const cause = error instanceof Error ? error.cause : undefined;
|
|
77
|
+
if (cause instanceof Error)
|
|
78
|
+
message += `: ${cause.message}`;
|
|
79
|
+
io.stderr(`${CLI_NAME}: ${message}\n`);
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function dispatch(argv, io) {
|
|
84
|
+
const { positionals, values } = parseArgs({
|
|
85
|
+
allowPositionals: true,
|
|
86
|
+
args: [...argv],
|
|
87
|
+
options: {
|
|
88
|
+
artifact: { type: 'string' },
|
|
89
|
+
branch: { type: 'string' },
|
|
90
|
+
follow: { short: 'f', type: 'boolean' },
|
|
91
|
+
help: { short: 'h', type: 'boolean' },
|
|
92
|
+
instance: { type: 'string' },
|
|
93
|
+
limit: { type: 'string' },
|
|
94
|
+
name: { type: 'string' },
|
|
95
|
+
'no-qr': { type: 'boolean' },
|
|
96
|
+
platform: { multiple: true, type: 'string' },
|
|
97
|
+
project: { type: 'string' },
|
|
98
|
+
token: { type: 'string' },
|
|
99
|
+
url: { type: 'string' },
|
|
100
|
+
},
|
|
101
|
+
strict: true,
|
|
102
|
+
});
|
|
103
|
+
const [command, target, ...extra] = positionals;
|
|
104
|
+
if (values.help || !command || command === 'help') {
|
|
105
|
+
io.stdout(`${USAGE}\n`);
|
|
106
|
+
return command || values.help ? 0 : 2;
|
|
107
|
+
}
|
|
108
|
+
if (extra.length > 0)
|
|
109
|
+
throw new CliError(`Unexpected argument: ${extra[0]}`, 2);
|
|
110
|
+
if (command === 'login') {
|
|
111
|
+
return login(io, {
|
|
112
|
+
name: values.name,
|
|
113
|
+
project: values.project,
|
|
114
|
+
token: values.token,
|
|
115
|
+
url: values.url,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const config = await readConfig(configPath(io.env));
|
|
119
|
+
const instance = resolveInstance(config, values, io.env);
|
|
120
|
+
const ctx = {
|
|
121
|
+
client: createOoreClient({
|
|
122
|
+
baseUrl: instance.url,
|
|
123
|
+
fetch: io.fetch,
|
|
124
|
+
token: instance.token,
|
|
125
|
+
}),
|
|
126
|
+
io,
|
|
127
|
+
project: values.project ?? instance.project,
|
|
128
|
+
url: instance.url,
|
|
129
|
+
};
|
|
130
|
+
switch (command) {
|
|
131
|
+
case 'run':
|
|
132
|
+
return run(ctx, requireTarget(target, 'run <pipeline>'), {
|
|
133
|
+
branch: values.branch,
|
|
134
|
+
follow: values.follow ?? false,
|
|
135
|
+
platforms: parsePlatforms(values.platform),
|
|
136
|
+
});
|
|
137
|
+
case 'logs':
|
|
138
|
+
return logs(ctx, requireTarget(target, 'logs <build>'), values.follow ?? false);
|
|
139
|
+
case 'install':
|
|
140
|
+
return install(ctx, requireTarget(target, 'install <build>'), {
|
|
141
|
+
artifact: values.artifact,
|
|
142
|
+
platform: values.platform?.[0],
|
|
143
|
+
qr: !values['no-qr'],
|
|
144
|
+
});
|
|
145
|
+
case 'status':
|
|
146
|
+
return status(ctx, parseLimit(values.limit));
|
|
147
|
+
default:
|
|
148
|
+
throw new CliError(`Unknown command "${command}". See \`${CLI_NAME} --help\`.`, 2);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const requireTarget = (value, usage) => {
|
|
152
|
+
if (!value)
|
|
153
|
+
throw new CliError(`Usage: ${CLI_NAME} ${usage}`, 2);
|
|
154
|
+
return value;
|
|
155
|
+
};
|
|
156
|
+
const parsePlatforms = (values) => {
|
|
157
|
+
if (!values)
|
|
158
|
+
return undefined;
|
|
159
|
+
const platforms = values.flatMap((value) => value.split(',')).map((p) => p.trim());
|
|
160
|
+
for (const platform of platforms) {
|
|
161
|
+
if (!PLATFORMS.includes(platform)) {
|
|
162
|
+
throw new CliError(`Unknown platform "${platform}". Use ${PLATFORMS.join(', ')}.`, 2);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return [...new Set(platforms)];
|
|
166
|
+
};
|
|
167
|
+
const parseLimit = (value) => {
|
|
168
|
+
if (value === undefined)
|
|
169
|
+
return 10;
|
|
170
|
+
const limit = Number(value);
|
|
171
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 200) {
|
|
172
|
+
throw new CliError('--limit must be a whole number from 1 to 200', 2);
|
|
173
|
+
}
|
|
174
|
+
return limit;
|
|
175
|
+
};
|
|
176
|
+
// ── login ───────────────────────────────────────────────────────
|
|
177
|
+
async function login(io, options) {
|
|
178
|
+
if (!options.url)
|
|
179
|
+
throw new CliError('Usage: oore-dev login --url <daemon url> [--token <token>]', 2);
|
|
180
|
+
const url = options.url.replace(/\/+$/, '');
|
|
181
|
+
let token = options.token ?? io.env.OORE_TOKEN;
|
|
182
|
+
if (!token && io.readStdin)
|
|
183
|
+
token = (await io.readStdin()).trim();
|
|
184
|
+
if (!token) {
|
|
185
|
+
throw new CliError('Pass an API token with --token, OORE_TOKEN or stdin. Create one in the web app under Settings → API tokens.', 2);
|
|
186
|
+
}
|
|
187
|
+
const client = createOoreClient({ baseUrl: url, fetch: io.fetch, token });
|
|
188
|
+
const { user } = await getMe({ client });
|
|
189
|
+
const path = configPath(io.env);
|
|
190
|
+
const config = await readConfig(path);
|
|
191
|
+
const name = options.name ?? 'default';
|
|
192
|
+
config.instances[name] = {
|
|
193
|
+
...(options.project ? { project: options.project } : {}),
|
|
194
|
+
token,
|
|
195
|
+
url,
|
|
196
|
+
};
|
|
197
|
+
config.default ??= name;
|
|
198
|
+
await writeConfig(path, config);
|
|
199
|
+
io.stdout(`Signed in to ${url} as ${user.email} (${user.role}). Saved "${name}" to ${path}\n`);
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
// ── lookups ─────────────────────────────────────────────────────
|
|
203
|
+
const notFound = (error) => isOoreApiError(error) && (error.status === 404 || error.status === 400);
|
|
204
|
+
async function resolveProject(ctx, value) {
|
|
205
|
+
const { projects } = await listProjects({ client: ctx.client, query: { limit: 200 } });
|
|
206
|
+
const lower = value.toLowerCase();
|
|
207
|
+
const match = projects.find((project) => project.id === value) ??
|
|
208
|
+
projects.find((project) => project.name.toLowerCase() === lower);
|
|
209
|
+
if (!match)
|
|
210
|
+
throw new CliError(`No project "${value}" is visible to this token`);
|
|
211
|
+
return match;
|
|
212
|
+
}
|
|
213
|
+
async function resolvePipeline(ctx, value) {
|
|
214
|
+
const lower = value.toLowerCase();
|
|
215
|
+
const exact = (pipelines) => pipelines.filter((pipeline) => pipeline.id === value || pipeline.name.toLowerCase() === lower);
|
|
216
|
+
if (ctx.project) {
|
|
217
|
+
const project = await resolveProject(ctx, ctx.project);
|
|
218
|
+
const { pipelines } = await listPipelines({
|
|
219
|
+
client: ctx.client,
|
|
220
|
+
path: { project_id: project.id },
|
|
221
|
+
query: { limit: 200 },
|
|
222
|
+
});
|
|
223
|
+
const [match] = exact(pipelines);
|
|
224
|
+
if (!match)
|
|
225
|
+
throw new CliError(`No pipeline "${value}" in project ${project.name}`);
|
|
226
|
+
return match;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return (await getPipeline({ client: ctx.client, path: { pipeline_id: value } })).pipeline;
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (!notFound(error))
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
const { projects } = await listProjects({ client: ctx.client, query: { limit: 200 } });
|
|
236
|
+
const matches = [];
|
|
237
|
+
for (const project of projects) {
|
|
238
|
+
const { pipelines } = await listPipelines({
|
|
239
|
+
client: ctx.client,
|
|
240
|
+
path: { project_id: project.id },
|
|
241
|
+
query: { limit: 200, search: value },
|
|
242
|
+
});
|
|
243
|
+
for (const pipeline of exact(pipelines))
|
|
244
|
+
matches.push({ pipeline, project });
|
|
245
|
+
}
|
|
246
|
+
if (matches.length === 0)
|
|
247
|
+
throw new CliError(`No pipeline "${value}" is visible to this token`);
|
|
248
|
+
if (matches.length > 1) {
|
|
249
|
+
const list = matches.map(({ pipeline, project }) => ` ${project.name}/${pipeline.name} ${pipeline.id}`);
|
|
250
|
+
throw new CliError(`"${value}" matches several pipelines; pass --project or a pipeline ID:\n${list.join('\n')}`);
|
|
251
|
+
}
|
|
252
|
+
return matches[0].pipeline;
|
|
253
|
+
}
|
|
254
|
+
// ── run ─────────────────────────────────────────────────────────
|
|
255
|
+
async function run(ctx, pipelineRef, options) {
|
|
256
|
+
const pipeline = await resolvePipeline(ctx, pipelineRef);
|
|
257
|
+
const { build } = await createBuild({
|
|
258
|
+
body: {
|
|
259
|
+
branch: options.branch ?? null,
|
|
260
|
+
pipeline_id: pipeline.id,
|
|
261
|
+
platforms: options.platforms ?? null,
|
|
262
|
+
},
|
|
263
|
+
client: ctx.client,
|
|
264
|
+
path: { project_id: pipeline.project_id },
|
|
265
|
+
});
|
|
266
|
+
const on = build.branch ? ` on ${build.branch}` : '';
|
|
267
|
+
const platforms = options.platforms ? ` for ${options.platforms.join(', ')}` : '';
|
|
268
|
+
ctx.io.stdout(`Queued build #${build.build_number} of ${pipeline.name}${on}${platforms} (${build.id})\n`);
|
|
269
|
+
if (!options.follow) {
|
|
270
|
+
ctx.io.stdout(`Follow it with: ${CLI_NAME} logs -f ${build.id}\n`);
|
|
271
|
+
return 0;
|
|
272
|
+
}
|
|
273
|
+
return follow(ctx, build.id);
|
|
274
|
+
}
|
|
275
|
+
// ── logs ────────────────────────────────────────────────────────
|
|
276
|
+
async function logs(ctx, buildId, followLogs) {
|
|
277
|
+
if (followLogs)
|
|
278
|
+
return follow(ctx, buildId);
|
|
279
|
+
await printPendingLogs(ctx, buildId, -1);
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
282
|
+
const writeChunk = (io, chunk) => {
|
|
283
|
+
const text = chunk.content.endsWith('\n') ? chunk.content : `${chunk.content}\n`;
|
|
284
|
+
if (chunk.stream === 'stderr')
|
|
285
|
+
io.stderr(text);
|
|
286
|
+
else
|
|
287
|
+
io.stdout(text);
|
|
288
|
+
};
|
|
289
|
+
const LOG_PAGE_SIZE = 500;
|
|
290
|
+
/** Prints every stored chunk after `after` and returns the last sequence. */
|
|
291
|
+
async function printPendingLogs(ctx, buildId, after) {
|
|
292
|
+
for (;;) {
|
|
293
|
+
const { logs } = await getBuildLogs({
|
|
294
|
+
client: ctx.client,
|
|
295
|
+
path: { build_id: buildId },
|
|
296
|
+
query: { after_sequence: after, limit: LOG_PAGE_SIZE },
|
|
297
|
+
});
|
|
298
|
+
for (const chunk of logs) {
|
|
299
|
+
if (chunk.sequence > after) {
|
|
300
|
+
writeChunk(ctx.io, chunk);
|
|
301
|
+
after = chunk.sequence;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (logs.length < LOG_PAGE_SIZE)
|
|
305
|
+
return after;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
309
|
+
/**
|
|
310
|
+
* Prints the stored logs, then streams new ones until the build finishes.
|
|
311
|
+
* The stream uses a one-use stream token, which works for API tokens as well
|
|
312
|
+
* as session tokens; if it drops, the CLI falls back to polling.
|
|
313
|
+
*/
|
|
314
|
+
async function follow(ctx, buildId) {
|
|
315
|
+
const { client, io } = ctx;
|
|
316
|
+
let after = await printPendingLogs(ctx, buildId, -1);
|
|
317
|
+
let build = (await getBuild({ client, path: { build_id: buildId } })).build;
|
|
318
|
+
if (!isFinished(build.status)) {
|
|
319
|
+
try {
|
|
320
|
+
const { token } = await createStreamToken({ client, path: { build_id: buildId } });
|
|
321
|
+
for await (const event of streamBuildLogEvents({
|
|
322
|
+
client,
|
|
323
|
+
path: { build_id: buildId },
|
|
324
|
+
query: { token },
|
|
325
|
+
signal: io.signal,
|
|
326
|
+
sseMaxRetryAttempts: 1,
|
|
327
|
+
})) {
|
|
328
|
+
if (event.type === 'log' && event.chunk.sequence > after) {
|
|
329
|
+
writeChunk(io, event.chunk);
|
|
330
|
+
after = event.chunk.sequence;
|
|
331
|
+
}
|
|
332
|
+
else if (event.type === 'done') {
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
// Polling below covers a stream that cannot open or drops.
|
|
339
|
+
}
|
|
340
|
+
const sleep = io.sleep ?? defaultSleep;
|
|
341
|
+
for (;;) {
|
|
342
|
+
if (io.signal?.aborted)
|
|
343
|
+
return 130;
|
|
344
|
+
after = await printPendingLogs(ctx, buildId, after);
|
|
345
|
+
build = (await getBuild({ client, path: { build_id: buildId } })).build;
|
|
346
|
+
if (isFinished(build.status))
|
|
347
|
+
break;
|
|
348
|
+
await sleep(io.pollIntervalMs ?? 2_000);
|
|
349
|
+
}
|
|
350
|
+
after = await printPendingLogs(ctx, buildId, after);
|
|
351
|
+
}
|
|
352
|
+
io.stderr(`Build #${build.build_number} ${build.status.replace('_', ' ')}\n`);
|
|
353
|
+
return build.status === 'succeeded' ? 0 : 1;
|
|
354
|
+
}
|
|
355
|
+
// ── install ─────────────────────────────────────────────────────
|
|
356
|
+
const INSTALLABLE = { apk: 'android', ipa: 'ios' };
|
|
357
|
+
async function install(ctx, buildId, options) {
|
|
358
|
+
if (options.platform && options.platform !== 'android' && options.platform !== 'ios') {
|
|
359
|
+
throw new CliError('--platform must be android or ios for install', 2);
|
|
360
|
+
}
|
|
361
|
+
const { artifacts } = await listBuildArtifacts({
|
|
362
|
+
body: { build_ids: [buildId] },
|
|
363
|
+
client: ctx.client,
|
|
364
|
+
});
|
|
365
|
+
const installable = artifacts.filter((artifact) => artifact.state === 'available' &&
|
|
366
|
+
INSTALLABLE[artifact.artifact_type] !== undefined &&
|
|
367
|
+
(!options.artifact || artifact.id === options.artifact) &&
|
|
368
|
+
(!options.platform || INSTALLABLE[artifact.artifact_type] === options.platform));
|
|
369
|
+
if (installable.length === 0) {
|
|
370
|
+
throw new CliError(options.artifact
|
|
371
|
+
? `Artifact ${options.artifact} is not an installable APK or IPA of build ${buildId}`
|
|
372
|
+
: `Build ${buildId} has no installable APK or IPA${options.platform ? ` for ${options.platform}` : ''}`);
|
|
373
|
+
}
|
|
374
|
+
if (installable.length > 1) {
|
|
375
|
+
const list = installable.map((artifact) => ` ${artifact.id} ${artifact.artifact_type} ${artifact.name}`);
|
|
376
|
+
throw new CliError(`Build ${buildId} has several installable artifacts; pass --platform or --artifact:\n${list.join('\n')}`);
|
|
377
|
+
}
|
|
378
|
+
const artifact = installable[0];
|
|
379
|
+
const link = await createArtifactInstallLink({
|
|
380
|
+
client: ctx.client,
|
|
381
|
+
path: { artifact_id: artifact.id },
|
|
382
|
+
});
|
|
383
|
+
const expires = new Date(link.expires_at * 1000).toLocaleTimeString();
|
|
384
|
+
ctx.io.stdout(`${artifact.name} (${link.platform}), link expires at ${expires}\n`);
|
|
385
|
+
if (options.qr) {
|
|
386
|
+
const color = ctx.io.isTTY === true && !ctx.io.env.NO_COLOR;
|
|
387
|
+
ctx.io.stdout(`${renderQr(encodeQr(link.install_url), { color })}\n`);
|
|
388
|
+
}
|
|
389
|
+
ctx.io.stdout(`${link.install_url}\n`);
|
|
390
|
+
return 0;
|
|
391
|
+
}
|
|
392
|
+
// ── status ──────────────────────────────────────────────────────
|
|
393
|
+
const age = (seconds, now) => {
|
|
394
|
+
const delta = Math.max(0, now - seconds);
|
|
395
|
+
if (delta < 60)
|
|
396
|
+
return `${delta}s ago`;
|
|
397
|
+
if (delta < 3600)
|
|
398
|
+
return `${Math.floor(delta / 60)}m ago`;
|
|
399
|
+
if (delta < 86_400)
|
|
400
|
+
return `${Math.floor(delta / 3600)}h ago`;
|
|
401
|
+
return `${Math.floor(delta / 86_400)}d ago`;
|
|
402
|
+
};
|
|
403
|
+
async function status(ctx, limit) {
|
|
404
|
+
const { client, io } = ctx;
|
|
405
|
+
const { user } = await getMe({ client });
|
|
406
|
+
const project = ctx.project ? await resolveProject(ctx, ctx.project) : undefined;
|
|
407
|
+
const { builds, total } = await listBuilds({
|
|
408
|
+
client,
|
|
409
|
+
query: {
|
|
410
|
+
direction: 'desc',
|
|
411
|
+
limit,
|
|
412
|
+
sort: 'created_at',
|
|
413
|
+
...(project ? { project_id: project.id } : {}),
|
|
414
|
+
},
|
|
415
|
+
});
|
|
416
|
+
io.stdout(`${ctx.url} ${user.email} (${user.role})\n`);
|
|
417
|
+
if (project)
|
|
418
|
+
io.stdout(`Project: ${project.name}\n`);
|
|
419
|
+
if (builds.length === 0) {
|
|
420
|
+
io.stdout('No builds yet.\n');
|
|
421
|
+
return 0;
|
|
422
|
+
}
|
|
423
|
+
const now = Math.floor(Date.now() / 1000);
|
|
424
|
+
const rows = builds.map((build) => [
|
|
425
|
+
`#${build.build_number}`,
|
|
426
|
+
build.status.replace('_', ' '),
|
|
427
|
+
build.branch ?? '-',
|
|
428
|
+
age(build.created_at, now),
|
|
429
|
+
build.id,
|
|
430
|
+
]);
|
|
431
|
+
const widths = rows[0].map((_, i) => Math.max(...rows.map((row) => row[i].length)));
|
|
432
|
+
for (const row of rows) {
|
|
433
|
+
io.stdout(`${row.map((cell, i) => cell.padEnd(widths[i])).join(' ').trimEnd()}\n`);
|
|
434
|
+
}
|
|
435
|
+
if (total > builds.length)
|
|
436
|
+
io.stdout(`Showing ${builds.length} of ${total} builds.\n`);
|
|
437
|
+
return 0;
|
|
438
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DefaultError, type InfiniteData, type UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import { type Options } from '../sdk.gen.js';
|
|
3
|
-
import type { AbortArtifactData, AbortArtifactResponse, AddProjectMemberData, AddProjectMemberError, AddProjectMemberResponse2, AppendBuildLogsData, AppendBuildLogsResponse2, ApproveBuildData, ApproveBuildError, ApproveBuildResponse, ApproveReleaseData, ApproveReleaseError, ApproveReleaseResponse, BrowseLocalGitDirectoriesData, CancelBuildData, CancelBuildError, CancelBuildResponse2, CheckGitlabPersonalTokenData, CheckGitlabPersonalTokenError, CheckGitlabPersonalTokenResponse, ClaimJobData, ClaimJobResponse2, CompleteArtifactData, CompleteArtifactResponse2, CompleteReleaseData, CompleteReleaseError, CompleteReleaseResponse, CompleteSetupData, CompleteSetupError, CompleteSetupResponse, ConfigureExternalAccessOidcData, ConfigureExternalAccessOidcError, ConfigureExternalAccessOidcResponse2, ConfigureOidcData, ConfigureOidcError, ConfigureOidcResponse, CreateApiTokenData, CreateApiTokenError, CreateApiTokenResponse2, CreateAppStoreConnectKeyData, CreateAppStoreConnectKeyError, CreateAppStoreConnectKeyResponse, CreateArtifactData, CreateArtifactInstallLinkData, CreateArtifactInstallLinkError, CreateArtifactInstallLinkResponse, CreateArtifactResponse2, CreateBuildData, CreateBuildError, CreateBuildResponse2, CreateInstanceSecretData, CreateInstanceSecretError, CreateInstanceSecretResponse, CreateLocalGitIntegrationData, CreateLocalGitIntegrationError, CreateLocalGitIntegrationResponse2, CreateNotificationChannelData, CreateNotificationChannelError, CreateNotificationChannelResponse, CreatePipelineData, CreatePipelineError, CreatePipelineResponse2, CreatePipelineSecretData, CreatePipelineSecretError, CreatePipelineSecretResponse, CreateProjectData, CreateProjectError, CreateProjectResponse2, CreateProjectSecretData, CreateProjectSecretError, CreateProjectSecretResponse, CreateReleaseData, CreateReleaseError, CreateReleaseResponse, CreateScopedDownloadTokenData, CreateScopedDownloadTokenError, CreateScopedDownloadTokenResponse2, CreateStreamTokenData, CreateStreamTokenResponse, DeleteAppStoreConnectKeyData, DeleteAppStoreConnectKeyError, DeleteAppStoreConnectKeyResponse, DeleteInstanceSecretData, DeleteInstanceSecretError, DeleteInstanceSecretResponse, DeleteIntegrationData, DeleteIntegrationError, DeleteIntegrationResponse, DeleteLocalGitIntegrationData, DeleteLocalGitIntegrationError, DeleteLocalGitIntegrationResponse, DeleteNotificationChannelData, DeleteNotificationChannelError, DeleteNotificationChannelResponse2, DeletePipelineData, DeletePipelineError, DeletePipelineResponse, DeletePipelineSecretData, DeletePipelineSecretError, DeletePipelineSecretResponse, DeleteProjectData, DeleteProjectError, DeleteProjectResponse, DeleteProjectRetentionData, DeleteProjectRetentionResponse, DeleteProjectSecretData, DeleteProjectSecretError, DeleteProjectSecretResponse, DeleteRunnerData, DeleteRunnerError, DeleteRunnerResponse, DeleteUserData, DeleteUserError, DeleteUserResponse, DiscoverRepositoryWorkflowsData, DownloadLocalArtifactData, DownloadLocalArtifactInstallData, DownloadLocalArtifactLegacyData, DownloadViaScopedTokenData, DownloadViaScopedTokenV1Data, FrontendPairData, FrontendPairError, FrontendPairResponse2, GenerateDownloadLinkData, GenerateDownloadLinkError, GenerateDownloadLinkResponse, GetArtifactStorageSettingsData, GetBuildData, GetBuildInsightsData, GetBuildLogsData, GetBuildTestResultsData, GetExternalAccessNetworkSettingsData, GetExternalAccessOidcData, GetExternalAccessPreflightData, GetExternalAccessTrustedProxySettingsData, GetInstancePreferencesData, GetIntegrationData, GetIosInstallManifestData, GetIosInstallManifestV1Data, GetJobAndroidSigningData, GetJobIosSigningData, GetJobPublishPlanData, GetJobRetryArtifactsData, GetJobSecretsData, GetJobStatusData, GetMeData, GetNotificationChannelData, GetPipelineAndroidSigningData, GetPipelineAppStorePublishData, GetPipelineData, GetPipelineGooglePlayPublishData, GetPipelineIosSigningData, GetProjectData, GetProjectRetentionData, GetReleaseData, GetRetentionLastCleanupData, GetRetentionPolicyData, GetRunnerData, GetRuntimeUpdatePreflightData, GetRuntimeUpdateStatusData, GetSetupStatusData, GetSetupSummaryData, GetStoreVitalsData, GithubCallbackData, GithubCompleteData, GithubCompleteError, GithubCompleteResponse, GithubCreatePageData, GithubInstalledData, GithubStartData, GithubStartError, GithubStartResponse, GithubWebhookData, GithubWebhookError, GithubWebhookResponse, GitlabAuthorizeData, GitlabAuthorizeError, GitlabAuthorizeResponse, GitlabCallbackData, GitlabCheckoutDiscoveryData, GitlabCheckoutUploadPackData, GitlabCheckoutUploadPackError, GitlabCheckoutUploadPackResponse, GitlabStartData, GitlabStartError, GitlabStartResponse, GitlabWebhookData, GitlabWebhookError, GitlabWebhookResponse, HaltReleaseData, HaltReleaseError, HaltReleaseResponse, HealthzData, InviteUserData, InviteUserError, InviteUserResponse2, ListApiTokensData, ListAppStoreConnectKeysData, ListArtifactsData, ListAuditLogsData, ListBuildArtifactsData, ListBuildArtifactsError, ListBuildArtifactsResponse, ListBuildsData, ListInstallationsData, ListInstanceSecretsData, ListIntegrationsData, ListLocalGitIntegrationsData, ListNotificationChannelsData, ListNotificationDeliveriesData, ListOperatorIncidentsData, ListPipelineIosDevicesData, ListPipelinesData, ListPipelineSecretsData, ListProjectArtifactsData, ListProjectMemberCandidatesData, ListProjectMembersData, ListProjectsData, ListProjectSecretsData, ListReleaseEventsData, ListReleasesData, ListRepositoriesData, ListRunnersData, ListScopedDownloadTokensData, ListSourceRepositoriesData, ListUsersData, LocalLoginData, LocalLoginError, LocalLoginResponse2, LogoutData, LogoutResponse2, MarkOperatorIncidentReadData, MarkOperatorIncidentReadError, MarkOperatorIncidentReadResponse, MetricsData, OidcCallbackData, OidcCallbackError, OidcCallbackResponse2, OidcStartData, PauseReleaseData, PauseReleaseError, PauseReleaseResponse, PreviewBuildChangelogData, PurgeRunnerCachesData, PurgeRunnerCachesError, PurgeRunnerCachesResponse, RaiseReleaseData, RaiseReleaseError, RaiseReleaseResponse, ReadyzData, ReEnableUserData, ReEnableUserError, ReEnableUserResponse2, RefreshStoreVitalsData, RefreshStoreVitalsResponse, RegisterPipelineIosDeviceData, RegisterPipelineIosDeviceResponse, RegisterRunnerData, RegisterRunnerResponse2, RejectBuildData, RejectBuildError, RejectBuildResponse, RemoveProjectMemberData, RemoveProjectMemberError, RemoveProjectMemberResponse2, ReplaceGitlabPersonalTokenData, ReplaceGitlabPersonalTokenError, ReplaceGitlabPersonalTokenResponse, ReportJobPublishResultData, ReportJobPublishResultError, ReportJobPublishResultResponse, ReportJobTestResultsData, ReportJobTestResultsError, ReportJobTestResultsResponse, RepositoryAvatarData, RerunBuildData, RerunBuildError, RerunBuildResponse2, ResumeReleaseData, ResumeReleaseError, ResumeReleaseResponse, RetryBuildStepData, RetryBuildStepError, RetryBuildStepResponse, RevokeApiTokenData, RevokeApiTokenError, RevokeApiTokenResponse2, RevokeScopedDownloadTokenData, RevokeScopedDownloadTokenError, RevokeScopedDownloadTokenResponse, RotateGitlabRepositoryWebhookSecretData, RotateGitlabRepositoryWebhookSecretError, RotateGitlabRepositoryWebhookSecretResponse, RotateInstanceSecretData, RotateInstanceSecretError, RotateInstanceSecretResponse, RotatePipelineSecretData, RotatePipelineSecretError, RotatePipelineSecretResponse, RotateProjectSecretData, RotateProjectSecretError, RotateProjectSecretResponse, RunnerHeartbeatData, RunnerHeartbeatResponse2, SetupLocalOwnerCreateData, SetupLocalOwnerCreateError, SetupLocalOwnerCreateResponse2, SetupOidcStartData, SetupOidcStartError, SetupOidcStartResponse2, SetupOidcVerifyData, SetupOidcVerifyError, SetupOidcVerifyResponse2, SetupOwnerClaimTrustedProxyData, SetupOwnerClaimTrustedProxyError, SetupOwnerClaimTrustedProxyResponse, SetupPreferencesData, SetupPreferencesError, SetupPreferencesResponse2, SetupTrustedProxyConfigureData, SetupTrustedProxyConfigureError, SetupTrustedProxyConfigureResponse2, StartRuntimeUpdateData, StartRuntimeUpdateError, StartRuntimeUpdateResponse, SyncInstallationsData, SyncInstallationsError, SyncInstallationsResponse2, SyncPipelineIosSigningData, SyncPipelineIosSigningResponse2, TestNotificationChannelData, TestNotificationChannelError, TestNotificationChannelResponse2, TestOidcConnectionData, TestOidcConnectionError, TestOidcConnectionResponse2, TestPipelineGooglePlayCredentialsData, TestPipelineGooglePlayCredentialsError, TestPipelineGooglePlayCredentialsResponse, TrustedProxyLoginData, TrustedProxyLoginError, TrustedProxyLoginResponse, UpdateAppStoreConnectKeyData, UpdateAppStoreConnectKeyError, UpdateAppStoreConnectKeyResponse, UpdateArtifactStorageSettingsData, UpdateArtifactStorageSettingsError, UpdateArtifactStorageSettingsResponse, UpdateExternalAccessNetworkSettingsData, UpdateExternalAccessNetworkSettingsError, UpdateExternalAccessNetworkSettingsResponse, UpdateExternalAccessTrustedProxySettingsData, UpdateExternalAccessTrustedProxySettingsError, UpdateExternalAccessTrustedProxySettingsResponse, UpdateInstancePreferencesData, UpdateInstancePreferencesError, UpdateInstancePreferencesResponse, UpdateJobStatusData, UpdateJobStatusError, UpdateJobStatusResponse, UpdateNotificationChannelData, UpdateNotificationChannelError, UpdateNotificationChannelResponse, UpdatePipelineAndroidSigningData, UpdatePipelineAndroidSigningResponse, UpdatePipelineAppStorePublishData, UpdatePipelineAppStorePublishError, UpdatePipelineAppStorePublishResponse, UpdatePipelineData, UpdatePipelineError, UpdatePipelineGooglePlayPublishData, UpdatePipelineGooglePlayPublishError, UpdatePipelineGooglePlayPublishResponse, UpdatePipelineIosSigningData, UpdatePipelineIosSigningResponse, UpdatePipelineResponse, UpdateProjectData, UpdateProjectError, UpdateProjectMemberData, UpdateProjectMemberError, UpdateProjectMemberResponse2, UpdateProjectResponse, UpdateProjectRetentionData, UpdateProjectRetentionResponse, UpdateRetentionPolicyData, UpdateRetentionPolicyResponse, UpdateRunnerData, UpdateRunnerResponse2, UpdateUserRoleData, UpdateUserRoleError, UpdateUserRoleResponse2, UploadLocalArtifactData, UploadLocalArtifactError, ValidatePipelineData, ValidatePipelineResponse2, VerifyBootstrapTokenData, VerifyBootstrapTokenError, VerifyBootstrapTokenResponse } from '../types.gen.js';
|
|
3
|
+
import type { AbortArtifactData, AbortArtifactResponse, AddProjectMemberData, AddProjectMemberError, AddProjectMemberResponse2, AppendBuildLogsData, AppendBuildLogsResponse2, ApproveBuildData, ApproveBuildError, ApproveBuildResponse, ApproveReleaseData, ApproveReleaseError, ApproveReleaseResponse, BrowseLocalGitDirectoriesData, CancelBuildData, CancelBuildError, CancelBuildResponse2, CheckGitlabPersonalTokenData, CheckGitlabPersonalTokenError, CheckGitlabPersonalTokenResponse, ClaimJobData, ClaimJobResponse2, CompleteArtifactData, CompleteArtifactResponse2, CompleteReleaseData, CompleteReleaseError, CompleteReleaseResponse, CompleteSetupData, CompleteSetupError, CompleteSetupResponse, ConfigureExternalAccessOidcData, ConfigureExternalAccessOidcError, ConfigureExternalAccessOidcResponse2, ConfigureOidcData, ConfigureOidcError, ConfigureOidcResponse, CreateApiTokenData, CreateApiTokenError, CreateApiTokenResponse2, CreateAppStoreConnectKeyData, CreateAppStoreConnectKeyError, CreateAppStoreConnectKeyResponse, CreateArtifactData, CreateArtifactInstallLinkData, CreateArtifactInstallLinkError, CreateArtifactInstallLinkResponse, CreateArtifactResponse2, CreateBuildData, CreateBuildError, CreateBuildResponse2, CreateInstanceSecretData, CreateInstanceSecretError, CreateInstanceSecretResponse, CreateLocalGitIntegrationData, CreateLocalGitIntegrationError, CreateLocalGitIntegrationResponse2, CreateNotificationChannelData, CreateNotificationChannelError, CreateNotificationChannelResponse, CreatePipelineData, CreatePipelineError, CreatePipelineResponse2, CreatePipelineSecretData, CreatePipelineSecretError, CreatePipelineSecretResponse, CreateProjectData, CreateProjectError, CreateProjectResponse2, CreateProjectSecretData, CreateProjectSecretError, CreateProjectSecretResponse, CreateReleaseData, CreateReleaseError, CreateReleaseResponse, CreateScopedDownloadTokenData, CreateScopedDownloadTokenError, CreateScopedDownloadTokenResponse2, CreateStreamTokenData, CreateStreamTokenResponse, DeleteAppStoreConnectKeyData, DeleteAppStoreConnectKeyError, DeleteAppStoreConnectKeyResponse, DeleteInstanceSecretData, DeleteInstanceSecretError, DeleteInstanceSecretResponse, DeleteIntegrationData, DeleteIntegrationError, DeleteIntegrationResponse, DeleteLocalGitIntegrationData, DeleteLocalGitIntegrationError, DeleteLocalGitIntegrationResponse, DeleteNotificationChannelData, DeleteNotificationChannelError, DeleteNotificationChannelResponse2, DeletePipelineData, DeletePipelineError, DeletePipelineResponse, DeletePipelineSecretData, DeletePipelineSecretError, DeletePipelineSecretResponse, DeleteProjectData, DeleteProjectError, DeleteProjectResponse, DeleteProjectRetentionData, DeleteProjectRetentionResponse, DeleteProjectSecretData, DeleteProjectSecretError, DeleteProjectSecretResponse, DeleteRunnerData, DeleteRunnerError, DeleteRunnerResponse, DeleteUserData, DeleteUserError, DeleteUserResponse, DiscoverRepositoryWorkflowsData, DownloadLocalArtifactData, DownloadLocalArtifactInstallData, DownloadLocalArtifactLegacyData, DownloadViaScopedTokenData, DownloadViaScopedTokenV1Data, FrontendPairData, FrontendPairError, FrontendPairResponse2, GenerateDownloadLinkData, GenerateDownloadLinkError, GenerateDownloadLinkResponse, GetArtifactStorageSettingsData, GetBuildData, GetBuildInsightsData, GetBuildLogsData, GetBuildTestResultsData, GetExternalAccessNetworkSettingsData, GetExternalAccessOidcData, GetExternalAccessPreflightData, GetExternalAccessTrustedProxySettingsData, GetInstancePreferencesData, GetIntegrationData, GetIosInstallManifestData, GetIosInstallManifestV1Data, GetJobAndroidSigningData, GetJobIosSigningData, GetJobPublishPlanData, GetJobRetryArtifactsData, GetJobSecretsData, GetJobStatusData, GetMeData, GetNotificationChannelData, GetPipelineAndroidSigningData, GetPipelineAppStorePublishData, GetPipelineData, GetPipelineGooglePlayPublishData, GetPipelineIosSigningData, GetProjectData, GetProjectRetentionData, GetReleaseData, GetRetentionLastCleanupData, GetRetentionPolicyData, GetRunnerData, GetRuntimeUpdatePreflightData, GetRuntimeUpdateStatusData, GetSetupStatusData, GetSetupSummaryData, GetStoreVitalsData, GithubCallbackData, GithubCompleteData, GithubCompleteError, GithubCompleteResponse, GithubCreatePageData, GithubInstalledData, GithubStartData, GithubStartError, GithubStartResponse, GithubWebhookData, GithubWebhookError, GithubWebhookResponse, GitlabAuthorizeData, GitlabAuthorizeError, GitlabAuthorizeResponse, GitlabCallbackData, GitlabCheckoutDiscoveryData, GitlabCheckoutUploadPackData, GitlabCheckoutUploadPackError, GitlabCheckoutUploadPackResponse, GitlabStartData, GitlabStartError, GitlabStartResponse, GitlabWebhookData, GitlabWebhookError, GitlabWebhookResponse, HaltReleaseData, HaltReleaseError, HaltReleaseResponse, HealthzData, InviteUserData, InviteUserError, InviteUserResponse2, ListApiTokensData, ListAppStoreConnectKeysData, ListArtifactsData, ListAuditLogsData, ListBuildActorsData, ListBuildArtifactsData, ListBuildArtifactsError, ListBuildArtifactsResponse, ListBuildsData, ListInstallationsData, ListInstanceSecretsData, ListIntegrationsData, ListLocalGitIntegrationsData, ListNotificationChannelsData, ListNotificationDeliveriesData, ListOperatorIncidentsData, ListPipelineIosDevicesData, ListPipelinesData, ListPipelineSecretsData, ListProjectArtifactsData, ListProjectMemberCandidatesData, ListProjectMembersData, ListProjectsData, ListProjectSecretsData, ListReleaseEventsData, ListReleasesData, ListRepositoriesData, ListRunnersData, ListScopedDownloadTokensData, ListSourceRepositoriesData, ListUsersData, LocalLoginData, LocalLoginError, LocalLoginResponse2, LogoutData, LogoutResponse2, MarkOperatorIncidentReadData, MarkOperatorIncidentReadError, MarkOperatorIncidentReadResponse, MetricsData, OidcCallbackData, OidcCallbackError, OidcCallbackResponse2, OidcStartData, PauseReleaseData, PauseReleaseError, PauseReleaseResponse, PreviewBuildChangelogData, PurgeRunnerCachesData, PurgeRunnerCachesError, PurgeRunnerCachesResponse, RaiseReleaseData, RaiseReleaseError, RaiseReleaseResponse, ReadyzData, ReEnableUserData, ReEnableUserError, ReEnableUserResponse2, RefreshStoreVitalsData, RefreshStoreVitalsResponse, RegisterPipelineIosDeviceData, RegisterPipelineIosDeviceResponse, RegisterRunnerData, RegisterRunnerResponse2, RejectBuildData, RejectBuildError, RejectBuildResponse, RemoveProjectMemberData, RemoveProjectMemberError, RemoveProjectMemberResponse2, ReplaceGitlabPersonalTokenData, ReplaceGitlabPersonalTokenError, ReplaceGitlabPersonalTokenResponse, ReportJobPublishResultData, ReportJobPublishResultError, ReportJobPublishResultResponse, ReportJobTestResultsData, ReportJobTestResultsError, ReportJobTestResultsResponse, RepositoryAvatarData, RerunBuildData, RerunBuildError, RerunBuildResponse2, ResumeReleaseData, ResumeReleaseError, ResumeReleaseResponse, RetryBuildStepData, RetryBuildStepError, RetryBuildStepResponse, RevokeApiTokenData, RevokeApiTokenError, RevokeApiTokenResponse2, RevokeScopedDownloadTokenData, RevokeScopedDownloadTokenError, RevokeScopedDownloadTokenResponse, RotateGitlabRepositoryWebhookSecretData, RotateGitlabRepositoryWebhookSecretError, RotateGitlabRepositoryWebhookSecretResponse, RotateInstanceSecretData, RotateInstanceSecretError, RotateInstanceSecretResponse, RotatePipelineSecretData, RotatePipelineSecretError, RotatePipelineSecretResponse, RotateProjectSecretData, RotateProjectSecretError, RotateProjectSecretResponse, RunnerHeartbeatData, RunnerHeartbeatResponse2, SetupLocalOwnerCreateData, SetupLocalOwnerCreateError, SetupLocalOwnerCreateResponse2, SetupOidcStartData, SetupOidcStartError, SetupOidcStartResponse2, SetupOidcVerifyData, SetupOidcVerifyError, SetupOidcVerifyResponse2, SetupOwnerClaimTrustedProxyData, SetupOwnerClaimTrustedProxyError, SetupOwnerClaimTrustedProxyResponse, SetupPreferencesData, SetupPreferencesError, SetupPreferencesResponse2, SetupTrustedProxyConfigureData, SetupTrustedProxyConfigureError, SetupTrustedProxyConfigureResponse2, StartRuntimeUpdateData, StartRuntimeUpdateError, StartRuntimeUpdateResponse, SyncInstallationsData, SyncInstallationsError, SyncInstallationsResponse2, SyncPipelineIosSigningData, SyncPipelineIosSigningResponse2, TestNotificationChannelData, TestNotificationChannelError, TestNotificationChannelResponse2, TestOidcConnectionData, TestOidcConnectionError, TestOidcConnectionResponse2, TestPipelineGooglePlayCredentialsData, TestPipelineGooglePlayCredentialsError, TestPipelineGooglePlayCredentialsResponse, TrustedProxyLoginData, TrustedProxyLoginError, TrustedProxyLoginResponse, UpdateAppStoreConnectKeyData, UpdateAppStoreConnectKeyError, UpdateAppStoreConnectKeyResponse, UpdateArtifactStorageSettingsData, UpdateArtifactStorageSettingsError, UpdateArtifactStorageSettingsResponse, UpdateExternalAccessNetworkSettingsData, UpdateExternalAccessNetworkSettingsError, UpdateExternalAccessNetworkSettingsResponse, UpdateExternalAccessTrustedProxySettingsData, UpdateExternalAccessTrustedProxySettingsError, UpdateExternalAccessTrustedProxySettingsResponse, UpdateInstancePreferencesData, UpdateInstancePreferencesError, UpdateInstancePreferencesResponse, UpdateJobStatusData, UpdateJobStatusError, UpdateJobStatusResponse, UpdateNotificationChannelData, UpdateNotificationChannelError, UpdateNotificationChannelResponse, UpdatePipelineAndroidSigningData, UpdatePipelineAndroidSigningResponse, UpdatePipelineAppStorePublishData, UpdatePipelineAppStorePublishError, UpdatePipelineAppStorePublishResponse, UpdatePipelineData, UpdatePipelineError, UpdatePipelineGooglePlayPublishData, UpdatePipelineGooglePlayPublishError, UpdatePipelineGooglePlayPublishResponse, UpdatePipelineIosSigningData, UpdatePipelineIosSigningResponse, UpdatePipelineResponse, UpdateProjectData, UpdateProjectError, UpdateProjectMemberData, UpdateProjectMemberError, UpdateProjectMemberResponse2, UpdateProjectResponse, UpdateProjectRetentionData, UpdateProjectRetentionResponse, UpdateRetentionPolicyData, UpdateRetentionPolicyResponse, UpdateRunnerData, UpdateRunnerResponse2, UpdateUserRoleData, UpdateUserRoleError, UpdateUserRoleResponse2, UploadLocalArtifactData, UploadLocalArtifactError, ValidatePipelineData, ValidatePipelineResponse2, VerifyBootstrapTokenData, VerifyBootstrapTokenError, VerifyBootstrapTokenResponse } from '../types.gen.js';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -803,7 +803,7 @@ export declare const listBuildsQueryKey: (options?: Options<ListBuildsData>) =>
|
|
|
803
803
|
/**
|
|
804
804
|
* List builds
|
|
805
805
|
*
|
|
806
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
806
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
807
807
|
*/
|
|
808
808
|
export declare const listBuildsOptions: (options: Options<ListBuildsData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen.js").ListBuildsResponse, import("../types.gen.js").ApiError, import("../types.gen.js").ListBuildsResponse, [Pick<Options<ListBuildsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
809
809
|
_id: string;
|
|
@@ -824,7 +824,7 @@ export declare const listBuildsInfiniteQueryKey: (options?: Options<ListBuildsDa
|
|
|
824
824
|
/**
|
|
825
825
|
* List builds
|
|
826
826
|
*
|
|
827
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
827
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
828
828
|
*/
|
|
829
829
|
export declare const listBuildsInfiniteOptions: (options: Options<ListBuildsData>) => Omit<import("@tanstack/react-query").UseInfiniteQueryOptions<import("../types.gen.js").ListBuildsResponse, import("../types.gen.js").ApiError, InfiniteData<import("../types.gen.js").ListBuildsResponse, unknown>, QueryKey<Options<ListBuildsData>>, number | Pick<Pick<Options<ListBuildsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
830
830
|
_id: string;
|
|
@@ -844,9 +844,40 @@ export declare const listBuildsInfiniteOptions: (options: Options<ListBuildsData
|
|
|
844
844
|
/**
|
|
845
845
|
* List builds
|
|
846
846
|
*
|
|
847
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
847
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
848
848
|
*/
|
|
849
849
|
export declare const useListBuildsQuery: (options: Options<ListBuildsData>) => import("@tanstack/react-query").UseQueryResult<import("../types.gen.js").ListBuildsResponse, import("../types.gen.js").ApiError>;
|
|
850
|
+
export declare const listBuildActorsQueryKey: (options?: Options<ListBuildActorsData>) => [Pick<Options<ListBuildActorsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
851
|
+
_id: string;
|
|
852
|
+
_infinite?: boolean;
|
|
853
|
+
tags?: ReadonlyArray<string>;
|
|
854
|
+
}];
|
|
855
|
+
/**
|
|
856
|
+
* List build actors
|
|
857
|
+
*
|
|
858
|
+
* Distinct trigger actors on builds the caller can see, most recently active first, for the builds list's actor filter.
|
|
859
|
+
*/
|
|
860
|
+
export declare const listBuildActorsOptions: (options: Options<ListBuildActorsData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen.js").ListBuildActorsResponse, import("../types.gen.js").ApiError, import("../types.gen.js").ListBuildActorsResponse, [Pick<Options<ListBuildActorsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
861
|
+
_id: string;
|
|
862
|
+
_infinite?: boolean;
|
|
863
|
+
tags?: ReadonlyArray<string>;
|
|
864
|
+
}]>, "queryFn"> & {
|
|
865
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen.js").ListBuildActorsResponse, [Pick<Options<ListBuildActorsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
866
|
+
_id: string;
|
|
867
|
+
_infinite?: boolean;
|
|
868
|
+
tags?: ReadonlyArray<string>;
|
|
869
|
+
}], never> | undefined;
|
|
870
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<[Pick<Options<ListBuildActorsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
871
|
+
_id: string;
|
|
872
|
+
_infinite?: boolean;
|
|
873
|
+
tags?: ReadonlyArray<string>;
|
|
874
|
+
}], import("../types.gen.js").ListBuildActorsResponse, import("../types.gen.js").ApiError>;
|
|
875
|
+
/**
|
|
876
|
+
* List build actors
|
|
877
|
+
*
|
|
878
|
+
* Distinct trigger actors on builds the caller can see, most recently active first, for the builds list's actor filter.
|
|
879
|
+
*/
|
|
880
|
+
export declare const useListBuildActorsQuery: (options: Options<ListBuildActorsData>) => import("@tanstack/react-query").UseQueryResult<import("../types.gen.js").ListBuildActorsResponse, import("../types.gen.js").ApiError>;
|
|
850
881
|
export declare const getBuildInsightsQueryKey: (options?: Options<GetBuildInsightsData>) => [Pick<Options<GetBuildInsightsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
851
882
|
_id: string;
|
|
852
883
|
_infinite?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { infiniteQueryOptions, queryOptions, useMutation, useQuery } from '@tanstack/react-query';
|
|
3
3
|
import { client } from '../client.gen.js';
|
|
4
|
-
import { abortArtifact, addProjectMember, appendBuildLogs, approveBuild, approveRelease, browseLocalGitDirectories, cancelBuild, checkGitlabPersonalToken, claimJob, completeArtifact, completeRelease, completeSetup, configureExternalAccessOidc, configureOidc, createApiToken, createAppStoreConnectKey, createArtifact, createArtifactInstallLink, createBuild, createInstanceSecret, createLocalGitIntegration, createNotificationChannel, createPipeline, createPipelineSecret, createProject, createProjectSecret, createRelease, createScopedDownloadToken, createStreamToken, deleteAppStoreConnectKey, deleteInstanceSecret, deleteIntegration, deleteLocalGitIntegration, deleteNotificationChannel, deletePipeline, deletePipelineSecret, deleteProject, deleteProjectRetention, deleteProjectSecret, deleteRunner, deleteUser, discoverRepositoryWorkflows, downloadLocalArtifact, downloadLocalArtifactInstall, downloadLocalArtifactLegacy, downloadViaScopedToken, downloadViaScopedTokenV1, frontendPair, generateDownloadLink, getArtifactStorageSettings, getBuild, getBuildInsights, getBuildLogs, getBuildTestResults, getExternalAccessNetworkSettings, getExternalAccessOidc, getExternalAccessPreflight, getExternalAccessTrustedProxySettings, getInstancePreferences, getIntegration, getIosInstallManifest, getIosInstallManifestV1, getJobAndroidSigning, getJobIosSigning, getJobPublishPlan, getJobRetryArtifacts, getJobSecrets, getJobStatus, getMe, getNotificationChannel, getPipeline, getPipelineAndroidSigning, getPipelineAppStorePublish, getPipelineGooglePlayPublish, getPipelineIosSigning, getProject, getProjectRetention, getRelease, getRetentionLastCleanup, getRetentionPolicy, getRunner, getRuntimeUpdatePreflight, getRuntimeUpdateStatus, getSetupStatus, getSetupSummary, getStoreVitals, githubCallback, githubComplete, githubCreatePage, githubInstalled, githubStart, githubWebhook, gitlabAuthorize, gitlabCallback, gitlabCheckoutDiscovery, gitlabCheckoutUploadPack, gitlabStart, gitlabWebhook, haltRelease, healthz, inviteUser, listApiTokens, listAppStoreConnectKeys, listArtifacts, listAuditLogs, listBuildArtifacts, listBuilds, listInstallations, listInstanceSecrets, listIntegrations, listLocalGitIntegrations, listNotificationChannels, listNotificationDeliveries, listOperatorIncidents, listPipelineIosDevices, listPipelines, listPipelineSecrets, listProjectArtifacts, listProjectMemberCandidates, listProjectMembers, listProjects, listProjectSecrets, listReleaseEvents, listReleases, listRepositories, listRunners, listScopedDownloadTokens, listSourceRepositories, listUsers, localLogin, logout, markOperatorIncidentRead, metrics, oidcCallback, oidcStart, pauseRelease, previewBuildChangelog, purgeRunnerCaches, raiseRelease, readyz, reEnableUser, refreshStoreVitals, registerPipelineIosDevice, registerRunner, rejectBuild, removeProjectMember, replaceGitlabPersonalToken, reportJobPublishResult, reportJobTestResults, repositoryAvatar, rerunBuild, resumeRelease, retryBuildStep, revokeApiToken, revokeScopedDownloadToken, rotateGitlabRepositoryWebhookSecret, rotateInstanceSecret, rotatePipelineSecret, rotateProjectSecret, runnerHeartbeat, setupLocalOwnerCreate, setupOidcStart, setupOidcVerify, setupOwnerClaimTrustedProxy, setupPreferences, setupTrustedProxyConfigure, startRuntimeUpdate, syncInstallations, syncPipelineIosSigning, testNotificationChannel, testOidcConnection, testPipelineGooglePlayCredentials, trustedProxyLogin, updateAppStoreConnectKey, updateArtifactStorageSettings, updateExternalAccessNetworkSettings, updateExternalAccessTrustedProxySettings, updateInstancePreferences, updateJobStatus, updateNotificationChannel, updatePipeline, updatePipelineAndroidSigning, updatePipelineAppStorePublish, updatePipelineGooglePlayPublish, updatePipelineIosSigning, updateProject, updateProjectMember, updateProjectRetention, updateRetentionPolicy, updateRunner, updateUserRole, uploadLocalArtifact, validatePipeline, verifyBootstrapToken } from '../sdk.gen.js';
|
|
4
|
+
import { abortArtifact, addProjectMember, appendBuildLogs, approveBuild, approveRelease, browseLocalGitDirectories, cancelBuild, checkGitlabPersonalToken, claimJob, completeArtifact, completeRelease, completeSetup, configureExternalAccessOidc, configureOidc, createApiToken, createAppStoreConnectKey, createArtifact, createArtifactInstallLink, createBuild, createInstanceSecret, createLocalGitIntegration, createNotificationChannel, createPipeline, createPipelineSecret, createProject, createProjectSecret, createRelease, createScopedDownloadToken, createStreamToken, deleteAppStoreConnectKey, deleteInstanceSecret, deleteIntegration, deleteLocalGitIntegration, deleteNotificationChannel, deletePipeline, deletePipelineSecret, deleteProject, deleteProjectRetention, deleteProjectSecret, deleteRunner, deleteUser, discoverRepositoryWorkflows, downloadLocalArtifact, downloadLocalArtifactInstall, downloadLocalArtifactLegacy, downloadViaScopedToken, downloadViaScopedTokenV1, frontendPair, generateDownloadLink, getArtifactStorageSettings, getBuild, getBuildInsights, getBuildLogs, getBuildTestResults, getExternalAccessNetworkSettings, getExternalAccessOidc, getExternalAccessPreflight, getExternalAccessTrustedProxySettings, getInstancePreferences, getIntegration, getIosInstallManifest, getIosInstallManifestV1, getJobAndroidSigning, getJobIosSigning, getJobPublishPlan, getJobRetryArtifacts, getJobSecrets, getJobStatus, getMe, getNotificationChannel, getPipeline, getPipelineAndroidSigning, getPipelineAppStorePublish, getPipelineGooglePlayPublish, getPipelineIosSigning, getProject, getProjectRetention, getRelease, getRetentionLastCleanup, getRetentionPolicy, getRunner, getRuntimeUpdatePreflight, getRuntimeUpdateStatus, getSetupStatus, getSetupSummary, getStoreVitals, githubCallback, githubComplete, githubCreatePage, githubInstalled, githubStart, githubWebhook, gitlabAuthorize, gitlabCallback, gitlabCheckoutDiscovery, gitlabCheckoutUploadPack, gitlabStart, gitlabWebhook, haltRelease, healthz, inviteUser, listApiTokens, listAppStoreConnectKeys, listArtifacts, listAuditLogs, listBuildActors, listBuildArtifacts, listBuilds, listInstallations, listInstanceSecrets, listIntegrations, listLocalGitIntegrations, listNotificationChannels, listNotificationDeliveries, listOperatorIncidents, listPipelineIosDevices, listPipelines, listPipelineSecrets, listProjectArtifacts, listProjectMemberCandidates, listProjectMembers, listProjects, listProjectSecrets, listReleaseEvents, listReleases, listRepositories, listRunners, listScopedDownloadTokens, listSourceRepositories, listUsers, localLogin, logout, markOperatorIncidentRead, metrics, oidcCallback, oidcStart, pauseRelease, previewBuildChangelog, purgeRunnerCaches, raiseRelease, readyz, reEnableUser, refreshStoreVitals, registerPipelineIosDevice, registerRunner, rejectBuild, removeProjectMember, replaceGitlabPersonalToken, reportJobPublishResult, reportJobTestResults, repositoryAvatar, rerunBuild, resumeRelease, retryBuildStep, revokeApiToken, revokeScopedDownloadToken, rotateGitlabRepositoryWebhookSecret, rotateInstanceSecret, rotatePipelineSecret, rotateProjectSecret, runnerHeartbeat, setupLocalOwnerCreate, setupOidcStart, setupOidcVerify, setupOwnerClaimTrustedProxy, setupPreferences, setupTrustedProxyConfigure, startRuntimeUpdate, syncInstallations, syncPipelineIosSigning, testNotificationChannel, testOidcConnection, testPipelineGooglePlayCredentials, trustedProxyLogin, updateAppStoreConnectKey, updateArtifactStorageSettings, updateExternalAccessNetworkSettings, updateExternalAccessTrustedProxySettings, updateInstancePreferences, updateJobStatus, updateNotificationChannel, updatePipeline, updatePipelineAndroidSigning, updatePipelineAppStorePublish, updatePipelineGooglePlayPublish, updatePipelineIosSigning, updateProject, updateProjectMember, updateProjectRetention, updateRetentionPolicy, updateRunner, updateUserRole, uploadLocalArtifact, validatePipeline, verifyBootstrapToken } from '../sdk.gen.js';
|
|
5
5
|
const createQueryKey = (id, options, infinite, tags) => {
|
|
6
6
|
const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
|
|
7
7
|
if (infinite) {
|
|
@@ -827,7 +827,7 @@ export const listBuildsQueryKey = (options) => createQueryKey('listBuilds', opti
|
|
|
827
827
|
/**
|
|
828
828
|
* List builds
|
|
829
829
|
*
|
|
830
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
830
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
831
831
|
*/
|
|
832
832
|
export const listBuildsOptions = (options) => queryOptions({
|
|
833
833
|
queryFn: async ({ queryKey, signal }) => await listBuilds({
|
|
@@ -842,7 +842,7 @@ export const listBuildsInfiniteQueryKey = (options) => createQueryKey('listBuild
|
|
|
842
842
|
/**
|
|
843
843
|
* List builds
|
|
844
844
|
*
|
|
845
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
845
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
846
846
|
*/
|
|
847
847
|
export const listBuildsInfiniteOptions = (options) => {
|
|
848
848
|
const opts = infiniteQueryOptions(
|
|
@@ -870,9 +870,30 @@ export const listBuildsInfiniteOptions = (options) => {
|
|
|
870
870
|
/**
|
|
871
871
|
* List builds
|
|
872
872
|
*
|
|
873
|
-
* Returns builds, optionally filtered by project, pipeline, status, or
|
|
873
|
+
* Returns builds, optionally filtered by project, pipeline, status, branch, trigger, actor, or creation time, or searched with `q`.
|
|
874
874
|
*/
|
|
875
875
|
export const useListBuildsQuery = (options) => useQuery(listBuildsOptions(options));
|
|
876
|
+
export const listBuildActorsQueryKey = (options) => createQueryKey('listBuildActors', options, false, ['Builds']);
|
|
877
|
+
/**
|
|
878
|
+
* List build actors
|
|
879
|
+
*
|
|
880
|
+
* Distinct trigger actors on builds the caller can see, most recently active first, for the builds list's actor filter.
|
|
881
|
+
*/
|
|
882
|
+
export const listBuildActorsOptions = (options) => queryOptions({
|
|
883
|
+
queryFn: async ({ queryKey, signal }) => await listBuildActors({
|
|
884
|
+
...options,
|
|
885
|
+
...queryKey[0],
|
|
886
|
+
signal,
|
|
887
|
+
throwOnError: true
|
|
888
|
+
}),
|
|
889
|
+
queryKey: listBuildActorsQueryKey(options)
|
|
890
|
+
});
|
|
891
|
+
/**
|
|
892
|
+
* List build actors
|
|
893
|
+
*
|
|
894
|
+
* Distinct trigger actors on builds the caller can see, most recently active first, for the builds list's actor filter.
|
|
895
|
+
*/
|
|
896
|
+
export const useListBuildActorsQuery = (options) => useQuery(listBuildActorsOptions(options));
|
|
876
897
|
export const getBuildInsightsQueryKey = (options) => createQueryKey('getBuildInsights', options, false, ['Builds']);
|
|
877
898
|
/**
|
|
878
899
|
* Get build insights
|