@@ -33,7 +33,6 @@ import {
3333 traceRelayHttpRequest ,
3434 tokenApi ,
3535} from "./api.ts" ;
36- import { CloudMintKeyPair } from "./infra/CloudMintKeyPair.ts" ;
3736import {
3837 MANAGED_ENDPOINT_ZONE ,
3938 managedEndpointBaseDomain ,
@@ -173,71 +172,68 @@ export default class Api extends Cloudflare.Worker<Api>()(
173172 ) ,
174173 } ,
175174 ) ;
176- const relayIssuer = yield * Alchemy . Variable (
175+ const relayIssuer = yield * Output . named (
176+ Output . map ( managedEndpointZone . name , ( name ) => relayPublicOrigin ( { name } ) ) ,
177177 "RELAY_ISSUER" ,
178- Output . map ( managedEndpointZone . name , ( name ) => relayPublicOrigin ( { name } ) ) as never ,
179178 ) ;
180- const managedEndpointBaseDomainValue = yield * Alchemy . Variable (
181- "MANAGED_ENDPOINT_BASE_DOMAIN" ,
179+ const managedEndpointBaseDomainValue = yield * Output . named (
182180 Output . map ( managedEndpointZone . name , ( name ) =>
183181 managedEndpointBaseDomain ( {
184182 name,
185183 baseSubdomain : MANAGED_ENDPOINT_ZONE . baseSubdomain ,
186184 } ) ,
187- ) as never ,
185+ ) ,
186+ "MANAGED_ENDPOINT_BASE_DOMAIN" ,
188187 ) ;
189- const managedEndpointCloudflareAccountId = yield * Alchemy . Secret (
188+ const managedEndpointCloudflareAccountId = yield * Output . named (
189+ Output . map ( managedEndpointZone . accountId , Redacted . make ) ,
190190 "MANAGED_ENDPOINT_CLOUDFLARE_ACCOUNT_ID" ,
191- managedEndpointZone . accountId as never ,
192191 ) ;
193- const managedEndpointCloudflareZoneId = yield * Alchemy . Secret (
192+ const managedEndpointCloudflareZoneId = yield * Output . named (
193+ Output . map ( managedEndpointZone . zoneId , Redacted . make ) ,
194194 "MANAGED_ENDPOINT_CLOUDFLARE_ZONE_ID" ,
195- managedEndpointZone . zoneId as never ,
196195 ) ;
197- const managedEndpointCloudflareApiToken = yield * Alchemy . Secret (
196+ const managedEndpointCloudflareApiToken = yield * Output . named (
197+ managedEndpointProvisionerToken . value ,
198198 "MANAGED_ENDPOINT_CLOUDFLARE_API_TOKEN" ,
199- managedEndpointProvisionerToken . value as never ,
200199 ) ;
201200 const relayHyperdrive = yield * RelayHyperdrive ;
202201 const apnsDeliveryQueue = yield * RelayApnsDeliveryQueue ;
203202 const apnsDeliveryDeadLetterQueue = yield * RelayApnsDeliveryDeadLetterQueue ;
204203 const hyperdrive = yield * Cloudflare . Hyperdrive . bind ( relayHyperdrive ) ;
205204 const apnsDeliveryQueueSender = yield * Cloudflare . QueueBinding . bind ( apnsDeliveryQueue ) ;
206- const cloudMintKeyPair = yield * CloudMintKeyPair ( "CloudMintKeyPair" ) ;
207- const environment = yield * Alchemy . Variable (
208- "APNS_ENVIRONMENT" ,
209- Config . schema ( Settings . ApnsEnvironment , "APNS_ENVIRONMENT" ) . pipe (
210- Config . withDefault ( "sandbox" ) ,
211- ) ,
205+ const cloudMintKeyPair = yield * Alchemy . KeyPair ( "CloudMintKeyPair" ) ;
206+ const environment = yield * Config . schema ( Settings . ApnsEnvironment , "APNS_ENVIRONMENT" ) . pipe (
207+ Config . withDefault ( "sandbox" ) ,
212208 ) ;
213- const apnsTeamId = yield * Alchemy . Secret ( "APNS_TEAM_ID" ) ;
214- const apnsKeyId = yield * Alchemy . Secret ( "APNS_KEY_ID" ) ;
215- const apnsBundleId = yield * Alchemy . Secret ( "APNS_BUNDLE_ID" ) ;
216- const apnsPrivateKey = yield * Alchemy . Secret ( "APNS_PRIVATE_KEY" ) ;
209+ const apnsTeamId = yield * Config . redacted ( "APNS_TEAM_ID" ) ;
210+ const apnsKeyId = yield * Config . redacted ( "APNS_KEY_ID" ) ;
211+ const apnsBundleId = yield * Config . redacted ( "APNS_BUNDLE_ID" ) ;
212+ const apnsPrivateKey = yield * Config . redacted ( "APNS_PRIVATE_KEY" ) ;
217213 const relayObservability = yield * provisionRelayObservability ;
218- const axiomIngestToken = yield * Alchemy . Secret (
214+ const axiomIngestToken = yield * Output . named (
215+ relayObservability . ingestToken . token ,
219216 "AXIOM_INGEST_TOKEN" ,
220- relayObservability . ingestToken . token as any ,
221217 ) ;
222- const axiomLogsEndpoint = yield * Alchemy . Variable (
218+ const axiomLogsEndpoint = yield * Output . named (
219+ relayObservability . events . otelLogsEndpoint ,
223220 "AXIOM_OTEL_LOGS_ENDPOINT" ,
224- relayObservability . events . otelLogsEndpoint as never ,
225221 ) ;
226- const axiomTracesEndpoint = yield * Alchemy . Variable (
222+ const axiomTracesEndpoint = yield * Output . named (
223+ relayObservability . events . otelTracesEndpoint ,
227224 "AXIOM_OTEL_TRACES_ENDPOINT" ,
228- relayObservability . events . otelTracesEndpoint as never ,
229225 ) ;
230- const axiomMetricsEndpoint = yield * Alchemy . Variable (
226+ const axiomMetricsEndpoint = yield * Output . named (
227+ relayObservability . metrics . otelMetricsEndpoint ,
231228 "AXIOM_OTEL_METRICS_ENDPOINT" ,
232- relayObservability . metrics . otelMetricsEndpoint as never ,
233229 ) ;
234- const axiomEventsDatasetName = yield * Alchemy . Variable (
230+ const axiomEventsDatasetName = yield * Output . named (
231+ relayObservability . events . name ,
235232 "AXIOM_EVENTS_DATASET" ,
236- relayObservability . events . name as never ,
237233 ) ;
238- const axiomMetricsDatasetName = yield * Alchemy . Variable (
234+ const axiomMetricsDatasetName = yield * Output . named (
235+ relayObservability . metrics . name ,
239236 "AXIOM_METRICS_DATASET" ,
240- relayObservability . metrics . name as never ,
241237 ) ;
242238 const relayTelemetryLayer = Layer . unwrap (
243239 Effect . gen ( function * ( ) {
@@ -255,18 +251,18 @@ export default class Api extends Cloudflare.Worker<Api>()(
255251 "ApnsDeliveryJobSigningSecret" ,
256252 { bytes : 32 } ,
257253 ) ;
258- const apnsDeliveryJobSigningSecret = yield * Alchemy . Secret (
254+ const apnsDeliveryJobSigningSecret = yield * Output . named (
255+ randomApnsDeliveryJobSigningSecret . text ,
259256 "APNS_DELIVERY_JOB_SIGNING_SECRET" ,
260- randomApnsDeliveryJobSigningSecret . text as any ,
261257 ) ;
262- const clerkSecretKey = yield * Alchemy . Secret ( "CLERK_SECRET_KEY" ) ;
263- const cloudMintPrivateKey = yield * Alchemy . Secret (
258+ const clerkSecretKey = yield * Config . redacted ( "CLERK_SECRET_KEY" ) ;
259+ const cloudMintPrivateKey = yield * Output . named (
260+ cloudMintKeyPair . privateKey ,
264261 "CLOUD_MINT_PRIVATE_KEY" ,
265- cloudMintKeyPair . privateKey as never ,
266262 ) ;
267- const cloudMintPublicKey = yield * Alchemy . Secret (
263+ const cloudMintPublicKey = yield * Output . named (
264+ Output . map ( cloudMintKeyPair . publicKey , Redacted . make ) ,
268265 "CLOUD_MINT_PUBLIC_KEY" ,
269- cloudMintKeyPair . publicKey as never ,
270266 ) ;
271267 const db = yield * Drizzle . postgres ( hyperdrive . connectionString ) ;
272268
@@ -275,14 +271,14 @@ export default class Api extends Cloudflare.Worker<Api>()(
275271 const settings = Settings . Settings . of ( {
276272 relayIssuer : yield * relayIssuer ,
277273 apns : {
278- environment : yield * environment ,
279- teamId : yield * apnsTeamId ,
280- keyId : yield * apnsKeyId ,
281- bundleId : yield * apnsBundleId ,
282- privateKey : yield * apnsPrivateKey ,
274+ environment,
275+ teamId : apnsTeamId ,
276+ keyId : apnsKeyId ,
277+ bundleId : apnsBundleId ,
278+ privateKey : apnsPrivateKey ,
283279 } ,
284280 apnsDeliveryJobSigningSecret : yield * apnsDeliveryJobSigningSecret ,
285- clerkSecretKey : yield * clerkSecretKey ,
281+ clerkSecretKey,
286282 cloudMintPrivateKey : yield * cloudMintPrivateKey ,
287283 cloudMintPublicKey : yield * cloudMintPublicKey ,
288284 managedEndpointBaseDomain : yield * managedEndpointBaseDomainValue ,
@@ -354,7 +350,7 @@ export default class Api extends Cloudflare.Worker<Api>()(
354350 yield * Cloudflare . messages < unknown > ( apnsDeliveryQueue , {
355351 batchSize : 10 ,
356352 maxRetries : 5 ,
357- maxWaitTimeMs : 5_000 ,
353+ maxWaitTime : "5 seconds" ,
358354 retryDelay : 30 ,
359355 deadLetterQueue : apnsDeliveryDeadLetterQueue . queueName as unknown as string ,
360356 } ) . subscribe ( ( stream ) =>
0 commit comments