MCPcopy Index your code
hub / github.com/CommandCodeAI/BaseAI / upsertPipe

Function upsertPipe

packages/baseai/src/deploy/index.ts:244–273  ·  view source on GitHub ↗
({ pipe, account }: { pipe: Pipe; account: Account })

Source from the content-addressed store, hash-verified

242}
243
244async function upsertPipe({ pipe, account }: { pipe: Pipe; account: Account }) {
245 const { createUrl } = getApiUrls(pipe.name);
246
247 try {
248 const createResponse = await fetch(createUrl, {
249 method: 'POST',
250 headers: {
251 'Content-Type': 'application/json',
252 Authorization: `Bearer ${account.apiKey}`
253 },
254 body: JSON.stringify({
255 ...pipe,
256 upsert: true
257 })
258 });
259
260 if (createResponse.ok) {
261 return (await createResponse.json()) as any;
262 }
263
264 const errorData = (await createResponse.json()) as ErrorResponse;
265
266 throw new Error(
267 `HTTP error! status: ${createResponse.status}, message: ${errorData.error?.message}`
268 );
269 } catch (error) {
270 console.error('Error in createNewPipe:', error);
271 throw error;
272 }
273}
274
275async function updateExistingPipe({
276 updateUrl,

Callers 1

deployPipeFunction · 0.85

Calls 1

getApiUrlsFunction · 0.85

Tested by

no test coverage detected