MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / cloudDbProviderLayer

Function cloudDbProviderLayer

apps/cloud/src/db/fuma.ts:56–77  ·  view source on GitHub ↗
(
  tables: FumaTables,
)

Source from the content-addressed store, hash-verified

54// out-of-band, so there is no schema bring-up here, and `close` is a no-op —
55// `DbService.Live` owns the postgres connection lifecycle.
56export const cloudDbProviderLayer = (
57 tables: FumaTables,
58): Layer.Layer<DbProvider, never, DbService> =>
59 Layer.effect(DbProvider)(
60 Effect.map(DbService.asEffect(), ({ db }): ExecutorDbHandle => {
61 const fuma = createDrizzleFumaDb({
62 db,
63 tables,
64 namespace: CLOUD_NAMESPACE,
65 provider: "postgresql",
66 });
67 return {
68 db: fuma.db,
69 fuma: fuma.fuma,
70 close: async () => {},
71 // Plugin blobs (multi-MB resolved specs) live in R2, not Postgres.
72 // Guarded because test workers / local dev may run without the
73 // binding — the executor then falls back to the FumaDB `blob` table.
74 blobs: env.BLOBS ? makeR2BlobStore(env.BLOBS) : undefined,
75 };
76 }),
77 );

Callers 1

execution-stack.tsFile · 0.90

Calls 2

makeR2BlobStoreFunction · 0.90
createDrizzleFumaDbFunction · 0.85

Tested by

no test coverage detected