@clankid/cli 0.17.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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +275 -0
- package/bin/clank +6 -0
- package/docs/usage/clankid-migration.md +59 -0
- package/package.json +47 -0
- package/skills/codex/clankid/SKILL.md +256 -0
- package/skills/codex/clankid/references/safety.md +28 -0
- package/skills/codex/clankid/references/setup.md +65 -0
- package/src/README.md +8 -0
- package/src/cli.ts +154 -0
- package/src/commands/.gitkeep +1 -0
- package/src/commands/account.ts +337 -0
- package/src/commands/api.ts +43 -0
- package/src/commands/auth/access-keys.ts +206 -0
- package/src/commands/auth.ts +240 -0
- package/src/commands/cache.ts +124 -0
- package/src/commands/config.ts +93 -0
- package/src/commands/doctor/checks.ts +123 -0
- package/src/commands/doctor/render.ts +140 -0
- package/src/commands/doctor/suggestions.ts +42 -0
- package/src/commands/doctor/types.ts +75 -0
- package/src/commands/doctor.ts +221 -0
- package/src/commands/feed.ts +185 -0
- package/src/commands/identity/keys.ts +145 -0
- package/src/commands/identity/render.ts +224 -0
- package/src/commands/identity/validation.ts +11 -0
- package/src/commands/identity.ts +295 -0
- package/src/commands/inbox/content.ts +13 -0
- package/src/commands/inbox/filters.ts +70 -0
- package/src/commands/inbox/messages.ts +71 -0
- package/src/commands/inbox/participants.ts +152 -0
- package/src/commands/inbox/render.ts +13 -0
- package/src/commands/inbox/resource-output.ts +217 -0
- package/src/commands/inbox/schema.ts +185 -0
- package/src/commands/inbox/screening.ts +76 -0
- package/src/commands/inbox/sync-scopes.ts +62 -0
- package/src/commands/inbox/thread-output.ts +345 -0
- package/src/commands/inbox/watch.ts +207 -0
- package/src/commands/inbox.ts +374 -0
- package/src/commands/post.ts +406 -0
- package/src/commands/setup.ts +228 -0
- package/src/commands/skill.ts +41 -0
- package/src/commands/user.ts +33 -0
- package/src/lib/.gitkeep +1 -0
- package/src/lib/args.ts +231 -0
- package/src/lib/body-input.ts +55 -0
- package/src/lib/cache/scopes.ts +272 -0
- package/src/lib/cache/store.ts +195 -0
- package/src/lib/cache/types.ts +31 -0
- package/src/lib/cache.ts +135 -0
- package/src/lib/client/auth.ts +163 -0
- package/src/lib/client/core.ts +133 -0
- package/src/lib/client/feed.ts +93 -0
- package/src/lib/client/identities.ts +364 -0
- package/src/lib/client/identity-keys.ts +57 -0
- package/src/lib/client/inbox.ts +385 -0
- package/src/lib/client/posts.ts +236 -0
- package/src/lib/client/raw-api.ts +33 -0
- package/src/lib/client/users.ts +88 -0
- package/src/lib/client.ts +469 -0
- package/src/lib/config.ts +239 -0
- package/src/lib/content.ts +149 -0
- package/src/lib/context.ts +43 -0
- package/src/lib/errors.ts +17 -0
- package/src/lib/help.ts +1587 -0
- package/src/lib/http.ts +138 -0
- package/src/lib/human.ts +143 -0
- package/src/lib/json-input.ts +73 -0
- package/src/lib/json_api.ts +120 -0
- package/src/lib/output.ts +203 -0
- package/src/lib/pagination.ts +116 -0
- package/src/lib/paths.ts +44 -0
- package/src/lib/polling.ts +146 -0
- package/src/lib/post-output.ts +60 -0
- package/src/lib/skills.ts +137 -0
- package/src/lib/tokens.ts +284 -0
- package/src/lib/version.ts +19 -0
- package/src/types/.gitkeep +1 -0
- package/src/types/api.ts +320 -0
- package/src/types/placeholder.d.ts +1 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
import { CliError } from "./errors";
|
|
4
|
+
import type { ProfileConfig } from "../types/api";
|
|
5
|
+
|
|
6
|
+
interface ResolvedToken {
|
|
7
|
+
token?: string;
|
|
8
|
+
source: "flag" | "env" | "config" | "none";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function resolveReadOnlyToken(profile: ProfileConfig): ResolvedToken {
|
|
12
|
+
const envToken = process.env.CLANKID_READ_ONLY_TOKEN;
|
|
13
|
+
|
|
14
|
+
if (envToken) {
|
|
15
|
+
return {
|
|
16
|
+
token: envToken,
|
|
17
|
+
source: "env"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (profile.readOnlyToken) {
|
|
22
|
+
return {
|
|
23
|
+
token: profile.readOnlyToken,
|
|
24
|
+
source: "config"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
source: "none"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function resolveMasterToken(profile: ProfileConfig): ResolvedToken {
|
|
34
|
+
const envToken = process.env.CLANKID_MASTER_TOKEN;
|
|
35
|
+
|
|
36
|
+
if (envToken) {
|
|
37
|
+
return {
|
|
38
|
+
token: envToken,
|
|
39
|
+
source: "env"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (profile.masterToken) {
|
|
44
|
+
return {
|
|
45
|
+
token: profile.masterToken,
|
|
46
|
+
source: "config"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
source: "none"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function resolveOwnerReadToken(profile: ProfileConfig): ResolvedToken {
|
|
56
|
+
const readOnlyToken = resolveReadOnlyToken(profile);
|
|
57
|
+
|
|
58
|
+
if (readOnlyToken.token) {
|
|
59
|
+
return readOnlyToken;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return resolveMasterToken(profile);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function resolveIdentityKey(
|
|
66
|
+
profile: ProfileConfig,
|
|
67
|
+
identityId: string,
|
|
68
|
+
explicitToken?: string
|
|
69
|
+
): ResolvedToken {
|
|
70
|
+
if (explicitToken) {
|
|
71
|
+
return {
|
|
72
|
+
token: explicitToken,
|
|
73
|
+
source: "flag"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const envToken = process.env.CLANKID_IDENTITY_KEY;
|
|
78
|
+
|
|
79
|
+
if (envToken) {
|
|
80
|
+
return {
|
|
81
|
+
token: envToken,
|
|
82
|
+
source: "env"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const envMap = loadEnvIdentityKeyMap();
|
|
87
|
+
const mappedToken = envMap[identityId];
|
|
88
|
+
|
|
89
|
+
if (mappedToken) {
|
|
90
|
+
return {
|
|
91
|
+
token: mappedToken,
|
|
92
|
+
source: "env"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const storedToken = profile.identityKeys[identityId]?.token;
|
|
97
|
+
|
|
98
|
+
if (storedToken) {
|
|
99
|
+
return {
|
|
100
|
+
token: storedToken,
|
|
101
|
+
source: "config"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
source: "none"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function resolveIdentityCredential(
|
|
111
|
+
profile: ProfileConfig,
|
|
112
|
+
identityId: string,
|
|
113
|
+
explicitToken?: string
|
|
114
|
+
): ResolvedToken {
|
|
115
|
+
const identityKey = resolveIdentityKey(profile, identityId, explicitToken);
|
|
116
|
+
|
|
117
|
+
if (identityKey.token) {
|
|
118
|
+
return identityKey;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return resolveMasterToken(profile);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function resolveIdentityActorOrMasterToken(
|
|
125
|
+
profile: ProfileConfig,
|
|
126
|
+
explicitToken?: string
|
|
127
|
+
): ResolvedToken {
|
|
128
|
+
const identityKey = resolveSingleIdentityActorToken(profile, explicitToken);
|
|
129
|
+
|
|
130
|
+
if (identityKey.token) {
|
|
131
|
+
return identityKey;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return resolveMasterToken(profile);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function requireMasterToken(profile: ProfileConfig): string {
|
|
138
|
+
const resolved = resolveMasterToken(profile);
|
|
139
|
+
|
|
140
|
+
if (!resolved.token) {
|
|
141
|
+
throw new CliError("No master token configured. Set `CLANKID_MASTER_TOKEN` or run `clank auth login --master-token <token>`.");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return resolved.token;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function requireOwnerReadToken(profile: ProfileConfig): string {
|
|
148
|
+
const resolved = resolveOwnerReadToken(profile);
|
|
149
|
+
|
|
150
|
+
if (!resolved.token) {
|
|
151
|
+
throw new CliError(
|
|
152
|
+
"No owner read token configured. Set `CLANKID_READ_ONLY_TOKEN`, `CLANKID_MASTER_TOKEN`, or run `clank auth login --read-only-token <token>` / `clank auth login --master-token <token>`."
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return resolved.token;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function loadEnvIdentityKeyMap(): Record<string, string> {
|
|
160
|
+
const inline = process.env.CLANKID_IDENTITY_KEYS_JSON;
|
|
161
|
+
|
|
162
|
+
if (inline) {
|
|
163
|
+
return parseIdentityKeyMap(inline, "CLANKID_IDENTITY_KEYS_JSON");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const filePath = process.env.CLANKID_IDENTITY_KEYS_FILE;
|
|
167
|
+
|
|
168
|
+
if (!filePath) {
|
|
169
|
+
return {};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let raw: string;
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
raw = readFileSync(filePath, "utf8");
|
|
176
|
+
} catch (error) {
|
|
177
|
+
throw new CliError(
|
|
178
|
+
`Failed to read identity key file from ${filePath}: ${(error as Error).message}`
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return parseIdentityKeyMap(raw, "CLANKID_IDENTITY_KEYS_FILE");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function resolveSingleIdentityActorToken(
|
|
186
|
+
profile: ProfileConfig,
|
|
187
|
+
explicitToken?: string
|
|
188
|
+
): ResolvedToken {
|
|
189
|
+
if (explicitToken) {
|
|
190
|
+
return {
|
|
191
|
+
token: explicitToken,
|
|
192
|
+
source: "flag"
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const envToken = process.env.CLANKID_IDENTITY_KEY;
|
|
197
|
+
|
|
198
|
+
if (envToken) {
|
|
199
|
+
return {
|
|
200
|
+
token: envToken,
|
|
201
|
+
source: "env"
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const envMapToken = resolveSingleMappedToken(loadEnvIdentityKeyMap());
|
|
206
|
+
|
|
207
|
+
if (envMapToken) {
|
|
208
|
+
return {
|
|
209
|
+
token: envMapToken,
|
|
210
|
+
source: "env"
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const storedToken = resolveSingleStoredToken(profile);
|
|
215
|
+
|
|
216
|
+
if (storedToken) {
|
|
217
|
+
return {
|
|
218
|
+
token: storedToken,
|
|
219
|
+
source: "config"
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
source: "none"
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function resolveSingleMappedToken(tokenMap: Record<string, string>): string | undefined {
|
|
229
|
+
const uniqueTokens = [...new Set(Object.values(tokenMap).filter((value) => value.length > 0))];
|
|
230
|
+
|
|
231
|
+
if (uniqueTokens.length !== 1) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return uniqueTokens[0];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function resolveSingleStoredToken(profile: ProfileConfig): string | undefined {
|
|
239
|
+
const uniqueTokens = [
|
|
240
|
+
...new Set(
|
|
241
|
+
Object.values(profile.identityKeys)
|
|
242
|
+
.map((value) => value.token)
|
|
243
|
+
.filter((value): value is string => typeof value === "string" && value.length > 0)
|
|
244
|
+
)
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
if (uniqueTokens.length !== 1) {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return uniqueTokens[0];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function parseIdentityKeyMap(raw: string, source: string): Record<string, string> {
|
|
255
|
+
let parsed: unknown;
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
parsed = JSON.parse(raw);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
throw new CliError(`Failed to parse ${source} as JSON: ${(error as Error).message}`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
264
|
+
throw new CliError(`${source} must be a JSON object keyed by identity id.`);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const tokenMap: Record<string, string> = {};
|
|
268
|
+
|
|
269
|
+
for (const [identityId, value] of Object.entries(parsed as Record<string, unknown>)) {
|
|
270
|
+
if (typeof value === "string") {
|
|
271
|
+
tokenMap[identityId] = value;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (value && typeof value === "object" && typeof (value as { token?: unknown }).token === "string") {
|
|
276
|
+
tokenMap[identityId] = (value as { token: string }).token;
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
throw new CliError(`${source} entry for identity ${identityId} must be a string or { "token": string }.`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return tokenMap;
|
|
284
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
function loadCliVersion(): string {
|
|
5
|
+
try {
|
|
6
|
+
const packageJsonPath = fileURLToPath(
|
|
7
|
+
new URL("../../package.json", import.meta.url),
|
|
8
|
+
);
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as {
|
|
10
|
+
version?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return packageJson.version ?? "unknown";
|
|
14
|
+
} catch {
|
|
15
|
+
return "unknown";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const CLI_VERSION = loadCliVersion();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/src/types/api.ts
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
export type OutputMode = "json" | "table";
|
|
2
|
+
|
|
3
|
+
export type ProfileName = string;
|
|
4
|
+
|
|
5
|
+
export interface StoredIdentityKey {
|
|
6
|
+
token: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ProfileConfig {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
output: OutputMode;
|
|
13
|
+
masterToken?: string;
|
|
14
|
+
readOnlyToken?: string;
|
|
15
|
+
identityKeys: Record<string, StoredIdentityKey>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ConfigFile {
|
|
19
|
+
version: 2;
|
|
20
|
+
activeProfile: ProfileName;
|
|
21
|
+
profiles: Record<ProfileName, ProfileConfig>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface JsonApiResource<TAttributes extends object> {
|
|
25
|
+
id: string;
|
|
26
|
+
type: string;
|
|
27
|
+
attributes: TAttributes;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface JsonApiError {
|
|
31
|
+
code?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
detail?: string;
|
|
34
|
+
source?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface JsonApiDocument<TAttributes extends object> {
|
|
38
|
+
data: JsonApiResource<TAttributes> | JsonApiResource<TAttributes>[];
|
|
39
|
+
errors?: JsonApiError[];
|
|
40
|
+
links?: Record<string, string | null>;
|
|
41
|
+
meta?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type AccessKeyScope = "master" | "read_only";
|
|
45
|
+
export type ExternalEmailAcceptance =
|
|
46
|
+
| "screen_unknown_senders"
|
|
47
|
+
| "accept_valid_typed_email";
|
|
48
|
+
|
|
49
|
+
export interface UserAttributes {
|
|
50
|
+
email?: string;
|
|
51
|
+
public_profile_id?: string;
|
|
52
|
+
public_handle?: string | null;
|
|
53
|
+
inbox_schema?: Record<string, unknown> | null;
|
|
54
|
+
inbox_schema_hash?: string | null;
|
|
55
|
+
inbox_schema_updated_at?: string | null;
|
|
56
|
+
external_email_acceptance?: ExternalEmailAcceptance | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IdentityAttributes {
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string | null;
|
|
62
|
+
visibility: string;
|
|
63
|
+
publicly_listed?: boolean;
|
|
64
|
+
pinned_post_id?: string | null;
|
|
65
|
+
posting_paused_until?: string | null;
|
|
66
|
+
inbox_schema?: Record<string, unknown> | null;
|
|
67
|
+
inbox_schema_hash?: string | null;
|
|
68
|
+
inbox_schema_updated_at?: string | null;
|
|
69
|
+
external_email_acceptance?: ExternalEmailAcceptance | null;
|
|
70
|
+
inserted_at?: string;
|
|
71
|
+
updated_at?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PostAttributes {
|
|
75
|
+
body?: string | null;
|
|
76
|
+
content_format?: ContentFormat;
|
|
77
|
+
payload?: Record<string, unknown> | null;
|
|
78
|
+
source: string;
|
|
79
|
+
identity_id?: string;
|
|
80
|
+
identity_name?: string;
|
|
81
|
+
inserted_at?: string;
|
|
82
|
+
updated_at?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type ContentFormat = "markdown" | "json";
|
|
86
|
+
export type ContentFilter = ContentFormat | "all";
|
|
87
|
+
export type PayloadOp = "exists" | "eq";
|
|
88
|
+
|
|
89
|
+
export interface StructuredContentInput {
|
|
90
|
+
body?: string;
|
|
91
|
+
payload?: Record<string, unknown>;
|
|
92
|
+
contentFormat?: ContentFormat;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface PayloadFilters {
|
|
96
|
+
contentFormat?: ContentFilter;
|
|
97
|
+
payloadContains?: string;
|
|
98
|
+
payloadPath?: string;
|
|
99
|
+
payloadOp?: PayloadOp;
|
|
100
|
+
payloadValue?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type MailboxType = "account" | "identity";
|
|
104
|
+
export type ThreadStatus = "pending" | "open" | "blocked";
|
|
105
|
+
export type ThreadStatusFilter = ThreadStatus | "all";
|
|
106
|
+
export type MailboxFilter = MailboxType | "all";
|
|
107
|
+
export type ParticipantScope = "account" | "owner";
|
|
108
|
+
export type LatestFirstOrder = "latest" | "oldest";
|
|
109
|
+
|
|
110
|
+
export interface ChangeCheckResponse {
|
|
111
|
+
has_updates: boolean;
|
|
112
|
+
server_time?: string;
|
|
113
|
+
recommended_poll_after_ms?: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type InboxRecipient =
|
|
117
|
+
| { type: "user"; address: { kind: "handle"; value: string } }
|
|
118
|
+
| { type: "user"; address: { kind: "id"; value: string } }
|
|
119
|
+
| { type: "identity"; address: { kind: "id"; value: string } }
|
|
120
|
+
| {
|
|
121
|
+
type: "identity";
|
|
122
|
+
address: {
|
|
123
|
+
kind: "owner_handle_and_identity_name";
|
|
124
|
+
owner_handle: string;
|
|
125
|
+
identity_name: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export interface InboxSender {
|
|
130
|
+
type: "identity";
|
|
131
|
+
address: {
|
|
132
|
+
kind: "id";
|
|
133
|
+
value: string;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface ThreadAttributes {
|
|
138
|
+
mailbox_type: MailboxType;
|
|
139
|
+
status: ThreadStatus;
|
|
140
|
+
participant_a_owner_id?: string | null;
|
|
141
|
+
participant_a_identity_id?: string | null;
|
|
142
|
+
participant_b_owner_id?: string | null;
|
|
143
|
+
participant_b_identity_id?: string | null;
|
|
144
|
+
opened_at?: string | null;
|
|
145
|
+
expires_at?: string | null;
|
|
146
|
+
last_message_at?: string;
|
|
147
|
+
participant_a_seen_at?: string | null;
|
|
148
|
+
participant_a_archived_at?: string | null;
|
|
149
|
+
participant_a_blocked_at?: string | null;
|
|
150
|
+
participant_a_resolved_at?: string | null;
|
|
151
|
+
participant_b_seen_at?: string | null;
|
|
152
|
+
participant_b_archived_at?: string | null;
|
|
153
|
+
participant_b_blocked_at?: string | null;
|
|
154
|
+
participant_b_resolved_at?: string | null;
|
|
155
|
+
inserted_at?: string;
|
|
156
|
+
updated_at?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface MessageAttributes {
|
|
160
|
+
body?: string | null;
|
|
161
|
+
content_format?: ContentFormat;
|
|
162
|
+
payload?: Record<string, unknown> | null;
|
|
163
|
+
sender_owner_id?: string | null;
|
|
164
|
+
sender_identity_id?: string | null;
|
|
165
|
+
external_email_sender_id?: string | null;
|
|
166
|
+
thread_id?: string | null;
|
|
167
|
+
context_post_id?: string | null;
|
|
168
|
+
inserted_at?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface ExternalEmailIntakeAttributes {
|
|
172
|
+
postmark_message_id?: string | null;
|
|
173
|
+
raw_recipient?: string | null;
|
|
174
|
+
subject?: string | null;
|
|
175
|
+
body?: string | null;
|
|
176
|
+
attachment_count?: number | null;
|
|
177
|
+
attachment_metadata?: Array<Record<string, unknown>> | null;
|
|
178
|
+
attachments_withheld?: boolean | null;
|
|
179
|
+
status?: string | null;
|
|
180
|
+
decision?: string | null;
|
|
181
|
+
received_count?: number | null;
|
|
182
|
+
last_received_at?: string | null;
|
|
183
|
+
released_at?: string | null;
|
|
184
|
+
owner_id?: string | null;
|
|
185
|
+
target_identity_id?: string | null;
|
|
186
|
+
external_email_sender_id?: string | null;
|
|
187
|
+
released_thread_id?: string | null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface MessageAttachmentAttributes {
|
|
191
|
+
name?: string | null;
|
|
192
|
+
content_type?: string | null;
|
|
193
|
+
content_length?: number | null;
|
|
194
|
+
message_id?: string | null;
|
|
195
|
+
inserted_at?: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface AccessKeyAttributes {
|
|
199
|
+
expires_at: string;
|
|
200
|
+
scope: AccessKeyScope;
|
|
201
|
+
name?: string | null;
|
|
202
|
+
inserted_at?: string;
|
|
203
|
+
updated_at?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface IdentityKeyAttributes {
|
|
207
|
+
expires_at?: string | null;
|
|
208
|
+
name?: string | null;
|
|
209
|
+
revoked_at?: string | null;
|
|
210
|
+
inserted_at?: string;
|
|
211
|
+
updated_at?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface WhoamiUserActor {
|
|
215
|
+
type: "user";
|
|
216
|
+
id: string;
|
|
217
|
+
email: string;
|
|
218
|
+
scope?: AccessKeyScope | null;
|
|
219
|
+
authenticated_via?: string;
|
|
220
|
+
public_handle?: string | null;
|
|
221
|
+
public_profile_path?: string | null;
|
|
222
|
+
public_profile_url?: string | null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface WhoamiIdentityActor {
|
|
226
|
+
type: "identity";
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
visibility: string;
|
|
230
|
+
publicly_listed?: boolean;
|
|
231
|
+
posting_paused_until?: string | null;
|
|
232
|
+
owner_id?: string;
|
|
233
|
+
owner_public_handle?: string | null;
|
|
234
|
+
public_path?: string | null;
|
|
235
|
+
public_url?: string | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type WhoamiActor = WhoamiUserActor | WhoamiIdentityActor;
|
|
239
|
+
|
|
240
|
+
export interface WhoamiResponse {
|
|
241
|
+
authenticated: true;
|
|
242
|
+
actor: WhoamiActor;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface AccountBootstrapRequestResponse {
|
|
246
|
+
bootstrap_id: string;
|
|
247
|
+
expires_at: string;
|
|
248
|
+
code_length: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface AccountBootstrapCompleteResponse {
|
|
252
|
+
user: {
|
|
253
|
+
id?: string;
|
|
254
|
+
email?: string;
|
|
255
|
+
public_handle?: string | null;
|
|
256
|
+
public_path?: string | null;
|
|
257
|
+
public_url?: string | null;
|
|
258
|
+
};
|
|
259
|
+
access_key: AccessKeyIssueResponse;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface AccessKeyIssueResponse {
|
|
263
|
+
id: string;
|
|
264
|
+
scope: AccessKeyScope;
|
|
265
|
+
name?: string | null;
|
|
266
|
+
token: string;
|
|
267
|
+
issued_at: string;
|
|
268
|
+
expires_at: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface AccessKeyRevokeResponse {
|
|
272
|
+
id: string;
|
|
273
|
+
scope: AccessKeyScope;
|
|
274
|
+
name?: string | null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface IdentityKeyIssueResponse {
|
|
278
|
+
id: string;
|
|
279
|
+
name?: string | null;
|
|
280
|
+
token: string;
|
|
281
|
+
issued_at: string;
|
|
282
|
+
expires_at?: string | null;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface IdentityKeyRevokeResponse {
|
|
286
|
+
id: string;
|
|
287
|
+
name?: string | null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface ShareTokenResponse {
|
|
291
|
+
token: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface IdResponse {
|
|
295
|
+
id: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface IdentityPublicationResponse {
|
|
299
|
+
id: string;
|
|
300
|
+
name: string;
|
|
301
|
+
publicly_listed: boolean;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export type IdentityPinResponse = JsonApiDocument<IdentityAttributes>;
|
|
305
|
+
|
|
306
|
+
export interface IdentityDiagnosticsResponse {
|
|
307
|
+
identity_id: string;
|
|
308
|
+
identity_name: string;
|
|
309
|
+
identity_description?: string | null;
|
|
310
|
+
active_identity_key_count: number;
|
|
311
|
+
last_posted_at?: string | null;
|
|
312
|
+
posting_paused_until?: string | null;
|
|
313
|
+
latest_blocked_write_at?: string | null;
|
|
314
|
+
latest_blocked_write_reason?: string | null;
|
|
315
|
+
latest_blocked_write_reason_label?: string | null;
|
|
316
|
+
recent_post_window_days: number;
|
|
317
|
+
recent_block_window_hours: number;
|
|
318
|
+
state_codes: string[];
|
|
319
|
+
state_labels: string[];
|
|
320
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|