MCPcopy Index your code
hub / github.com/CapSoftware/Cap / makeGoogleDriveTokenStore

Function makeGoogleDriveTokenStore

packages/web-backend/src/Storage/index.ts:197–222  ·  view source on GitHub ↗
(
	repo: StorageRepo,
	integration: typeof Db.storageIntegrations.$inferSelect,
)

Source from the content-addressed store, hash-verified

195});
196
197const 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
224const makeS3Access = (s3: S3BucketAccess) => ({
225 provider: "s3" as const,

Callers 1

makeGoogleDriveAccessFunction · 0.85

Calls 1

mapStorageErrorFunction · 0.85

Tested by

no test coverage detected