(key: string, ttlSeconds = 3600)
| 137 | ); |
| 138 | |
| 139 | const createDriveObjectUrl = (key: string, ttlSeconds = 3600) => |
| 140 | parseVideoIdFromObjectKey(key).pipe( |
| 141 | Option.match({ |
| 142 | onNone: () => |
| 143 | Effect.fail( |
| 144 | new StorageDomain.StorageError({ |
| 145 | cause: new Error(`Could not resolve video id from key: ${key}`), |
| 146 | }), |
| 147 | ), |
| 148 | onSome: (videoId) => |
| 149 | Effect.sync(() => { |
| 150 | const token = createStorageObjectToken({ videoId, key }, ttlSeconds); |
| 151 | const params = new URLSearchParams({ videoId, key, token }); |
| 152 | return `${serverEnv().WEB_URL}/api/storage/object?${params.toString()}`; |
| 153 | }), |
| 154 | }), |
| 155 | ); |
| 156 | |
| 157 | const mapStorageError = <A, E, R>(effect: Effect.Effect<A, E, R>) => |
| 158 | effect.pipe( |
no test coverage detected