@replohq/canopy-sdk 0.8.1 → 0.8.2

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.
@@ -1,4 +1,4 @@
1
- import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-YANWFPD5.mjs';
1
+ import { priceSchema, metafieldSchema, imageSchema, selectedOptionSchema, mediaSchema, productOptionSchema, productSchema } from '../../../../../chunk-5E25PJUK.mjs';
2
2
  import { sellingPlanGroupSchema } from '../../../../../chunk-4TZVNC3W.mjs';
3
3
  import { z } from 'zod';
4
4
 
@@ -1,2 +1,2 @@
1
- export { assetSchema, collectionSchema, customerIoBroadcastSchema, customerIoCampaignSchema, customerIoSegmentSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, looxReviewSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema, vwoCampaignSchema } from '../../chunk-YANWFPD5.mjs';
1
+ export { assetSchema, collectionSchema, customerIoBroadcastSchema, customerIoCampaignSchema, customerIoSegmentSchema, externalVideoSchema, getObjectTypeDefinition, imageSchema, integrationSchema, intelligemsExperienceSchema, levantaAffiliateLinkSchema, levantaProductSchema, looxReviewSchema, mediaImageSchema, mediaSchema, metafieldSchema, okendoReviewSchema, optionValueSchema, optionValueSwatchSchema, opusClipSchema, opusCollectionSchema, opusProjectSchema, pageSchema, planSchema, previewImageSchema, priceSchema, productOptionSchema, productSchema, registryItemSchema, segmentSourceSchema, selectedOptionSchema, transformReploProductToCanonical, variantSchema, videoSchema, videoSourceSchema, vwoCampaignSchema } from '../../chunk-5E25PJUK.mjs';
2
2
  import '../../chunk-4TZVNC3W.mjs';
@@ -27,7 +27,7 @@ export declare const registryItemVisibilitySchema: z.ZodEnum<{
27
27
  unlisted: "unlisted";
28
28
  }>;
29
29
  export declare const registrySlugSchema: z.ZodString;
30
- export declare const registryItemIdSchema: z.ZodString;
30
+ export declare const registryItemIdSchema: z.ZodUUID;
31
31
  export declare const registryContentFilesSchema: z.ZodRecord<z.ZodString, z.ZodString>;
32
32
  export declare const registryItemSourceIdentitySchema: z.ZodObject<{
33
33
  sourceType: z.ZodString;
@@ -36,29 +36,29 @@ export declare const registryItemSourceIdentitySchema: z.ZodObject<{
36
36
  export declare const siteRegistryItemMetadataSchema: z.ZodObject<{
37
37
  brandName: z.ZodOptional<z.ZodString>;
38
38
  brandDomain: z.ZodOptional<z.ZodString>;
39
- logoUrl: z.ZodOptional<z.ZodString>;
39
+ logoUrl: z.ZodOptional<z.ZodURL>;
40
40
  artifactRepo: z.ZodOptional<z.ZodString>;
41
- liveUrl: z.ZodOptional<z.ZodString>;
41
+ liveUrl: z.ZodOptional<z.ZodURL>;
42
42
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
43
  route: z.ZodString;
44
44
  name: z.ZodString;
45
- url: z.ZodString;
45
+ url: z.ZodURL;
46
46
  }, z.core.$strict>>>;
47
47
  }, z.core.$strict>;
48
48
  export declare const pageRegistryItemMetadataSchema: z.ZodObject<{
49
49
  brandName: z.ZodOptional<z.ZodString>;
50
50
  brandDomain: z.ZodOptional<z.ZodString>;
51
- logoUrl: z.ZodOptional<z.ZodString>;
51
+ logoUrl: z.ZodOptional<z.ZodURL>;
52
52
  }, z.core.$strict>;
53
53
  export declare const sectionRegistryItemMetadataSchema: z.ZodObject<{
54
54
  brandName: z.ZodOptional<z.ZodString>;
55
55
  brandDomain: z.ZodOptional<z.ZodString>;
56
- logoUrl: z.ZodOptional<z.ZodString>;
56
+ logoUrl: z.ZodOptional<z.ZodURL>;
57
57
  }, z.core.$strict>;
58
58
  export declare const brandingRegistryItemMetadataSchema: z.ZodObject<{
59
59
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- logoUrl: z.ZodOptional<z.ZodString>;
61
- faviconUrl: z.ZodOptional<z.ZodString>;
60
+ logoUrl: z.ZodOptional<z.ZodURL>;
61
+ faviconUrl: z.ZodOptional<z.ZodURL>;
62
62
  tagline: z.ZodOptional<z.ZodString>;
63
63
  }, z.core.$strict>;
64
64
  export declare const skillRegistryItemMetadataSchema: z.ZodObject<{
@@ -87,29 +87,29 @@ export declare const productRegistryItemMetadataSchema: z.ZodObject<{
87
87
  export declare const genericRegistryItemMetadataSchema: z.ZodUnion<readonly [z.ZodObject<{
88
88
  brandName: z.ZodOptional<z.ZodString>;
89
89
  brandDomain: z.ZodOptional<z.ZodString>;
90
- logoUrl: z.ZodOptional<z.ZodString>;
90
+ logoUrl: z.ZodOptional<z.ZodURL>;
91
91
  artifactRepo: z.ZodOptional<z.ZodString>;
92
- liveUrl: z.ZodOptional<z.ZodString>;
92
+ liveUrl: z.ZodOptional<z.ZodURL>;
93
93
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
94
  route: z.ZodString;
95
95
  name: z.ZodString;
96
- url: z.ZodString;
96
+ url: z.ZodURL;
97
97
  }, z.core.$strict>>>;
98
98
  }, z.core.$strict>, z.ZodObject<{
99
99
  brandName: z.ZodOptional<z.ZodString>;
100
100
  brandDomain: z.ZodOptional<z.ZodString>;
101
- logoUrl: z.ZodOptional<z.ZodString>;
101
+ logoUrl: z.ZodOptional<z.ZodURL>;
102
102
  }, z.core.$strict>, z.ZodObject<{
103
103
  brandName: z.ZodOptional<z.ZodString>;
104
104
  brandDomain: z.ZodOptional<z.ZodString>;
105
- logoUrl: z.ZodOptional<z.ZodString>;
105
+ logoUrl: z.ZodOptional<z.ZodURL>;
106
106
  }, z.core.$strict>, z.ZodObject<{
107
107
  command: z.ZodOptional<z.ZodString>;
108
108
  tagline: z.ZodOptional<z.ZodString>;
109
109
  }, z.core.$strict>, z.ZodObject<{
110
110
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
- logoUrl: z.ZodOptional<z.ZodString>;
112
- faviconUrl: z.ZodOptional<z.ZodString>;
111
+ logoUrl: z.ZodOptional<z.ZodURL>;
112
+ faviconUrl: z.ZodOptional<z.ZodURL>;
113
113
  tagline: z.ZodOptional<z.ZodString>;
114
114
  }, z.core.$strict>, z.ZodObject<{
115
115
  provider: z.ZodString;
@@ -146,29 +146,29 @@ export declare const registryItemMetadataSchema: z.ZodObject<{
146
146
  metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
147
147
  brandName: z.ZodOptional<z.ZodString>;
148
148
  brandDomain: z.ZodOptional<z.ZodString>;
149
- logoUrl: z.ZodOptional<z.ZodString>;
149
+ logoUrl: z.ZodOptional<z.ZodURL>;
150
150
  artifactRepo: z.ZodOptional<z.ZodString>;
151
- liveUrl: z.ZodOptional<z.ZodString>;
151
+ liveUrl: z.ZodOptional<z.ZodURL>;
152
152
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
153
  route: z.ZodString;
154
154
  name: z.ZodString;
155
- url: z.ZodString;
155
+ url: z.ZodURL;
156
156
  }, z.core.$strict>>>;
157
157
  }, z.core.$strict>, z.ZodObject<{
158
158
  brandName: z.ZodOptional<z.ZodString>;
159
159
  brandDomain: z.ZodOptional<z.ZodString>;
160
- logoUrl: z.ZodOptional<z.ZodString>;
160
+ logoUrl: z.ZodOptional<z.ZodURL>;
161
161
  }, z.core.$strict>, z.ZodObject<{
162
162
  brandName: z.ZodOptional<z.ZodString>;
163
163
  brandDomain: z.ZodOptional<z.ZodString>;
164
- logoUrl: z.ZodOptional<z.ZodString>;
164
+ logoUrl: z.ZodOptional<z.ZodURL>;
165
165
  }, z.core.$strict>, z.ZodObject<{
166
166
  command: z.ZodOptional<z.ZodString>;
167
167
  tagline: z.ZodOptional<z.ZodString>;
168
168
  }, z.core.$strict>, z.ZodObject<{
169
169
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
170
- logoUrl: z.ZodOptional<z.ZodString>;
171
- faviconUrl: z.ZodOptional<z.ZodString>;
170
+ logoUrl: z.ZodOptional<z.ZodURL>;
171
+ faviconUrl: z.ZodOptional<z.ZodURL>;
172
172
  tagline: z.ZodOptional<z.ZodString>;
173
173
  }, z.core.$strict>, z.ZodObject<{
174
174
  provider: z.ZodString;
@@ -219,29 +219,29 @@ export declare const registryListItemsResultSchema: z.ZodObject<{
219
219
  metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
220
220
  brandName: z.ZodOptional<z.ZodString>;
221
221
  brandDomain: z.ZodOptional<z.ZodString>;
222
- logoUrl: z.ZodOptional<z.ZodString>;
222
+ logoUrl: z.ZodOptional<z.ZodURL>;
223
223
  artifactRepo: z.ZodOptional<z.ZodString>;
224
- liveUrl: z.ZodOptional<z.ZodString>;
224
+ liveUrl: z.ZodOptional<z.ZodURL>;
225
225
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
226
226
  route: z.ZodString;
227
227
  name: z.ZodString;
228
- url: z.ZodString;
228
+ url: z.ZodURL;
229
229
  }, z.core.$strict>>>;
230
230
  }, z.core.$strict>, z.ZodObject<{
231
231
  brandName: z.ZodOptional<z.ZodString>;
232
232
  brandDomain: z.ZodOptional<z.ZodString>;
233
- logoUrl: z.ZodOptional<z.ZodString>;
233
+ logoUrl: z.ZodOptional<z.ZodURL>;
234
234
  }, z.core.$strict>, z.ZodObject<{
235
235
  brandName: z.ZodOptional<z.ZodString>;
236
236
  brandDomain: z.ZodOptional<z.ZodString>;
237
- logoUrl: z.ZodOptional<z.ZodString>;
237
+ logoUrl: z.ZodOptional<z.ZodURL>;
238
238
  }, z.core.$strict>, z.ZodObject<{
239
239
  command: z.ZodOptional<z.ZodString>;
240
240
  tagline: z.ZodOptional<z.ZodString>;
241
241
  }, z.core.$strict>, z.ZodObject<{
242
242
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
- logoUrl: z.ZodOptional<z.ZodString>;
244
- faviconUrl: z.ZodOptional<z.ZodString>;
243
+ logoUrl: z.ZodOptional<z.ZodURL>;
244
+ faviconUrl: z.ZodOptional<z.ZodURL>;
245
245
  tagline: z.ZodOptional<z.ZodString>;
246
246
  }, z.core.$strict>, z.ZodObject<{
247
247
  provider: z.ZodString;
@@ -299,29 +299,29 @@ export declare const registryItemDetailSchema: z.ZodObject<{
299
299
  metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
300
300
  brandName: z.ZodOptional<z.ZodString>;
301
301
  brandDomain: z.ZodOptional<z.ZodString>;
302
- logoUrl: z.ZodOptional<z.ZodString>;
302
+ logoUrl: z.ZodOptional<z.ZodURL>;
303
303
  artifactRepo: z.ZodOptional<z.ZodString>;
304
- liveUrl: z.ZodOptional<z.ZodString>;
304
+ liveUrl: z.ZodOptional<z.ZodURL>;
305
305
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
306
306
  route: z.ZodString;
307
307
  name: z.ZodString;
308
- url: z.ZodString;
308
+ url: z.ZodURL;
309
309
  }, z.core.$strict>>>;
310
310
  }, z.core.$strict>, z.ZodObject<{
311
311
  brandName: z.ZodOptional<z.ZodString>;
312
312
  brandDomain: z.ZodOptional<z.ZodString>;
313
- logoUrl: z.ZodOptional<z.ZodString>;
313
+ logoUrl: z.ZodOptional<z.ZodURL>;
314
314
  }, z.core.$strict>, z.ZodObject<{
315
315
  brandName: z.ZodOptional<z.ZodString>;
316
316
  brandDomain: z.ZodOptional<z.ZodString>;
317
- logoUrl: z.ZodOptional<z.ZodString>;
317
+ logoUrl: z.ZodOptional<z.ZodURL>;
318
318
  }, z.core.$strict>, z.ZodObject<{
319
319
  command: z.ZodOptional<z.ZodString>;
320
320
  tagline: z.ZodOptional<z.ZodString>;
321
321
  }, z.core.$strict>, z.ZodObject<{
322
322
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
- logoUrl: z.ZodOptional<z.ZodString>;
324
- faviconUrl: z.ZodOptional<z.ZodString>;
323
+ logoUrl: z.ZodOptional<z.ZodURL>;
324
+ faviconUrl: z.ZodOptional<z.ZodURL>;
325
325
  tagline: z.ZodOptional<z.ZodString>;
326
326
  }, z.core.$strict>, z.ZodObject<{
327
327
  provider: z.ZodString;
@@ -373,29 +373,29 @@ export declare const registryItemPreviewResultSchema: z.ZodObject<{
373
373
  metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
374
374
  brandName: z.ZodOptional<z.ZodString>;
375
375
  brandDomain: z.ZodOptional<z.ZodString>;
376
- logoUrl: z.ZodOptional<z.ZodString>;
376
+ logoUrl: z.ZodOptional<z.ZodURL>;
377
377
  artifactRepo: z.ZodOptional<z.ZodString>;
378
- liveUrl: z.ZodOptional<z.ZodString>;
378
+ liveUrl: z.ZodOptional<z.ZodURL>;
379
379
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
380
380
  route: z.ZodString;
381
381
  name: z.ZodString;
382
- url: z.ZodString;
382
+ url: z.ZodURL;
383
383
  }, z.core.$strict>>>;
384
384
  }, z.core.$strict>, z.ZodObject<{
385
385
  brandName: z.ZodOptional<z.ZodString>;
386
386
  brandDomain: z.ZodOptional<z.ZodString>;
387
- logoUrl: z.ZodOptional<z.ZodString>;
387
+ logoUrl: z.ZodOptional<z.ZodURL>;
388
388
  }, z.core.$strict>, z.ZodObject<{
389
389
  brandName: z.ZodOptional<z.ZodString>;
390
390
  brandDomain: z.ZodOptional<z.ZodString>;
391
- logoUrl: z.ZodOptional<z.ZodString>;
391
+ logoUrl: z.ZodOptional<z.ZodURL>;
392
392
  }, z.core.$strict>, z.ZodObject<{
393
393
  command: z.ZodOptional<z.ZodString>;
394
394
  tagline: z.ZodOptional<z.ZodString>;
395
395
  }, z.core.$strict>, z.ZodObject<{
396
396
  palette: z.ZodOptional<z.ZodArray<z.ZodString>>;
397
- logoUrl: z.ZodOptional<z.ZodString>;
398
- faviconUrl: z.ZodOptional<z.ZodString>;
397
+ logoUrl: z.ZodOptional<z.ZodURL>;
398
+ faviconUrl: z.ZodOptional<z.ZodURL>;
399
399
  tagline: z.ZodOptional<z.ZodString>;
400
400
  }, z.core.$strict>, z.ZodObject<{
401
401
  provider: z.ZodString;
@@ -451,7 +451,7 @@ export declare const registryItemContentSchema: z.ZodObject<{
451
451
  dependencies: z.ZodArray<z.ZodString>;
452
452
  }, z.core.$strip>;
453
453
  export declare const registryItemDocumentSchema: z.ZodObject<{
454
- id: z.ZodString;
454
+ id: z.ZodUUID;
455
455
  slug: z.ZodString;
456
456
  name: z.ZodString;
457
457
  type: z.ZodEnum<{
@@ -484,7 +484,7 @@ export declare const registryItemDocumentSchema: z.ZodObject<{
484
484
  }, z.core.$strip>;
485
485
  export declare const registryCreateItemInputSchema: z.ZodObject<{
486
486
  item: z.ZodObject<{
487
- id: z.ZodString;
487
+ id: z.ZodUUID;
488
488
  slug: z.ZodString;
489
489
  name: z.ZodString;
490
490
  type: z.ZodEnum<{
@@ -516,7 +516,7 @@ export declare const registryCreateItemInputSchema: z.ZodObject<{
516
516
  }, z.core.$strip>;
517
517
  export declare const registryCreateItemOutputSchema: z.ZodObject<{
518
518
  created: z.ZodObject<{
519
- id: z.ZodString;
519
+ id: z.ZodUUID;
520
520
  type: z.ZodEnum<{
521
521
  product: "product";
522
522
  plan: "plan";
@@ -529,8 +529,8 @@ export declare const registryCreateItemOutputSchema: z.ZodObject<{
529
529
  slug: z.ZodString;
530
530
  sourceType: z.ZodNullable<z.ZodString>;
531
531
  sourceKey: z.ZodNullable<z.ZodString>;
532
- url: z.ZodString;
533
- shareUrl: z.ZodNullable<z.ZodString>;
532
+ url: z.ZodURL;
533
+ shareUrl: z.ZodNullable<z.ZodURL>;
534
534
  }, z.core.$strip>;
535
535
  }, z.core.$strip>;
536
536
  export declare const registryCatalogUpsertInputSchema: z.ZodObject<{
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
  var registryItemTypeSchema = z.enum(["site", "page", "section", "skill", "plan", "branding", "product"]).describe("RegistryItemType");
5
5
  var registryItemVisibilitySchema = z.enum(["public", "unlisted"]).describe("RegistryItemVisibility");
6
6
  var registrySlugSchema = z.string().min(1).max(120).regex(/^[\da-z][\d_a-z-]*$/);
7
- var registryItemIdSchema = z.string().uuid();
7
+ var registryItemIdSchema = z.uuid();
8
8
  var registryContentFilesSchema = z.record(z.string().min(1), z.string()).refine((files) => Object.keys(files).length > 0, {
9
9
  message: "Registry item content must include at least one file"
10
10
  });
@@ -15,24 +15,24 @@ z.object({
15
15
  var visualDisplayMetadataSchema = z.object({
16
16
  brandName: z.string().optional(),
17
17
  brandDomain: z.string().optional(),
18
- logoUrl: z.string().url().optional()
18
+ logoUrl: z.url().optional()
19
19
  }).strict();
20
20
  var siteTemplatePageSchema = z.object({
21
21
  route: z.string(),
22
22
  name: z.string(),
23
- url: z.string().url()
23
+ url: z.url()
24
24
  }).strict();
25
25
  var siteRegistryItemMetadataSchema = visualDisplayMetadataSchema.extend({
26
26
  artifactRepo: z.string().optional(),
27
- liveUrl: z.string().url().optional(),
27
+ liveUrl: z.url().optional(),
28
28
  pages: z.array(siteTemplatePageSchema).optional()
29
29
  }).describe("SiteRegistryItemMetadata");
30
30
  var pageRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("PageRegistryItemMetadata");
31
31
  var sectionRegistryItemMetadataSchema = visualDisplayMetadataSchema.describe("SectionRegistryItemMetadata");
32
32
  var brandingRegistryItemMetadataSchema = z.object({
33
33
  palette: z.array(z.string()).max(8).optional(),
34
- logoUrl: z.string().url().optional(),
35
- faviconUrl: z.string().url().optional(),
34
+ logoUrl: z.url().optional(),
35
+ faviconUrl: z.url().optional(),
36
36
  tagline: z.string().max(140).optional()
37
37
  }).strict().describe("BrandingRegistryItemMetadata");
38
38
  var skillRegistryItemMetadataSchema = z.object({
@@ -116,7 +116,7 @@ z.object({
116
116
  dependencies: z.array(z.string())
117
117
  }).describe("RegistryItemContent");
118
118
  z.object({
119
- id: z.string().uuid(),
119
+ id: z.uuid(),
120
120
  slug: z.string().min(1),
121
121
  name: z.string().min(1),
122
122
  type: registryItemTypeSchema,
@@ -151,7 +151,11 @@ z.object({
151
151
  sourceKey: z.string().min(1).max(512).nullable().default(null),
152
152
  description: z.string().nullable().default(null),
153
153
  metadata: z.record(z.string(), z.unknown()).nullable().default(null),
154
- visibility: registryItemVisibilitySchema.default("public"),
154
+ // (Ezra, 2026-07-07, REPL-27571): owned channels (REST create, MCP
155
+ // create_registry_item) may not author public items — only the internal
156
+ // registry-catalog endpoint does — so an omitted visibility must resolve
157
+ // to the project-scoped lane instead of silently going public.
158
+ visibility: registryItemVisibilitySchema.default("unlisted"),
155
159
  tags: z.array(z.string()).default([]),
156
160
  category: z.string().nullable().default(null),
157
161
  previewUrls: z.array(z.string()).default([]),
@@ -167,10 +171,10 @@ z.object({
167
171
  slug: registrySlugSchema,
168
172
  sourceType: z.string().nullable(),
169
173
  sourceKey: z.string().nullable(),
170
- url: z.string().url().describe(
174
+ url: z.url().describe(
171
175
  "Canonical public-facing URL for the new registry item. The skill returns this to the user immediately so they can share / preview without waiting on verification."
172
176
  ),
173
- shareUrl: z.string().url().nullable()
177
+ shareUrl: z.url().nullable()
174
178
  })
175
179
  }).describe("RegistryCreateItemOutput");
176
180
  z.object({
package/env.d.ts CHANGED
@@ -11,5 +11,10 @@ type Env = {
11
11
  /** Shared secret sent in X-Replo-Resolver-Auth for server-to-server cart calls. */
12
12
  CART_AUTH_SECRET?: string;
13
13
  };
14
+ declare const fetchCloudflareContext: () => Promise<import("@opennextjs/cloudflare").CloudflareContext<IncomingRequestCfProperties, ExecutionContext>>;
15
+ type CloudflareContextPromise = ReturnType<typeof fetchCloudflareContext>;
16
+ declare global {
17
+ var canopyCloudflareContextPromise: CloudflareContextPromise | undefined;
18
+ }
14
19
  export declare const getEnv: () => Promise<Env>;
15
20
  export {};
package/env.js CHANGED
@@ -2,7 +2,7 @@ import { getCloudflareContext } from "@opennextjs/cloudflare";
2
2
  import { z } from "zod";
3
3
  const envSchema = z.object({
4
4
  CANOPY_API_HOST: z.string().min(1),
5
- PROJECT_ID: z.string().uuid(),
5
+ PROJECT_ID: z.uuid(),
6
6
  ANALYTICS_FIRE_API_URL: z.string().optional(),
7
7
  REPLO_ANALYTICS_PIXEL_URL: z.string().optional(),
8
8
  SHOPIFY_URL: z.string().optional(),
@@ -12,8 +12,16 @@ const envSchema = z.object({
12
12
  REPLO_INTERNAL_REVALIDATE_SECRET: z.string().optional(),
13
13
  CART_AUTH_SECRET: z.string().optional()
14
14
  });
15
+ const fetchCloudflareContext = () => getCloudflareContext({ async: true });
16
+ const getSharedCloudflareContext = () => {
17
+ if (process.env.NODE_ENV !== "development") return fetchCloudflareContext();
18
+ return globalThis.canopyCloudflareContextPromise ??= fetchCloudflareContext().catch((error) => {
19
+ globalThis.canopyCloudflareContextPromise = void 0;
20
+ throw error;
21
+ });
22
+ };
15
23
  const getEnv = async () => {
16
- const { env } = await getCloudflareContext({ async: true });
24
+ const { env } = await getSharedCloudflareContext();
17
25
  return envSchema.parse(env);
18
26
  };
19
27
  export {
package/env.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../env.ts"],
4
- "sourcesContent": ["import { getCloudflareContext } from \"@opennextjs/cloudflare\";\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.string().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().nullable().optional(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullable().optional(),\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\nexport const getEnv = async (): Promise<Env> => {\n const { env } = await getCloudflareContext({ async: true });\n return envSchema.parse(env);\n};\n"],
5
- "mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAiClB,MAAM,YAAY,EAAE,OAAO;AAAA,EACzB,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACjC,YAAY,EAAE,OAAO,EAAE,KAAK;AAAA,EAC5B,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,SAAS,EAAE,SAAS;AAAA,EAChE,2BAA2B,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1D,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;AAEM,MAAM,SAAS,YAA0B;AAC9C,QAAM,EAAE,IAAI,IAAI,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;AAC1D,SAAO,UAAU,MAAM,GAAG;AAC5B;",
4
+ "sourcesContent": ["import { getCloudflareContext } from \"@opennextjs/cloudflare\";\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().nullable().optional(),\n STRIPE_CONNECT_ACCOUNT_ID: z.string().nullable().optional(),\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 fetchCloudflareContext = () => getCloudflareContext({ async: true });\ntype CloudflareContextPromise = ReturnType<typeof fetchCloudflareContext>;\n\ndeclare global {\n var canopyCloudflareContextPromise: CloudflareContextPromise | undefined;\n}\n\n// (Andrew, 2026-07-08, REPL-29048): memoize the in-flight dev init so concurrent cold-start renders share one workerd, not separate ones racing on the same SQLite lock (SQLITE_BUSY).\nconst getSharedCloudflareContext = (): CloudflareContextPromise => {\n if (process.env.NODE_ENV !== \"development\") return fetchCloudflareContext();\n return (globalThis.canopyCloudflareContextPromise ??=\n fetchCloudflareContext().catch((error: unknown) => {\n globalThis.canopyCloudflareContextPromise = undefined; // let the next request retry instead of caching a rejection\n throw error;\n }));\n};\n\nexport const getEnv = async (): Promise<Env> => {\n const { env } = await getSharedCloudflareContext();\n return envSchema.parse(env);\n};\n"],
5
+ "mappings": "AAAA,SAAS,4BAA4B;AACrC,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,SAAS,EAAE,SAAS;AAAA,EAChE,2BAA2B,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1D,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,yBAAyB,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;AAQzE,MAAM,6BAA6B,MAAgC;AACjE,MAAI,QAAQ,IAAI,aAAa,cAAe,QAAO,uBAAuB;AAC1E,SAAQ,WAAW,mCACjB,uBAAuB,EAAE,MAAM,CAAC,UAAmB;AACjD,eAAW,iCAAiC;AAC5C,UAAM;AAAA,EACR,CAAC;AACL;AAEO,MAAM,SAAS,YAA0B;AAC9C,QAAM,EAAE,IAAI,IAAI,MAAM,2BAA2B;AACjD,SAAO,UAAU,MAAM,GAAG;AAC5B;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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,