@uniformdev/next-app-router 20.81.1-alpha.4.sha-de16ebeee7 → 20.81.1

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.
package/dist/handler.mjs CHANGED
@@ -41,6 +41,124 @@ 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
+
44
162
  // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
45
163
  var require_retry_operation = __commonJS({
46
164
  "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
@@ -272,9 +390,432 @@ var require_retry2 = __commonJS({
272
390
  }
273
391
  });
274
392
 
275
- // ../canvas/dist/index.mjs
276
- import { ApiClient } from "@uniformdev/context/api";
277
- import { ApiClientError } from "@uniformdev/context/api";
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");
278
819
 
279
820
  // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
280
821
  var Node = class {
@@ -347,7 +888,7 @@ _tail = new WeakMap();
347
888
  _size = new WeakMap();
348
889
 
349
890
  // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
350
- function pLimit(concurrency) {
891
+ function pLimit2(concurrency) {
351
892
  validateConcurrency(concurrency);
352
893
  const queue = new Queue();
353
894
  let activeCount = 0;
@@ -627,44 +1168,19 @@ function pThrottle({ limit, interval, strict, onDelay }) {
627
1168
  }
628
1169
 
629
1170
  // ../canvas/dist/index.mjs
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) => {
1171
+ var __typeError3 = (msg) => {
656
1172
  throw TypeError(msg);
657
1173
  };
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);
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);
661
1177
  function createLimitPolicy({
662
1178
  throttle = { interval: 1e3, limit: 10 },
663
1179
  retry: retry3 = { retries: 1, factor: 1.66 },
664
1180
  limit = 10
665
1181
  }) {
666
1182
  const throttler = throttle ? pThrottle(throttle) : null;
667
- const limiter = limit ? pLimit(limit) : null;
1183
+ const limiter = limit ? pLimit2(limit) : null;
668
1184
  return function limitPolicy(func) {
669
1185
  let currentFunc = async () => await func();
670
1186
  if (throttler) {
@@ -692,7 +1208,7 @@ function createLimitPolicy({
692
1208
  return currentFunc();
693
1209
  };
694
1210
  }
695
- var ContentClientBase = class extends ApiClient2 {
1211
+ var ContentClientBase = class extends ApiClient {
696
1212
  constructor(options, defaultBypassCache) {
697
1213
  var _a, _b;
698
1214
  super({
@@ -838,7 +1354,7 @@ var CompositionDeliveryClient = class extends DeliveryClientBase {
838
1354
  };
839
1355
  var _contentTypesUrl;
840
1356
  var _entriesUrl;
841
- var _ContentClient = class _ContentClient2 extends ApiClient4 {
1357
+ var _ContentClient = class _ContentClient2 extends ApiClient {
842
1358
  constructor(options) {
843
1359
  var _a;
844
1360
  super(options);
@@ -846,16 +1362,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
846
1362
  }
847
1363
  getContentTypes(options) {
848
1364
  const { projectId } = this.options;
849
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1365
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
850
1366
  return this.apiClient(fetchUri);
851
1367
  }
852
1368
  getEntries(options) {
853
1369
  const { projectId } = this.options;
854
1370
  const { skipDataResolution, filters, select, ...params } = options;
855
- const rewrittenFilters = rewriteFiltersForApi6(filters);
1371
+ const rewrittenFilters = rewriteFiltersForApi(filters);
856
1372
  const rewrittenSelect = projectionToQuery(select);
857
1373
  if (skipDataResolution) {
858
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
1374
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
859
1375
  ...params,
860
1376
  ...rewrittenFilters,
861
1377
  ...rewrittenSelect,
@@ -864,7 +1380,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
864
1380
  return this.apiClient(url);
865
1381
  }
866
1382
  const edgeUrl = this.createUrl(
867
- __privateGet2(_ContentClient2, _entriesUrl),
1383
+ __privateGet3(_ContentClient2, _entriesUrl),
868
1384
  { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
869
1385
  this.edgeApiHost
870
1386
  );
@@ -882,7 +1398,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
882
1398
  return this.apiClient(historyUrl);
883
1399
  }
884
1400
  async upsertContentType(body, opts = {}) {
885
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1401
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
886
1402
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
887
1403
  delete body.contentType.slugSettings;
888
1404
  }
@@ -894,7 +1410,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
894
1410
  });
895
1411
  }
896
1412
  async upsertEntry(body, options) {
897
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1413
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
898
1414
  const headers = {};
899
1415
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
900
1416
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -908,7 +1424,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
908
1424
  return { modified: response.headers.get("x-modified-at") };
909
1425
  }
910
1426
  async deleteContentType(body) {
911
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1427
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
912
1428
  await this.apiClient(fetchUri, {
913
1429
  method: "DELETE",
914
1430
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -916,7 +1432,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
916
1432
  });
917
1433
  }
918
1434
  async deleteEntry(body) {
919
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1435
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
920
1436
  await this.apiClient(fetchUri, {
921
1437
  method: "DELETE",
922
1438
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -935,17 +1451,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
935
1451
  };
936
1452
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
937
1453
  _entriesUrl = /* @__PURE__ */ new WeakMap();
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 {
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 {
942
1458
  constructor(options) {
943
1459
  super(options);
944
1460
  }
945
1461
  /** Fetches a list of DataTypes for a project */
946
1462
  async list(options) {
947
1463
  const { projectId } = this.options;
948
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
1464
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
949
1465
  return await this.apiClient(fetchUri);
950
1466
  }
951
1467
  /** @deprecated Use {@link list} instead. */
@@ -954,7 +1470,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
954
1470
  }
955
1471
  /** Updates or creates (based on id) a DataType */
956
1472
  async save(body) {
957
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1473
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
958
1474
  await this.apiClient(fetchUri, {
959
1475
  method: "PUT",
960
1476
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -967,7 +1483,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
967
1483
  }
968
1484
  /** Deletes a DataType */
969
1485
  async remove(body) {
970
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1486
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
971
1487
  await this.apiClient(fetchUri, {
972
1488
  method: "DELETE",
973
1489
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -975,8 +1491,8 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
975
1491
  });
976
1492
  }
977
1493
  };
978
- _url = /* @__PURE__ */ new WeakMap();
979
- __privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
1494
+ _url8 = /* @__PURE__ */ new WeakMap();
1495
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
980
1496
  var variablePrefix = "${";
981
1497
  var variableSuffix = "}";
982
1498
  var escapeCharacter = "\\";
@@ -1054,7 +1570,7 @@ function createVariableReference(variableName) {
1054
1570
  return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
1055
1571
  }
1056
1572
  var _baseUrl;
1057
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient8 {
1573
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
1058
1574
  constructor(options) {
1059
1575
  super(options);
1060
1576
  this.teamId = options.teamId;
@@ -1063,7 +1579,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1063
1579
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1064
1580
  */
1065
1581
  get(options) {
1066
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1582
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1067
1583
  ...options,
1068
1584
  teamId: this.teamId
1069
1585
  });
@@ -1073,7 +1589,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1073
1589
  * Creates or updates a custom AI property editor on a Mesh app.
1074
1590
  */
1075
1591
  async deploy(body) {
1076
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1592
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1077
1593
  await this.apiClient(fetchUri, {
1078
1594
  method: "PUT",
1079
1595
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1084,7 +1600,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1084
1600
  * Removes a custom AI property editor from a Mesh app.
1085
1601
  */
1086
1602
  async delete(body) {
1087
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1603
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1088
1604
  await this.apiClient(fetchUri, {
1089
1605
  method: "DELETE",
1090
1606
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1093,16 +1609,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1093
1609
  }
1094
1610
  };
1095
1611
  _baseUrl = /* @__PURE__ */ new WeakMap();
1096
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1097
- var _url2;
1612
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1613
+ var _url22;
1098
1614
  var _projectsUrl;
1099
- var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1615
+ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1100
1616
  constructor(options) {
1101
1617
  super({ ...options, bypassCache: true });
1102
1618
  }
1103
1619
  /** Fetches single Project */
1104
1620
  async get(options) {
1105
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
1621
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1106
1622
  return await this.apiClient(fetchUri);
1107
1623
  }
1108
1624
  /**
@@ -1111,7 +1627,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1111
1627
  * When omitted, returns all accessible teams and their projects.
1112
1628
  */
1113
1629
  async list(options) {
1114
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1630
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1115
1631
  return await this.apiClient(fetchUri);
1116
1632
  }
1117
1633
  /** @deprecated Use {@link list} instead. */
@@ -1120,7 +1636,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1120
1636
  }
1121
1637
  /** Updates or creates (based on id) a Project */
1122
1638
  async save(body) {
1123
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1639
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1124
1640
  return await this.apiClient(fetchUri, {
1125
1641
  method: "PUT",
1126
1642
  body: JSON.stringify({ ...body })
@@ -1132,7 +1648,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1132
1648
  }
1133
1649
  /** Deletes a Project */
1134
1650
  async remove(body) {
1135
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1651
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1136
1652
  await this.apiClient(fetchUri, {
1137
1653
  method: "DELETE",
1138
1654
  body: JSON.stringify({ ...body }),
@@ -1144,10 +1660,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1144
1660
  return this.remove(body);
1145
1661
  }
1146
1662
  };
1147
- _url2 = /* @__PURE__ */ new WeakMap();
1663
+ _url22 = /* @__PURE__ */ new WeakMap();
1148
1664
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1149
- __privateAdd2(_ProjectClient, _url2, "/api/v1/project");
1150
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1665
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1666
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1151
1667
  var ALLOWED_REFERRER_ORIGIN = /^https:\/\/([\w-]+\.)*(uniform\.(app|wtf)|uniformcode\.ai)$|^https?:\/\/localhost:\d{4}$/;
1152
1668
  var isAllowedReferrer = (referrer) => {
1153
1669
  try {
@@ -1164,6 +1680,15 @@ import { NextResponse } from "next/server";
1164
1680
 
1165
1681
  // src/config/helpers.ts
1166
1682
  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
+ };
1167
1692
  var getPlaygroundPath = () => {
1168
1693
  if (typeof config.playgroundPath === "string") {
1169
1694
  return config.playgroundPath;
@@ -1340,6 +1865,7 @@ var createPreviewOPTIONSRouteHandler = () => {
1340
1865
  };
1341
1866
 
1342
1867
  // src/handler/createPreviewPOSTRouteHandler.ts
1868
+ import { getCache } from "@vercel/functions";
1343
1869
  import { revalidatePath, revalidateTag } from "next/cache";
1344
1870
 
1345
1871
  // src/handler/helpers.ts
@@ -1475,7 +2001,6 @@ var determineFetchCacheOptions = (mode) => {
1475
2001
  };
1476
2002
 
1477
2003
  // src/clients/retry.ts
1478
- import { ApiClientError as ApiClientError6 } from "@uniformdev/context/api";
1479
2004
  function createThrottler(limit, interval) {
1480
2005
  let available = limit;
1481
2006
  let refillScheduled = false;
@@ -1586,7 +2111,7 @@ function createLimitPolicy2({
1586
2111
  if (retryOptions.onFailedAttempt) {
1587
2112
  await retryOptions.onFailedAttempt(error);
1588
2113
  }
1589
- if (error instanceof ApiClientError6 && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
2114
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1590
2115
  throw error;
1591
2116
  }
1592
2117
  }
@@ -1657,16 +2182,15 @@ var getCompositionDeliveryClient = (options) => {
1657
2182
  import "server-only";
1658
2183
 
1659
2184
  // ../project-map/dist/index.mjs
1660
- import { ApiClient as ApiClient19 } from "@uniformdev/context/api";
1661
- var __typeError3 = (msg) => {
2185
+ var __typeError4 = (msg) => {
1662
2186
  throw TypeError(msg);
1663
2187
  };
1664
- var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1665
- var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1666
- 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);
1667
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
1668
- var __privateMethod = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
1669
- var ProjectMapClient = class extends ApiClient19 {
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 {
1670
2194
  constructor(options) {
1671
2195
  super(options);
1672
2196
  this.getProjectMapDefinitions = async () => {
@@ -1812,12 +2336,12 @@ var isDynamicRouteSegment_fn;
1812
2336
  var _Route = class _Route2 {
1813
2337
  constructor(route) {
1814
2338
  this.route = route;
1815
- __privateAdd3(this, _routeInfo);
2339
+ __privateAdd4(this, _routeInfo);
1816
2340
  var _a;
1817
2341
  __privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
1818
2342
  }
1819
2343
  get dynamicSegmentCount() {
1820
- return __privateGet3(this, _routeInfo).segments.reduce(
2344
+ return __privateGet4(this, _routeInfo).segments.reduce(
1821
2345
  (count, segment) => {
1822
2346
  var _a;
1823
2347
  return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
@@ -1829,7 +2353,7 @@ var _Route = class _Route2 {
1829
2353
  matches(path) {
1830
2354
  var _a, _b;
1831
2355
  const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
1832
- const { segments: routeSegments } = __privateGet3(this, _routeInfo);
2356
+ const { segments: routeSegments } = __privateGet4(this, _routeInfo);
1833
2357
  if (pathSegments.length !== routeSegments.length) {
1834
2358
  return { match: false };
1835
2359
  }
@@ -1850,7 +2374,7 @@ var _Route = class _Route2 {
1850
2374
  return { match: false };
1851
2375
  }
1852
2376
  }
1853
- for (const [key, value] of __privateGet3(this, _routeInfo).queryParams) {
2377
+ for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
1854
2378
  possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
1855
2379
  }
1856
2380
  return possibleMatch;
@@ -1860,7 +2384,7 @@ var _Route = class _Route2 {
1860
2384
  */
1861
2385
  expand(options) {
1862
2386
  const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
1863
- const path = __privateGet3(this, _routeInfo).segments.map((segment) => {
2387
+ const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
1864
2388
  const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
1865
2389
  if (!dynamicSegmentName) {
1866
2390
  return segment;
@@ -1940,7 +2464,7 @@ isDynamicRouteSegment_fn = function(segment) {
1940
2464
  }
1941
2465
  return segment.startsWith(_Route.dynamicSegmentPrefix);
1942
2466
  };
1943
- __privateAdd3(_Route, _Route_static);
2467
+ __privateAdd4(_Route, _Route_static);
1944
2468
  _Route.dynamicSegmentPrefix = ":";
1945
2469
  function encodeRouteComponent(value, doNotEscapeVariables) {
1946
2470
  if (!doNotEscapeVariables) {
@@ -2058,7 +2582,7 @@ var getComposition = async ({ compositionId }) => {
2058
2582
  });
2059
2583
  return composition;
2060
2584
  } catch (err) {
2061
- if (err instanceof ApiClientError5 && err.statusCode === 404) {
2585
+ if (err instanceof ApiClientError && err.statusCode === 404) {
2062
2586
  return null;
2063
2587
  }
2064
2588
  throw err;
@@ -2313,8 +2837,13 @@ var handleSvixMessage = async (request) => {
2313
2837
  }
2314
2838
  }
2315
2839
  if (tags == null ? void 0 : tags.length) {
2840
+ const cache = getMiddlewareRuntimeCache() ? getCache() : void 0;
2316
2841
  for (let i = 0; i < tags.length; i++) {
2317
- revalidateTag(tags[i], "max");
2842
+ const tag = tags[i];
2843
+ revalidateTag(tag, "max");
2844
+ if (cache) {
2845
+ await cache.expireTag(tag);
2846
+ }
2318
2847
  }
2319
2848
  }
2320
2849
  if (paths == null ? void 0 : paths.length) {