(
method: string,
key: string,
f: (path: string) => Effect.Effect<A, KeyValueStoreError>
)
| 358 | const fs = yield* FileSystem.FileSystem |
| 359 | const path = yield* Path.Path |
| 360 | const withKeyPath = <A>( |
| 361 | method: string, |
| 362 | key: string, |
| 363 | f: (path: string) => Effect.Effect<A, KeyValueStoreError> |
| 364 | ): Effect.Effect<A, KeyValueStoreError> => |
| 365 | key.length === 0 || key === "." || key === ".." |
| 366 | ? Effect.fail( |
| 367 | new KeyValueStoreError({ |
| 368 | method, |
| 369 | key, |
| 370 | message: `Invalid key ${key}` |
| 371 | }) |
| 372 | ) |
| 373 | : f(path.join(directory, encodeURIComponent(key))) |
| 374 | |
| 375 | if (!(yield* fs.exists(directory))) { |
| 376 | yield* fs.makeDirectory(directory, { recursive: true }) |
no test coverage detected