Using services inside a schema transformation in Effect Typescript library

I have a schema transformation like this, and I'm trying to use services inside of it (in this case to get the project ID injected into the schema transformation). Is this possible?

const ZoneFromURL = S.transformOrFail(
  S.String,
  ComputeZone,
  {
    strict: true,
    decode: (zoneURL) => S.decodeUnknown(ComputeZone)(zoneURL.split("/").pop()).pipe(
      Effect.mapError((e) => e.issue)
    ),
    encode: (zone) => Effect.gen(function*() {
      const projectId = yield* ProjectId // <- how can I make this work? I want `ProjectId` to be a requirement of the schema. Is this possible?
      return `https://www.googleapis.com/compute/v1/projects/${projectId}/zones/${zone}`
    })
  }
)
Was this page helpful?