MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / create

Function create

packages/plugins/toolkits/src/server.ts:306–324  ·  view source on GitHub ↗
(input: {
    readonly owner: Owner;
    readonly name: string;
    readonly slug?: string;
  })

Source from the content-addressed store, hash-verified

304 );
305
306 const create = (input: {
307 readonly owner: Owner;
308 readonly name: string;
309 readonly slug?: string;
310 }) =>
311 Effect.gen(function* () {
312 const name = input.name.trim();
313 if (!name) return yield* fail("Toolkit name is required.");
314 const slug = yield* normalizeSlugEffect({ name, slug: input.slug });
315 yield* assertSlugAvailable(slug);
316 const now = Date.now();
317 const id = newId("tk");
318 const entry = yield* storage.toolkits.put({
319 owner: input.owner,
320 key: id,
321 data: { id, slug, name, createdAt: now, updatedAt: now },
322 });
323 return toolkitToResponse(entry);
324 });
325
326 const update = (toolkitId: string, input: { readonly name?: string; readonly slug?: string }) =>
327 Effect.gen(function* () {

Callers

nothing calls this directly

Calls 6

normalizeSlugEffectFunction · 0.85
assertSlugAvailableFunction · 0.85
newIdFunction · 0.85
toolkitToResponseFunction · 0.85
failFunction · 0.70
putMethod · 0.65

Tested by

no test coverage detected