@agent-foundry/studio 1.0.0 → 1.0.2
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/README.md +180 -47
- package/dist/bff/client.d.ts +168 -0
- package/dist/bff/client.d.ts.map +1 -0
- package/dist/bff/client.js +288 -0
- package/dist/bff/client.js.map +1 -0
- package/dist/bff/index.d.ts +27 -0
- package/dist/bff/index.d.ts.map +1 -0
- package/dist/bff/index.js +26 -0
- package/dist/bff/index.js.map +1 -0
- package/dist/bff/types.d.ts +168 -0
- package/dist/bff/types.d.ts.map +1 -0
- package/dist/bff/types.js +8 -0
- package/dist/bff/types.js.map +1 -0
- package/dist/db/deployments.d.ts +67 -1
- package/dist/db/deployments.d.ts.map +1 -1
- package/dist/db/deployments.js +92 -1
- package/dist/db/deployments.js.map +1 -1
- package/dist/db/index.d.ts +17 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +17 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/projects.d.ts +54 -1
- package/dist/db/projects.d.ts.map +1 -1
- package/dist/db/projects.js +79 -1
- package/dist/db/projects.js.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/types/deployment.d.ts +56 -0
- package/dist/types/deployment.d.ts.map +1 -1
- package/dist/types/project.d.ts +6 -0
- package/dist/types/project.d.ts.map +1 -1
- package/package.json +14 -4
- package/src/bff/client.ts +412 -0
- package/src/bff/index.ts +32 -0
- package/src/bff/types.ts +212 -0
- package/src/db/deployments.ts +99 -1
- package/src/db/index.ts +17 -0
- package/src/db/projects.ts +86 -1
- package/src/db/schema.sql +35 -52
- package/src/index.ts +18 -2
- package/src/types/deployment.ts +75 -0
- package/src/types/project.ts +7 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BFF API Client
|
|
3
|
+
*
|
|
4
|
+
* Client for interacting with the BFF Studio API endpoints.
|
|
5
|
+
* All write operations (create, update, delete) should go through this client.
|
|
6
|
+
*
|
|
7
|
+
* The BFF uses SQLAlchemy with service_role credentials, which bypasses RLS.
|
|
8
|
+
* This is the secure and recommended way to perform write operations.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { createBFFClient } from '@agent-foundry/studio/bff';
|
|
13
|
+
*
|
|
14
|
+
* const client = createBFFClient({
|
|
15
|
+
* baseUrl: 'http://localhost:11001',
|
|
16
|
+
* authToken: 'your-supabase-jwt',
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Create a project
|
|
20
|
+
* const project = await client.projects.create({
|
|
21
|
+
* name: 'My App',
|
|
22
|
+
* slug: 'my-app',
|
|
23
|
+
* rootPath: '/Users/me/projects/my-app',
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Error thrown by BFF API client
|
|
29
|
+
*/
|
|
30
|
+
export class BFFAPIError extends Error {
|
|
31
|
+
constructor(message, status, detail, code) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.status = status;
|
|
34
|
+
this.detail = detail;
|
|
35
|
+
this.code = code;
|
|
36
|
+
this.name = 'BFFAPIError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Projects API client
|
|
41
|
+
*/
|
|
42
|
+
export class ProjectsAPI {
|
|
43
|
+
constructor(baseUrl, authToken, timeout) {
|
|
44
|
+
this.baseUrl = baseUrl;
|
|
45
|
+
this.authToken = authToken;
|
|
46
|
+
this.timeout = timeout;
|
|
47
|
+
}
|
|
48
|
+
get headers() {
|
|
49
|
+
return {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'Authorization': `Bearer ${this.authToken}`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async request(method, path, body) {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
59
|
+
method,
|
|
60
|
+
headers: this.headers,
|
|
61
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
62
|
+
signal: controller.signal,
|
|
63
|
+
});
|
|
64
|
+
clearTimeout(timeoutId);
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
let detail;
|
|
67
|
+
let code;
|
|
68
|
+
try {
|
|
69
|
+
const error = await response.json();
|
|
70
|
+
detail = error.detail;
|
|
71
|
+
code = error.code;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
detail = await response.text();
|
|
75
|
+
}
|
|
76
|
+
throw new BFFAPIError(`BFF API error: ${response.status}`, response.status, detail, code);
|
|
77
|
+
}
|
|
78
|
+
// Handle 204 No Content
|
|
79
|
+
if (response.status === 204) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return response.json();
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
clearTimeout(timeoutId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create a new project
|
|
90
|
+
*/
|
|
91
|
+
async create(input) {
|
|
92
|
+
const request = {
|
|
93
|
+
name: input.name,
|
|
94
|
+
slug: input.slug,
|
|
95
|
+
description: input.description,
|
|
96
|
+
rootPath: input.rootPath,
|
|
97
|
+
framework: input.framework,
|
|
98
|
+
config: input.config,
|
|
99
|
+
parentProjectId: input.parentProjectId,
|
|
100
|
+
};
|
|
101
|
+
return this.request('POST', '/studio/projects', request);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get a project by ID
|
|
105
|
+
*/
|
|
106
|
+
async get(id) {
|
|
107
|
+
return this.request('GET', `/studio/projects/${id}`);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* List all projects with optional pagination
|
|
111
|
+
*/
|
|
112
|
+
async list(options) {
|
|
113
|
+
const params = new URLSearchParams();
|
|
114
|
+
if (options?.page)
|
|
115
|
+
params.set('page', String(options.page));
|
|
116
|
+
if (options?.pageSize)
|
|
117
|
+
params.set('pageSize', String(options.pageSize));
|
|
118
|
+
if (options?.framework)
|
|
119
|
+
params.set('framework', options.framework);
|
|
120
|
+
if (options?.search)
|
|
121
|
+
params.set('search', options.search);
|
|
122
|
+
const query = params.toString();
|
|
123
|
+
const path = query ? `/studio/projects?${query}` : '/studio/projects';
|
|
124
|
+
return this.request('GET', path);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Update a project
|
|
128
|
+
*/
|
|
129
|
+
async update(id, input) {
|
|
130
|
+
const request = {
|
|
131
|
+
name: input.name,
|
|
132
|
+
description: input.description,
|
|
133
|
+
config: input.config,
|
|
134
|
+
};
|
|
135
|
+
return this.request('PUT', `/studio/projects/${id}`, request);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Delete a project
|
|
139
|
+
*/
|
|
140
|
+
async delete(id) {
|
|
141
|
+
return this.request('DELETE', `/studio/projects/${id}`);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Fork a project
|
|
145
|
+
*/
|
|
146
|
+
async fork(id, options) {
|
|
147
|
+
const request = {
|
|
148
|
+
newSlug: options.newSlug,
|
|
149
|
+
newRootPath: options.newRootPath,
|
|
150
|
+
newName: options.newName,
|
|
151
|
+
};
|
|
152
|
+
return this.request('POST', `/studio/projects/${id}/fork`, request);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Publish a project to Feed
|
|
156
|
+
*/
|
|
157
|
+
async publish(id, options) {
|
|
158
|
+
return this.request('POST', `/studio/projects/${id}/publish`, options ?? {});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Deployments API client
|
|
163
|
+
*/
|
|
164
|
+
export class DeploymentsAPI {
|
|
165
|
+
constructor(baseUrl, authToken, timeout) {
|
|
166
|
+
this.baseUrl = baseUrl;
|
|
167
|
+
this.authToken = authToken;
|
|
168
|
+
this.timeout = timeout;
|
|
169
|
+
}
|
|
170
|
+
get headers() {
|
|
171
|
+
return {
|
|
172
|
+
'Content-Type': 'application/json',
|
|
173
|
+
'Authorization': `Bearer ${this.authToken}`,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
async request(method, path, body) {
|
|
177
|
+
const controller = new AbortController();
|
|
178
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
179
|
+
try {
|
|
180
|
+
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
181
|
+
method,
|
|
182
|
+
headers: this.headers,
|
|
183
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
184
|
+
signal: controller.signal,
|
|
185
|
+
});
|
|
186
|
+
clearTimeout(timeoutId);
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
let detail;
|
|
189
|
+
let code;
|
|
190
|
+
try {
|
|
191
|
+
const error = await response.json();
|
|
192
|
+
detail = error.detail;
|
|
193
|
+
code = error.code;
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
detail = await response.text();
|
|
197
|
+
}
|
|
198
|
+
throw new BFFAPIError(`BFF API error: ${response.status}`, response.status, detail, code);
|
|
199
|
+
}
|
|
200
|
+
return response.json();
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
clearTimeout(timeoutId);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Start a new deployment (creates deployment record and returns STS credentials)
|
|
208
|
+
*/
|
|
209
|
+
async start(input) {
|
|
210
|
+
const request = {
|
|
211
|
+
projectId: input.projectId,
|
|
212
|
+
version: input.version,
|
|
213
|
+
metadata: input.metadata,
|
|
214
|
+
};
|
|
215
|
+
return this.request('POST', '/studio/deployments/start', request);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get a deployment by ID
|
|
219
|
+
*/
|
|
220
|
+
async get(id) {
|
|
221
|
+
return this.request('GET', `/studio/deployments/${id}`);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* List deployments for a project
|
|
225
|
+
*/
|
|
226
|
+
async list(projectId, limit) {
|
|
227
|
+
const params = new URLSearchParams();
|
|
228
|
+
if (limit)
|
|
229
|
+
params.set('limit', String(limit));
|
|
230
|
+
const query = params.toString();
|
|
231
|
+
const path = query
|
|
232
|
+
? `/studio/projects/${projectId}/deployments?${query}`
|
|
233
|
+
: `/studio/projects/${projectId}/deployments`;
|
|
234
|
+
return this.request('GET', path);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Update deployment status
|
|
238
|
+
*/
|
|
239
|
+
async updateStatus(id, input) {
|
|
240
|
+
return this.request('PUT', `/studio/deployments/${id}/status`, input);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Mark deployment as complete (after successful OSS upload)
|
|
244
|
+
*/
|
|
245
|
+
async complete(id, input) {
|
|
246
|
+
return this.request('POST', `/studio/deployments/${id}/complete`, input);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Mark deployment as failed
|
|
250
|
+
*/
|
|
251
|
+
async fail(id, input) {
|
|
252
|
+
return this.request('POST', `/studio/deployments/${id}/fail`, input);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a new BFF client
|
|
257
|
+
*
|
|
258
|
+
* @param config - Client configuration
|
|
259
|
+
* @returns BFFClient instance
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const client = createBFFClient({
|
|
264
|
+
* baseUrl: 'http://localhost:11001',
|
|
265
|
+
* authToken: 'your-supabase-jwt',
|
|
266
|
+
* });
|
|
267
|
+
*
|
|
268
|
+
* // Create a project
|
|
269
|
+
* const project = await client.projects.create({
|
|
270
|
+
* name: 'My App',
|
|
271
|
+
* slug: 'my-app',
|
|
272
|
+
* rootPath: '/Users/me/projects/my-app',
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* // Start a deployment
|
|
276
|
+
* const deployment = await client.deployments.start({
|
|
277
|
+
* projectId: project.id,
|
|
278
|
+
* });
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
export function createBFFClient(config) {
|
|
282
|
+
const timeout = config.timeout ?? 30000;
|
|
283
|
+
return {
|
|
284
|
+
projects: new ProjectsAPI(config.baseUrl, config.authToken, timeout),
|
|
285
|
+
deployments: new DeploymentsAPI(config.baseUrl, config.authToken, timeout),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/bff/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YACE,OAAe,EACC,MAAc,EACd,MAAe,EACf,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB,YACmB,OAAe,EACf,SAAiB,EACjB,OAAe;QAFf,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,IAAY,OAAO;QACjB,OAAO;YACL,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;SAC5C,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO,CACnB,MAAc,EACd,IAAY,EACZ,IAAc;QAEd,MAAM,UAAU,GAAG,IAAI,e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ACV,KAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CACjB,MAAM,EACN,uBAAuB,EAAE,WAAW,EACpC,KAAK,CACN,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,EAAU,EACV,KAA4B;QAE5B,OAAO,IAAI,CAAC,OAAO,CACjB,MAAM,EACN,uBAAuB,EAAE,OAAO,EAChC,KAAK,CACN,CAAC;IACJ,CAAC;CACF;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB;IACrD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IAExC,OAAO;QACL,QAAQ,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC;QACpE,WAAW,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC;KAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BFF module - API client for BFF Studio endpoints
|
|
3
|
+
*
|
|
4
|
+
* Use this for all write operations (create, update, delete).
|
|
5
|
+
* The BFF uses SQLAlchemy with service_role credentials, which bypasses RLS.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createBFFClient } from '@agent-foundry/studio/bff';
|
|
10
|
+
*
|
|
11
|
+
* const client = createBFFClient({
|
|
12
|
+
* baseUrl: 'http://localhost:11001',
|
|
13
|
+
* authToken: 'your-supabase-jwt',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // Create a project (write operation via BFF)
|
|
17
|
+
* const project = await client.projects.create({
|
|
18
|
+
* name: 'My App',
|
|
19
|
+
* slug: 'my-app',
|
|
20
|
+
* rootPath: '/path/to/project',
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export * from './types';
|
|
25
|
+
export { createBFFClient, BFFAPIError, ProjectsAPI, DeploymentsAPI, } from './client';
|
|
26
|
+
export type { BFFClient } from './client';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bff/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BFF module - API client for BFF Studio endpoints
|
|
3
|
+
*
|
|
4
|
+
* Use this for all write operations (create, update, delete).
|
|
5
|
+
* The BFF uses SQLAlchemy with service_role credentials, which bypasses RLS.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createBFFClient } from '@agent-foundry/studio/bff';
|
|
10
|
+
*
|
|
11
|
+
* const client = createBFFClient({
|
|
12
|
+
* baseUrl: 'http://localhost:11001',
|
|
13
|
+
* authToken: 'your-supabase-jwt',
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // Create a project (write operation via BFF)
|
|
17
|
+
* const project = await client.projects.create({
|
|
18
|
+
* name: 'My App',
|
|
19
|
+
* slug: 'my-app',
|
|
20
|
+
* rootPath: '/path/to/project',
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export * from './types';
|
|
25
|
+
export { createBFFClient, BFFAPIError, ProjectsAPI, DeploymentsAPI, } from './client';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bff/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BFF API Types
|
|
3
|
+
*
|
|
4
|
+
* Response types from the BFF Studio API endpoints.
|
|
5
|
+
* These match the Pydantic models in services/bff/app/models/studio.py
|
|
6
|
+
*/
|
|
7
|
+
import type { StudioProject, ProjectConfig, ProjectFramework } from '../types/project';
|
|
8
|
+
import type { DeploymentStatus, DeploymentMetadata, AppManifest } from '../types/deployment';
|
|
9
|
+
/**
|
|
10
|
+
* Request body for creating a project via BFF
|
|
11
|
+
*/
|
|
12
|
+
export interface CreateProjectRequest {
|
|
13
|
+
name: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
rootPath: string;
|
|
17
|
+
framework?: ProjectFramework;
|
|
18
|
+
config?: ProjectConfig;
|
|
19
|
+
parentProjectId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Request body for updating a project via BFF
|
|
23
|
+
*/
|
|
24
|
+
export interface UpdateProjectRequest {
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
config?: Partial<ProjectConfig>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Request body for forking a project via BFF
|
|
31
|
+
*/
|
|
32
|
+
export interface ForkProjectRequest {
|
|
33
|
+
newSlug: string;
|
|
34
|
+
newRootPath: string;
|
|
35
|
+
newName?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Project response from BFF API
|
|
39
|
+
*/
|
|
40
|
+
export interface ProjectResponse extends StudioProject {
|
|
41
|
+
latestDeployment?: DeploymentSummary;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Paginated project list response
|
|
45
|
+
*/
|
|
46
|
+
export interface ProjectListResponse {
|
|
47
|
+
projects: ProjectResponse[];
|
|
48
|
+
total: number;
|
|
49
|
+
page: number;
|
|
50
|
+
pageSize: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deployment summary (for lists)
|
|
54
|
+
*/
|
|
55
|
+
export interface DeploymentSummary {
|
|
56
|
+
id: string;
|
|
57
|
+
version: string;
|
|
58
|
+
status: DeploymentStatus;
|
|
59
|
+
ossUrl?: string;
|
|
60
|
+
bundleSizeBytes?: number;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
publishedAt?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Request body for starting a deployment
|
|
66
|
+
*/
|
|
67
|
+
export interface StartDeploymentRequest {
|
|
68
|
+
projectId: string;
|
|
69
|
+
version?: string;
|
|
70
|
+
metadata?: Partial<DeploymentMetadata>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* STS credentials for OSS upload
|
|
74
|
+
*/
|
|
75
|
+
export interface STSCredentials {
|
|
76
|
+
accessKeyId: string;
|
|
77
|
+
accessKeySecret: string;
|
|
78
|
+
securityToken: string;
|
|
79
|
+
expiration: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Response from starting a deployment
|
|
83
|
+
*/
|
|
84
|
+
export interface StartDeploymentResponse {
|
|
85
|
+
deploymentId: string;
|
|
86
|
+
credentials: STSCredentials;
|
|
87
|
+
bucket: string;
|
|
88
|
+
region: string;
|
|
89
|
+
keyPrefix: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Request body for updating deployment status
|
|
93
|
+
*/
|
|
94
|
+
export interface UpdateDeploymentStatusRequest {
|
|
95
|
+
status: DeploymentStatus;
|
|
96
|
+
buildLog?: string;
|
|
97
|
+
errorMessage?: string;
|
|
98
|
+
metadata?: Partial<DeploymentMetadata>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Request body for completing a deployment
|
|
102
|
+
*/
|
|
103
|
+
export interface CompleteDeploymentRequest {
|
|
104
|
+
bucket: string;
|
|
105
|
+
keyPrefix: string;
|
|
106
|
+
ossUrl: string;
|
|
107
|
+
totalBytes: number;
|
|
108
|
+
fileCount: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Response from completing a deployment
|
|
112
|
+
*/
|
|
113
|
+
export interface CompleteDeploymentResponse {
|
|
114
|
+
deploymentId: string;
|
|
115
|
+
ossUrl: string;
|
|
116
|
+
version: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Request body for failing a deployment
|
|
120
|
+
*/
|
|
121
|
+
export interface FailDeploymentRequest {
|
|
122
|
+
errorMessage: string;
|
|
123
|
+
buildLog?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Deployment list response
|
|
127
|
+
*/
|
|
128
|
+
export interface DeploymentListResponse {
|
|
129
|
+
deployments: DeploymentSummary[];
|
|
130
|
+
total: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Request body for publishing to Feed
|
|
134
|
+
*/
|
|
135
|
+
export interface PublishRequest {
|
|
136
|
+
deploymentId?: string;
|
|
137
|
+
manifest?: AppManifest;
|
|
138
|
+
status?: 'canary' | 'stable';
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Response from publishing to Feed
|
|
142
|
+
*/
|
|
143
|
+
export interface PublishResponse {
|
|
144
|
+
appId: string;
|
|
145
|
+
artifactId: string;
|
|
146
|
+
deploymentId: string;
|
|
147
|
+
shareUrl: string;
|
|
148
|
+
entryUrl: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* API error response
|
|
152
|
+
*/
|
|
153
|
+
export interface APIError {
|
|
154
|
+
detail: string;
|
|
155
|
+
code?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* BFF client configuration
|
|
159
|
+
*/
|
|
160
|
+
export interface BFFClientConfig {
|
|
161
|
+
/** BFF base URL (e.g., "http://localhost:11001") */
|
|
162
|
+
baseUrl: string;
|
|
163
|
+
/** Supabase JWT token for authentication */
|
|
164
|
+
authToken: string;
|
|
165
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
166
|
+
timeout?: number;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bff/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAM7B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG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AAA;;;;;GAKG"}
|
package/dist/db/deployments.d.ts
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deployments Repository
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Provides access to studio_deployments table via Supabase client.
|
|
5
|
+
*
|
|
6
|
+
* ## Important: Hybrid Access Pattern
|
|
7
|
+
*
|
|
8
|
+
* Due to RLS (Row Level Security) restrictions, this repository should
|
|
9
|
+
* primarily be used for **read operations only**.
|
|
10
|
+
*
|
|
11
|
+
* **For write operations, use the BFF client or DirectUploader:**
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { DirectUploader } from '@agent-foundry/studio/oss';
|
|
15
|
+
*
|
|
16
|
+
* // DirectUploader handles the complete deployment workflow via BFF
|
|
17
|
+
* const uploader = new DirectUploader({
|
|
18
|
+
* bffBaseUrl: 'http://localhost:11001',
|
|
19
|
+
* authToken: 'your-jwt-token',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* const result = await uploader.upload({
|
|
23
|
+
* projectId: 'project-uuid',
|
|
24
|
+
* files: distFiles,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Or use the BFF client directly:
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { createBFFClient } from '@agent-foundry/studio/bff';
|
|
32
|
+
*
|
|
33
|
+
* const bff = createBFFClient({ ... });
|
|
34
|
+
* const deployment = await bff.deployments.start({ projectId: '...' });
|
|
35
|
+
* ```
|
|
5
36
|
*/
|
|
6
37
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
7
38
|
import type { Deployment, CreateDeploymentInput, UpdateDeploymentInput, DeploymentListFilters } from '../types/deployment';
|
|
@@ -14,6 +45,12 @@ export declare class DeploymentsRepository {
|
|
|
14
45
|
constructor(supabase: SupabaseClient);
|
|
15
46
|
/**
|
|
16
47
|
* Create a new deployment
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Use `DirectUploader.upload()` or `createBFFClient().deployments.start()` instead.
|
|
50
|
+
*
|
|
51
|
+
* This method may fail with RLS errors. The recommended workflow is:
|
|
52
|
+
* 1. Use DirectUploader which handles the complete deployment lifecycle
|
|
53
|
+
* 2. Or use BFF client's deployments.start() to get STS credentials
|
|
17
54
|
*/
|
|
18
55
|
create(input: CreateDeploymentInput): Promise<Deployment>;
|
|
19
56
|
/**
|
|
@@ -26,18 +63,28 @@ export declare class DeploymentsRepository {
|
|
|
26
63
|
list(filters?: DeploymentListFilters): Promise<Deployment[]>;
|
|
27
64
|
/**
|
|
28
65
|
* Update a deployment
|
|
66
|
+
*
|
|
67
|
+
* @deprecated Use `createBFFClient().deployments.updateStatus()` instead.
|
|
68
|
+
*
|
|
69
|
+
* This method may fail with RLS errors. Use BFF client for write operations.
|
|
29
70
|
*/
|
|
30
71
|
update(id: string, input: UpdateDeploymentInput): Promise<Deployment>;
|
|
31
72
|
/**
|
|
32
73
|
* Mark deployment as building
|
|
74
|
+
*
|
|
75
|
+
* @deprecated Use `createBFFClient().deployments.updateStatus()` instead.
|
|
33
76
|
*/
|
|
34
77
|
markBuilding(id: string): Promise<Deployment>;
|
|
35
78
|
/**
|
|
36
79
|
* Mark deployment as uploading
|
|
80
|
+
*
|
|
81
|
+
* @deprecated Use `createBFFClient().deployments.updateStatus()` instead.
|
|
37
82
|
*/
|
|
38
83
|
markUploading(id: string): Promise<Deployment>;
|
|
39
84
|
/**
|
|
40
85
|
* Mark deployment as published
|
|
86
|
+
*
|
|
87
|
+
* @deprecated Use `createBFFClient().deployments.complete()` instead.
|
|
41
88
|
*/
|
|
42
89
|
markPublished(id: string, ossInfo: {
|
|
43
90
|
bucket: string;
|
|
@@ -47,6 +94,8 @@ export declare class DeploymentsRepository {
|
|
|
47
94
|
}): Promise<Deployment>;
|
|
48
95
|
/**
|
|
49
96
|
* Mark deployment as failed
|
|
97
|
+
*
|
|
98
|
+
* @deprecated Use `createBFFClient().deployments.fail()` instead.
|
|
50
99
|
*/
|
|
51
100
|
markFailed(id: string, errorMessage: string, buildLog?: string): Promise<Deployment>;
|
|
52
101
|
/**
|
|
@@ -55,11 +104,28 @@ export declare class DeploymentsRepository {
|
|
|
55
104
|
getLatestPublished(projectId: string): Promise<Deployment | null>;
|
|
56
105
|
/**
|
|
57
106
|
* Delete a deployment
|
|
107
|
+
*
|
|
108
|
+
* @deprecated Deployment deletion should be handled server-side.
|
|
109
|
+
* This method may fail with RLS errors.
|
|
58
110
|
*/
|
|
59
111
|
delete(id: string): Promise<void>;
|
|
60
112
|
/**
|
|
61
113
|
* Append to build log
|
|
114
|
+
*
|
|
115
|
+
* @deprecated Use `createBFFClient().deployments.updateStatus()` with buildLog field.
|
|
116
|
+
* This method may fail with RLS errors.
|
|
62
117
|
*/
|
|
63
118
|
appendBuildLog(id: string, logLine: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Link deployment to an artifact (called after publishing to Feed)
|
|
121
|
+
*
|
|
122
|
+
* @deprecated This is handled automatically by BFF's publish workflow.
|
|
123
|
+
* Use `createBFFClient().projects.publish()` instead.
|
|
124
|
+
*/
|
|
125
|
+
linkToArtifact(id: string, artifactId: string): Promise<Deployment>;
|
|
126
|
+
/**
|
|
127
|
+
* Get deployment by artifact ID
|
|
128
|
+
*/
|
|
129
|
+
getByArtifactId(artifactId: string): Promise<Deployment | null>;
|
|
64
130
|
}
|
|
65
131
|
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/db/deployments.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/db/deployments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAC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