@replohq/canopy-sdk 0.16.3 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/env.js +2 -6
  2. package/env.js.map +2 -2
  3. package/package.json +1 -1
package/env.js CHANGED
@@ -1,5 +1,3 @@
1
- import { promises as fs } from "node:fs";
2
- import path from "node:path";
3
1
  import { getCloudflareContext } from "@opennextjs/cloudflare";
4
2
  import JSONC from "tiny-jsonc";
5
3
  import { z } from "zod";
@@ -24,10 +22,8 @@ const getEnv = async () => {
24
22
  const { env } = await getCloudflareContext({ async: true });
25
23
  return envSchema.parse(env);
26
24
  }
27
- const raw = await fs.readFile(
28
- path.join(process.cwd(), "wrangler.jsonc"),
29
- "utf8"
30
- );
25
+ const { promises: fs } = await import(`${"__node:fs".replaceAll("__", "")}`);
26
+ const raw = await fs.readFile(`${process.cwd()}/wrangler.jsonc`, "utf8");
31
27
  return wranglerConfigSchema.parse(JSONC.parse(raw)).vars;
32
28
  };
33
29
  export {
package/env.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../env.ts"],
4
- "sourcesContent": ["import { promises as fs } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { getCloudflareContext } from \"@opennextjs/cloudflare\";\nimport JSONC from \"tiny-jsonc\";\nimport { z } from \"zod\";\n\ntype Env = {\n CANOPY_API_HOST: string;\n PROJECT_ID: string;\n\n // Base URL of analytics-fire (e.g. https://data.replo.app). Read server-side by\n // the consent action (`consent/consent-actions.ts`) to forward proof-of-consent\n // records. Optional: absent in environments where the audit pipeline isn't\n // wired (e.g. local dev), where consent recording simply no-ops.\n ANALYTICS_FIRE_API_URL?: string;\n\n // Base URL of the Replo first-party analytics pixel CDN (e.g.\n // https://pixel.replo.app). `<ReploFirstPartyPixel>` loads\n // `${REPLO_ANALYTICS_PIXEL_URL}/latest.js` into the page once analytics consent\n // is granted; the browser fetches it directly. Optional: absent when the pixel\n // isn't configured (e.g. lean local dev), where the pixel simply isn't injected.\n REPLO_ANALYTICS_PIXEL_URL?: string;\n\n // NOTE (Gabe 2025-06-26): If there's no Shopify integration these will be\n // undefined.\n SHOPIFY_URL?: string;\n // NOTE (Gabe 2025-06-26): Even if there's an integration, if we haven't been\n // given elevated scope this may be null.\n SHOPIFY_STOREFRONT_ACCESS_TOKEN?: string | null;\n STRIPE_CONNECT_ACCOUNT_ID?: string | null;\n CHECKOUT_PROVIDER?: \"shopify\" | \"stripe\" | \"none\";\n\n REPLO_INTERNAL_REVALIDATE_SECRET?: string;\n /** Shared secret sent in X-Replo-Resolver-Auth for server-to-server cart calls. */\n CART_AUTH_SECRET?: string;\n};\n\nconst envSchema = z.object({\n CANOPY_API_HOST: z.string().min(1),\n PROJECT_ID: z.uuid(),\n ANALYTICS_FIRE_API_URL: z.string().optional(),\n REPLO_ANALYTICS_PIXEL_URL: z.string().optional(),\n SHOPIFY_URL: z.string().optional(),\n SHOPIFY_STOREFRONT_ACCESS_TOKEN: z.string().nullish(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullish(),\n CHECKOUT_PROVIDER: z.enum([\"shopify\", \"stripe\", \"none\"]).optional(),\n REPLO_INTERNAL_REVALIDATE_SECRET: z.string().optional(),\n CART_AUTH_SECRET: z.string().optional(),\n});\n\nconst wranglerConfigSchema = z.object({ vars: envSchema });\n\n// NOTE (Cole, 2026-07-28, REPL-29501): outside the deployed worker, read wrangler.jsonc directly \u2014 concurrent workerd boots race on the shared .wrangler/state SQLite (SQLITE_BUSY).\nconst isDeployedWorker = () => {\n return (\n process.env.NODE_ENV === \"production\" &&\n process.env.BUILD_ENV !== \"build\" &&\n process.env.NEXT_PHASE !== \"phase-production-build\"\n );\n};\n\nexport const getEnv = async (): Promise<Env> => {\n if (isDeployedWorker()) {\n const { env } = await getCloudflareContext({ async: true });\n return envSchema.parse(env);\n }\n const raw = await fs.readFile(\n path.join(process.cwd(), \"wrangler.json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\"@opennextjs/cloudflare\";\nimport JSONC from \"tiny-jsonc\";\nimport { z } from \"zod\";\n\ntype Env = {\n CANOPY_API_HOST: string;\n PROJECT_ID: string;\n\n // Base URL of analytics-fire (e.g. https://data.replo.app). Read server-side by\n // the consent action (`consent/consent-actions.ts`) to forward proof-of-consent\n // records. Optional: absent in environments where the audit pipeline isn't\n // wired (e.g. local dev), where consent recording simply no-ops.\n ANALYTICS_FIRE_API_URL?: string;\n\n // Base URL of the Replo first-party analytics pixel CDN (e.g.\n // https://pixel.replo.app). `<ReploFirstPartyPixel>` loads\n // `${REPLO_ANALYTICS_PIXEL_URL}/latest.js` into the page once analytics consent\n // is granted; the browser fetches it directly. Optional: absent when the pixel\n // isn't configured (e.g. lean local dev), where the pixel simply isn't injected.\n REPLO_ANALYTICS_PIXEL_URL?: string;\n\n // NOTE (Gabe 2025-06-26): If there's no Shopify integration these will be\n // undefined.\n SHOPIFY_URL?: string;\n // NOTE (Gabe 2025-06-26): Even if there's an integration, if we haven't been\n // given elevated scope this may be null.\n SHOPIFY_STOREFRONT_ACCESS_TOKEN?: string | null;\n STRIPE_CONNECT_ACCOUNT_ID?: string | null;\n CHECKOUT_PROVIDER?: \"shopify\" | \"stripe\" | \"none\";\n\n REPLO_INTERNAL_REVALIDATE_SECRET?: string;\n /** Shared secret sent in X-Replo-Resolver-Auth for server-to-server cart calls. */\n CART_AUTH_SECRET?: string;\n};\n\nconst envSchema = z.object({\n CANOPY_API_HOST: z.string().min(1),\n PROJECT_ID: z.uuid(),\n ANALYTICS_FIRE_API_URL: z.string().optional(),\n REPLO_ANALYTICS_PIXEL_URL: z.string().optional(),\n SHOPIFY_URL: z.string().optional(),\n SHOPIFY_STOREFRONT_ACCESS_TOKEN: z.string().nullish(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullish(),\n CHECKOUT_PROVIDER: z.enum([\"shopify\", \"stripe\", \"none\"]).optional(),\n REPLO_INTERNAL_REVALIDATE_SECRET: z.string().optional(),\n CART_AUTH_SECRET: z.string().optional(),\n});\n\nconst wranglerConfigSchema = z.object({ vars: envSchema });\n\n// NOTE (Cole, 2026-07-28, REPL-29501): outside the deployed worker, read wrangler.jsonc directly \u2014 concurrent workerd boots race on the shared .wrangler/state SQLite (SQLITE_BUSY).\nconst isDeployedWorker = () => {\n return (\n process.env.NODE_ENV === \"production\" &&\n process.env.BUILD_ENV !== \"build\" &&\n process.env.NEXT_PHASE !== \"phase-production-build\"\n );\n};\n\nexport const getEnv = async (): Promise<Env> => {\n if (isDeployedWorker()) {\n const { env } = await getCloudflareContext({ async: true });\n return envSchema.parse(env);\n }\n // NOTE (Cole, 2026-07-29, REPL-29501): client chunks bundle this module (integration-utils has client consumers), so Node builtins must stay out of the static import graph \u2014 a static node:fs broke those chunks in 0.16.3; the computed specifier mirrors @opennextjs/cloudflare's wrangler import.\n const { promises: fs }: typeof import(\"node:fs\") = await import(\n `${\"__node:fs\".replaceAll(\"__\", \"\")}`\n );\n const raw = await fs.readFile(`${process.cwd()}/wrangler.jsonc`, \"utf8\");\n return wranglerConfigSchema.parse(JSONC.parse(raw)).vars;\n};\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AACrC,OAAO,WAAW;AAClB,SAAS,SAAS;AAiClB,MAAM,YAAY,EAAE,OAAO;AAAA,EACzB,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACjC,YAAY,EAAE,KAAK;AAAA,EACnB,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,2BAA2B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,iCAAiC,EAAE,OAAO,EAAE,QAAQ;AAAA,EACpD,2BAA2B,EAAE,OAAO,EAAE,QAAQ;AAAA,EAC9C,mBAAmB,EAAE,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,EAAE,SAAS;AAAA,EAClE,kCAAkC,EAAE,OAAO,EAAE,SAAS;AAAA,EACtD,kBAAkB,EAAE,OAAO,EAAE,SAAS;AACxC,CAAC;AAED,MAAM,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGzD,MAAM,mBAAmB,MAAM;AAC7B,SACE,QAAQ,IAAI,aAAa,gBACzB,QAAQ,IAAI,cAAc,WAC1B,QAAQ,IAAI,eAAe;AAE/B;AAEO,MAAM,SAAS,YAA0B;AAC9C,MAAI,iBAAiB,GAAG;AACtB,UAAM,EAAE,IAAI,IAAI,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;AAC1D,WAAO,UAAU,MAAM,GAAG;AAAA,EAC5B;AAEA,QAAM,EAAE,UAAU,GAAG,IAA8B,MAAM,OACvD,GAAG,YAAY,WAAW,MAAM,EAAE,CAAC;AAErC,QAAM,MAAM,MAAM,GAAG,SAAS,GAAG,QAAQ,IAAI,CAAC,mBAAmB,MAAM;AACvE,SAAO,qBAAqB,MAAM,MAAM,MAAM,GAAG,CAAC,EAAE;AACtD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "0.16.3",
3
+ "version": "0.16.4",
4
4
  "description": "Replo Canopy SDK — cart, analytics, data loaders, and editor runtime for agent-built Next.js sites.",
5
5
  "type": "module",
6
6
  "sideEffects": false,