(
calls: { count: number },
wrapGet?: <A>(run: () => Promise<A>) => Promise<A>,
)
| 981 | }; |
| 982 | |
| 983 | const countingProvider = ( |
| 984 | calls: { count: number }, |
| 985 | wrapGet?: <A>(run: () => Promise<A>) => Promise<A>, |
| 986 | ) => { |
| 987 | const store = new Map<string, string>(); |
| 988 | const provider: CredentialProvider = { |
| 989 | key: ProviderKey.make("memory"), |
| 990 | writable: true, |
| 991 | get: (id) => |
| 992 | Effect.promise(() => { |
| 993 | calls.count++; |
| 994 | const run = async () => store.get(String(id)) ?? null; |
| 995 | return wrapGet ? wrapGet(run) : run(); |
| 996 | }), |
| 997 | set: (id, value) => Effect.sync(() => void store.set(String(id), value)), |
| 998 | }; |
| 999 | return provider; |
| 1000 | }; |
| 1001 | |
| 1002 | const invokeConcurrencyPlugin = (provider: CredentialProvider) => |
| 1003 | definePlugin(() => ({ |
no test coverage detected