@uniformdev/next-app-router 20.81.0 → 20.81.1-alpha.7.sha-91a5b13e0c

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 (46) hide show
  1. package/dist/{UniformComposition-DBO-oo7J.d.ts → UniformComposition-C00_YDOg.d.ts} +11 -31
  2. package/dist/{UniformComposition-le6UEB_r.d.mts → UniformComposition-DiArCpVQ.d.mts} +11 -31
  3. package/dist/cache.d.mts +24 -6
  4. package/dist/cache.d.ts +24 -6
  5. package/dist/cache.js +410 -831
  6. package/dist/cache.mjs +405 -829
  7. package/dist/compat.d.mts +2 -4
  8. package/dist/compat.d.ts +2 -4
  9. package/dist/component.d.mts +10 -1
  10. package/dist/component.d.ts +10 -1
  11. package/dist/component.js +113 -617
  12. package/dist/component.mjs +112 -640
  13. package/dist/composition-BvOM-LIW.d.mts +28 -0
  14. package/dist/composition-BvOM-LIW.d.ts +28 -0
  15. package/dist/config/default.js +0 -1
  16. package/dist/config/default.mjs +0 -1
  17. package/dist/createCachedManifestProvider-C7faGJJ8.d.mts +69 -0
  18. package/dist/createCachedManifestProvider-C7faGJJ8.d.ts +69 -0
  19. package/dist/edge.d.mts +57 -0
  20. package/dist/edge.d.ts +57 -0
  21. package/dist/edge.js +1105 -0
  22. package/dist/edge.mjs +1073 -0
  23. package/dist/handler.d.mts +15 -2
  24. package/dist/handler.d.ts +15 -2
  25. package/dist/handler.js +134 -628
  26. package/dist/handler.mjs +132 -626
  27. package/dist/index.d.mts +73 -42
  28. package/dist/index.d.ts +73 -42
  29. package/dist/index.esm.js +2032 -5629
  30. package/dist/index.js +2068 -5661
  31. package/dist/index.mjs +2032 -5629
  32. package/dist/middleware.d.mts +52 -13
  33. package/dist/middleware.d.ts +52 -13
  34. package/dist/middleware.js +410 -5746
  35. package/dist/middleware.mjs +417 -5776
  36. package/dist/resolveRouteFromPath-BHJGOpBN.d.ts +82 -0
  37. package/dist/resolveRouteFromPath-BsZUVkRX.d.mts +82 -0
  38. package/dist/vercel.d.mts +24 -0
  39. package/dist/vercel.d.ts +24 -0
  40. package/dist/vercel.js +703 -0
  41. package/dist/vercel.mjs +675 -0
  42. package/package.json +37 -9
  43. package/dist/client-BElN_CWD.d.mts +0 -786
  44. package/dist/client-BElN_CWD.d.ts +0 -786
  45. package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +0 -18
  46. package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +0 -18
package/dist/handler.mjs CHANGED
@@ -41,124 +41,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
41
41
  }
42
42
  });
43
43
 
44
- // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
45
- var require_yocto_queue = __commonJS({
46
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
47
- "use strict";
48
- var Node2 = class {
49
- /// value;
50
- /// next;
51
- constructor(value) {
52
- this.value = value;
53
- this.next = void 0;
54
- }
55
- };
56
- var Queue2 = class {
57
- // TODO: Use private class fields when targeting Node.js 12.
58
- // #_head;
59
- // #_tail;
60
- // #_size;
61
- constructor() {
62
- this.clear();
63
- }
64
- enqueue(value) {
65
- const node = new Node2(value);
66
- if (this._head) {
67
- this._tail.next = node;
68
- this._tail = node;
69
- } else {
70
- this._head = node;
71
- this._tail = node;
72
- }
73
- this._size++;
74
- }
75
- dequeue() {
76
- const current = this._head;
77
- if (!current) {
78
- return;
79
- }
80
- this._head = this._head.next;
81
- this._size--;
82
- return current.value;
83
- }
84
- clear() {
85
- this._head = void 0;
86
- this._tail = void 0;
87
- this._size = 0;
88
- }
89
- get size() {
90
- return this._size;
91
- }
92
- *[Symbol.iterator]() {
93
- let current = this._head;
94
- while (current) {
95
- yield current.value;
96
- current = current.next;
97
- }
98
- }
99
- };
100
- module.exports = Queue2;
101
- }
102
- });
103
-
104
- // ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
105
- var require_p_limit = __commonJS({
106
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
107
- "use strict";
108
- var Queue2 = require_yocto_queue();
109
- var pLimit3 = (concurrency) => {
110
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
111
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
112
- }
113
- const queue = new Queue2();
114
- let activeCount = 0;
115
- const next = () => {
116
- activeCount--;
117
- if (queue.size > 0) {
118
- queue.dequeue()();
119
- }
120
- };
121
- const run = async (fn, resolve, ...args) => {
122
- activeCount++;
123
- const result = (async () => fn(...args))();
124
- resolve(result);
125
- try {
126
- await result;
127
- } catch (e) {
128
- }
129
- next();
130
- };
131
- const enqueue = (fn, resolve, ...args) => {
132
- queue.enqueue(run.bind(null, fn, resolve, ...args));
133
- (async () => {
134
- await Promise.resolve();
135
- if (activeCount < concurrency && queue.size > 0) {
136
- queue.dequeue()();
137
- }
138
- })();
139
- };
140
- const generator = (fn, ...args) => new Promise((resolve) => {
141
- enqueue(fn, resolve, ...args);
142
- });
143
- Object.defineProperties(generator, {
144
- activeCount: {
145
- get: () => activeCount
146
- },
147
- pendingCount: {
148
- get: () => queue.size
149
- },
150
- clearQueue: {
151
- value: () => {
152
- queue.clear();
153
- }
154
- }
155
- });
156
- return generator;
157
- };
158
- module.exports = pLimit3;
159
- }
160
- });
161
-
162
44
  // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
163
45
  var require_retry_operation = __commonJS({
164
46
  "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
@@ -390,432 +272,9 @@ var require_retry2 = __commonJS({
390
272
  }
391
273
  });
392
274
 
393
- // ../context/dist/api/api.mjs
394
- var import_p_limit = __toESM(require_p_limit(), 1);
395
- var __defProp2 = Object.defineProperty;
396
- var __typeError2 = (msg) => {
397
- throw TypeError(msg);
398
- };
399
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
400
- var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
401
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
402
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
403
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
404
- var defaultLimitPolicy = (0, import_p_limit.default)(6);
405
- var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
406
- var ApiClientError = class _ApiClientError extends Error {
407
- constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
408
- super(
409
- `${errorMessage}
410
- ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
411
- );
412
- __publicField2(this, "errorMessage", errorMessage);
413
- __publicField2(this, "fetchMethod", fetchMethod);
414
- __publicField2(this, "fetchUri", fetchUri);
415
- __publicField2(this, "statusCode", statusCode);
416
- __publicField2(this, "statusText", statusText);
417
- __publicField2(this, "requestId", requestId);
418
- Object.setPrototypeOf(this, _ApiClientError.prototype);
419
- }
420
- };
421
- var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
422
- constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
423
- super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
424
- Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
425
- }
426
- };
427
- var ApiClient = class _ApiClient {
428
- constructor(options) {
429
- __publicField2(this, "options");
430
- var _a, _b, _c, _d, _e;
431
- if (!options.apiKey && !options.bearerToken) {
432
- throw new Error("You must provide an API key or a bearer token");
433
- }
434
- let leFetch = options.fetch;
435
- if (!leFetch) {
436
- if (typeof window !== "undefined") {
437
- leFetch = window.fetch.bind(window);
438
- } else if (typeof fetch !== "undefined") {
439
- leFetch = fetch;
440
- } else {
441
- throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
442
- }
443
- }
444
- this.options = {
445
- ...options,
446
- fetch: leFetch,
447
- apiHost: this.ensureApiHost(options.apiHost),
448
- apiKey: (_a = options.apiKey) != null ? _a : null,
449
- projectId: (_b = options.projectId) != null ? _b : null,
450
- bearerToken: (_c = options.bearerToken) != null ? _c : null,
451
- limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
452
- bypassCache: (_e = options.bypassCache) != null ? _e : false
453
- };
454
- }
455
- async apiClient(fetchUri, options) {
456
- return (await this.apiClientWithResponse(fetchUri, options)).body;
457
- }
458
- async apiClientWithResponse(fetchUri, options) {
459
- return this.options.limitPolicy(async () => {
460
- var _a, _b;
461
- const coreHeaders = this.options.apiKey ? {
462
- "x-api-key": this.options.apiKey
463
- } : {
464
- Authorization: `Bearer ${this.options.bearerToken}`
465
- };
466
- if (this.options.bypassCache) {
467
- coreHeaders["x-bypass-cache"] = "true";
468
- }
469
- const { fetch: fetch2, signal } = this.options;
470
- const callApi = () => fetch2(fetchUri.toString(), {
471
- ...options,
472
- signal,
473
- headers: {
474
- ...options == null ? void 0 : options.headers,
475
- ...coreHeaders
476
- }
477
- });
478
- const apiResponse = await handleRateLimits(callApi);
479
- if (!apiResponse.ok) {
480
- let message = "";
481
- try {
482
- const responseText = await apiResponse.text();
483
- try {
484
- const parsed = JSON.parse(responseText);
485
- if (parsed.errorMessage) {
486
- message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
487
- } else {
488
- message = responseText;
489
- }
490
- } catch (e) {
491
- message = responseText;
492
- }
493
- } catch (e) {
494
- message = `General error`;
495
- }
496
- if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
497
- throw new BearerTokenNotValidOrExpiredError(
498
- message,
499
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
500
- fetchUri.toString(),
501
- apiResponse.status,
502
- apiResponse.statusText,
503
- _ApiClient.getRequestId(apiResponse)
504
- );
505
- }
506
- throw new ApiClientError(
507
- message,
508
- (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
509
- fetchUri.toString(),
510
- apiResponse.status,
511
- apiResponse.statusText,
512
- _ApiClient.getRequestId(apiResponse)
513
- );
514
- }
515
- if (options == null ? void 0 : options.expectNoContent) {
516
- return { response: apiResponse, body: null };
517
- }
518
- return {
519
- response: apiResponse,
520
- body: await apiResponse.json()
521
- };
522
- });
523
- }
524
- createUrl(path, queryParams, hostOverride) {
525
- const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
526
- Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
527
- var _a;
528
- if (typeof value !== "undefined" && value !== null) {
529
- url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
530
- }
531
- });
532
- return url;
533
- }
534
- ensureApiHost(apiHost) {
535
- if (!apiHost) return "https://uniform.app";
536
- if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
537
- throw new Error('Your apiHost must start with "http"');
538
- }
539
- if (apiHost.indexOf("/", 8) > -1) {
540
- throw new Error("Your apiHost must not contain a path element after the domain");
541
- }
542
- if (apiHost.indexOf("?") > -1) {
543
- throw new Error("Your apiHost must not contain a query string");
544
- }
545
- if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
546
- apiHost = apiHost.substring(0, apiHost.length - 1);
547
- }
548
- return apiHost;
549
- }
550
- static getRequestId(response) {
551
- const apigRequestId = response.headers.get("apigw-requestid");
552
- if (apigRequestId) {
553
- return apigRequestId;
554
- }
555
- return void 0;
556
- }
557
- };
558
- async function handleRateLimits(callApi) {
559
- var _a;
560
- const backoffRetries = 5;
561
- let backoffRetriesLeft = backoffRetries;
562
- let response;
563
- while (backoffRetriesLeft > 0) {
564
- response = await callApi();
565
- if (response.status !== 429) {
566
- break;
567
- }
568
- let resetWait = 0;
569
- try {
570
- const responseClone = response.clone();
571
- const dateHeader = responseClone.headers.get("date");
572
- const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
573
- const body = await responseClone.json();
574
- const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
575
- if (typeof serverTime === "number" && typeof resetTime === "number") {
576
- resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
577
- }
578
- } catch (e) {
579
- }
580
- const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
581
- const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
582
- await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
583
- backoffRetriesLeft -= 1;
584
- }
585
- return response;
586
- }
587
- var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
588
- function rewriteFiltersForApi(filters) {
589
- return Object.entries(filters != null ? filters : {}).reduce(
590
- (acc, [key, value]) => {
591
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
592
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
593
- return {
594
- ...acc,
595
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
596
- };
597
- },
598
- {}
599
- );
600
- }
601
- var _url;
602
- var _AggregateClient = class _AggregateClient2 extends ApiClient {
603
- constructor(options) {
604
- super(options);
605
- }
606
- /** Fetches all aggregates for a project */
607
- async get(options) {
608
- const { projectId } = this.options;
609
- const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
610
- return await this.apiClient(fetchUri);
611
- }
612
- /** Updates or creates (based on id) an Aggregate */
613
- async upsert(body) {
614
- const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
615
- await this.apiClient(fetchUri, {
616
- method: "PUT",
617
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
618
- expectNoContent: true
619
- });
620
- }
621
- /** Deletes an Aggregate */
622
- async remove(body) {
623
- const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
624
- await this.apiClient(fetchUri, {
625
- method: "DELETE",
626
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
627
- expectNoContent: true
628
- });
629
- }
630
- };
631
- _url = /* @__PURE__ */ new WeakMap();
632
- __privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
633
- var _url2;
634
- var _DimensionClient = class _DimensionClient2 extends ApiClient {
635
- constructor(options) {
636
- super(options);
637
- }
638
- /** Fetches the known score dimensions for a project */
639
- async get(options) {
640
- const { projectId } = this.options;
641
- const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
642
- return await this.apiClient(fetchUri);
643
- }
644
- };
645
- _url2 = /* @__PURE__ */ new WeakMap();
646
- __privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
647
- var _url3;
648
- var _valueUrl;
649
- var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
650
- constructor(options) {
651
- super(options);
652
- }
653
- /** Fetches all enrichments and values for a project, grouped by category */
654
- async get(options) {
655
- const { projectId } = this.options;
656
- const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
657
- return await this.apiClient(fetchUri);
658
- }
659
- /** Updates or creates (based on id) an enrichment category */
660
- async upsertCategory(body) {
661
- const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
662
- await this.apiClient(fetchUri, {
663
- method: "PUT",
664
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
665
- expectNoContent: true
666
- });
667
- }
668
- /** Deletes an enrichment category */
669
- async removeCategory(body) {
670
- const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
671
- await this.apiClient(fetchUri, {
672
- method: "DELETE",
673
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
674
- expectNoContent: true
675
- });
676
- }
677
- /** Updates or creates (based on id) an enrichment value within an enrichment category */
678
- async upsertValue(body) {
679
- const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
680
- await this.apiClient(fetchUri, {
681
- method: "PUT",
682
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
683
- expectNoContent: true
684
- });
685
- }
686
- /** Deletes an enrichment value within an enrichment category. The category is left alone. */
687
- async removeValue(body) {
688
- const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
689
- await this.apiClient(fetchUri, {
690
- method: "DELETE",
691
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
692
- expectNoContent: true
693
- });
694
- }
695
- };
696
- _url3 = /* @__PURE__ */ new WeakMap();
697
- _valueUrl = /* @__PURE__ */ new WeakMap();
698
- __privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
699
- __privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
700
- var _url4;
701
- var _ManifestClient = class _ManifestClient2 extends ApiClient {
702
- constructor(options) {
703
- super(options);
704
- }
705
- /** Fetches the Context manifest for a project */
706
- async get(options) {
707
- const { projectId } = this.options;
708
- const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
709
- return await this.apiClient(fetchUri);
710
- }
711
- /** Publishes the Context manifest for a project */
712
- async publish() {
713
- const { projectId } = this.options;
714
- const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
715
- await this.apiClient(fetchUri, {
716
- method: "POST",
717
- expectNoContent: true
718
- });
719
- }
720
- };
721
- _url4 = /* @__PURE__ */ new WeakMap();
722
- __privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
723
- var _url5;
724
- var _QuirkClient = class _QuirkClient2 extends ApiClient {
725
- constructor(options) {
726
- super(options);
727
- }
728
- /** Fetches all Quirks for a project */
729
- async get(options) {
730
- const { projectId } = this.options;
731
- const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
732
- return await this.apiClient(fetchUri);
733
- }
734
- /** Updates or creates (based on id) a Quirk */
735
- async upsert(body) {
736
- const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
737
- await this.apiClient(fetchUri, {
738
- method: "PUT",
739
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
740
- expectNoContent: true
741
- });
742
- }
743
- /** Deletes a Quirk */
744
- async remove(body) {
745
- const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
746
- await this.apiClient(fetchUri, {
747
- method: "DELETE",
748
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
749
- expectNoContent: true
750
- });
751
- }
752
- };
753
- _url5 = /* @__PURE__ */ new WeakMap();
754
- __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
755
- var _url6;
756
- var _SignalClient = class _SignalClient2 extends ApiClient {
757
- constructor(options) {
758
- super(options);
759
- }
760
- /** Fetches all Signals for a project */
761
- async get(options) {
762
- const { projectId } = this.options;
763
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
764
- return await this.apiClient(fetchUri);
765
- }
766
- /** Updates or creates (based on id) a Signal */
767
- async upsert(body) {
768
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
769
- await this.apiClient(fetchUri, {
770
- method: "PUT",
771
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
772
- expectNoContent: true
773
- });
774
- }
775
- /** Deletes a Signal */
776
- async remove(body) {
777
- const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
778
- await this.apiClient(fetchUri, {
779
- method: "DELETE",
780
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
781
- expectNoContent: true
782
- });
783
- }
784
- };
785
- _url6 = /* @__PURE__ */ new WeakMap();
786
- __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
787
- var _url7;
788
- var _TestClient = class _TestClient2 extends ApiClient {
789
- constructor(options) {
790
- super(options);
791
- }
792
- /** Fetches all Tests for a project */
793
- async get(options) {
794
- const { projectId } = this.options;
795
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
796
- return await this.apiClient(fetchUri);
797
- }
798
- /** Updates or creates (based on id) a Test */
799
- async upsert(body) {
800
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
801
- await this.apiClient(fetchUri, {
802
- method: "PUT",
803
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
804
- expectNoContent: true
805
- });
806
- }
807
- /** Deletes a Test */
808
- async remove(body) {
809
- const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
810
- await this.apiClient(fetchUri, {
811
- method: "DELETE",
812
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
813
- expectNoContent: true
814
- });
815
- }
816
- };
817
- _url7 = /* @__PURE__ */ new WeakMap();
818
- __privateAdd2(_TestClient, _url7, "/api/v2/test");
275
+ // ../canvas/dist/index.mjs
276
+ import { ApiClient } from "@uniformdev/context/api";
277
+ import { ApiClientError } from "@uniformdev/context/api";
819
278
 
820
279
  // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
821
280
  var Node = class {
@@ -888,7 +347,7 @@ _tail = new WeakMap();
888
347
  _size = new WeakMap();
889
348
 
890
349
  // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
891
- function pLimit2(concurrency) {
350
+ function pLimit(concurrency) {
892
351
  validateConcurrency(concurrency);
893
352
  const queue = new Queue();
894
353
  let activeCount = 0;
@@ -1168,19 +627,44 @@ function pThrottle({ limit, interval, strict, onDelay }) {
1168
627
  }
1169
628
 
1170
629
  // ../canvas/dist/index.mjs
1171
- var __typeError3 = (msg) => {
630
+ import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
631
+ import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
632
+ import { rewriteFiltersForApi } from "@uniformdev/context/api";
633
+ import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
634
+ import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
635
+ import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
636
+ import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
637
+ import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
638
+ import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
639
+ import { ApiClient as ApiClient4, rewriteFiltersForApi as rewriteFiltersForApi6 } from "@uniformdev/context/api";
640
+ import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
641
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
642
+ import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
643
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
644
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
645
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
646
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
647
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
648
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
649
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
650
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
651
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
652
+ import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
653
+ import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
654
+ import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
655
+ var __typeError2 = (msg) => {
1172
656
  throw TypeError(msg);
1173
657
  };
1174
- var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1175
- var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1176
- var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
658
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
659
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
660
+ var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1177
661
  function createLimitPolicy({
1178
662
  throttle = { interval: 1e3, limit: 10 },
1179
663
  retry: retry3 = { retries: 1, factor: 1.66 },
1180
664
  limit = 10
1181
665
  }) {
1182
666
  const throttler = throttle ? pThrottle(throttle) : null;
1183
- const limiter = limit ? pLimit2(limit) : null;
667
+ const limiter = limit ? pLimit(limit) : null;
1184
668
  return function limitPolicy(func) {
1185
669
  let currentFunc = async () => await func();
1186
670
  if (throttler) {
@@ -1208,7 +692,7 @@ function createLimitPolicy({
1208
692
  return currentFunc();
1209
693
  };
1210
694
  }
1211
- var ContentClientBase = class extends ApiClient {
695
+ var ContentClientBase = class extends ApiClient2 {
1212
696
  constructor(options, defaultBypassCache) {
1213
697
  var _a, _b;
1214
698
  super({
@@ -1354,7 +838,7 @@ var CompositionDeliveryClient = class extends DeliveryClientBase {
1354
838
  };
1355
839
  var _contentTypesUrl;
1356
840
  var _entriesUrl;
1357
- var _ContentClient = class _ContentClient2 extends ApiClient {
841
+ var _ContentClient = class _ContentClient2 extends ApiClient4 {
1358
842
  constructor(options) {
1359
843
  var _a;
1360
844
  super(options);
@@ -1362,16 +846,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1362
846
  }
1363
847
  getContentTypes(options) {
1364
848
  const { projectId } = this.options;
1365
- const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
849
+ const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1366
850
  return this.apiClient(fetchUri);
1367
851
  }
1368
852
  getEntries(options) {
1369
853
  const { projectId } = this.options;
1370
854
  const { skipDataResolution, filters, select, ...params } = options;
1371
- const rewrittenFilters = rewriteFiltersForApi(filters);
855
+ const rewrittenFilters = rewriteFiltersForApi6(filters);
1372
856
  const rewrittenSelect = projectionToQuery(select);
1373
857
  if (skipDataResolution) {
1374
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
858
+ const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
1375
859
  ...params,
1376
860
  ...rewrittenFilters,
1377
861
  ...rewrittenSelect,
@@ -1380,7 +864,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1380
864
  return this.apiClient(url);
1381
865
  }
1382
866
  const edgeUrl = this.createUrl(
1383
- __privateGet3(_ContentClient2, _entriesUrl),
867
+ __privateGet2(_ContentClient2, _entriesUrl),
1384
868
  { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1385
869
  this.edgeApiHost
1386
870
  );
@@ -1398,7 +882,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1398
882
  return this.apiClient(historyUrl);
1399
883
  }
1400
884
  async upsertContentType(body, opts = {}) {
1401
- const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
885
+ const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1402
886
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
1403
887
  delete body.contentType.slugSettings;
1404
888
  }
@@ -1410,7 +894,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1410
894
  });
1411
895
  }
1412
896
  async upsertEntry(body, options) {
1413
- const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
897
+ const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1414
898
  const headers = {};
1415
899
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
1416
900
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -1424,7 +908,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1424
908
  return { modified: response.headers.get("x-modified-at") };
1425
909
  }
1426
910
  async deleteContentType(body) {
1427
- const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
911
+ const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1428
912
  await this.apiClient(fetchUri, {
1429
913
  method: "DELETE",
1430
914
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1432,7 +916,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1432
916
  });
1433
917
  }
1434
918
  async deleteEntry(body) {
1435
- const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
919
+ const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1436
920
  await this.apiClient(fetchUri, {
1437
921
  method: "DELETE",
1438
922
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1451,17 +935,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1451
935
  };
1452
936
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
1453
937
  _entriesUrl = /* @__PURE__ */ new WeakMap();
1454
- __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1455
- __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1456
- var _url8;
1457
- var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
938
+ __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
939
+ __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
940
+ var _url;
941
+ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
1458
942
  constructor(options) {
1459
943
  super(options);
1460
944
  }
1461
945
  /** Fetches a list of DataTypes for a project */
1462
946
  async list(options) {
1463
947
  const { projectId } = this.options;
1464
- const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
948
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
1465
949
  return await this.apiClient(fetchUri);
1466
950
  }
1467
951
  /** @deprecated Use {@link list} instead. */
@@ -1470,7 +954,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1470
954
  }
1471
955
  /** Updates or creates (based on id) a DataType */
1472
956
  async save(body) {
1473
- const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
957
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1474
958
  await this.apiClient(fetchUri, {
1475
959
  method: "PUT",
1476
960
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1483,7 +967,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1483
967
  }
1484
968
  /** Deletes a DataType */
1485
969
  async remove(body) {
1486
- const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
970
+ const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1487
971
  await this.apiClient(fetchUri, {
1488
972
  method: "DELETE",
1489
973
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1491,8 +975,8 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1491
975
  });
1492
976
  }
1493
977
  };
1494
- _url8 = /* @__PURE__ */ new WeakMap();
1495
- __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
978
+ _url = /* @__PURE__ */ new WeakMap();
979
+ __privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
1496
980
  var variablePrefix = "${";
1497
981
  var variableSuffix = "}";
1498
982
  var escapeCharacter = "\\";
@@ -1570,7 +1054,7 @@ function createVariableReference(variableName) {
1570
1054
  return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
1571
1055
  }
1572
1056
  var _baseUrl;
1573
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
1057
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient8 {
1574
1058
  constructor(options) {
1575
1059
  super(options);
1576
1060
  this.teamId = options.teamId;
@@ -1579,7 +1063,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1579
1063
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1580
1064
  */
1581
1065
  get(options) {
1582
- const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1066
+ const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1583
1067
  ...options,
1584
1068
  teamId: this.teamId
1585
1069
  });
@@ -1589,7 +1073,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1589
1073
  * Creates or updates a custom AI property editor on a Mesh app.
1590
1074
  */
1591
1075
  async deploy(body) {
1592
- const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1076
+ const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1593
1077
  await this.apiClient(fetchUri, {
1594
1078
  method: "PUT",
1595
1079
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1600,7 +1084,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1600
1084
  * Removes a custom AI property editor from a Mesh app.
1601
1085
  */
1602
1086
  async delete(body) {
1603
- const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1087
+ const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1604
1088
  await this.apiClient(fetchUri, {
1605
1089
  method: "DELETE",
1606
1090
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1609,16 +1093,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1609
1093
  }
1610
1094
  };
1611
1095
  _baseUrl = /* @__PURE__ */ new WeakMap();
1612
- __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1613
- var _url22;
1096
+ __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1097
+ var _url2;
1614
1098
  var _projectsUrl;
1615
- var _ProjectClient = class _ProjectClient2 extends ApiClient {
1099
+ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1616
1100
  constructor(options) {
1617
1101
  super({ ...options, bypassCache: true });
1618
1102
  }
1619
1103
  /** Fetches single Project */
1620
1104
  async get(options) {
1621
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1105
+ const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
1622
1106
  return await this.apiClient(fetchUri);
1623
1107
  }
1624
1108
  /**
@@ -1627,7 +1111,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1627
1111
  * When omitted, returns all accessible teams and their projects.
1628
1112
  */
1629
1113
  async list(options) {
1630
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1114
+ const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1631
1115
  return await this.apiClient(fetchUri);
1632
1116
  }
1633
1117
  /** @deprecated Use {@link list} instead. */
@@ -1636,7 +1120,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1636
1120
  }
1637
1121
  /** Updates or creates (based on id) a Project */
1638
1122
  async save(body) {
1639
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1123
+ const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1640
1124
  return await this.apiClient(fetchUri, {
1641
1125
  method: "PUT",
1642
1126
  body: JSON.stringify({ ...body })
@@ -1648,7 +1132,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1648
1132
  }
1649
1133
  /** Deletes a Project */
1650
1134
  async remove(body) {
1651
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1135
+ const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1652
1136
  await this.apiClient(fetchUri, {
1653
1137
  method: "DELETE",
1654
1138
  body: JSON.stringify({ ...body }),
@@ -1660,10 +1144,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1660
1144
  return this.remove(body);
1661
1145
  }
1662
1146
  };
1663
- _url22 = /* @__PURE__ */ new WeakMap();
1147
+ _url2 = /* @__PURE__ */ new WeakMap();
1664
1148
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1665
- __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1666
- __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1149
+ __privateAdd2(_ProjectClient, _url2, "/api/v1/project");
1150
+ __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1667
1151
  var ALLOWED_REFERRER_ORIGIN = /^https:\/\/([\w-]+\.)*(uniform\.(app|wtf)|uniformcode\.ai)$|^https?:\/\/localhost:\d{4}$/;
1668
1152
  var isAllowedReferrer = (referrer) => {
1669
1153
  try {
@@ -1680,15 +1164,6 @@ import { NextResponse } from "next/server";
1680
1164
 
1681
1165
  // src/config/helpers.ts
1682
1166
  import config from "@uniformdev/next-app-router/config/resolved";
1683
- var getMiddlewareRuntimeCache = () => {
1684
- if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
1685
- return false;
1686
- }
1687
- if (typeof config.middlewareRuntimeCache === "boolean") {
1688
- return config.middlewareRuntimeCache;
1689
- }
1690
- return true;
1691
- };
1692
1167
  var getPlaygroundPath = () => {
1693
1168
  if (typeof config.playgroundPath === "string") {
1694
1169
  return config.playgroundPath;
@@ -1865,7 +1340,6 @@ var createPreviewOPTIONSRouteHandler = () => {
1865
1340
  };
1866
1341
 
1867
1342
  // src/handler/createPreviewPOSTRouteHandler.ts
1868
- import { getCache } from "@vercel/functions";
1869
1343
  import { revalidatePath, revalidateTag } from "next/cache";
1870
1344
 
1871
1345
  // src/handler/helpers.ts
@@ -1891,13 +1365,17 @@ var env = {
1891
1365
  };
1892
1366
 
1893
1367
  // src/utils/tag.ts
1368
+ var encodePathForTag = (path) => path.split("/").map((segment) => /[^\x00-\x7F]/.test(segment) ? encodeURIComponent(segment) : segment).join("/");
1894
1369
  var buildPathTag = (path) => {
1895
1370
  const actualPath = path.startsWith("/") ? path : `/${path}`;
1896
- return `path:${actualPath}`.toLowerCase();
1371
+ return `path:${encodePathForTag(actualPath)}`.toLowerCase();
1897
1372
  };
1898
1373
  var buildCompositionTag = (compositionId) => {
1899
1374
  return `composition:${compositionId}`.toLowerCase();
1900
1375
  };
1376
+ var buildCompositionSlugTag = (slug) => {
1377
+ return `composition-slug:${encodePathForTag(slug)}`.toLowerCase();
1378
+ };
1901
1379
 
1902
1380
  // src/utils/draft.ts
1903
1381
  var isDraftModeEnabled = ({
@@ -2001,6 +1479,7 @@ var determineFetchCacheOptions = (mode) => {
2001
1479
  };
2002
1480
 
2003
1481
  // src/clients/retry.ts
1482
+ import { ApiClientError as ApiClientError6 } from "@uniformdev/context/api";
2004
1483
  function createThrottler(limit, interval) {
2005
1484
  let available = limit;
2006
1485
  let refillScheduled = false;
@@ -2111,7 +1590,7 @@ function createLimitPolicy2({
2111
1590
  if (retryOptions.onFailedAttempt) {
2112
1591
  await retryOptions.onFailedAttempt(error);
2113
1592
  }
2114
- if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1593
+ if (error instanceof ApiClientError6 && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
2115
1594
  throw error;
2116
1595
  }
2117
1596
  }
@@ -2146,11 +1625,16 @@ var buildCanvasClientOptions = (options) => {
2146
1625
  if (requestedUrl) {
2147
1626
  const compositionIdKey = "compositionId";
2148
1627
  const compositionIdsKey = "compositionIDs";
1628
+ const slugKey = "slug";
2149
1629
  const compositionId = requestedUrl.searchParams.get(compositionIdKey);
2150
1630
  const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
1631
+ const slug = requestedUrl.searchParams.get(slugKey);
2151
1632
  if (compositionId) {
2152
1633
  tags.push(buildCompositionTag(compositionId));
2153
1634
  }
1635
+ if (slug) {
1636
+ tags.push(buildCompositionSlugTag(slug));
1637
+ }
2154
1638
  if (compositionIds) {
2155
1639
  const ids = compositionIds.split(",");
2156
1640
  for (let i = 0; i < ids.length; i++) {
@@ -2182,15 +1666,16 @@ var getCompositionDeliveryClient = (options) => {
2182
1666
  import "server-only";
2183
1667
 
2184
1668
  // ../project-map/dist/index.mjs
2185
- var __typeError4 = (msg) => {
1669
+ import { ApiClient as ApiClient19 } from "@uniformdev/context/api";
1670
+ var __typeError3 = (msg) => {
2186
1671
  throw TypeError(msg);
2187
1672
  };
2188
- var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
2189
- var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2190
- var __privateAdd4 = (obj, member, value) => member.has(obj) ? __typeError4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2191
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
2192
- var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
2193
- var ProjectMapClient = class extends ApiClient {
1673
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1674
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1675
+ var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1676
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1677
+ var __privateMethod = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
1678
+ var ProjectMapClient = class extends ApiClient19 {
2194
1679
  constructor(options) {
2195
1680
  super(options);
2196
1681
  this.getProjectMapDefinitions = async () => {
@@ -2336,12 +1821,12 @@ var isDynamicRouteSegment_fn;
2336
1821
  var _Route = class _Route2 {
2337
1822
  constructor(route) {
2338
1823
  this.route = route;
2339
- __privateAdd4(this, _routeInfo);
1824
+ __privateAdd3(this, _routeInfo);
2340
1825
  var _a;
2341
1826
  __privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
2342
1827
  }
2343
1828
  get dynamicSegmentCount() {
2344
- return __privateGet4(this, _routeInfo).segments.reduce(
1829
+ return __privateGet3(this, _routeInfo).segments.reduce(
2345
1830
  (count, segment) => {
2346
1831
  var _a;
2347
1832
  return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
@@ -2353,7 +1838,7 @@ var _Route = class _Route2 {
2353
1838
  matches(path) {
2354
1839
  var _a, _b;
2355
1840
  const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
2356
- const { segments: routeSegments } = __privateGet4(this, _routeInfo);
1841
+ const { segments: routeSegments } = __privateGet3(this, _routeInfo);
2357
1842
  if (pathSegments.length !== routeSegments.length) {
2358
1843
  return { match: false };
2359
1844
  }
@@ -2374,7 +1859,7 @@ var _Route = class _Route2 {
2374
1859
  return { match: false };
2375
1860
  }
2376
1861
  }
2377
- for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
1862
+ for (const [key, value] of __privateGet3(this, _routeInfo).queryParams) {
2378
1863
  possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
2379
1864
  }
2380
1865
  return possibleMatch;
@@ -2384,7 +1869,7 @@ var _Route = class _Route2 {
2384
1869
  */
2385
1870
  expand(options) {
2386
1871
  const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
2387
- const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
1872
+ const path = __privateGet3(this, _routeInfo).segments.map((segment) => {
2388
1873
  const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
2389
1874
  if (!dynamicSegmentName) {
2390
1875
  return segment;
@@ -2464,7 +1949,7 @@ isDynamicRouteSegment_fn = function(segment) {
2464
1949
  }
2465
1950
  return segment.startsWith(_Route.dynamicSegmentPrefix);
2466
1951
  };
2467
- __privateAdd4(_Route, _Route_static);
1952
+ __privateAdd3(_Route, _Route_static);
2468
1953
  _Route.dynamicSegmentPrefix = ":";
2469
1954
  function encodeRouteComponent(value, doNotEscapeVariables) {
2470
1955
  if (!doNotEscapeVariables) {
@@ -2537,7 +2022,7 @@ var isSvixMessage = async (request) => {
2537
2022
  validation: true
2538
2023
  };
2539
2024
  };
2540
- var processCompositionChange = async (compositionId) => {
2025
+ var processCompositionChange = async (compositionId, slug) => {
2541
2026
  const projectMapClient = getProjectMapClient({
2542
2027
  cache: {
2543
2028
  type: "no-cache"
@@ -2565,6 +2050,9 @@ var processCompositionChange = async (compositionId) => {
2565
2050
  }
2566
2051
  }
2567
2052
  tags.push(buildCompositionTag(compositionId));
2053
+ if (slug) {
2054
+ tags.push(buildCompositionSlugTag(slug));
2055
+ }
2568
2056
  return {
2569
2057
  tags,
2570
2058
  paths
@@ -2582,7 +2070,7 @@ var getComposition = async ({ compositionId }) => {
2582
2070
  });
2583
2071
  return composition;
2584
2072
  } catch (err) {
2585
- if (err instanceof ApiClientError && err.statusCode === 404) {
2073
+ if (err instanceof ApiClientError5 && err.statusCode === 404) {
2586
2074
  return null;
2587
2075
  }
2588
2076
  throw err;
@@ -2614,6 +2102,16 @@ var buildProjectMapNodePaths = (path) => {
2614
2102
  paths
2615
2103
  };
2616
2104
  };
2105
+ var buildProjectMapNodeInvalidation = ({
2106
+ path,
2107
+ compositionId
2108
+ }) => {
2109
+ const result = buildProjectMapNodePaths(path);
2110
+ if (compositionId) {
2111
+ result.tags.push(buildCompositionTag(compositionId));
2112
+ }
2113
+ return result;
2114
+ };
2617
2115
  var getPathName = (url) => {
2618
2116
  try {
2619
2117
  const { pathname } = new URL(url);
@@ -2639,7 +2137,7 @@ var handleCompositionChanged = async (body) => {
2639
2137
  if (!parsed.success) {
2640
2138
  return void 0;
2641
2139
  }
2642
- return processCompositionChange(parsed.data.id);
2140
+ return processCompositionChange(parsed.data.id, parsed.data.slug);
2643
2141
  };
2644
2142
 
2645
2143
  // src/handler/messages/handleCompositionDeleted.ts
@@ -2649,7 +2147,7 @@ var handleCompositionDeleted = async (body) => {
2649
2147
  if (!parsed.success) {
2650
2148
  return void 0;
2651
2149
  }
2652
- return processCompositionChange(parsed.data.id);
2150
+ return processCompositionChange(parsed.data.id, parsed.data.slug);
2653
2151
  };
2654
2152
 
2655
2153
  // src/handler/messages/handleCompositionPublished.ts
@@ -2659,7 +2157,7 @@ var handleCompositionPublished = async (body) => {
2659
2157
  if (!parsed.success) {
2660
2158
  return void 0;
2661
2159
  }
2662
- return processCompositionChange(parsed.data.id);
2160
+ return processCompositionChange(parsed.data.id, parsed.data.slug);
2663
2161
  };
2664
2162
 
2665
2163
  // src/handler/messages/handleManifestPublished.ts
@@ -2683,7 +2181,10 @@ var handleProjectMapNodeDelete = async (body) => {
2683
2181
  }
2684
2182
  const tags = [];
2685
2183
  const paths = [];
2686
- const result = buildProjectMapNodePaths(parsed.data.path);
2184
+ const result = buildProjectMapNodeInvalidation({
2185
+ path: parsed.data.path,
2186
+ compositionId: parsed.data.composition_id
2187
+ });
2687
2188
  tags.push(...result.tags);
2688
2189
  if (result.paths) {
2689
2190
  paths.push(...result.paths);
@@ -2703,7 +2204,10 @@ var handleProjectMapNodeInsert = async (body) => {
2703
2204
  }
2704
2205
  const tags = [];
2705
2206
  const paths = [];
2706
- const result = buildProjectMapNodePaths(parsed.data.path);
2207
+ const result = buildProjectMapNodeInvalidation({
2208
+ path: parsed.data.path,
2209
+ compositionId: parsed.data.composition_id
2210
+ });
2707
2211
  tags.push(...result.tags);
2708
2212
  if (result.paths) {
2709
2213
  paths.push(...result.paths);
@@ -2723,12 +2227,18 @@ var handleProjectMapNodeUpdate = async (body) => {
2723
2227
  }
2724
2228
  const tags = [];
2725
2229
  const paths = [];
2726
- const currentResult = buildProjectMapNodePaths(parsed.data.path);
2230
+ const currentResult = buildProjectMapNodeInvalidation({
2231
+ path: parsed.data.path,
2232
+ compositionId: parsed.data.composition_id
2233
+ });
2727
2234
  tags.push(...currentResult.tags);
2728
2235
  if (currentResult.paths) {
2729
2236
  paths.push(...currentResult.paths);
2730
2237
  }
2731
- const previousResult = buildProjectMapNodePaths(parsed.data.previous_path);
2238
+ const previousResult = buildProjectMapNodeInvalidation({
2239
+ path: parsed.data.previous_path,
2240
+ compositionId: parsed.data.composition_id
2241
+ });
2732
2242
  tags.push(...previousResult.tags);
2733
2243
  if (previousResult.paths) {
2734
2244
  paths.push(...previousResult.paths);
@@ -2770,7 +2280,7 @@ var handleRedirectUpdate = async (body) => {
2770
2280
  };
2771
2281
 
2772
2282
  // src/handler/createPreviewPOSTRouteHandler.ts
2773
- var createPreviewPOSTRouteHandler = () => {
2283
+ var createPreviewPOSTRouteHandler = (options = {}) => {
2774
2284
  return async (request) => {
2775
2285
  let previewSecretPassed = false;
2776
2286
  if (process.env.UNIFORM_PREVIEW_SECRET) {
@@ -2798,12 +2308,12 @@ var createPreviewPOSTRouteHandler = () => {
2798
2308
  if (!validation) {
2799
2309
  return new Response("This looks like a webhook request but the validation failed.", { status: 401 });
2800
2310
  }
2801
- return handleSvixMessage(request);
2311
+ return handleSvixMessage(request, options);
2802
2312
  }
2803
2313
  return new Response("This is not a webhook request.", { status: 401 });
2804
2314
  };
2805
2315
  };
2806
- var handleSvixMessage = async (request) => {
2316
+ var handleSvixMessage = async (request, { onRevalidateTags }) => {
2807
2317
  const handlers = [
2808
2318
  handleProjectMapNodeUpdate,
2809
2319
  handleProjectMapNodeInsert,
@@ -2837,14 +2347,10 @@ var handleSvixMessage = async (request) => {
2837
2347
  }
2838
2348
  }
2839
2349
  if (tags == null ? void 0 : tags.length) {
2840
- const cache = getMiddlewareRuntimeCache() ? getCache() : void 0;
2841
2350
  for (let i = 0; i < tags.length; i++) {
2842
- const tag = tags[i];
2843
- revalidateTag(tag, "max");
2844
- if (cache) {
2845
- await cache.expireTag(tag);
2846
- }
2351
+ revalidateTag(tags[i], "max");
2847
2352
  }
2353
+ await (onRevalidateTags == null ? void 0 : onRevalidateTags(tags));
2848
2354
  }
2849
2355
  if (paths == null ? void 0 : paths.length) {
2850
2356
  for (let i = 0; i < paths.length; i++) {