(
calls: { count: number },
wrapGet?: <A>(run: () => Promise<A>) => Promise<A>,
)
| 871 | }; |
| 872 | |
| 873 | const countingProvider = ( |
| 874 | calls: { count: number }, |
| 875 | wrapGet?: <A>(run: () => Promise<A>) => Promise<A>, |
| 876 | ) => { |
| 877 | const store = new Map<string, string>(); |
| 878 | const provider: CredentialProvider = { |
| 879 | key: ProviderKey.make("memory"), |
| 880 | writable: true, |
| 881 | get: (id) => |
| 882 | Effect.promise(() => { |
| 883 | calls.count++; |
| 884 | const run = async () => store.get(String(id)) ?? null; |
| 885 | return wrapGet ? wrapGet(run) : run(); |
| 886 | }), |
| 887 | set: (id, value) => Effect.sync(() => void store.set(String(id), value)), |
| 888 | }; |
| 889 | return provider; |
| 890 | }; |
| 891 | |
| 892 | const invokeConcurrencyPlugin = (provider: CredentialProvider) => |
| 893 | definePlugin(() => ({ |
no test coverage detected