@uniformdev/canvas-next-rsc 19.147.0 → 19.147.1-alpha.10

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.
@@ -36,6 +36,9 @@ type ResolveComponentFunction = (options: {
36
36
  type ResolveComponentResult = {
37
37
  component: ComponentType<ComponentProps<any, any>> | null;
38
38
  includeContext?: boolean;
39
+ suspense?: {
40
+ fallback: ComponentType<any> | undefined;
41
+ };
39
42
  };
40
43
  declare const resolveComposition: (props: Omit<ResolveComponentsOptions, 'slotName' | 'slotIndex' | 'target'> & {
41
44
  composition: ComponentInstance;
@@ -36,6 +36,9 @@ type ResolveComponentFunction = (options: {
36
36
  type ResolveComponentResult = {
37
37
  component: ComponentType<ComponentProps<any, any>> | null;
38
38
  includeContext?: boolean;
39
+ suspense?: {
40
+ fallback: ComponentType<any> | undefined;
41
+ };
39
42
  };
40
43
  declare const resolveComposition: (props: Omit<ResolveComponentsOptions, 'slotName' | 'slotIndex' | 'target'> & {
41
44
  composition: ComponentInstance;
@@ -1,7 +1,7 @@
1
1
  import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
2
2
  export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
4
- export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-D4tBQ2U4.mjs';
4
+ export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-B-Z17dUt.mjs';
5
5
  import { ComponentInstance } from '@uniformdev/canvas';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
@@ -55,6 +55,15 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
55
55
  component: ComponentInstance;
56
56
  } & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children"> & React__default.RefAttributes<unknown>>;
57
57
 
58
+ type UniformRichTextNodeProps = {
59
+ node: RichTextNode;
60
+ resolveRichTextRenderer?: RenderRichTextComponentResolver;
61
+ };
62
+ /**
63
+ * Render a single RichText node
64
+ */
65
+ declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps): React__default.JSX.Element | null;
66
+
58
67
  type CustomSlotChildRenderFunc = (options: {
59
68
  child: ReactNode;
60
69
  component: ComponentInstance;
@@ -75,4 +84,4 @@ type UniformTextProps = {
75
84
  } & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
76
85
  declare const UniformText: ({ context, ...rest }: UniformTextProps) => React__default.JSX.Element;
77
86
 
78
- export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
87
+ export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
@@ -1,7 +1,7 @@
1
1
  import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
2
2
  export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
3
3
  import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
4
- export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-D4tBQ2U4.js';
4
+ export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-B-Z17dUt.js';
5
5
  import { ComponentInstance } from '@uniformdev/canvas';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
@@ -55,6 +55,15 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
55
55
  component: ComponentInstance;
56
56
  } & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children"> & React__default.RefAttributes<unknown>>;
57
57
 
58
+ type UniformRichTextNodeProps = {
59
+ node: RichTextNode;
60
+ resolveRichTextRenderer?: RenderRichTextComponentResolver;
61
+ };
62
+ /**
63
+ * Render a single RichText node
64
+ */
65
+ declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps): React__default.JSX.Element | null;
66
+
58
67
  type CustomSlotChildRenderFunc = (options: {
59
68
  child: ReactNode;
60
69
  component: ComponentInstance;
@@ -75,4 +84,4 @@ type UniformTextProps = {
75
84
  } & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
76
85
  declare const UniformText: ({ context, ...rest }: UniformTextProps) => React__default.JSX.Element;
77
86
 
78
- export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
87
+ export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
package/dist/component.js CHANGED
@@ -32,6 +32,7 @@ var component_exports = {};
32
32
  __export(component_exports, {
33
33
  DefaultNotImplementedComponent: () => DefaultNotImplementedComponent,
34
34
  UniformRichText: () => UniformRichText,
35
+ UniformRichTextNode: () => UniformRichTextNode,
35
36
  UniformSlot: () => UniformSlot,
36
37
  UniformText: () => UniformText,
37
38
  createClientUniformContext: () => import_canvas_next_rsc_client.createClientUniformContext,
@@ -212,6 +213,7 @@ var import_canvas_next_rsc_client = require("@uniformdev/canvas-next-rsc-client"
212
213
  0 && (module.exports = {
213
214
  DefaultNotImplementedComponent,
214
215
  UniformRichText,
216
+ UniformRichTextNode,
215
217
  UniformSlot,
216
218
  UniformText,
217
219
  createClientUniformContext,
@@ -176,6 +176,7 @@ import {
176
176
  export {
177
177
  DefaultNotImplementedComponent,
178
178
  UniformRichText,
179
+ UniformRichTextNode,
179
180
  UniformSlot,
180
181
  UniformText,
181
182
  createClientUniformContext,
package/dist/handler.js CHANGED
@@ -228,6 +228,7 @@ var getCanvasClient = (options) => {
228
228
  apiHost: env.getApiHost(),
229
229
  apiKey: env.getApiKey(),
230
230
  edgeApiHost: env.getEdgeApiHost(),
231
+ disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
231
232
  fetch: (req, init) => {
232
233
  let requestedUrl;
233
234
  if (typeof req === "string") {
@@ -259,7 +260,7 @@ var getCanvasClient = (options) => {
259
260
  cache,
260
261
  headers: {
261
262
  ...init == null ? void 0 : init.headers,
262
- "x-bypass-cache": "true"
263
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
263
264
  },
264
265
  next: {
265
266
  revalidate
@@ -282,7 +283,7 @@ var getProjectMapClient = (options) => {
282
283
  ...init,
283
284
  headers: {
284
285
  ...init == null ? void 0 : init.headers,
285
- "x-bypass-cache": "true"
286
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
286
287
  },
287
288
  cache,
288
289
  next: {
@@ -301,6 +302,7 @@ var getRouteClient = (options) => {
301
302
  projectId: env.getProjectId(),
302
303
  apiKey: env.getApiKey(),
303
304
  edgeApiHost: env.getEdgeApiHost(),
305
+ disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
304
306
  fetch: (req, init) => {
305
307
  let requestedUrl;
306
308
  if (typeof req === "string") {
@@ -328,7 +330,7 @@ var getRouteClient = (options) => {
328
330
  ...init,
329
331
  headers: {
330
332
  ...init == null ? void 0 : init.headers,
331
- "x-bypass-cache": "true"
333
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
332
334
  },
333
335
  cache,
334
336
  next: {
@@ -382,6 +384,7 @@ var processCompositionChange = async (compositionId) => {
382
384
  getComposition({ compositionId })
383
385
  ]);
384
386
  const tags = [];
387
+ const paths = [];
385
388
  if (composition == null ? void 0 : composition.pattern) {
386
389
  tags.push("route");
387
390
  }
@@ -391,12 +394,17 @@ var processCompositionChange = async (compositionId) => {
391
394
  await processEdgeConfigChange({
392
395
  source_url: node.path
393
396
  });
394
- tags.push(...buildProjectMapNodePaths(node.path));
397
+ const result = buildProjectMapNodePaths(node.path);
398
+ tags.push(...result.tags);
399
+ if (result.paths) {
400
+ paths.push(...result.paths);
401
+ }
395
402
  }
396
403
  }
397
404
  tags.push(buildCompositionTag(compositionId));
398
405
  return {
399
- tags
406
+ tags,
407
+ paths
400
408
  };
401
409
  };
402
410
  var getComposition = async ({ compositionId }) => {
@@ -419,9 +427,11 @@ var getComposition = async ({ compositionId }) => {
419
427
  };
420
428
  var buildProjectMapNodePaths = (path) => {
421
429
  const tags = [];
430
+ const paths = [];
422
431
  const isDynamic = path.includes(":");
423
432
  if (!isDynamic) {
424
433
  tags.push(buildPathTag(path));
434
+ paths.push(path);
425
435
  } else {
426
436
  const pieces = path.split("/");
427
437
  const invalidatePieces = [];
@@ -434,8 +444,12 @@ var buildProjectMapNodePaths = (path) => {
434
444
  }
435
445
  const toInvalidate = invalidatePieces.join("/");
436
446
  tags.push(buildPathTag(toInvalidate));
447
+ paths.push(toInvalidate);
437
448
  }
438
- return tags;
449
+ return {
450
+ tags,
451
+ paths
452
+ };
439
453
  };
440
454
  var getPathName = (url) => {
441
455
  try {
@@ -450,7 +464,8 @@ var processRedirectChange = async (sourceUrl) => {
450
464
  const pathName = getPathName(sourceUrl);
451
465
  tags.push(buildPathTag(pathName));
452
466
  return {
453
- tags
467
+ tags,
468
+ paths: [pathName]
454
469
  };
455
470
  };
456
471
  var processEdgeConfigChange = async ({ source_url }) => {
@@ -557,7 +572,12 @@ var handleProjectMapNodeDelete = async (body) => {
557
572
  return void 0;
558
573
  }
559
574
  const tags = [];
560
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
575
+ const paths = [];
576
+ const result = buildProjectMapNodePaths(parsed.data.path);
577
+ tags.push(...result.tags);
578
+ if (result.paths) {
579
+ paths.push(...result.paths);
580
+ }
561
581
  const config = getServerConfig();
562
582
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
563
583
  await processEdgeConfigChange({
@@ -565,7 +585,8 @@ var handleProjectMapNodeDelete = async (body) => {
565
585
  });
566
586
  }
567
587
  return {
568
- tags
588
+ tags,
589
+ paths
569
590
  };
570
591
  };
571
592
 
@@ -578,7 +599,12 @@ var handleProjectMapNodeInsert = async (body) => {
578
599
  return void 0;
579
600
  }
580
601
  const tags = [];
581
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
602
+ const paths = [];
603
+ const result = buildProjectMapNodePaths(parsed.data.path);
604
+ tags.push(...result.tags);
605
+ if (result.paths) {
606
+ paths.push(...result.paths);
607
+ }
582
608
  const config = getServerConfig();
583
609
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
584
610
  await processEdgeConfigChange({
@@ -586,7 +612,8 @@ var handleProjectMapNodeInsert = async (body) => {
586
612
  });
587
613
  }
588
614
  return {
589
- tags
615
+ tags,
616
+ paths
590
617
  };
591
618
  };
592
619
 
@@ -599,8 +626,17 @@ var handleProjectMapNodeUpdate = async (body) => {
599
626
  return void 0;
600
627
  }
601
628
  const tags = [];
602
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
603
- tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
629
+ const paths = [];
630
+ const currentResult = buildProjectMapNodePaths(parsed.data.path);
631
+ tags.push(...currentResult.tags);
632
+ if (currentResult.paths) {
633
+ paths.push(...currentResult.paths);
634
+ }
635
+ const previousResult = buildProjectMapNodePaths(parsed.data.previous_path);
636
+ tags.push(...previousResult.tags);
637
+ if (previousResult.paths) {
638
+ paths.push(...previousResult.paths);
639
+ }
604
640
  const config = getServerConfig();
605
641
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
606
642
  await processEdgeConfigChange({
@@ -608,7 +644,8 @@ var handleProjectMapNodeUpdate = async (body) => {
608
644
  });
609
645
  }
610
646
  return {
611
- tags
647
+ tags,
648
+ paths
612
649
  };
613
650
  };
614
651
 
@@ -703,6 +740,7 @@ var handleSvixMessage = async (request) => {
703
740
  handleManifestPublished
704
741
  ];
705
742
  let tags = void 0;
743
+ let paths = void 0;
706
744
  let jsonBody;
707
745
  try {
708
746
  jsonBody = await request.json();
@@ -715,6 +753,7 @@ var handleSvixMessage = async (request) => {
715
753
  const result = await handler(jsonBody);
716
754
  if (result) {
717
755
  tags = result.tags;
756
+ paths = result.paths;
718
757
  break;
719
758
  }
720
759
  }
@@ -724,10 +763,17 @@ var handleSvixMessage = async (request) => {
724
763
  (0, import_cache.revalidateTag)(tag);
725
764
  }
726
765
  }
766
+ if (paths == null ? void 0 : paths.length) {
767
+ for (let i = 0; i < paths.length; i++) {
768
+ const path = paths[i];
769
+ (0, import_cache.revalidatePath)(path);
770
+ }
771
+ }
727
772
  return new Response(
728
773
  JSON.stringify({
729
- handled: typeof tags !== "undefined",
730
- tags
774
+ handled: typeof tags !== "undefined" || typeof paths !== "undefined",
775
+ tags,
776
+ paths
731
777
  })
732
778
  );
733
779
  };
package/dist/handler.mjs CHANGED
@@ -142,7 +142,7 @@ var createPreviewOPTIONSRouteHandler = () => {
142
142
 
143
143
  // src/handler/createPreviewPOSTRouteHandler.ts
144
144
  import { SECRET_QUERY_STRING_PARAM as SECRET_QUERY_STRING_PARAM2 } from "@uniformdev/canvas";
145
- import { revalidateTag } from "next/cache";
145
+ import { revalidatePath, revalidateTag } from "next/cache";
146
146
 
147
147
  // src/handler/helpers.ts
148
148
  import { ApiClientError } from "@uniformdev/canvas";
@@ -213,6 +213,7 @@ var getCanvasClient = (options) => {
213
213
  apiHost: env.getApiHost(),
214
214
  apiKey: env.getApiKey(),
215
215
  edgeApiHost: env.getEdgeApiHost(),
216
+ disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
216
217
  fetch: (req, init) => {
217
218
  let requestedUrl;
218
219
  if (typeof req === "string") {
@@ -244,7 +245,7 @@ var getCanvasClient = (options) => {
244
245
  cache,
245
246
  headers: {
246
247
  ...init == null ? void 0 : init.headers,
247
- "x-bypass-cache": "true"
248
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
248
249
  },
249
250
  next: {
250
251
  revalidate
@@ -267,7 +268,7 @@ var getProjectMapClient = (options) => {
267
268
  ...init,
268
269
  headers: {
269
270
  ...init == null ? void 0 : init.headers,
270
- "x-bypass-cache": "true"
271
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
271
272
  },
272
273
  cache,
273
274
  next: {
@@ -286,6 +287,7 @@ var getRouteClient = (options) => {
286
287
  projectId: env.getProjectId(),
287
288
  apiKey: env.getApiKey(),
288
289
  edgeApiHost: env.getEdgeApiHost(),
290
+ disableSWR: typeof options.cache.disableSWR !== "undefined" ? options.cache.disableSWR : true,
289
291
  fetch: (req, init) => {
290
292
  let requestedUrl;
291
293
  if (typeof req === "string") {
@@ -313,7 +315,7 @@ var getRouteClient = (options) => {
313
315
  ...init,
314
316
  headers: {
315
317
  ...init == null ? void 0 : init.headers,
316
- "x-bypass-cache": "true"
318
+ "x-bypass-cache": typeof options.cache.bypassCache !== "undefined" ? options.cache.bypassCache.toString() : "false"
317
319
  },
318
320
  cache,
319
321
  next: {
@@ -367,6 +369,7 @@ var processCompositionChange = async (compositionId) => {
367
369
  getComposition({ compositionId })
368
370
  ]);
369
371
  const tags = [];
372
+ const paths = [];
370
373
  if (composition == null ? void 0 : composition.pattern) {
371
374
  tags.push("route");
372
375
  }
@@ -376,12 +379,17 @@ var processCompositionChange = async (compositionId) => {
376
379
  await processEdgeConfigChange({
377
380
  source_url: node.path
378
381
  });
379
- tags.push(...buildProjectMapNodePaths(node.path));
382
+ const result = buildProjectMapNodePaths(node.path);
383
+ tags.push(...result.tags);
384
+ if (result.paths) {
385
+ paths.push(...result.paths);
386
+ }
380
387
  }
381
388
  }
382
389
  tags.push(buildCompositionTag(compositionId));
383
390
  return {
384
- tags
391
+ tags,
392
+ paths
385
393
  };
386
394
  };
387
395
  var getComposition = async ({ compositionId }) => {
@@ -404,9 +412,11 @@ var getComposition = async ({ compositionId }) => {
404
412
  };
405
413
  var buildProjectMapNodePaths = (path) => {
406
414
  const tags = [];
415
+ const paths = [];
407
416
  const isDynamic = path.includes(":");
408
417
  if (!isDynamic) {
409
418
  tags.push(buildPathTag(path));
419
+ paths.push(path);
410
420
  } else {
411
421
  const pieces = path.split("/");
412
422
  const invalidatePieces = [];
@@ -419,8 +429,12 @@ var buildProjectMapNodePaths = (path) => {
419
429
  }
420
430
  const toInvalidate = invalidatePieces.join("/");
421
431
  tags.push(buildPathTag(toInvalidate));
432
+ paths.push(toInvalidate);
422
433
  }
423
- return tags;
434
+ return {
435
+ tags,
436
+ paths
437
+ };
424
438
  };
425
439
  var getPathName = (url) => {
426
440
  try {
@@ -435,7 +449,8 @@ var processRedirectChange = async (sourceUrl) => {
435
449
  const pathName = getPathName(sourceUrl);
436
450
  tags.push(buildPathTag(pathName));
437
451
  return {
438
- tags
452
+ tags,
453
+ paths: [pathName]
439
454
  };
440
455
  };
441
456
  var processEdgeConfigChange = async ({ source_url }) => {
@@ -542,7 +557,12 @@ var handleProjectMapNodeDelete = async (body) => {
542
557
  return void 0;
543
558
  }
544
559
  const tags = [];
545
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
560
+ const paths = [];
561
+ const result = buildProjectMapNodePaths(parsed.data.path);
562
+ tags.push(...result.tags);
563
+ if (result.paths) {
564
+ paths.push(...result.paths);
565
+ }
546
566
  const config = getServerConfig();
547
567
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
548
568
  await processEdgeConfigChange({
@@ -550,7 +570,8 @@ var handleProjectMapNodeDelete = async (body) => {
550
570
  });
551
571
  }
552
572
  return {
553
- tags
573
+ tags,
574
+ paths
554
575
  };
555
576
  };
556
577
 
@@ -563,7 +584,12 @@ var handleProjectMapNodeInsert = async (body) => {
563
584
  return void 0;
564
585
  }
565
586
  const tags = [];
566
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
587
+ const paths = [];
588
+ const result = buildProjectMapNodePaths(parsed.data.path);
589
+ tags.push(...result.tags);
590
+ if (result.paths) {
591
+ paths.push(...result.paths);
592
+ }
567
593
  const config = getServerConfig();
568
594
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
569
595
  await processEdgeConfigChange({
@@ -571,7 +597,8 @@ var handleProjectMapNodeInsert = async (body) => {
571
597
  });
572
598
  }
573
599
  return {
574
- tags
600
+ tags,
601
+ paths
575
602
  };
576
603
  };
577
604
 
@@ -584,8 +611,17 @@ var handleProjectMapNodeUpdate = async (body) => {
584
611
  return void 0;
585
612
  }
586
613
  const tags = [];
587
- tags.push(...buildProjectMapNodePaths(parsed.data.path));
588
- tags.push(...buildProjectMapNodePaths(parsed.data.previous_path));
614
+ const paths = [];
615
+ const currentResult = buildProjectMapNodePaths(parsed.data.path);
616
+ tags.push(...currentResult.tags);
617
+ if (currentResult.paths) {
618
+ paths.push(...currentResult.paths);
619
+ }
620
+ const previousResult = buildProjectMapNodePaths(parsed.data.previous_path);
621
+ tags.push(...previousResult.tags);
622
+ if (previousResult.paths) {
623
+ paths.push(...previousResult.paths);
624
+ }
589
625
  const config = getServerConfig();
590
626
  if ((_a = config.experimental) == null ? void 0 : _a.edgeCompositions) {
591
627
  await processEdgeConfigChange({
@@ -593,7 +629,8 @@ var handleProjectMapNodeUpdate = async (body) => {
593
629
  });
594
630
  }
595
631
  return {
596
- tags
632
+ tags,
633
+ paths
597
634
  };
598
635
  };
599
636
 
@@ -688,6 +725,7 @@ var handleSvixMessage = async (request) => {
688
725
  handleManifestPublished
689
726
  ];
690
727
  let tags = void 0;
728
+ let paths = void 0;
691
729
  let jsonBody;
692
730
  try {
693
731
  jsonBody = await request.json();
@@ -700,6 +738,7 @@ var handleSvixMessage = async (request) => {
700
738
  const result = await handler(jsonBody);
701
739
  if (result) {
702
740
  tags = result.tags;
741
+ paths = result.paths;
703
742
  break;
704
743
  }
705
744
  }
@@ -709,10 +748,17 @@ var handleSvixMessage = async (request) => {
709
748
  revalidateTag(tag);
710
749
  }
711
750
  }
751
+ if (paths == null ? void 0 : paths.length) {
752
+ for (let i = 0; i < paths.length; i++) {
753
+ const path = paths[i];
754
+ revalidatePath(path);
755
+ }
756
+ }
712
757
  return new Response(
713
758
  JSON.stringify({
714
- handled: typeof tags !== "undefined",
715
- tags
759
+ handled: typeof tags !== "undefined" || typeof paths !== "undefined",
760
+ tags,
761
+ paths
716
762
  })
717
763
  );
718
764
  };
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
- import { CanvasClient, RouteClient, ResolvedRouteGetResponse, RouteGetParameters } from '@uniformdev/canvas';
2
- import { CacheMode, PageParameters, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
1
+ import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
2
+ import { UniformServerConfig, PageParameters, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
3
3
  export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
4
4
  import { ManifestClient } from '@uniformdev/context/api';
5
5
  import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
6
6
  import { ContextState, ContextOptions } from '@uniformdev/context';
7
7
  import React__default, { PropsWithChildren } from 'react';
8
- import { U as UniformCompositionProps } from './UniformComposition-D4tBQ2U4.mjs';
9
- export { a as UniformComposition, r as resolveComposition } from './UniformComposition-D4tBQ2U4.mjs';
8
+ import { U as UniformCompositionProps } from './UniformComposition-B-Z17dUt.mjs';
9
+ export { a as UniformComposition, r as resolveComposition } from './UniformComposition-B-Z17dUt.mjs';
10
10
  import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
11
11
 
12
12
  type GetCanvasClientOptions = {
13
- cache: CacheMode;
13
+ cache: NonNullable<UniformServerConfig['canvasCache']>;
14
14
  };
15
15
  declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
16
16
  declare const getDefaultCanvasClient: ({ searchParams, }: {
@@ -18,7 +18,7 @@ declare const getDefaultCanvasClient: ({ searchParams, }: {
18
18
  }) => CanvasClient;
19
19
 
20
20
  type GetManifestClientOptions = {
21
- cache: CacheMode;
21
+ cache: NonNullable<UniformServerConfig['manifestCache']>;
22
22
  };
23
23
  declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
24
24
  declare const getDefaultManifestClient: ({ searchParams, }: {
@@ -183,7 +183,7 @@ declare const getManifest: ({ searchParams }: {
183
183
  }>;
184
184
 
185
185
  type GetProjectMapClientOptions = {
186
- cache: CacheMode;
186
+ cache: NonNullable<UniformServerConfig['projectMapCache']>;
187
187
  };
188
188
  declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
189
189
  declare const getDefaultProjectMapClient: ({ searchParams, }: {
@@ -191,7 +191,7 @@ declare const getDefaultProjectMapClient: ({ searchParams, }: {
191
191
  }) => ProjectMapClient;
192
192
 
193
193
  type GetRouteClientOptions = {
194
- cache: CacheMode;
194
+ cache: NonNullable<UniformServerConfig['canvasCache']>;
195
195
  };
196
196
  declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
197
197
  declare const getDefaultRouteClient: ({ searchParams }: {
@@ -243,7 +243,7 @@ declare const isIncontextEditingEnabled: ({ searchParams, }: {
243
243
  declare const isOnVercelPreviewEnvironment: () => boolean;
244
244
  declare const isDevelopmentEnvironment: () => boolean;
245
245
 
246
- type RetrieveRouteOptions = PageParameters & {
246
+ type RetrieveCommonOptions = {
247
247
  /**
248
248
  * If true, the manifest will not be prefetched.
249
249
  *
@@ -251,7 +251,17 @@ type RetrieveRouteOptions = PageParameters & {
251
251
  */
252
252
  skipPrefetch?: boolean;
253
253
  };
254
+ type RetrieveRouteOptions = PageParameters & RetrieveCommonOptions;
255
+ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale' | 'releaseId' | 'versionId'> & {
256
+ /**
257
+ * The searchParams object from Next.js router. Used for signal evaluation.
258
+ */
259
+ searchParams?: {
260
+ [key: string]: string | undefined;
261
+ };
262
+ } & RetrieveCommonOptions;
254
263
  type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
264
+ declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
255
265
  declare const retrieveRoute: ({ params, searchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
256
266
 
257
- export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveRoute };
267
+ export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };