@remixhq/core 0.1.13 → 0.1.15
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 +76 -1
- package/dist/api.js +1 -1
- package/dist/auth.js +1 -1
- package/dist/binding-WiIRI2fl.d.ts +43 -0
- package/dist/binding.d.ts +1 -21
- package/dist/binding.js +2 -0
- package/dist/{chunk-EVWDYCBL.js → chunk-P6JHXOV4.js} +36 -23
- package/dist/{chunk-R7FVSCQW.js → chunk-US5SM7ZC.js} +19 -1
- package/dist/collab.d.ts +376 -611
- package/dist/collab.js +2381 -376
- package/dist/contracts-CHmD-fMj.d.ts +677 -0
- package/dist/history.d.ts +64 -0
- package/dist/history.js +529 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/package.json +9 -3
- package/dist/chunk-2WGZS7CD.js +0 -0
- package/dist/chunk-34WDQCPF.js +0 -242
- package/dist/chunk-4276ARDF.js +0 -303
- package/dist/chunk-4L3ZBZUQ.js +0 -281
- package/dist/chunk-54CBEP2W.js +0 -570
- package/dist/chunk-55K5GHAZ.js +0 -252
- package/dist/chunk-5H5CZKGN.js +0 -691
- package/dist/chunk-5NTOJXEZ.js +0 -223
- package/dist/chunk-7WUKH3ZD.js +0 -221
- package/dist/chunk-AE2HPMUZ.js +0 -80
- package/dist/chunk-AEAOYVIL.js +0 -200
- package/dist/chunk-B5S3PUIR.js +0 -388
- package/dist/chunk-BJFCN2C3.js +0 -46
- package/dist/chunk-BNKPTE2U.js +0 -401
- package/dist/chunk-C5NBNU32.js +0 -240
- package/dist/chunk-CJFGQE7D.js +0 -46
- package/dist/chunk-CUUXZSKW.js +0 -611
- package/dist/chunk-DCU3646I.js +0 -12
- package/dist/chunk-DEWAIK5X.js +0 -11
- package/dist/chunk-DRD6EVTT.js +0 -447
- package/dist/chunk-DXCL6I4Q.js +0 -399
- package/dist/chunk-E4KAGBU7.js +0 -134
- package/dist/chunk-E6AYE22H.js +0 -343
- package/dist/chunk-EF3677RE.js +0 -93
- package/dist/chunk-EW4PWFHB.js +0 -46
- package/dist/chunk-FAZUMWBS.js +0 -93
- package/dist/chunk-GEHSFPCD.js +0 -93
- package/dist/chunk-GFOBGYW4.js +0 -252
- package/dist/chunk-INDDXWAH.js +0 -92
- package/dist/chunk-IXWQWFYT.js +0 -342
- package/dist/chunk-J3J4PBQ7.js +0 -710
- package/dist/chunk-K54U353Z.js +0 -691
- package/dist/chunk-K57ZFDGC.js +0 -15
- package/dist/chunk-NDA7EJJA.js +0 -286
- package/dist/chunk-NK2DA4X6.js +0 -357
- package/dist/chunk-OBYR4JHZ.js +0 -374
- package/dist/chunk-OJMTW22J.js +0 -286
- package/dist/chunk-OMUDRPUI.js +0 -195
- package/dist/chunk-ONKKRS2C.js +0 -239
- package/dist/chunk-OWFBBWU7.js +0 -196
- package/dist/chunk-OZRXDDEL.js +0 -46
- package/dist/chunk-P7EM3N73.js +0 -46
- package/dist/chunk-POYB6MCQ.js +0 -373
- package/dist/chunk-PR5QKMHM.js +0 -46
- package/dist/chunk-R44EOUS4.js +0 -288
- package/dist/chunk-RIP2MIZL.js +0 -710
- package/dist/chunk-RKMMEML5.js +0 -46
- package/dist/chunk-RM2BGDBB.js +0 -400
- package/dist/chunk-RREREIGW.js +0 -710
- package/dist/chunk-TQHLFQY4.js +0 -448
- package/dist/chunk-TY3SSQQK.js +0 -688
- package/dist/chunk-UGKPOCN5.js +0 -710
- package/dist/chunk-UIGKSCTD.js +0 -406
- package/dist/chunk-UWIVJRTI.js +0 -343
- package/dist/chunk-VA6WXRWB.js +0 -636
- package/dist/chunk-XC2FV57P.js +0 -385
- package/dist/chunk-XOQIADCH.js +0 -223
- package/dist/chunk-ZAQZKEH4.js +0 -46
- package/dist/chunk-ZBMOGUSJ.js +0 -17
- package/dist/chunk-ZXP6ENQY.js +0 -244
- package/dist/index.cjs +0 -1269
- package/dist/index.d.cts +0 -482
package/dist/chunk-XC2FV57P.js
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
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?.forked) qs.set("forked", params.forked);
|
|
120
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
121
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
122
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
123
|
-
return request(`/v1/apps${suffix}`, { method: "GET" });
|
|
124
|
-
},
|
|
125
|
-
getApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}`, { method: "GET" }),
|
|
126
|
-
getAppContext: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/context`, { method: "GET" }),
|
|
127
|
-
getAppOverview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/overview`, { method: "GET" }),
|
|
128
|
-
listAppTimeline: (appId, params) => {
|
|
129
|
-
const qs = new URLSearchParams();
|
|
130
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
131
|
-
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
132
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
133
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/timeline${suffix}`, { method: "GET" });
|
|
134
|
-
},
|
|
135
|
-
getAppTimelineEvent: (appId, eventId) => request(`/v1/apps/${encodeURIComponent(appId)}/timeline/${encodeURIComponent(eventId)}`, { method: "GET" }),
|
|
136
|
-
listAppEditQueue: (appId, params) => {
|
|
137
|
-
const qs = new URLSearchParams();
|
|
138
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
139
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
140
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
141
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/edit-queue${suffix}`, { method: "GET" });
|
|
142
|
-
},
|
|
143
|
-
getMergeRequest: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "GET" }),
|
|
144
|
-
presignImportUpload: (payload) => request("/v1/apps/import/upload/presign", { method: "POST", body: JSON.stringify(payload) }),
|
|
145
|
-
importFromUpload: (payload) => request("/v1/apps/import/upload", { method: "POST", body: JSON.stringify(payload) }),
|
|
146
|
-
presignImportUploadFirstParty: (payload) => request("/v1/apps/import/upload/presign/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
147
|
-
importFromUploadFirstParty: (payload) => request("/v1/apps/import/upload/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
148
|
-
importFromGithubFirstParty: (payload) => request("/v1/apps/import/github/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
149
|
-
forkApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/fork`, { method: "POST", body: JSON.stringify(payload ?? {}) }),
|
|
150
|
-
downloadAppBundle: (appId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/download.bundle`, { method: "GET" }),
|
|
151
|
-
createChangeStep: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps`, {
|
|
152
|
-
method: "POST",
|
|
153
|
-
body: JSON.stringify(payload)
|
|
154
|
-
}),
|
|
155
|
-
createCollabTurn: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns`, {
|
|
156
|
-
method: "POST",
|
|
157
|
-
body: JSON.stringify(payload)
|
|
158
|
-
}),
|
|
159
|
-
listCollabTurns: (appId, params) => {
|
|
160
|
-
const qs = new URLSearchParams();
|
|
161
|
-
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
162
|
-
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
163
|
-
if (params?.changeStepId) qs.set("changeStepId", params.changeStepId);
|
|
164
|
-
if (params?.threadId) qs.set("threadId", params.threadId);
|
|
165
|
-
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
166
|
-
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
167
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
168
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns${suffix}`, { method: "GET" });
|
|
169
|
-
},
|
|
170
|
-
getCollabTurn: (appId, collabTurnId) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns/${encodeURIComponent(collabTurnId)}`, {
|
|
171
|
-
method: "GET"
|
|
172
|
-
}),
|
|
173
|
-
getAgentMemorySummary: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/summary`, { method: "GET" }),
|
|
174
|
-
listAgentMemoryTimeline: (appId, params) => {
|
|
175
|
-
const qs = new URLSearchParams();
|
|
176
|
-
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
177
|
-
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
178
|
-
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
179
|
-
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
180
|
-
if (params?.kinds?.length) {
|
|
181
|
-
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
182
|
-
}
|
|
183
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
184
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/timeline${suffix}`, { method: "GET" });
|
|
185
|
-
},
|
|
186
|
-
searchAgentMemory: (appId, params) => {
|
|
187
|
-
const qs = new URLSearchParams();
|
|
188
|
-
qs.set("q", params.q);
|
|
189
|
-
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
190
|
-
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
191
|
-
if (params.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
192
|
-
if (params.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
193
|
-
if (params.kinds?.length) {
|
|
194
|
-
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
195
|
-
}
|
|
196
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/search?${qs.toString()}`, { method: "GET" });
|
|
197
|
-
},
|
|
198
|
-
getChangeStep: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}`, { method: "GET" }),
|
|
199
|
-
getChangeStepDiff: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}/diff`, {
|
|
200
|
-
method: "GET"
|
|
201
|
-
}),
|
|
202
|
-
startChangeStepReplay: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays`, {
|
|
203
|
-
method: "POST",
|
|
204
|
-
body: JSON.stringify(payload)
|
|
205
|
-
}),
|
|
206
|
-
getChangeStepReplay: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}`, {
|
|
207
|
-
method: "GET"
|
|
208
|
-
}),
|
|
209
|
-
getChangeStepReplayDiff: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}/diff`, {
|
|
210
|
-
method: "GET"
|
|
211
|
-
}),
|
|
212
|
-
listMergeRequests: (params) => {
|
|
213
|
-
const qs = new URLSearchParams();
|
|
214
|
-
if (params?.queue) qs.set("queue", params.queue);
|
|
215
|
-
if (params?.appId) qs.set("appId", params.appId);
|
|
216
|
-
if (params?.sourceAppId) qs.set("sourceAppId", params.sourceAppId);
|
|
217
|
-
if (params?.targetAppId) qs.set("targetAppId", params.targetAppId);
|
|
218
|
-
if (Array.isArray(params?.status)) {
|
|
219
|
-
for (const status of params.status) qs.append("status", status);
|
|
220
|
-
} else if (typeof params?.status === "string") {
|
|
221
|
-
qs.set("status", params.status);
|
|
222
|
-
}
|
|
223
|
-
if (params?.kind) qs.set("kind", params.kind);
|
|
224
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
225
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
226
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
227
|
-
return request(`/v1/merge-requests${suffix}`, { method: "GET" });
|
|
228
|
-
},
|
|
229
|
-
openMergeRequest: (sourceAppId) => request("/v1/merge-requests", { method: "POST", body: JSON.stringify({ sourceAppId }) }),
|
|
230
|
-
getMergeRequestReview: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}/review`, { method: "GET" }),
|
|
231
|
-
updateMergeRequest: (mrId, payload) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "PATCH", body: JSON.stringify(payload) }),
|
|
232
|
-
createOrganizationInvite: (orgId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations`, {
|
|
233
|
-
method: "POST",
|
|
234
|
-
body: JSON.stringify(payload)
|
|
235
|
-
}),
|
|
236
|
-
createProjectInvite: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations`, {
|
|
237
|
-
method: "POST",
|
|
238
|
-
body: JSON.stringify(payload)
|
|
239
|
-
}),
|
|
240
|
-
createAppInvite: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations`, {
|
|
241
|
-
method: "POST",
|
|
242
|
-
body: JSON.stringify(payload)
|
|
243
|
-
}),
|
|
244
|
-
listOrganizationMembers: (orgId, params) => {
|
|
245
|
-
const qs = new URLSearchParams();
|
|
246
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
247
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
248
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
249
|
-
return request(`/v1/organizations/${encodeURIComponent(orgId)}/members${suffix}`, { method: "GET" });
|
|
250
|
-
},
|
|
251
|
-
updateOrganizationMember: (orgId, userId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`, {
|
|
252
|
-
method: "PATCH",
|
|
253
|
-
body: JSON.stringify(payload)
|
|
254
|
-
}),
|
|
255
|
-
listProjectMembers: (projectId, params) => {
|
|
256
|
-
const qs = new URLSearchParams();
|
|
257
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
258
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
259
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
260
|
-
return request(`/v1/projects/${encodeURIComponent(projectId)}/members${suffix}`, { method: "GET" });
|
|
261
|
-
},
|
|
262
|
-
updateProjectMember: (projectId, userId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/members/${encodeURIComponent(userId)}`, {
|
|
263
|
-
method: "PATCH",
|
|
264
|
-
body: JSON.stringify(payload)
|
|
265
|
-
}),
|
|
266
|
-
listAppMembers: (appId, params) => {
|
|
267
|
-
const qs = new URLSearchParams();
|
|
268
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
269
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
270
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
271
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/members${suffix}`, { method: "GET" });
|
|
272
|
-
},
|
|
273
|
-
updateAppMember: (appId, userId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/members/${encodeURIComponent(userId)}`, {
|
|
274
|
-
method: "PATCH",
|
|
275
|
-
body: JSON.stringify(payload)
|
|
276
|
-
}),
|
|
277
|
-
listOrganizationInvites: (orgId, params) => {
|
|
278
|
-
const qs = new URLSearchParams();
|
|
279
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
280
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
281
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
282
|
-
return request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations${suffix}`, { method: "GET" });
|
|
283
|
-
},
|
|
284
|
-
listProjectInvites: (projectId, params) => {
|
|
285
|
-
const qs = new URLSearchParams();
|
|
286
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
287
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
288
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
289
|
-
return request(`/v1/projects/${encodeURIComponent(projectId)}/invitations${suffix}`, { method: "GET" });
|
|
290
|
-
},
|
|
291
|
-
listAppInvites: (appId, params) => {
|
|
292
|
-
const qs = new URLSearchParams();
|
|
293
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
294
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
295
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
296
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/invitations${suffix}`, { method: "GET" });
|
|
297
|
-
},
|
|
298
|
-
resendOrganizationInvite: (orgId, inviteId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
299
|
-
method: "POST",
|
|
300
|
-
body: JSON.stringify(payload ?? {})
|
|
301
|
-
}),
|
|
302
|
-
resendProjectInvite: (projectId, inviteId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
303
|
-
method: "POST",
|
|
304
|
-
body: JSON.stringify(payload ?? {})
|
|
305
|
-
}),
|
|
306
|
-
resendAppInvite: (appId, inviteId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
307
|
-
method: "POST",
|
|
308
|
-
body: JSON.stringify(payload ?? {})
|
|
309
|
-
}),
|
|
310
|
-
revokeOrganizationInvite: (orgId, inviteId) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
311
|
-
method: "DELETE"
|
|
312
|
-
}),
|
|
313
|
-
revokeProjectInvite: (projectId, inviteId) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
314
|
-
method: "DELETE"
|
|
315
|
-
}),
|
|
316
|
-
revokeAppInvite: (appId, inviteId) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
317
|
-
method: "DELETE"
|
|
318
|
-
}),
|
|
319
|
-
acceptInvitation: (payload) => request("/v1/invitations/accept", { method: "POST", body: JSON.stringify(payload) }),
|
|
320
|
-
syncUpstreamApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-upstream`, {
|
|
321
|
-
method: "POST",
|
|
322
|
-
body: JSON.stringify({})
|
|
323
|
-
}),
|
|
324
|
-
preflightAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/preflight`, {
|
|
325
|
-
method: "POST",
|
|
326
|
-
body: JSON.stringify(payload)
|
|
327
|
-
}),
|
|
328
|
-
startAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/start`, {
|
|
329
|
-
method: "POST",
|
|
330
|
-
body: JSON.stringify(payload)
|
|
331
|
-
}),
|
|
332
|
-
getAppReconcile: (appId, reconcileId) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}`, { method: "GET" }),
|
|
333
|
-
downloadAppReconcileBundle: (appId, reconcileId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}/download.bundle`, {
|
|
334
|
-
method: "GET"
|
|
335
|
-
}),
|
|
336
|
-
syncLocalApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-local`, {
|
|
337
|
-
method: "POST",
|
|
338
|
-
body: JSON.stringify(payload)
|
|
339
|
-
}),
|
|
340
|
-
initiateBundle: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles`, { method: "POST", body: JSON.stringify(payload) }),
|
|
341
|
-
getBundle: (appId, bundleId) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}`, { method: "GET" }),
|
|
342
|
-
getBundleDownloadUrl: (appId, bundleId, options) => request(
|
|
343
|
-
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/download?redirect=${options?.redirect ?? false}`,
|
|
344
|
-
{ method: "GET" }
|
|
345
|
-
),
|
|
346
|
-
getBundleAssetsDownloadUrl: (appId, bundleId, options) => {
|
|
347
|
-
const qs = new URLSearchParams({
|
|
348
|
-
redirect: String(options?.redirect ?? false),
|
|
349
|
-
kind: options?.kind ?? "metro-assets"
|
|
350
|
-
});
|
|
351
|
-
return request(
|
|
352
|
-
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/assets/download?${qs.toString()}`,
|
|
353
|
-
{ method: "GET" }
|
|
354
|
-
);
|
|
355
|
-
},
|
|
356
|
-
listAgentRuns: (appId, params) => {
|
|
357
|
-
const qs = new URLSearchParams();
|
|
358
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
359
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
360
|
-
if (params?.status) qs.set("status", params.status);
|
|
361
|
-
if (params?.currentPhase) qs.set("currentPhase", params.currentPhase);
|
|
362
|
-
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
363
|
-
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
364
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
365
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs${suffix}`, { method: "GET" });
|
|
366
|
-
},
|
|
367
|
-
getAgentRun: (appId, runId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}`, { method: "GET" }),
|
|
368
|
-
listAgentRunEvents: (appId, runId, params) => {
|
|
369
|
-
const qs = new URLSearchParams();
|
|
370
|
-
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
371
|
-
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
372
|
-
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
373
|
-
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
374
|
-
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
375
|
-
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}/events${suffix}`, {
|
|
376
|
-
method: "GET"
|
|
377
|
-
});
|
|
378
|
-
},
|
|
379
|
-
getSandboxStatus: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/status`, { method: "GET" })
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
export {
|
|
384
|
-
createApiClient
|
|
385
|
-
};
|
package/dist/chunk-XOQIADCH.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ComergeError
|
|
3
|
-
} from "./chunk-ZBMOGUSJ.js";
|
|
4
|
-
|
|
5
|
-
// src/auth/session.ts
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
var storedSessionSchema = z.object({
|
|
8
|
-
access_token: z.string().min(1),
|
|
9
|
-
refresh_token: z.string().min(1),
|
|
10
|
-
expires_at: z.number().int().positive(),
|
|
11
|
-
token_type: z.string().min(1).optional(),
|
|
12
|
-
user: z.object({
|
|
13
|
-
id: z.string().min(1),
|
|
14
|
-
email: z.string().email().optional().nullable()
|
|
15
|
-
}).optional()
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// src/auth/localSessionStore.ts
|
|
19
|
-
import fs from "fs/promises";
|
|
20
|
-
import os from "os";
|
|
21
|
-
import path from "path";
|
|
22
|
-
function xdgConfigHome() {
|
|
23
|
-
const value = process.env.XDG_CONFIG_HOME;
|
|
24
|
-
if (typeof value === "string" && value.trim()) return value;
|
|
25
|
-
return path.join(os.homedir(), ".config");
|
|
26
|
-
}
|
|
27
|
-
async function maybeLoadKeytar() {
|
|
28
|
-
try {
|
|
29
|
-
const mod = await new Function("return import('keytar')")();
|
|
30
|
-
const candidates = [mod, mod?.default].filter(Boolean);
|
|
31
|
-
for (const candidate of candidates) {
|
|
32
|
-
const value = candidate;
|
|
33
|
-
if (typeof value.getPassword === "function" && typeof value.setPassword === "function") {
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
} catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
async function ensurePathPermissions(filePath) {
|
|
43
|
-
const dir = path.dirname(filePath);
|
|
44
|
-
await fs.mkdir(dir, { recursive: true });
|
|
45
|
-
try {
|
|
46
|
-
await fs.chmod(dir, 448);
|
|
47
|
-
} catch {
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
await fs.chmod(filePath, 384);
|
|
51
|
-
} catch {
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function writeJsonAtomic(filePath, value) {
|
|
55
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
56
|
-
const tmpPath = `${filePath}.tmp-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
57
|
-
await fs.writeFile(tmpPath, JSON.stringify(value, null, 2) + "\n", "utf8");
|
|
58
|
-
await fs.rename(tmpPath, filePath);
|
|
59
|
-
}
|
|
60
|
-
async function writeSessionFileFallback(filePath, session) {
|
|
61
|
-
await writeJsonAtomic(filePath, session);
|
|
62
|
-
await ensurePathPermissions(filePath);
|
|
63
|
-
}
|
|
64
|
-
function createLocalSessionStore(params) {
|
|
65
|
-
const service = params?.service?.trim() || "comerge-cli";
|
|
66
|
-
const account = params?.account?.trim() || "default";
|
|
67
|
-
const filePath = params?.filePath?.trim() || path.join(xdgConfigHome(), "comerge", "session.json");
|
|
68
|
-
return {
|
|
69
|
-
async getSession() {
|
|
70
|
-
const keytar = await maybeLoadKeytar();
|
|
71
|
-
if (keytar) {
|
|
72
|
-
const raw2 = await keytar.getPassword(service, account);
|
|
73
|
-
if (!raw2) return null;
|
|
74
|
-
try {
|
|
75
|
-
const parsed = storedSessionSchema.safeParse(JSON.parse(raw2));
|
|
76
|
-
return parsed.success ? parsed.data : null;
|
|
77
|
-
} catch {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const raw = await fs.readFile(filePath, "utf8").catch(() => null);
|
|
82
|
-
if (!raw) return null;
|
|
83
|
-
try {
|
|
84
|
-
const parsed = storedSessionSchema.safeParse(JSON.parse(raw));
|
|
85
|
-
if (!parsed.success) return null;
|
|
86
|
-
await ensurePathPermissions(filePath);
|
|
87
|
-
return parsed.data;
|
|
88
|
-
} catch {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
async setSession(session) {
|
|
93
|
-
const parsed = storedSessionSchema.safeParse(session);
|
|
94
|
-
if (!parsed.success) {
|
|
95
|
-
throw new Error("Session data is invalid and was not stored.");
|
|
96
|
-
}
|
|
97
|
-
const keytar = await maybeLoadKeytar();
|
|
98
|
-
if (keytar) {
|
|
99
|
-
await keytar.setPassword(service, account, JSON.stringify(parsed.data));
|
|
100
|
-
}
|
|
101
|
-
await writeSessionFileFallback(filePath, parsed.data);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// src/auth/tokenProvider.ts
|
|
107
|
-
function shouldRefreshSoon(session, skewSeconds = 60) {
|
|
108
|
-
const nowSec = Math.floor(Date.now() / 1e3);
|
|
109
|
-
return session.expires_at <= nowSec + skewSeconds;
|
|
110
|
-
}
|
|
111
|
-
function createStoredSessionTokenProvider(params) {
|
|
112
|
-
return async (opts) => {
|
|
113
|
-
const forceRefresh = Boolean(opts?.forceRefresh);
|
|
114
|
-
const envToken = process.env.COMERGE_ACCESS_TOKEN;
|
|
115
|
-
if (typeof envToken === "string" && envToken.trim().length > 0) {
|
|
116
|
-
return { token: envToken.trim(), session: null, fromEnv: true };
|
|
117
|
-
}
|
|
118
|
-
let session = await params.sessionStore.getSession();
|
|
119
|
-
if (!session) {
|
|
120
|
-
throw new ComergeError("Not signed in.", {
|
|
121
|
-
exitCode: 2,
|
|
122
|
-
hint: "Run `comerge login`, or set COMERGE_ACCESS_TOKEN for CI."
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
if (forceRefresh || shouldRefreshSoon(session)) {
|
|
126
|
-
try {
|
|
127
|
-
session = await params.refreshStoredSession({ config: params.config, session });
|
|
128
|
-
await params.sessionStore.setSession(session);
|
|
129
|
-
} catch (err) {
|
|
130
|
-
void err;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return { token: session.access_token, session, fromEnv: false };
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// src/auth/supabase.ts
|
|
138
|
-
import { createClient } from "@supabase/supabase-js";
|
|
139
|
-
function createInMemoryStorage() {
|
|
140
|
-
const map = /* @__PURE__ */ new Map();
|
|
141
|
-
return {
|
|
142
|
-
getItem: (k) => map.get(k) ?? null,
|
|
143
|
-
setItem: (k, v) => {
|
|
144
|
-
map.set(k, v);
|
|
145
|
-
},
|
|
146
|
-
removeItem: (k) => {
|
|
147
|
-
map.delete(k);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
function createSupabaseClient(config, storage) {
|
|
152
|
-
return createClient(config.supabaseUrl, config.supabaseAnonKey, {
|
|
153
|
-
auth: {
|
|
154
|
-
flowType: "pkce",
|
|
155
|
-
persistSession: false,
|
|
156
|
-
autoRefreshToken: false,
|
|
157
|
-
detectSessionInUrl: false,
|
|
158
|
-
storage
|
|
159
|
-
},
|
|
160
|
-
global: {
|
|
161
|
-
headers: {
|
|
162
|
-
"X-Requested-By": "comerge-cli"
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function toStoredSession(session) {
|
|
168
|
-
if (!session.access_token || !session.refresh_token || !session.expires_at) {
|
|
169
|
-
throw new ComergeError("Supabase session is missing required fields.", { exitCode: 1 });
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
access_token: session.access_token,
|
|
173
|
-
refresh_token: session.refresh_token,
|
|
174
|
-
expires_at: session.expires_at,
|
|
175
|
-
token_type: session.token_type ?? void 0,
|
|
176
|
-
user: session.user ? { id: session.user.id, email: session.user.email ?? null } : void 0
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function createSupabaseAuthHelpers(config) {
|
|
180
|
-
const storage = createInMemoryStorage();
|
|
181
|
-
const supabase = createSupabaseClient(config, storage);
|
|
182
|
-
return {
|
|
183
|
-
async startGoogleLogin(params) {
|
|
184
|
-
const { data, error } = await supabase.auth.signInWithOAuth({
|
|
185
|
-
provider: "google",
|
|
186
|
-
options: {
|
|
187
|
-
redirectTo: params.redirectTo,
|
|
188
|
-
skipBrowserRedirect: true,
|
|
189
|
-
queryParams: {
|
|
190
|
-
access_type: "offline",
|
|
191
|
-
prompt: "consent"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
if (error) throw error;
|
|
196
|
-
if (!data?.url) throw new ComergeError("Supabase did not return an OAuth URL.", { exitCode: 1 });
|
|
197
|
-
return { url: data.url };
|
|
198
|
-
},
|
|
199
|
-
async exchangeCode(params) {
|
|
200
|
-
const { data, error } = await supabase.auth.exchangeCodeForSession(params.code);
|
|
201
|
-
if (error) throw error;
|
|
202
|
-
if (!data?.session) throw new ComergeError("Supabase did not return a session.", { exitCode: 1 });
|
|
203
|
-
return toStoredSession(data.session);
|
|
204
|
-
},
|
|
205
|
-
async refreshWithStoredSession(params) {
|
|
206
|
-
const { data, error } = await supabase.auth.setSession({
|
|
207
|
-
access_token: params.session.access_token,
|
|
208
|
-
refresh_token: params.session.refresh_token
|
|
209
|
-
});
|
|
210
|
-
if (error) throw error;
|
|
211
|
-
if (!data?.session) throw new ComergeError("No session returned after refresh.", { exitCode: 1 });
|
|
212
|
-
return toStoredSession(data.session);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export {
|
|
218
|
-
storedSessionSchema,
|
|
219
|
-
createLocalSessionStore,
|
|
220
|
-
shouldRefreshSoon,
|
|
221
|
-
createStoredSessionTokenProvider,
|
|
222
|
-
createSupabaseAuthHelpers
|
|
223
|
-
};
|
package/dist/chunk-ZAQZKEH4.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RemixError
|
|
3
|
-
} from "./chunk-YZ34ICNN.js";
|
|
4
|
-
|
|
5
|
-
// src/config/model.ts
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
var DEFAULT_API_URL = "http://192.168.8.242:8080";
|
|
8
|
-
var DEFAULT_SUPABASE_URL = "https://xtfxwbckjpfmqubnsusu.supabase.co";
|
|
9
|
-
var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inh0Znh3YmNranBmbXF1Ym5zdXN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MDEyMzAsImV4cCI6MjA3NjE3NzIzMH0.dzWGAWrK4CvrmHVHzf8w7JlUZohdap0ZPnLZnABMV8s";
|
|
10
|
-
function isValidUrl(value) {
|
|
11
|
-
try {
|
|
12
|
-
new URL(value);
|
|
13
|
-
return true;
|
|
14
|
-
} catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
var urlSchema = z.string().min(1).transform((s) => s.trim()).refine((s) => isValidUrl(s), "Invalid URL.").transform((s) => s.replace(/\/+$/, ""));
|
|
19
|
-
var configSchema = z.object({
|
|
20
|
-
apiUrl: urlSchema,
|
|
21
|
-
supabaseUrl: urlSchema,
|
|
22
|
-
supabaseAnonKey: z.string().min(1)
|
|
23
|
-
});
|
|
24
|
-
var cachedConfig = null;
|
|
25
|
-
async function resolveConfig(_opts) {
|
|
26
|
-
if (cachedConfig) return cachedConfig;
|
|
27
|
-
const cfgRaw = {
|
|
28
|
-
apiUrl: DEFAULT_API_URL,
|
|
29
|
-
supabaseUrl: DEFAULT_SUPABASE_URL,
|
|
30
|
-
supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
|
|
31
|
-
};
|
|
32
|
-
const parsedCfg = configSchema.safeParse(cfgRaw);
|
|
33
|
-
if (!parsedCfg.success) {
|
|
34
|
-
throw new RemixError("Invalid core configuration.", {
|
|
35
|
-
exitCode: 1,
|
|
36
|
-
hint: parsedCfg.error.issues.map((i) => `${i.path.join(".") || "config"}: ${i.message}`).join("; ")
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
cachedConfig = parsedCfg.data;
|
|
40
|
-
return parsedCfg.data;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
configSchema,
|
|
45
|
-
resolveConfig
|
|
46
|
-
};
|
package/dist/chunk-ZBMOGUSJ.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// src/errors/cliError.ts
|
|
2
|
-
var ComergeError = class extends Error {
|
|
3
|
-
code;
|
|
4
|
-
exitCode;
|
|
5
|
-
hint;
|
|
6
|
-
constructor(message, opts) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = "ComergeError";
|
|
9
|
-
this.code = opts?.code ?? null;
|
|
10
|
-
this.exitCode = opts?.exitCode ?? 1;
|
|
11
|
-
this.hint = opts?.hint ?? null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
ComergeError
|
|
17
|
-
};
|