@remixhq/core 0.1.9 → 0.1.10
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/dist/api.d.ts +3 -0
- package/dist/api.js +1 -1
- package/dist/chunk-B5S3PUIR.js +388 -0
- package/dist/collab.d.ts +6 -0
- package/dist/collab.js +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -326,6 +326,9 @@ type ApiClient = {
|
|
|
326
326
|
listApps(params?: {
|
|
327
327
|
projectId?: string;
|
|
328
328
|
organizationId?: string;
|
|
329
|
+
ownership?: "mine" | "shared" | "all";
|
|
330
|
+
accessScope?: "all_readable" | "explicit_member";
|
|
331
|
+
createdBy?: "me" | string;
|
|
329
332
|
forked?: "only" | "exclude" | "all";
|
|
330
333
|
limit?: number;
|
|
331
334
|
offset?: number;
|
package/dist/api.js
CHANGED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RemixError
|
|
3
|
+
} from "./chunk-YZ34ICNN.js";
|
|
4
|
+
|
|
5
|
+
// src/api/client.ts
|
|
6
|
+
async function readJsonSafe(res) {
|
|
7
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
8
|
+
if (!ct.toLowerCase().includes("application/json")) return null;
|
|
9
|
+
try {
|
|
10
|
+
return await res.json();
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function createApiClient(config, opts) {
|
|
16
|
+
const apiKey = (opts?.apiKey ?? "").trim();
|
|
17
|
+
const tokenProvider = opts?.tokenProvider;
|
|
18
|
+
const CLIENT_KEY_HEADER = "x-comerge-api-key";
|
|
19
|
+
async function request(path, init) {
|
|
20
|
+
if (!tokenProvider) {
|
|
21
|
+
throw new RemixError("API client is missing a token provider.", {
|
|
22
|
+
exitCode: 1,
|
|
23
|
+
hint: "Configure auth before creating the Remix API client."
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const auth = await tokenProvider();
|
|
27
|
+
const url = new URL(path, config.apiUrl).toString();
|
|
28
|
+
const doFetch = async (bearer) => fetch(url, {
|
|
29
|
+
...init,
|
|
30
|
+
headers: {
|
|
31
|
+
Accept: "application/json",
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
...init?.headers ?? {},
|
|
34
|
+
Authorization: `Bearer ${bearer}`,
|
|
35
|
+
...apiKey ? { [CLIENT_KEY_HEADER]: apiKey } : {}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
let res = await doFetch(auth.token);
|
|
39
|
+
if (res.status === 401 && !auth.fromEnv && auth.session?.refresh_token) {
|
|
40
|
+
const refreshed = await tokenProvider({ forceRefresh: true });
|
|
41
|
+
res = await doFetch(refreshed.token);
|
|
42
|
+
}
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
const body = await readJsonSafe(res);
|
|
45
|
+
const msg = (body && typeof body === "object" && body && "message" in body && typeof body.message === "string" ? body.message : null) ?? `Request failed (status ${res.status})`;
|
|
46
|
+
throw new RemixError(msg, { exitCode: 1, hint: body ? JSON.stringify(body, null, 2) : null });
|
|
47
|
+
}
|
|
48
|
+
const json = await readJsonSafe(res);
|
|
49
|
+
return json ?? null;
|
|
50
|
+
}
|
|
51
|
+
async function requestBinary(path, init) {
|
|
52
|
+
if (!tokenProvider) {
|
|
53
|
+
throw new RemixError("API client is missing a token provider.", {
|
|
54
|
+
exitCode: 1,
|
|
55
|
+
hint: "Configure auth before creating the Remix API client."
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const auth = await tokenProvider();
|
|
59
|
+
const url = new URL(path, config.apiUrl).toString();
|
|
60
|
+
const doFetch = async (bearer) => fetch(url, {
|
|
61
|
+
...init,
|
|
62
|
+
headers: {
|
|
63
|
+
Accept: "*/*",
|
|
64
|
+
...init?.headers ?? {},
|
|
65
|
+
Authorization: `Bearer ${bearer}`,
|
|
66
|
+
...apiKey ? { [CLIENT_KEY_HEADER]: apiKey } : {}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
let res = await doFetch(auth.token);
|
|
70
|
+
if (res.status === 401 && !auth.fromEnv && auth.session?.refresh_token) {
|
|
71
|
+
const refreshed = await tokenProvider({ forceRefresh: true });
|
|
72
|
+
res = await doFetch(refreshed.token);
|
|
73
|
+
}
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const body = await readJsonSafe(res);
|
|
76
|
+
const msg = (body && typeof body === "object" && body && "message" in body && typeof body.message === "string" ? body.message : null) ?? `Request failed (status ${res.status})`;
|
|
77
|
+
throw new RemixError(msg, { exitCode: 1, hint: body ? JSON.stringify(body, null, 2) : null });
|
|
78
|
+
}
|
|
79
|
+
const contentDisposition = res.headers.get("content-disposition") ?? "";
|
|
80
|
+
const fileNameMatch = contentDisposition.match(/filename=\"([^\"]+)\"/i);
|
|
81
|
+
return {
|
|
82
|
+
data: Buffer.from(await res.arrayBuffer()),
|
|
83
|
+
fileName: fileNameMatch?.[1] ?? null,
|
|
84
|
+
contentType: res.headers.get("content-type")
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
getMe: () => request("/v1/me", { method: "GET" }),
|
|
89
|
+
listOrganizations: () => request("/v1/organizations", { method: "GET" }),
|
|
90
|
+
getOrganization: (orgId) => request(`/v1/organizations/${encodeURIComponent(orgId)}`, { method: "GET" }),
|
|
91
|
+
listProjects: (params) => {
|
|
92
|
+
const qs = new URLSearchParams();
|
|
93
|
+
if (params?.organizationId) qs.set("organizationId", params.organizationId);
|
|
94
|
+
if (params?.clientAppId) qs.set("clientAppId", params.clientAppId);
|
|
95
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
96
|
+
return request(`/v1/projects${suffix}`, { method: "GET" });
|
|
97
|
+
},
|
|
98
|
+
getProject: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}`, { method: "GET" }),
|
|
99
|
+
resolveProjectBinding: (params) => {
|
|
100
|
+
const qs = new URLSearchParams();
|
|
101
|
+
if (params.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
102
|
+
if (params.remoteUrl) qs.set("remoteUrl", params.remoteUrl);
|
|
103
|
+
return request(`/v1/projects/bindings/resolve?${qs.toString()}`, { method: "GET" });
|
|
104
|
+
},
|
|
105
|
+
autoEnableDeveloper: () => request("/v1/developer/auto-enable", { method: "POST" }),
|
|
106
|
+
listClientApps: (params) => {
|
|
107
|
+
const qs = params?.orgId ? `?orgId=${encodeURIComponent(params.orgId)}` : "";
|
|
108
|
+
return request(`/v1/developer/client-apps${qs}`, { method: "GET" });
|
|
109
|
+
},
|
|
110
|
+
createClientApp: (payload) => request("/v1/developer/client-apps", { method: "POST", body: JSON.stringify(payload) }),
|
|
111
|
+
createClientAppKey: (clientAppId, payload) => request(`/v1/developer/client-apps/${encodeURIComponent(clientAppId)}/keys`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
body: JSON.stringify(payload ?? {})
|
|
114
|
+
}),
|
|
115
|
+
listApps: (params) => {
|
|
116
|
+
const qs = new URLSearchParams();
|
|
117
|
+
if (params?.projectId) qs.set("projectId", params.projectId);
|
|
118
|
+
if (params?.organizationId) qs.set("organizationId", params.organizationId);
|
|
119
|
+
if (params?.ownership) qs.set("ownership", params.ownership);
|
|
120
|
+
if (params?.accessScope) qs.set("accessScope", params.accessScope);
|
|
121
|
+
if (params?.createdBy) qs.set("createdBy", params.createdBy);
|
|
122
|
+
if (params?.forked) qs.set("forked", params.forked);
|
|
123
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
124
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
125
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
126
|
+
return request(`/v1/apps${suffix}`, { method: "GET" });
|
|
127
|
+
},
|
|
128
|
+
getApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}`, { method: "GET" }),
|
|
129
|
+
getAppContext: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/context`, { method: "GET" }),
|
|
130
|
+
getAppOverview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/overview`, { method: "GET" }),
|
|
131
|
+
listAppTimeline: (appId, params) => {
|
|
132
|
+
const qs = new URLSearchParams();
|
|
133
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
134
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
135
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
136
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/timeline${suffix}`, { method: "GET" });
|
|
137
|
+
},
|
|
138
|
+
getAppTimelineEvent: (appId, eventId) => request(`/v1/apps/${encodeURIComponent(appId)}/timeline/${encodeURIComponent(eventId)}`, { method: "GET" }),
|
|
139
|
+
listAppEditQueue: (appId, params) => {
|
|
140
|
+
const qs = new URLSearchParams();
|
|
141
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
142
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
143
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
144
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/edit-queue${suffix}`, { method: "GET" });
|
|
145
|
+
},
|
|
146
|
+
getMergeRequest: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "GET" }),
|
|
147
|
+
presignImportUpload: (payload) => request("/v1/apps/import/upload/presign", { method: "POST", body: JSON.stringify(payload) }),
|
|
148
|
+
importFromUpload: (payload) => request("/v1/apps/import/upload", { method: "POST", body: JSON.stringify(payload) }),
|
|
149
|
+
presignImportUploadFirstParty: (payload) => request("/v1/apps/import/upload/presign/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
150
|
+
importFromUploadFirstParty: (payload) => request("/v1/apps/import/upload/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
151
|
+
importFromGithubFirstParty: (payload) => request("/v1/apps/import/github/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
152
|
+
forkApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/fork`, { method: "POST", body: JSON.stringify(payload ?? {}) }),
|
|
153
|
+
downloadAppBundle: (appId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/download.bundle`, { method: "GET" }),
|
|
154
|
+
createChangeStep: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps`, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
body: JSON.stringify(payload)
|
|
157
|
+
}),
|
|
158
|
+
createCollabTurn: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns`, {
|
|
159
|
+
method: "POST",
|
|
160
|
+
body: JSON.stringify(payload)
|
|
161
|
+
}),
|
|
162
|
+
listCollabTurns: (appId, params) => {
|
|
163
|
+
const qs = new URLSearchParams();
|
|
164
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
165
|
+
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
166
|
+
if (params?.changeStepId) qs.set("changeStepId", params.changeStepId);
|
|
167
|
+
if (params?.threadId) qs.set("threadId", params.threadId);
|
|
168
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
169
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
170
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
171
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns${suffix}`, { method: "GET" });
|
|
172
|
+
},
|
|
173
|
+
getCollabTurn: (appId, collabTurnId) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns/${encodeURIComponent(collabTurnId)}`, {
|
|
174
|
+
method: "GET"
|
|
175
|
+
}),
|
|
176
|
+
getAgentMemorySummary: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/summary`, { method: "GET" }),
|
|
177
|
+
listAgentMemoryTimeline: (appId, params) => {
|
|
178
|
+
const qs = new URLSearchParams();
|
|
179
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
180
|
+
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
181
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
182
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
183
|
+
if (params?.kinds?.length) {
|
|
184
|
+
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
185
|
+
}
|
|
186
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
187
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/timeline${suffix}`, { method: "GET" });
|
|
188
|
+
},
|
|
189
|
+
searchAgentMemory: (appId, params) => {
|
|
190
|
+
const qs = new URLSearchParams();
|
|
191
|
+
qs.set("q", params.q);
|
|
192
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
193
|
+
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
194
|
+
if (params.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
195
|
+
if (params.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
196
|
+
if (params.kinds?.length) {
|
|
197
|
+
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
198
|
+
}
|
|
199
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/search?${qs.toString()}`, { method: "GET" });
|
|
200
|
+
},
|
|
201
|
+
getChangeStep: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}`, { method: "GET" }),
|
|
202
|
+
getChangeStepDiff: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}/diff`, {
|
|
203
|
+
method: "GET"
|
|
204
|
+
}),
|
|
205
|
+
startChangeStepReplay: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays`, {
|
|
206
|
+
method: "POST",
|
|
207
|
+
body: JSON.stringify(payload)
|
|
208
|
+
}),
|
|
209
|
+
getChangeStepReplay: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}`, {
|
|
210
|
+
method: "GET"
|
|
211
|
+
}),
|
|
212
|
+
getChangeStepReplayDiff: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}/diff`, {
|
|
213
|
+
method: "GET"
|
|
214
|
+
}),
|
|
215
|
+
listMergeRequests: (params) => {
|
|
216
|
+
const qs = new URLSearchParams();
|
|
217
|
+
if (params?.queue) qs.set("queue", params.queue);
|
|
218
|
+
if (params?.appId) qs.set("appId", params.appId);
|
|
219
|
+
if (params?.sourceAppId) qs.set("sourceAppId", params.sourceAppId);
|
|
220
|
+
if (params?.targetAppId) qs.set("targetAppId", params.targetAppId);
|
|
221
|
+
if (Array.isArray(params?.status)) {
|
|
222
|
+
for (const status of params.status) qs.append("status", status);
|
|
223
|
+
} else if (typeof params?.status === "string") {
|
|
224
|
+
qs.set("status", params.status);
|
|
225
|
+
}
|
|
226
|
+
if (params?.kind) qs.set("kind", params.kind);
|
|
227
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
228
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
229
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
230
|
+
return request(`/v1/merge-requests${suffix}`, { method: "GET" });
|
|
231
|
+
},
|
|
232
|
+
openMergeRequest: (sourceAppId) => request("/v1/merge-requests", { method: "POST", body: JSON.stringify({ sourceAppId }) }),
|
|
233
|
+
getMergeRequestReview: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}/review`, { method: "GET" }),
|
|
234
|
+
updateMergeRequest: (mrId, payload) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "PATCH", body: JSON.stringify(payload) }),
|
|
235
|
+
createOrganizationInvite: (orgId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: JSON.stringify(payload)
|
|
238
|
+
}),
|
|
239
|
+
createProjectInvite: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations`, {
|
|
240
|
+
method: "POST",
|
|
241
|
+
body: JSON.stringify(payload)
|
|
242
|
+
}),
|
|
243
|
+
createAppInvite: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations`, {
|
|
244
|
+
method: "POST",
|
|
245
|
+
body: JSON.stringify(payload)
|
|
246
|
+
}),
|
|
247
|
+
listOrganizationMembers: (orgId, params) => {
|
|
248
|
+
const qs = new URLSearchParams();
|
|
249
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
250
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
251
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
252
|
+
return request(`/v1/organizations/${encodeURIComponent(orgId)}/members${suffix}`, { method: "GET" });
|
|
253
|
+
},
|
|
254
|
+
updateOrganizationMember: (orgId, userId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`, {
|
|
255
|
+
method: "PATCH",
|
|
256
|
+
body: JSON.stringify(payload)
|
|
257
|
+
}),
|
|
258
|
+
listProjectMembers: (projectId, params) => {
|
|
259
|
+
const qs = new URLSearchParams();
|
|
260
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
261
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
262
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
263
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/members${suffix}`, { method: "GET" });
|
|
264
|
+
},
|
|
265
|
+
updateProjectMember: (projectId, userId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/members/${encodeURIComponent(userId)}`, {
|
|
266
|
+
method: "PATCH",
|
|
267
|
+
body: JSON.stringify(payload)
|
|
268
|
+
}),
|
|
269
|
+
listAppMembers: (appId, params) => {
|
|
270
|
+
const qs = new URLSearchParams();
|
|
271
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
272
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
273
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
274
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/members${suffix}`, { method: "GET" });
|
|
275
|
+
},
|
|
276
|
+
updateAppMember: (appId, userId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/members/${encodeURIComponent(userId)}`, {
|
|
277
|
+
method: "PATCH",
|
|
278
|
+
body: JSON.stringify(payload)
|
|
279
|
+
}),
|
|
280
|
+
listOrganizationInvites: (orgId, params) => {
|
|
281
|
+
const qs = new URLSearchParams();
|
|
282
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
283
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
284
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
285
|
+
return request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations${suffix}`, { method: "GET" });
|
|
286
|
+
},
|
|
287
|
+
listProjectInvites: (projectId, params) => {
|
|
288
|
+
const qs = new URLSearchParams();
|
|
289
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
290
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
291
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
292
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/invitations${suffix}`, { method: "GET" });
|
|
293
|
+
},
|
|
294
|
+
listAppInvites: (appId, params) => {
|
|
295
|
+
const qs = new URLSearchParams();
|
|
296
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
297
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
298
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
299
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/invitations${suffix}`, { method: "GET" });
|
|
300
|
+
},
|
|
301
|
+
resendOrganizationInvite: (orgId, inviteId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
302
|
+
method: "POST",
|
|
303
|
+
body: JSON.stringify(payload ?? {})
|
|
304
|
+
}),
|
|
305
|
+
resendProjectInvite: (projectId, inviteId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
306
|
+
method: "POST",
|
|
307
|
+
body: JSON.stringify(payload ?? {})
|
|
308
|
+
}),
|
|
309
|
+
resendAppInvite: (appId, inviteId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
body: JSON.stringify(payload ?? {})
|
|
312
|
+
}),
|
|
313
|
+
revokeOrganizationInvite: (orgId, inviteId) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
314
|
+
method: "DELETE"
|
|
315
|
+
}),
|
|
316
|
+
revokeProjectInvite: (projectId, inviteId) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
317
|
+
method: "DELETE"
|
|
318
|
+
}),
|
|
319
|
+
revokeAppInvite: (appId, inviteId) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
320
|
+
method: "DELETE"
|
|
321
|
+
}),
|
|
322
|
+
acceptInvitation: (payload) => request("/v1/invitations/accept", { method: "POST", body: JSON.stringify(payload) }),
|
|
323
|
+
syncUpstreamApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-upstream`, {
|
|
324
|
+
method: "POST",
|
|
325
|
+
body: JSON.stringify({})
|
|
326
|
+
}),
|
|
327
|
+
preflightAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/preflight`, {
|
|
328
|
+
method: "POST",
|
|
329
|
+
body: JSON.stringify(payload)
|
|
330
|
+
}),
|
|
331
|
+
startAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/start`, {
|
|
332
|
+
method: "POST",
|
|
333
|
+
body: JSON.stringify(payload)
|
|
334
|
+
}),
|
|
335
|
+
getAppReconcile: (appId, reconcileId) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}`, { method: "GET" }),
|
|
336
|
+
downloadAppReconcileBundle: (appId, reconcileId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}/download.bundle`, {
|
|
337
|
+
method: "GET"
|
|
338
|
+
}),
|
|
339
|
+
syncLocalApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-local`, {
|
|
340
|
+
method: "POST",
|
|
341
|
+
body: JSON.stringify(payload)
|
|
342
|
+
}),
|
|
343
|
+
initiateBundle: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles`, { method: "POST", body: JSON.stringify(payload) }),
|
|
344
|
+
getBundle: (appId, bundleId) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}`, { method: "GET" }),
|
|
345
|
+
getBundleDownloadUrl: (appId, bundleId, options) => request(
|
|
346
|
+
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/download?redirect=${options?.redirect ?? false}`,
|
|
347
|
+
{ method: "GET" }
|
|
348
|
+
),
|
|
349
|
+
getBundleAssetsDownloadUrl: (appId, bundleId, options) => {
|
|
350
|
+
const qs = new URLSearchParams({
|
|
351
|
+
redirect: String(options?.redirect ?? false),
|
|
352
|
+
kind: options?.kind ?? "metro-assets"
|
|
353
|
+
});
|
|
354
|
+
return request(
|
|
355
|
+
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/assets/download?${qs.toString()}`,
|
|
356
|
+
{ method: "GET" }
|
|
357
|
+
);
|
|
358
|
+
},
|
|
359
|
+
listAgentRuns: (appId, params) => {
|
|
360
|
+
const qs = new URLSearchParams();
|
|
361
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
362
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
363
|
+
if (params?.status) qs.set("status", params.status);
|
|
364
|
+
if (params?.currentPhase) qs.set("currentPhase", params.currentPhase);
|
|
365
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
366
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
367
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
368
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs${suffix}`, { method: "GET" });
|
|
369
|
+
},
|
|
370
|
+
getAgentRun: (appId, runId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}`, { method: "GET" }),
|
|
371
|
+
listAgentRunEvents: (appId, runId, params) => {
|
|
372
|
+
const qs = new URLSearchParams();
|
|
373
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
374
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
375
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
376
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
377
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
378
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}/events${suffix}`, {
|
|
379
|
+
method: "GET"
|
|
380
|
+
});
|
|
381
|
+
},
|
|
382
|
+
getSandboxStatus: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/status`, { method: "GET" })
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export {
|
|
387
|
+
createApiClient
|
|
388
|
+
};
|
package/dist/collab.d.ts
CHANGED
|
@@ -304,6 +304,9 @@ type CollabApiClient = {
|
|
|
304
304
|
listApps(params?: {
|
|
305
305
|
projectId?: string;
|
|
306
306
|
organizationId?: string;
|
|
307
|
+
ownership?: "mine" | "shared" | "all";
|
|
308
|
+
accessScope?: "all_readable" | "explicit_member";
|
|
309
|
+
createdBy?: "me" | string;
|
|
307
310
|
forked?: "only" | "exclude" | "all";
|
|
308
311
|
limit?: number;
|
|
309
312
|
offset?: number;
|
|
@@ -673,6 +676,9 @@ declare function collabInvite(params: {
|
|
|
673
676
|
|
|
674
677
|
declare function collabList(params: {
|
|
675
678
|
api: CollabApiClient;
|
|
679
|
+
ownership?: "mine" | "shared" | "all";
|
|
680
|
+
accessScope?: "all_readable" | "explicit_member";
|
|
681
|
+
createdBy?: "me" | string;
|
|
676
682
|
forked?: "only" | "exclude" | "all";
|
|
677
683
|
limit?: number;
|
|
678
684
|
offset?: number;
|
package/dist/collab.js
CHANGED
|
@@ -1882,6 +1882,9 @@ async function collabInvite(params) {
|
|
|
1882
1882
|
async function collabList(params) {
|
|
1883
1883
|
const pageRequest = normalizePagination(params);
|
|
1884
1884
|
const resp = await params.api.listApps({
|
|
1885
|
+
ownership: params.ownership ?? "all",
|
|
1886
|
+
accessScope: params.accessScope ?? "explicit_member",
|
|
1887
|
+
createdBy: params.createdBy,
|
|
1885
1888
|
forked: params.forked ?? "all",
|
|
1886
1889
|
limit: pageRequest.limit + 1,
|
|
1887
1890
|
offset: pageRequest.offset
|
package/dist/index.js
CHANGED