@madewithremy/admin 0.1.57 → 0.1.58
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/client.d.ts +199 -0
- package/dist/config.d.ts +8 -0
- package/dist/ctx.d.ts +36 -0
- package/dist/errors.d.ts +68 -0
- package/dist/http.d.ts +68 -0
- package/dist/index.d.ts +7 -9442
- package/dist/index.js +6 -6
- package/dist/index.js.map +7 -1
- package/dist/ops/agent.d.ts +44 -0
- package/dist/ops/analytics.d.ts +285 -0
- package/dist/ops/apps.d.ts +33 -0
- package/dist/ops/crashes.d.ts +86 -0
- package/dist/ops/cron.d.ts +40 -0
- package/dist/ops/data.d.ts +68 -0
- package/dist/ops/dataSourceConnectors.d.ts +80 -0
- package/dist/ops/dataSourceEvals.d.ts +208 -0
- package/dist/ops/dataSourceJobs.d.ts +141 -0
- package/dist/ops/dataSourceMappers.d.ts +125 -0
- package/dist/ops/dataSources.d.ts +654 -0
- package/dist/ops/db.d.ts +81 -0
- package/dist/ops/diagnostics.d.ts +42 -0
- package/dist/ops/domains.d.ts +250 -0
- package/dist/ops/email.d.ts +305 -0
- package/dist/ops/events.d.ts +56 -0
- package/dist/ops/feedback.d.ts +24 -0
- package/dist/ops/files.d.ts +166 -0
- package/dist/ops/infra.d.ts +163 -0
- package/dist/ops/issues.d.ts +160 -0
- package/dist/ops/jewels.d.ts +249 -0
- package/dist/ops/methods.d.ts +60 -0
- package/dist/ops/prerender.d.ts +74 -0
- package/dist/ops/previews.d.ts +52 -0
- package/dist/ops/qaRecordings.d.ts +68 -0
- package/dist/ops/releases.d.ts +193 -0
- package/dist/ops/requests.d.ts +73 -0
- package/dist/ops/secrets.d.ts +69 -0
- package/dist/ops/settings.d.ts +45 -0
- package/dist/ops/tasks.d.ts +47 -0
- package/dist/ops/usage.d.ts +40 -0
- package/dist/ops/users.d.ts +59 -0
- package/dist/ops/voice.d.ts +178 -0
- package/dist/output.d.ts +19 -0
- package/dist/parseJsonConfig.d.ts +41 -0
- package/dist/poll.d.ts +38 -0
- package/dist/prod.js +21 -21
- package/dist/runningMethod.d.ts +25 -0
- package/dist/sleep.d.ts +12 -0
- package/dist/types/agent.d.ts +95 -0
- package/dist/types/analytics.d.ts +225 -0
- package/dist/types/apps.d.ts +39 -0
- package/dist/types/crashes.d.ts +81 -0
- package/dist/types/cron.d.ts +68 -0
- package/dist/types/data.d.ts +38 -0
- package/dist/types/dataSourceConnectors.d.ts +59 -0
- package/dist/types/dataSourceEvals.d.ts +225 -0
- package/dist/types/dataSourceJobs.d.ts +283 -0
- package/dist/types/dataSourceMappers.d.ts +204 -0
- package/dist/types/dataSourceReaders.d.ts +102 -0
- package/dist/types/dataSources.d.ts +627 -0
- package/dist/types/db.d.ts +63 -0
- package/dist/types/diagnostics.d.ts +96 -0
- package/dist/types/domains.d.ts +277 -0
- package/dist/types/email.d.ts +400 -0
- package/dist/types/events.d.ts +54 -0
- package/dist/types/feedback.d.ts +11 -0
- package/dist/types/files.d.ts +150 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/infra.d.ts +188 -0
- package/dist/types/issues.d.ts +106 -0
- package/dist/types/jewels.d.ts +336 -0
- package/dist/types/methods.d.ts +34 -0
- package/dist/types/prerender.d.ts +59 -0
- package/dist/types/previews.d.ts +39 -0
- package/dist/types/progress.d.ts +31 -0
- package/dist/types/qaRecordings.d.ts +51 -0
- package/dist/types/releases.d.ts +233 -0
- package/dist/types/requests.d.ts +114 -0
- package/dist/types/secrets.d.ts +52 -0
- package/dist/types/settings.d.ts +79 -0
- package/dist/types/tasks.d.ts +99 -0
- package/dist/types/usage.d.ts +29 -0
- package/dist/types/users.d.ts +61 -0
- package/dist/types/voice.d.ts +197 -0
- package/dist/upload.d.ts +11 -0
- package/package.json +7 -10
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-events observability operations.
|
|
3
|
+
*
|
|
4
|
+
* Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
|
|
5
|
+
* AdminTimeoutError. The live tail is CLI-only (src/cliStream.ts) — the
|
|
6
|
+
* import layer stays non-streaming by design.
|
|
7
|
+
*/
|
|
8
|
+
import type { AdminContext } from '../ctx.js';
|
|
9
|
+
import type { EventsChannelsListResult, EventsPublishResult } from '../types/events.js';
|
|
10
|
+
export interface EventsScopeParams {
|
|
11
|
+
/**
|
|
12
|
+
* Environment scope to inspect: `live` (the default for reads),
|
|
13
|
+
* `preview:<releaseId>`, or `dev:<sessionId>` — publishes and subscriptions
|
|
14
|
+
* never cross scopes, so a dev session's events are visible only under its
|
|
15
|
+
* `dev:` scope. A publish without one goes to the caller's own dev session.
|
|
16
|
+
*/
|
|
17
|
+
scope?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface EventsPublishParams extends EventsScopeParams {
|
|
20
|
+
/** Exact channel name(s) — no wildcards anywhere in app events. */
|
|
21
|
+
channels: string | string[];
|
|
22
|
+
/** The payload subscribers receive (≤256k serialized characters). */
|
|
23
|
+
data: unknown;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Channels with a publish or a subscription in the last 24h, with live
|
|
27
|
+
* subscriber counts — recency-sorted, capped at 200.
|
|
28
|
+
*
|
|
29
|
+
* The debugging read: a channel with subscribers but no publishes (or the
|
|
30
|
+
* reverse) usually means the frontend and backend spell the channel
|
|
31
|
+
* differently.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const { channels } = await admin.events.channelsList();
|
|
35
|
+
* const mismatch = channels.filter((c) => c.subscribers > 0 && !c.lastPublishAt);
|
|
36
|
+
*/
|
|
37
|
+
export declare function channelsList(ctx: AdminContext, params?: EventsScopeParams): Promise<EventsChannelsListResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Publish a test event, exactly as the app's own `events.publish` would —
|
|
40
|
+
* same validation, same delivery, same metering. Lets a frontend subscriber
|
|
41
|
+
* be verified before the backend trigger exists.
|
|
42
|
+
*
|
|
43
|
+
* Without `scope` it goes to the caller's own dev session, the preview they
|
|
44
|
+
* are building in; `scope: 'live'` reaches real users. The result's `scope`
|
|
45
|
+
* says where it went. `delivered` counts live subscriber connections per
|
|
46
|
+
* published channel; `0` is normal (nobody listening), never an error.
|
|
47
|
+
*
|
|
48
|
+
* @throws AdminApiError `invalid_channels` / `payload_too_large` (400), and
|
|
49
|
+
* `no_dev_session` (400) with no `scope` when the caller has no dev session.
|
|
50
|
+
* @example
|
|
51
|
+
* const { delivered } = await admin.events.publish({
|
|
52
|
+
* channels: 'jobs:usr_123',
|
|
53
|
+
* data: { type: 'ping' },
|
|
54
|
+
* });
|
|
55
|
+
*/
|
|
56
|
+
export declare function publish(ctx: AdminContext, params: EventsPublishParams): Promise<EventsPublishResult>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback operations: a problem with or gap in Remy, to the Remy team.
|
|
3
|
+
*
|
|
4
|
+
* Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
|
|
5
|
+
* AdminTimeoutError. No printing, no process coupling — the CLI skin in
|
|
6
|
+
* commands/feedback.ts and the importable client both call these.
|
|
7
|
+
*/
|
|
8
|
+
import type { AdminContext } from '../ctx.js';
|
|
9
|
+
import type { FeedbackDraftResult } from '../types/feedback.js';
|
|
10
|
+
/**
|
|
11
|
+
* Open Send Feedback in the person's editor with this message filled in.
|
|
12
|
+
*
|
|
13
|
+
* Nothing is sent from here. The person reviews the draft, edits it if they
|
|
14
|
+
* like, and sends it; the report then carries Remy's conversation, the
|
|
15
|
+
* sandbox's logs and the editor's state. Only the person's own editors on this
|
|
16
|
+
* app open it, and only ones open at the time.
|
|
17
|
+
*
|
|
18
|
+
* @throws AdminApiError `feedback_not_configured` (404) — this deployment
|
|
19
|
+
* doesn't take feedback; `missing_message` (400); `message_too_long` (400) —
|
|
20
|
+
* over 20,000 characters.
|
|
21
|
+
* @example
|
|
22
|
+
* await admin.feedback.draft('The preview stopped reloading after every save.');
|
|
23
|
+
*/
|
|
24
|
+
export declare function draft(ctx: AdminContext, message: string): Promise<FeedbackDraftResult>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-store operations: presigned uploads, read links, metadata, listing,
|
|
3
|
+
* deletion. Pure (ctx, params) → typed result; the CLI skin owns everything
|
|
4
|
+
* filesystem-shaped (path resolution, reading/writing disk).
|
|
5
|
+
*/
|
|
6
|
+
import type { AdminContext } from '../ctx.js';
|
|
7
|
+
import type { FilesDeleteResult, FilesListResult, FilesLsResult, FilesStatResult, FilesUrlResult } from '../types/files.js';
|
|
8
|
+
export type FileAccess = 'public' | 'private';
|
|
9
|
+
export interface FileRef {
|
|
10
|
+
/** Store name (e.g. 'assets'). */
|
|
11
|
+
store: string;
|
|
12
|
+
/** 'public' or 'private'. */
|
|
13
|
+
access: FileAccess;
|
|
14
|
+
/** Store-relative object key. */
|
|
15
|
+
key: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FilesPutParams {
|
|
18
|
+
content: Buffer;
|
|
19
|
+
store: string;
|
|
20
|
+
access: FileAccess;
|
|
21
|
+
/**
|
|
22
|
+
* Omitted → content-addressed: `<sha256(content)><ext-of-filename>`.
|
|
23
|
+
* Idempotent and immutable, so the returned URL is safe to bake into source.
|
|
24
|
+
*/
|
|
25
|
+
key?: string;
|
|
26
|
+
/** Used for the upload form part name and the default key's extension. */
|
|
27
|
+
filename?: string;
|
|
28
|
+
contentType?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Omitted → content-addressed public objects default to
|
|
31
|
+
* `public, max-age=31536000, immutable` (their keys are never reused);
|
|
32
|
+
* everything else falls through to the server default.
|
|
33
|
+
*/
|
|
34
|
+
cacheControl?: string;
|
|
35
|
+
/** Called just before the byte upload starts. */
|
|
36
|
+
onProgress?: (message: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Upload a file via presigned POST (up to 5 GiB).
|
|
40
|
+
*
|
|
41
|
+
* The API mints a presigned S3 POST; bytes go straight to storage, bypassing
|
|
42
|
+
* the API's JSON body limit. The key defaults to sha256(content) plus the
|
|
43
|
+
* filename extension (see `FilesPutParams.key`), making re-uploads of the same
|
|
44
|
+
* bytes idempotent and their URL safe to bake into source. Pass `key` for a
|
|
45
|
+
* stable, overwritable name (e.g. a config JSON the frontend fetches).
|
|
46
|
+
*
|
|
47
|
+
* @throws AdminApiError `invalid_store` (400); `invalid_access` (400);
|
|
48
|
+
* `invalid_key` (400).
|
|
49
|
+
* @example
|
|
50
|
+
* const { key, url } = await admin.files.put({
|
|
51
|
+
* content: imageBuffer,
|
|
52
|
+
* store: 'assets',
|
|
53
|
+
* access: 'public',
|
|
54
|
+
* filename: 'hero.jpg',
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
export declare function put(ctx: AdminContext, params: FilesPutParams): Promise<{
|
|
58
|
+
key: string;
|
|
59
|
+
url: string;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Mint a read link for one object.
|
|
63
|
+
*
|
|
64
|
+
* Private objects return a signed, expiring URL with `expiresAt` (ttl clamped
|
|
65
|
+
* server-side to [60s, 7d], default 300s). Where the link is a storage presign
|
|
66
|
+
* rather than the deployment's private CDN, it lasts three hours at most;
|
|
67
|
+
* `expiresAt` is when it actually expires. Public objects return a permanent
|
|
68
|
+
* on-domain URL with no expiry. Use a private store plus `sign` as the
|
|
69
|
+
* sensitive-file handoff channel — links are unguessable and the object stays
|
|
70
|
+
* deletable.
|
|
71
|
+
*
|
|
72
|
+
* @param ttlSeconds Requested TTL in seconds (clamped to [60, 604800]; default
|
|
73
|
+
* 300). Ignored for public objects.
|
|
74
|
+
* @throws AdminApiError `invalid_store` (400); `invalid_access` (400);
|
|
75
|
+
* `invalid_key` (400); `file_flagged` (403) — the object was flagged by AV
|
|
76
|
+
* scanning and cannot be linked.
|
|
77
|
+
* @example
|
|
78
|
+
* const { url, expiresAt } = await admin.files.sign(
|
|
79
|
+
* { store: 'handoff', access: 'private', key },
|
|
80
|
+
* 86400,
|
|
81
|
+
* );
|
|
82
|
+
*/
|
|
83
|
+
export declare function sign(ctx: AdminContext, ref: FileRef, ttlSeconds?: number): Promise<FilesUrlResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Download an object's bytes in-process.
|
|
86
|
+
*
|
|
87
|
+
* Mints a 60s presigned link via `sign`, then plain-fetches it — the link is
|
|
88
|
+
* self-authorizing, so no auth headers are needed for the byte transfer. No
|
|
89
|
+
* timeout on the byte stream; large objects are the whole point.
|
|
90
|
+
*
|
|
91
|
+
* @throws AdminApiError `file_flagged` (403) — the object was flagged by AV
|
|
92
|
+
* scanning; also propagates `sign` errors.
|
|
93
|
+
* @example
|
|
94
|
+
* const { bytes, contentType } = await admin.files.fetchBytes({
|
|
95
|
+
* store: 'handoff',
|
|
96
|
+
* access: 'private',
|
|
97
|
+
* key,
|
|
98
|
+
* });
|
|
99
|
+
*/
|
|
100
|
+
export declare function fetchBytes(ctx: AdminContext, ref: FileRef): Promise<{
|
|
101
|
+
bytes: Buffer;
|
|
102
|
+
contentType: string | null;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Object metadata (size, contentType, updatedAt, scan status) — no download.
|
|
106
|
+
*
|
|
107
|
+
* A missing key throws AdminApiError 404, so this doubles as an existence
|
|
108
|
+
* check without transferring any bytes.
|
|
109
|
+
*
|
|
110
|
+
* @throws AdminApiError `invalid_store` (400); `invalid_access` (400);
|
|
111
|
+
* `invalid_key` (400); 404 if the key does not exist.
|
|
112
|
+
* @example
|
|
113
|
+
* const meta = await admin.files.stat({
|
|
114
|
+
* store: 'assets',
|
|
115
|
+
* access: 'public',
|
|
116
|
+
* key: 'hero.jpg',
|
|
117
|
+
* });
|
|
118
|
+
*/
|
|
119
|
+
export declare function stat(ctx: AdminContext, ref: FileRef): Promise<FilesStatResult>;
|
|
120
|
+
export interface FilesLsParams {
|
|
121
|
+
/** Store name (e.g. 'assets'). */
|
|
122
|
+
store: string;
|
|
123
|
+
/** 'public' or 'private'. */
|
|
124
|
+
access: FileAccess;
|
|
125
|
+
/** Return only keys that start with this string. */
|
|
126
|
+
prefix?: string;
|
|
127
|
+
/** Server-side substring search (switches the listing mode). */
|
|
128
|
+
q?: string;
|
|
129
|
+
/** Pagination cursor from the previous page's `cursor` field. */
|
|
130
|
+
cursor?: string;
|
|
131
|
+
/** Maximum objects to return per page. */
|
|
132
|
+
limit?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List objects in one store with optional prefix filtering or substring search.
|
|
136
|
+
*
|
|
137
|
+
* Flat list by default. Pass `q` for substring search across the whole store
|
|
138
|
+
* (overrides `prefix`, delimiter ignored). Results are paginated — follow the
|
|
139
|
+
* returned `cursor` to fetch the next page.
|
|
140
|
+
*
|
|
141
|
+
* @throws AdminApiError `invalid_store` (400); `invalid_access` (400).
|
|
142
|
+
* @example
|
|
143
|
+
* const { files, cursor } = await admin.files.ls({
|
|
144
|
+
* store: 'assets',
|
|
145
|
+
* access: 'public',
|
|
146
|
+
* prefix: 'images/',
|
|
147
|
+
* });
|
|
148
|
+
*/
|
|
149
|
+
export declare function ls(ctx: AdminContext, params: FilesLsParams): Promise<FilesLsResult>;
|
|
150
|
+
/**
|
|
151
|
+
* Store-level summary: every store with object counts, total bytes, and
|
|
152
|
+
* AV/PII scan status histograms.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* const { stores, totalObjects } = await admin.files.summary();
|
|
156
|
+
*/
|
|
157
|
+
export declare function summary(ctx: AdminContext): Promise<FilesListResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Delete one object from a store.
|
|
160
|
+
*
|
|
161
|
+
* @throws AdminApiError `invalid_store` (400); `invalid_access` (400);
|
|
162
|
+
* `invalid_key` (400).
|
|
163
|
+
* @example
|
|
164
|
+
* await admin.files.remove({ store: 'handoff', access: 'private', key });
|
|
165
|
+
*/
|
|
166
|
+
export declare function remove(ctx: AdminContext, ref: FileRef): Promise<FilesDeleteResult>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provisioned-infrastructure operations: lease, park, resume and delete
|
|
3
|
+
* dedicated resources (first kind: retrieval capacity for data sources).
|
|
4
|
+
*
|
|
5
|
+
* Ops are pure (ctx, params) → typed result. The CLI skin in
|
|
6
|
+
* commands/infra.ts owns flag parsing, progress printing and exit codes.
|
|
7
|
+
*/
|
|
8
|
+
import type { AdminContext } from '../ctx.js';
|
|
9
|
+
import type { InfraGetResult, InfraListResult, InfraLogsResult, InfraPhase, InfraResource, InfraResourceResult } from '../types/infra.js';
|
|
10
|
+
/** @internal Consumed by the CLI skin; waitForPhase documents the default. */
|
|
11
|
+
export declare const DEFAULT_WAIT_TIMEOUT_MS: number;
|
|
12
|
+
export interface ListParams {
|
|
13
|
+
/** Include resources that have been deleted; off by default. */
|
|
14
|
+
includeDestroyed?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The app's dedicated resources plus the offerings it can provision, with
|
|
18
|
+
* their hourly and monthly prices.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const { resources, offerings } = await admin.infra.list();
|
|
22
|
+
*/
|
|
23
|
+
export declare function list(ctx: AdminContext, params?: ListParams): Promise<InfraListResult>;
|
|
24
|
+
export interface GetParams {
|
|
25
|
+
/** Resource id. */
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One resource with its state timeline and the data sources placed on it.
|
|
30
|
+
*
|
|
31
|
+
* @throws AdminApiError `resource_not_found` (404).
|
|
32
|
+
*/
|
|
33
|
+
export declare function get(ctx: AdminContext, params: GetParams): Promise<InfraGetResult>;
|
|
34
|
+
export interface LogsParams {
|
|
35
|
+
/** Resource id. */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Continue after this line id (the last line of a previous page). */
|
|
38
|
+
after?: string;
|
|
39
|
+
/** Lines per page; without `after`, the newest this many. Max 500. */
|
|
40
|
+
limit?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The platform's narration of a resource, oldest first: the steps a
|
|
44
|
+
* transition went through, failed attempts, and failures with the pod's
|
|
45
|
+
* events and a warnings-and-errors tail of the instance log. Not the
|
|
46
|
+
* instance's own stdout.
|
|
47
|
+
*
|
|
48
|
+
* @throws AdminApiError `resource_not_found` (404).
|
|
49
|
+
*/
|
|
50
|
+
export declare function logs(ctx: AdminContext, params: LogsParams): Promise<InfraLogsResult>;
|
|
51
|
+
export interface ProvisionParams {
|
|
52
|
+
/** Offering id from `list().offerings`, e.g. `retrieval.small`. */
|
|
53
|
+
offeringId: string;
|
|
54
|
+
/** Display name; defaults to the offering label. */
|
|
55
|
+
name?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Lease a new resource. Spends credits: the workspace must have a month's
|
|
59
|
+
* worth available before the request is accepted; nothing is charged until
|
|
60
|
+
* activation, and from then the resource bills by the hour.
|
|
61
|
+
*
|
|
62
|
+
* The response is the row in `requested`; the platform brings it to `active`
|
|
63
|
+
* within a minute or so. Use `waitForPhase` to block on that.
|
|
64
|
+
*
|
|
65
|
+
* @throws AdminApiError `offering_not_found` (400), `offering_retired` (422),
|
|
66
|
+
* `provisioning_unavailable` (422), `insufficient_credits/*` (402).
|
|
67
|
+
* @example
|
|
68
|
+
* const { resource } = await admin.infra.provision({ offeringId: 'retrieval.small' });
|
|
69
|
+
*/
|
|
70
|
+
export declare function provision(ctx: AdminContext, params: ProvisionParams): Promise<InfraResourceResult>;
|
|
71
|
+
export interface ResourceIdParams {
|
|
72
|
+
/** Resource id. */
|
|
73
|
+
id: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Park an active resource. Data is kept; searches on its data sources return
|
|
77
|
+
* `capacity_hibernating` while it parks and `capacity_hibernated` once parked,
|
|
78
|
+
* until it resumes; billing drops to the retained-storage rate.
|
|
79
|
+
*
|
|
80
|
+
* @throws AdminApiError `resource_not_found` (404), `invalid_transition` (422).
|
|
81
|
+
*/
|
|
82
|
+
export declare function hibernate(ctx: AdminContext, params: ResourceIdParams): Promise<InfraResourceResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Bring a hibernated (or failed) resource back to active.
|
|
85
|
+
*
|
|
86
|
+
* @throws AdminApiError `resource_not_found` (404), `invalid_transition` (422).
|
|
87
|
+
*/
|
|
88
|
+
export declare function resume(ctx: AdminContext, params: ResourceIdParams): Promise<InfraResourceResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Delete a resource. Refused while any data source is placed on it — move
|
|
91
|
+
* those to shared capacity (`admin.dataSources.move({ placement: 'shared' })`,
|
|
92
|
+
* data intact) or delete them first. Billing stops when the phase reaches
|
|
93
|
+
* `destroyed`.
|
|
94
|
+
*
|
|
95
|
+
* @throws AdminApiError `resource_not_found` (404),
|
|
96
|
+
* `resource_has_attachments` (422), `invalid_transition` (422).
|
|
97
|
+
*/
|
|
98
|
+
export declare function destroy(ctx: AdminContext, params: ResourceIdParams): Promise<InfraResourceResult>;
|
|
99
|
+
export interface ResizeParams {
|
|
100
|
+
id: string;
|
|
101
|
+
/** Offering id from `list().offerings`, e.g. `retrieval.medium`. */
|
|
102
|
+
offeringId: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Change a resource's size, keeping its documents.
|
|
106
|
+
*
|
|
107
|
+
* The platform parks the resource, swaps its spec, and brings it back up with
|
|
108
|
+
* its sources' indexes rebuilt from durable storage in the background, so a
|
|
109
|
+
* resize passes through `hibernated` and searches on those sources answer
|
|
110
|
+
* `index_warming` with the rebuild's progress until it lands. A resource that
|
|
111
|
+
* is already hibernated swaps in place and stays parked. Growing is gated on a
|
|
112
|
+
* month of credits at the new rate like a provision; shrinking is refused
|
|
113
|
+
* below what the resource holds. The response carries `resizingTo` until the
|
|
114
|
+
* swap has happened; `waitForPhase` with `until: (r) => r.resizingTo === null`
|
|
115
|
+
* blocks on the whole thing.
|
|
116
|
+
*
|
|
117
|
+
* @throws AdminApiError `resource_not_found` (404), `offering_not_found`
|
|
118
|
+
* (400), `offering_retired` (422), `same_offering` (400),
|
|
119
|
+
* `offering_kind_mismatch` (400), `resize_pending` (422), `resize_too_small`
|
|
120
|
+
* (422), `insufficient_credits/*` (402), `invalid_transition` (422).
|
|
121
|
+
* @example
|
|
122
|
+
* await admin.infra.resize({ id, offeringId: 'retrieval.medium' });
|
|
123
|
+
*/
|
|
124
|
+
export declare function resize(ctx: AdminContext, params: ResizeParams): Promise<InfraResourceResult>;
|
|
125
|
+
export interface RenameParams {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
}
|
|
129
|
+
/** @throws AdminApiError `resource_not_found` (404), `invalid_name` (400). */
|
|
130
|
+
export declare function rename(ctx: AdminContext, params: RenameParams): Promise<InfraResourceResult>;
|
|
131
|
+
export interface WaitForPhaseParams {
|
|
132
|
+
id: string;
|
|
133
|
+
/** The phase(s) that count as done. */
|
|
134
|
+
phases: InfraPhase[];
|
|
135
|
+
/**
|
|
136
|
+
* An extra condition on top of the phase — a resize, for one, ends in the
|
|
137
|
+
* phase it started from and is done only once `resizingTo` has cleared.
|
|
138
|
+
*/
|
|
139
|
+
until?: (resource: InfraResource) => boolean;
|
|
140
|
+
/** How long without movement before giving up. Default 10 minutes. */
|
|
141
|
+
timeoutMs?: number;
|
|
142
|
+
onProgress?: (message: string) => void;
|
|
143
|
+
}
|
|
144
|
+
export type WaitForPhaseResult = {
|
|
145
|
+
status: 'done';
|
|
146
|
+
resource: InfraResource;
|
|
147
|
+
} | {
|
|
148
|
+
status: 'failed';
|
|
149
|
+
resource: InfraResource;
|
|
150
|
+
error: string;
|
|
151
|
+
} | {
|
|
152
|
+
status: 'timeout';
|
|
153
|
+
resource: InfraResource;
|
|
154
|
+
error: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Poll a resource until it reaches one of `phases`, fails, or the timeout
|
|
158
|
+
* elapses. A `failed` phase returns immediately with the platform's error.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* const result = await admin.infra.waitForPhase({ id, phases: ['active'] });
|
|
162
|
+
*/
|
|
163
|
+
export declare function waitForPhase(ctx: AdminContext, params: WaitForPhaseParams): Promise<WaitForPhaseResult>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App issues operations: CRUD for bugs, ideas, and tasks.
|
|
3
|
+
*
|
|
4
|
+
* Ops take resolved strings for body content — the stdin read
|
|
5
|
+
* (`fs.readFileSync(0, ...)`) stays in the CLI skin (commands/issues.ts).
|
|
6
|
+
*
|
|
7
|
+
* Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
|
|
8
|
+
* AdminTimeoutError. No printing, no process coupling.
|
|
9
|
+
*/
|
|
10
|
+
import type { AdminContext } from '../ctx.js';
|
|
11
|
+
import type { IssuesListResult, IssuesGetResult, IssuesCreateResult, IssuesCommentResult, IssuesUpdateResult, IssuesDeleteResult } from '../types/issues.js';
|
|
12
|
+
export interface IssuesListParams {
|
|
13
|
+
/** Filter by status: `open` or `closed`. Omit for any state. */
|
|
14
|
+
status?: string;
|
|
15
|
+
/** Match issues carrying ANY of these labels. */
|
|
16
|
+
labels?: string[];
|
|
17
|
+
/** Only issues another app filed here, by that app's id. */
|
|
18
|
+
originAppId?: string;
|
|
19
|
+
/** Max issues to return (default 50). */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/** Keyset cursor from a previous response's `nextCursor`. */
|
|
22
|
+
cursor?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* List the issues filed IN an app, newest-first.
|
|
26
|
+
*
|
|
27
|
+
* @throws AdminApiError `invalid_status` (400) — status is not `open` or
|
|
28
|
+
* `closed`.
|
|
29
|
+
* @example
|
|
30
|
+
* const { issues } = await admin.issues.list({ status: 'open', labels: ['bug'] });
|
|
31
|
+
*/
|
|
32
|
+
export declare function list(ctx: AdminContext, params?: IssuesListParams): Promise<IssuesListResult>;
|
|
33
|
+
/**
|
|
34
|
+
* List the issues this app filed INTO other apps, newest-first.
|
|
35
|
+
*
|
|
36
|
+
* The sender's half of a cross-app thread: one call returns every issue the
|
|
37
|
+
* app sent out, so a fan-out across forty apps is read once rather than forty
|
|
38
|
+
* times. Scoped to apps in the same workspace.
|
|
39
|
+
*
|
|
40
|
+
* @throws AdminApiError `invalid_status` (400) — status is not `open` or
|
|
41
|
+
* `closed`.
|
|
42
|
+
* @example
|
|
43
|
+
* const { issues } = await admin.issues.filed({ status: 'open' });
|
|
44
|
+
*/
|
|
45
|
+
export declare function filed(ctx: AdminContext, params?: Omit<IssuesListParams, 'originAppId'>): Promise<IssuesListResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Get one issue with its full comment thread.
|
|
48
|
+
*
|
|
49
|
+
* @param number The friendly per-app issue number (e.g. `"42"`), as shown
|
|
50
|
+
* in `list` results under `issue.number`.
|
|
51
|
+
* @throws AdminApiError `issue_not_found` (404) — no issue with this number
|
|
52
|
+
* in this app.
|
|
53
|
+
* @example
|
|
54
|
+
* const { issue, comments } = await admin.issues.get('42');
|
|
55
|
+
*/
|
|
56
|
+
export declare function get(ctx: AdminContext, number: string): Promise<IssuesGetResult>;
|
|
57
|
+
export interface IssuesCreateParams {
|
|
58
|
+
/** Issue title (required, non-empty). */
|
|
59
|
+
title: string;
|
|
60
|
+
/** Issue body in markdown. */
|
|
61
|
+
body?: string;
|
|
62
|
+
/** Labels to file it under. Open set, at most 20, 64 chars each. */
|
|
63
|
+
labels?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* The app filing this, when it isn't the app the issue lands in. Defaults to
|
|
66
|
+
* `ctx.originAppId` — set whenever the caller retargeted at another app — so
|
|
67
|
+
* cross-app authorship is recorded without anyone opting in. Pass it
|
|
68
|
+
* explicitly only to override that.
|
|
69
|
+
*/
|
|
70
|
+
originAppId?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* File a new issue authored as the agent (`authorKind: "agent"`).
|
|
74
|
+
*
|
|
75
|
+
* Returns the created issue row. When the server is supplied a `source`
|
|
76
|
+
* blob and an open issue for the same source already existed, it returns
|
|
77
|
+
* that issue with `deduped: true` (no new row created); the ops layer does
|
|
78
|
+
* not accept `source`, so `deduped` is always absent from op-layer responses.
|
|
79
|
+
*
|
|
80
|
+
* @throws AdminApiError `missing_title` (400) — title is required or empty;
|
|
81
|
+
* `invalid_labels` (400) — labels are not strings, or exceed the count /
|
|
82
|
+
* length caps; `invalid_origin_app_id` (400) — originAppId is not an app id.
|
|
83
|
+
* @example
|
|
84
|
+
* const { issue } = await admin.issues.create({ title: 'Checkout 500s on empty cart', labels: ['bug'] });
|
|
85
|
+
*/
|
|
86
|
+
export declare function create(ctx: AdminContext, params: IssuesCreateParams): Promise<IssuesCreateResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Post a comment on an issue's thread authored as the agent.
|
|
89
|
+
*
|
|
90
|
+
* @param number The issue number.
|
|
91
|
+
* @param body The comment body (non-empty).
|
|
92
|
+
* @throws AdminApiError `missing_body` (400) — body is empty;
|
|
93
|
+
* `issue_not_found` (404) — no issue with this number in this app.
|
|
94
|
+
* @example
|
|
95
|
+
* await admin.issues.comment('42', 'Fixed in the latest release.');
|
|
96
|
+
*/
|
|
97
|
+
export declare function comment(ctx: AdminContext, number: string, body: string): Promise<IssuesCommentResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Close an issue, optionally with a closing comment.
|
|
100
|
+
*
|
|
101
|
+
* Records a `closed` timeline event on the thread, preceded by the comment
|
|
102
|
+
* when one is given — so answering and resolving is one call, which is what
|
|
103
|
+
* replying to an issue another app filed usually amounts to.
|
|
104
|
+
*
|
|
105
|
+
* @param number The issue number.
|
|
106
|
+
* @param comment Optional prose posted before the close event.
|
|
107
|
+
* @throws AdminApiError `issue_not_found` (404) — no issue with this number
|
|
108
|
+
* in this app.
|
|
109
|
+
* @example
|
|
110
|
+
* await admin.issues.close('42', 'Already fixed in v3 — no change needed.');
|
|
111
|
+
*/
|
|
112
|
+
export declare function close(ctx: AdminContext, number: string, comment?: string): Promise<IssuesUpdateResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Reopen a closed issue.
|
|
115
|
+
*
|
|
116
|
+
* Records a `reopened` timeline event on the thread.
|
|
117
|
+
*
|
|
118
|
+
* @param number The issue number.
|
|
119
|
+
* @throws AdminApiError `issue_not_found` (404) — no issue with this number
|
|
120
|
+
* in this app.
|
|
121
|
+
* @example
|
|
122
|
+
* await admin.issues.reopen('42');
|
|
123
|
+
*/
|
|
124
|
+
export declare function reopen(ctx: AdminContext, number: string): Promise<IssuesUpdateResult>;
|
|
125
|
+
export interface IssuesEditParams {
|
|
126
|
+
/** Replace the issue's title (non-empty). */
|
|
127
|
+
title?: string;
|
|
128
|
+
/** Replace the issue's body. */
|
|
129
|
+
body?: string;
|
|
130
|
+
/** Replace the issue's labels wholesale (not a merge). */
|
|
131
|
+
labels?: string[];
|
|
132
|
+
/** Change the status to `open` or `closed`. */
|
|
133
|
+
status?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Edit an issue's title, body, labels, or status.
|
|
137
|
+
*
|
|
138
|
+
* Status transitions record a `closed` or `reopened` timeline event
|
|
139
|
+
* automatically. At least one field must be provided.
|
|
140
|
+
*
|
|
141
|
+
* @param number The issue number.
|
|
142
|
+
* @throws AdminApiError `missing_title` (400) — title was supplied but empty;
|
|
143
|
+
* `invalid_labels` (400) — labels are not strings, or exceed the count /
|
|
144
|
+
* length caps; `invalid_status` (400) — status is not `open` or `closed`;
|
|
145
|
+
* `no_fields` (400) — no editable field was provided; `issue_not_found`
|
|
146
|
+
* (404) — no issue with this number in this app.
|
|
147
|
+
* @example
|
|
148
|
+
* await admin.issues.edit('42', { status: 'closed' });
|
|
149
|
+
*/
|
|
150
|
+
export declare function edit(ctx: AdminContext, number: string, params: IssuesEditParams): Promise<IssuesUpdateResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Delete an issue. The number is permanently retired (never reissued).
|
|
153
|
+
*
|
|
154
|
+
* @param number The issue number.
|
|
155
|
+
* @throws AdminApiError `issue_not_found` (404) — no issue with this number
|
|
156
|
+
* in this app.
|
|
157
|
+
* @example
|
|
158
|
+
* await admin.issues.del('42');
|
|
159
|
+
*/
|
|
160
|
+
export declare function del(ctx: AdminContext, number: string): Promise<IssuesDeleteResult>;
|