( repo: StorageRepo, integration: typeof Db.storageIntegrations.$inferSelect, )
| 195 | }); |
| 196 | |
| 197 | const makeGoogleDriveTokenStore = ( |
| 198 | repo: StorageRepo, |
| 199 | integration: typeof Db.storageIntegrations.$inferSelect, |
| 200 | ): GoogleDriveTokenStore => ({ |
| 201 | cacheKey: integration.id, |
| 202 | getInitialAccessTokenCache: () => |
| 203 | mapStorageError(repo.getGoogleDriveAccessTokenCache(integration)), |
| 204 | getAccessTokenCache: () => |
| 205 | mapStorageError(repo.getGoogleDriveAccessTokenCacheById(integration.id)), |
| 206 | claimRefreshLease: (leaseId, expiresAt) => |
| 207 | mapStorageError( |
| 208 | repo.claimGoogleDriveTokenRefreshLease( |
| 209 | integration.id, |
| 210 | leaseId, |
| 211 | expiresAt, |
| 212 | ), |
| 213 | ), |
| 214 | saveAccessTokenCache: (leaseId, cache) => |
| 215 | mapStorageError( |
| 216 | repo.saveGoogleDriveAccessTokenCache(integration.id, leaseId, cache), |
| 217 | ), |
| 218 | releaseRefreshLease: (leaseId) => |
| 219 | mapStorageError( |
| 220 | repo.releaseGoogleDriveTokenRefreshLease(integration.id, leaseId), |
| 221 | ), |
| 222 | }); |
| 223 | |
| 224 | const makeS3Access = (s3: S3BucketAccess) => ({ |
| 225 | provider: "s3" as const, |
no test coverage detected