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

Function createObject

packages/plugins/workos-vault/src/sdk/testing.ts:105–124  ·  view source on GitHub ↗
(opts: {
    readonly name: string;
    readonly value: string;
    readonly context: Record<string, string>;
  })

Source from the content-addressed store, hash-verified

103 });
104
105 const createObject = (opts: {
106 readonly name: string;
107 readonly value: string;
108 readonly context: Record<string, string>;
109 }): Effect.Effect<WorkOSVaultObjectMetadata, TestWorkOSVaultError> =>
110 Effect.gen(function* () {
111 yield* validateObjectName(opts.name);
112 if (objects.has(opts.name)) {
113 return yield* conflict(`Object "${opts.name}" already exists`);
114 }
115 const id = nextId();
116 const metadata = makeMetadata(id, opts.context, `${id}-v1`);
117 objects.set(opts.name, {
118 id,
119 name: opts.name,
120 value: opts.value,
121 metadata,
122 });
123 return metadata;
124 });
125
126 const readObjectByName = (name: string): Effect.Effect<WorkOSVaultObject, TestWorkOSVaultError> =>
127 Effect.gen(function* () {

Callers 1

Calls 5

validateObjectNameFunction · 0.85
conflictFunction · 0.85
nextIdFunction · 0.70
makeMetadataFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected