MCPcopy
hub / github.com/CapSoftware/Cap / createDriveObjectUrl

Function createDriveObjectUrl

packages/web-backend/src/Storage/index.ts:139–155  ·  view source on GitHub ↗
(key: string, ttlSeconds = 3600)

Source from the content-addressed store, hash-verified

137 );
138
139const 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
157const mapStorageError = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
158 effect.pipe(

Callers 1

makeGoogleDriveAccessFunction · 0.85

Calls 3

createStorageObjectTokenFunction · 0.90
serverEnvFunction · 0.90

Tested by

no test coverage detected