TrashItem
The trash: what was deleted and can still be put back.
Deleting an app, database, bucket, dict, queue, repo, volume, inbox or agent
moves it here, restorable for 30 days, then purged for good. delete() on each of
them returns its TrashItem:
item = noclick.Dict.from_name("rates-cache").delete()
item.restore() # back under its name, every key with itA database's restore lands what it rewound here too, as a database_copy:
restoring that puts it back into its database. While it's in the trash its
name is free and its storage is billed as before; restoring is free.
purge() deletes it for good now: the one deletion that can't be undone, so
through MCP it waits for a person.
class TrashItemSomething deleted, restorable until purgeAfter.
- Like every live object, it also has hydrate(), refresh() and raw.
| id | string | |
| kind | TrashKind | What it is. |
| resourceId | string | Its id as it was, and will be again once restored. |
| name | string | null | |
| userId | string | null | The user it was deleted from (null for the account's). |
| trashedAt | Date | null | |
| purgeAfter | Date | null | When it's purged for good unless restored first. |
| operationId | string | null | The deletion's operation (on the item a |
type TrashKind =
| "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
| "skill" | "memory";fromIdstatic
static fromId(trashId: string, options?: CallOptions): TrashItemA lazy reference to an item in the trash by its id.
The item; it loads the first time it's used.
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}liststatic
static list(
options?: TrashListOptions & { limit?: number },
): Promise<TrashItem[]>What's in the trash, newest first.
One kind; omitted, every kind.
Return at most this many.
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Which users the read covers (user_id query), instead of acting as one (user).
Each item, with when it's purged unless restored first.
type TrashKind =
| "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
| "skill" | "memory";
/**
* Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
* `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
*/
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;listPagestatic
static listPage(
options?: TrashListOptions & PageOptions,
): Promise<Page<TrashItem>>One page of the trash; pass nextCursor back as cursor.
One kind; omitted, every kind.
The next_cursor of the page before; omit it for the first page.
Return at most this many.
undefined = the ambient user (asUser), null = the account itself.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Which users the read covers (user_id query), instead of acting as one (user).
A page whose data holds the items and whose next_cursor is None on the last page.
type TrashKind =
| "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
| "skill" | "memory";
/**
* Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
* `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
*/
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;restore
restore(): Promise<JsonObject>Put it back where it was, under its name, with everything in it; throws Conflict when
something new has taken its name since. A database_copy goes back into its database: a
restore of its own (its operation), which keeps what the database holds now as a copy the
same way. Returns the restored resource as its own API shows it.
The restored resource as its own API shows it, with restored: True.
type JsonObject = { [key: string]: unknown };purge
purge(): Promise<void>Delete it for good now: the one deletion that can't be undone.
DeletePreview
interface DeletePreviewWhat a deletion would do, in words a person reads before agreeing: what it deletes, what stops working
(dependsOnIt), the data that goes (dataLost), what stops being billed (stopsBilling), and whether it's
reversible and how (undo). Nothing is deleted by asking. confirmToken is what a call through MCP sends to
confirm it, within expiresInS.
| deletes | string | |
| dependsOnIt | string[] | |
| dataLost | string[] | |
| stopsBilling | string[] | |
| reversible | boolean | |
| undo | string | null | |
| confirmToken | string | null | |
| expiresInS | number | null | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };previewDelete
function previewDelete(
method: "DELETE" | "POST",
path: string,
options?: { body?: unknown; user?: UserOption; client?: NoClick },
): Promise<DeletionPreview>What method path would delete (DELETE, or POST for a cancel, close or clear), as the account sees it (user:
as one of its users does): what goes, what depends on it, what data is lost and whether it can be taken back.
body is the call's own, for a deletion judged by it (a workflow's edits that remove steps). Nothing is deleted.
const { impact } = await previewDelete("DELETE", `/v1/agents/${agent.id}`);
console.log(impact.deletes, impact.reversible ? impact.undo : "for good");Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The preview.
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
/** A `User` or your own id for the user. */
type UserRef = string | UserLike;
/** Anything that can name a user lazily (a `User`). */
interface UserLike {
_userId(): Promise<string>;
}DeletionPreview
interface DeletionPreviewA deletion previewed: its operation, method and path, what it's called (title), its impact, and the
confirmToken (good for expiresInS seconds) the call takes.
| operation | string | |
| method | string | |
| path | string | |
| title | string | null | |
| impact | DeletionImpact | |
| confirmToken | string | |
| expiresInS | number | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };DeletionImpact
interface DeletionImpactWhat a deletion does, in words a person reads before agreeing; effects says some of dependsOnIt as data too.
| deletes | string | |
| dependsOnIt | string[] | What has to go first, or stops working with it. |
| dataLost | string[] | |
| stopsBilling | string[] | |
| reversible | boolean | Whether it can be taken back ( |
| undo | string | null | |
| effects | DeletionEffect[] |
DeletionEffect
interface DeletionEffectOne line of a deletion's dependsOnIt said as data, for a page that groups what happens: what it's about (kind,
id and name, null where you can't see it), what happens to it (outcome, the area's own word: a listener
moves, stops or waits), where it goes (to) and the line that says it, word for word. Several may share a
line.
| kind | string | |
| id | string | null | |
| name | string | null | |
| outcome | string | |
| to | { kind: string; id: string; name: string } | null | |
| line | string |