Effection Logo
@effection-contrib/deno-deployv0.1.0thefrontside/effection-contrib
JSR BadgeNPM Badge with published versionBundle size badgeDependency count badgeTree shaking support badge
import { } from "@effection-contrib/deno-deploy"

Deno Deploy

Provides Deno Deploy Effection context with region, deploymentId and isDenoDeploy flag to detect when running in the Deno Deploy environment. This can be useful when testing an application that's deployed to Deno Deploy.

API

interface DenoDeploy {

  • True when running in Deno Deploy

    isDenoDeploy: boolean;
  • ID of the current Deno Deploy environment

    deploymentId: string | undefined;
  • It holds the region code of the region in which the deployment is running. You can use this variable to serve region-specific content. You can refer to the region code from the regions page.

    region: string | undefined;
}

const DenoDeployContext: Context<DenoDeploy>

Context used to access DenoDeploy value

function*() {
 const {
   isDenoDeploy,
   deploymentId,
   region
 } = yield* DenoDeployContext;
}

function* initDenoDeploy(): Operation<DenoDeploy>

Use at the root of your application to setup Deno Deploy context.

import { main } from "effection";
import { initDenoDeploy } from "@effection-contrib/deno-deploy";

await main(function*() {
 yield* initDenoDeploy();
});

function* useDenoDeploy(): Operation<DenoDeploy>

Use to read the values of Deno Deploy Context.

import { useDenoDeploy } from "@effection-contrib/deno-deploy";

function* () {
 const { isDenoDeploy } = yield* useDenoDeploy();
}