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

Function wrap

packages/plugins/onepassword/src/sdk/service.ts:149–160  ·  view source on GitHub ↗
(fn: () => Promise<A>, operation: string)

Source from the content-addressed store, hash-verified

147 }).pipe(timeoutWithOnePasswordError("client setup", timeoutMs));
148
149 const wrap = <A>(fn: () => Promise<A>, operation: string): Effect.Effect<A, OnePasswordError> =>
150 Effect.tryPromise({
151 try: fn,
152 catch: (cause) =>
153 new OnePasswordError({
154 operation,
155 message: messageWithCause(`1Password SDK ${operation} failed`, cause),
156 }),
157 }).pipe(
158 timeoutWithOnePasswordError(operation, timeoutMs),
159 Effect.withSpan(`onepassword.sdk.${operation}`),
160 );
161
162 return OnePasswordServiceTag.of({
163 resolveSecret: (uri) => wrap(() => client.secrets.resolve(uri), "secret resolution"),

Callers 1

makeNativeSdkServiceFunction · 0.70

Calls 2

messageWithCauseFunction · 0.85

Tested by

no test coverage detected