@uniformdev/next-app-router 20.81.1-alpha.7.sha-91a5b13e0c → 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.
Files changed (46) hide show
  1. package/dist/{UniformComposition-C00_YDOg.d.ts → UniformComposition-DBO-oo7J.d.ts} +31 -11
  2. package/dist/{UniformComposition-DiArCpVQ.d.mts → UniformComposition-le6UEB_r.d.mts} +31 -11
  3. package/dist/cache.d.mts +6 -24
  4. package/dist/cache.d.ts +6 -24
  5. package/dist/cache.js +831 -410
  6. package/dist/cache.mjs +829 -405
  7. package/dist/client-BElN_CWD.d.mts +786 -0
  8. package/dist/client-BElN_CWD.d.ts +786 -0
  9. package/dist/compat.d.mts +4 -2
  10. package/dist/compat.d.ts +4 -2
  11. package/dist/component.d.mts +1 -10
  12. package/dist/component.d.ts +1 -10
  13. package/dist/component.js +617 -113
  14. package/dist/component.mjs +640 -112
  15. package/dist/config/default.js +1 -0
  16. package/dist/config/default.mjs +1 -0
  17. package/dist/handler.d.mts +2 -15
  18. package/dist/handler.d.ts +2 -15
  19. package/dist/handler.js +628 -134
  20. package/dist/handler.mjs +626 -132
  21. package/dist/index.d.mts +42 -73
  22. package/dist/index.d.ts +42 -73
  23. package/dist/index.esm.js +5802 -2205
  24. package/dist/index.js +5615 -2022
  25. package/dist/index.mjs +5802 -2205
  26. package/dist/middleware.d.mts +13 -52
  27. package/dist/middleware.d.ts +13 -52
  28. package/dist/middleware.js +5741 -405
  29. package/dist/middleware.mjs +5774 -415
  30. package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +18 -0
  31. package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +18 -0
  32. package/package.json +9 -37
  33. package/dist/composition-BvOM-LIW.d.mts +0 -28
  34. package/dist/composition-BvOM-LIW.d.ts +0 -28
  35. package/dist/createCachedManifestProvider-C7faGJJ8.d.mts +0 -69
  36. package/dist/createCachedManifestProvider-C7faGJJ8.d.ts +0 -69
  37. package/dist/edge.d.mts +0 -57
  38. package/dist/edge.d.ts +0 -57
  39. package/dist/edge.js +0 -1105
  40. package/dist/edge.mjs +0 -1073
  41. package/dist/resolveRouteFromPath-BHJGOpBN.d.ts +0 -82
  42. package/dist/resolveRouteFromPath-BsZUVkRX.d.mts +0 -82
  43. package/dist/vercel.d.mts +0 -24
  44. package/dist/vercel.d.ts +0 -24
  45. package/dist/vercel.js +0 -703
  46. package/dist/vercel.mjs +0 -675
package/dist/cache.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,436 @@ 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
+ // src/data/resolveRouteFromCode.ts
394
+ import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
395
+
396
+ // ../context/dist/api/api.mjs
397
+ var import_p_limit = __toESM(require_p_limit(), 1);
398
+ var __defProp2 = Object.defineProperty;
399
+ var __typeError2 = (msg) => {
400
+ throw TypeError(msg);
401
+ };
402
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
403
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
404
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
405
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
406
+ 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);
407
+ var defaultLimitPolicy = (0, import_p_limit.default)(6);
408
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
409
+ var ApiClientError = class _ApiClientError extends Error {
410
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
411
+ super(
412
+ `${errorMessage}
413
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
414
+ );
415
+ __publicField2(this, "errorMessage", errorMessage);
416
+ __publicField2(this, "fetchMethod", fetchMethod);
417
+ __publicField2(this, "fetchUri", fetchUri);
418
+ __publicField2(this, "statusCode", statusCode);
419
+ __publicField2(this, "statusText", statusText);
420
+ __publicField2(this, "requestId", requestId);
421
+ Object.setPrototypeOf(this, _ApiClientError.prototype);
422
+ }
423
+ };
424
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
425
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
426
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
427
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
428
+ }
429
+ };
430
+ var ApiClient = class _ApiClient {
431
+ constructor(options) {
432
+ __publicField2(this, "options");
433
+ var _a, _b, _c, _d, _e;
434
+ if (!options.apiKey && !options.bearerToken) {
435
+ throw new Error("You must provide an API key or a bearer token");
436
+ }
437
+ let leFetch = options.fetch;
438
+ if (!leFetch) {
439
+ if (typeof window !== "undefined") {
440
+ leFetch = window.fetch.bind(window);
441
+ } else if (typeof fetch !== "undefined") {
442
+ leFetch = fetch;
443
+ } else {
444
+ throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
445
+ }
446
+ }
447
+ this.options = {
448
+ ...options,
449
+ fetch: leFetch,
450
+ apiHost: this.ensureApiHost(options.apiHost),
451
+ apiKey: (_a = options.apiKey) != null ? _a : null,
452
+ projectId: (_b = options.projectId) != null ? _b : null,
453
+ bearerToken: (_c = options.bearerToken) != null ? _c : null,
454
+ limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
455
+ bypassCache: (_e = options.bypassCache) != null ? _e : false
456
+ };
457
+ }
458
+ async apiClient(fetchUri, options) {
459
+ return (await this.apiClientWithResponse(fetchUri, options)).body;
460
+ }
461
+ async apiClientWithResponse(fetchUri, options) {
462
+ return this.options.limitPolicy(async () => {
463
+ var _a, _b;
464
+ const coreHeaders = this.options.apiKey ? {
465
+ "x-api-key": this.options.apiKey
466
+ } : {
467
+ Authorization: `Bearer ${this.options.bearerToken}`
468
+ };
469
+ if (this.options.bypassCache) {
470
+ coreHeaders["x-bypass-cache"] = "true";
471
+ }
472
+ const { fetch: fetch2, signal } = this.options;
473
+ const callApi = () => fetch2(fetchUri.toString(), {
474
+ ...options,
475
+ signal,
476
+ headers: {
477
+ ...options == null ? void 0 : options.headers,
478
+ ...coreHeaders
479
+ }
480
+ });
481
+ const apiResponse = await handleRateLimits(callApi);
482
+ if (!apiResponse.ok) {
483
+ let message = "";
484
+ try {
485
+ const responseText = await apiResponse.text();
486
+ try {
487
+ const parsed = JSON.parse(responseText);
488
+ if (parsed.errorMessage) {
489
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
490
+ } else {
491
+ message = responseText;
492
+ }
493
+ } catch (e) {
494
+ message = responseText;
495
+ }
496
+ } catch (e) {
497
+ message = `General error`;
498
+ }
499
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
500
+ throw new BearerTokenNotValidOrExpiredError(
501
+ message,
502
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
503
+ fetchUri.toString(),
504
+ apiResponse.status,
505
+ apiResponse.statusText,
506
+ _ApiClient.getRequestId(apiResponse)
507
+ );
508
+ }
509
+ throw new ApiClientError(
510
+ message,
511
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
512
+ fetchUri.toString(),
513
+ apiResponse.status,
514
+ apiResponse.statusText,
515
+ _ApiClient.getRequestId(apiResponse)
516
+ );
517
+ }
518
+ if (options == null ? void 0 : options.expectNoContent) {
519
+ return { response: apiResponse, body: null };
520
+ }
521
+ return {
522
+ response: apiResponse,
523
+ body: await apiResponse.json()
524
+ };
525
+ });
526
+ }
527
+ createUrl(path, queryParams, hostOverride) {
528
+ const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
529
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
530
+ var _a;
531
+ if (typeof value !== "undefined" && value !== null) {
532
+ url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
533
+ }
534
+ });
535
+ return url;
536
+ }
537
+ ensureApiHost(apiHost) {
538
+ if (!apiHost) return "https://uniform.app";
539
+ if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
540
+ throw new Error('Your apiHost must start with "http"');
541
+ }
542
+ if (apiHost.indexOf("/", 8) > -1) {
543
+ throw new Error("Your apiHost must not contain a path element after the domain");
544
+ }
545
+ if (apiHost.indexOf("?") > -1) {
546
+ throw new Error("Your apiHost must not contain a query string");
547
+ }
548
+ if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
549
+ apiHost = apiHost.substring(0, apiHost.length - 1);
550
+ }
551
+ return apiHost;
552
+ }
553
+ static getRequestId(response) {
554
+ const apigRequestId = response.headers.get("apigw-requestid");
555
+ if (apigRequestId) {
556
+ return apigRequestId;
557
+ }
558
+ return void 0;
559
+ }
560
+ };
561
+ async function handleRateLimits(callApi) {
562
+ var _a;
563
+ const backoffRetries = 5;
564
+ let backoffRetriesLeft = backoffRetries;
565
+ let response;
566
+ while (backoffRetriesLeft > 0) {
567
+ response = await callApi();
568
+ if (response.status !== 429) {
569
+ break;
570
+ }
571
+ let resetWait = 0;
572
+ try {
573
+ const responseClone = response.clone();
574
+ const dateHeader = responseClone.headers.get("date");
575
+ const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
576
+ const body = await responseClone.json();
577
+ const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
578
+ if (typeof serverTime === "number" && typeof resetTime === "number") {
579
+ resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
580
+ }
581
+ } catch (e) {
582
+ }
583
+ const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
584
+ const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
585
+ await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
586
+ backoffRetriesLeft -= 1;
587
+ }
588
+ return response;
589
+ }
590
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
591
+ function rewriteFiltersForApi(filters) {
592
+ return Object.entries(filters != null ? filters : {}).reduce(
593
+ (acc, [key, value]) => {
594
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
595
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
596
+ return {
597
+ ...acc,
598
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
599
+ };
600
+ },
601
+ {}
602
+ );
603
+ }
604
+ var _url;
605
+ var _AggregateClient = class _AggregateClient2 extends ApiClient {
606
+ constructor(options) {
607
+ super(options);
608
+ }
609
+ /** Fetches all aggregates for a project */
610
+ async get(options) {
611
+ const { projectId } = this.options;
612
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
613
+ return await this.apiClient(fetchUri);
614
+ }
615
+ /** Updates or creates (based on id) an Aggregate */
616
+ async upsert(body) {
617
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
618
+ await this.apiClient(fetchUri, {
619
+ method: "PUT",
620
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
621
+ expectNoContent: true
622
+ });
623
+ }
624
+ /** Deletes an Aggregate */
625
+ async remove(body) {
626
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
627
+ await this.apiClient(fetchUri, {
628
+ method: "DELETE",
629
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
630
+ expectNoContent: true
631
+ });
632
+ }
633
+ };
634
+ _url = /* @__PURE__ */ new WeakMap();
635
+ __privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
636
+ var _url2;
637
+ var _DimensionClient = class _DimensionClient2 extends ApiClient {
638
+ constructor(options) {
639
+ super(options);
640
+ }
641
+ /** Fetches the known score dimensions for a project */
642
+ async get(options) {
643
+ const { projectId } = this.options;
644
+ const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
645
+ return await this.apiClient(fetchUri);
646
+ }
647
+ };
648
+ _url2 = /* @__PURE__ */ new WeakMap();
649
+ __privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
650
+ var _url3;
651
+ var _valueUrl;
652
+ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
653
+ constructor(options) {
654
+ super(options);
655
+ }
656
+ /** Fetches all enrichments and values for a project, grouped by category */
657
+ async get(options) {
658
+ const { projectId } = this.options;
659
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
660
+ return await this.apiClient(fetchUri);
661
+ }
662
+ /** Updates or creates (based on id) an enrichment category */
663
+ async upsertCategory(body) {
664
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
665
+ await this.apiClient(fetchUri, {
666
+ method: "PUT",
667
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
668
+ expectNoContent: true
669
+ });
670
+ }
671
+ /** Deletes an enrichment category */
672
+ async removeCategory(body) {
673
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
674
+ await this.apiClient(fetchUri, {
675
+ method: "DELETE",
676
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
677
+ expectNoContent: true
678
+ });
679
+ }
680
+ /** Updates or creates (based on id) an enrichment value within an enrichment category */
681
+ async upsertValue(body) {
682
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
683
+ await this.apiClient(fetchUri, {
684
+ method: "PUT",
685
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
686
+ expectNoContent: true
687
+ });
688
+ }
689
+ /** Deletes an enrichment value within an enrichment category. The category is left alone. */
690
+ async removeValue(body) {
691
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
692
+ await this.apiClient(fetchUri, {
693
+ method: "DELETE",
694
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
695
+ expectNoContent: true
696
+ });
697
+ }
698
+ };
699
+ _url3 = /* @__PURE__ */ new WeakMap();
700
+ _valueUrl = /* @__PURE__ */ new WeakMap();
701
+ __privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
702
+ __privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
703
+ var _url4;
704
+ var _ManifestClient = class _ManifestClient2 extends ApiClient {
705
+ constructor(options) {
706
+ super(options);
707
+ }
708
+ /** Fetches the Context manifest for a project */
709
+ async get(options) {
710
+ const { projectId } = this.options;
711
+ const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
712
+ return await this.apiClient(fetchUri);
713
+ }
714
+ /** Publishes the Context manifest for a project */
715
+ async publish() {
716
+ const { projectId } = this.options;
717
+ const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
718
+ await this.apiClient(fetchUri, {
719
+ method: "POST",
720
+ expectNoContent: true
721
+ });
722
+ }
723
+ };
724
+ _url4 = /* @__PURE__ */ new WeakMap();
725
+ __privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
726
+ var ManifestClient = _ManifestClient;
727
+ var _url5;
728
+ var _QuirkClient = class _QuirkClient2 extends ApiClient {
729
+ constructor(options) {
730
+ super(options);
731
+ }
732
+ /** Fetches all Quirks for a project */
733
+ async get(options) {
734
+ const { projectId } = this.options;
735
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
736
+ return await this.apiClient(fetchUri);
737
+ }
738
+ /** Updates or creates (based on id) a Quirk */
739
+ async upsert(body) {
740
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
741
+ await this.apiClient(fetchUri, {
742
+ method: "PUT",
743
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
744
+ expectNoContent: true
745
+ });
746
+ }
747
+ /** Deletes a Quirk */
748
+ async remove(body) {
749
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
750
+ await this.apiClient(fetchUri, {
751
+ method: "DELETE",
752
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
753
+ expectNoContent: true
754
+ });
755
+ }
756
+ };
757
+ _url5 = /* @__PURE__ */ new WeakMap();
758
+ __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
759
+ var _url6;
760
+ var _SignalClient = class _SignalClient2 extends ApiClient {
761
+ constructor(options) {
762
+ super(options);
763
+ }
764
+ /** Fetches all Signals for a project */
765
+ async get(options) {
766
+ const { projectId } = this.options;
767
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
768
+ return await this.apiClient(fetchUri);
769
+ }
770
+ /** Updates or creates (based on id) a Signal */
771
+ async upsert(body) {
772
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
773
+ await this.apiClient(fetchUri, {
774
+ method: "PUT",
775
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
776
+ expectNoContent: true
777
+ });
778
+ }
779
+ /** Deletes a Signal */
780
+ async remove(body) {
781
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
782
+ await this.apiClient(fetchUri, {
783
+ method: "DELETE",
784
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
785
+ expectNoContent: true
786
+ });
787
+ }
788
+ };
789
+ _url6 = /* @__PURE__ */ new WeakMap();
790
+ __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
791
+ var _url7;
792
+ var _TestClient = class _TestClient2 extends ApiClient {
793
+ constructor(options) {
794
+ super(options);
795
+ }
796
+ /** Fetches all Tests for a project */
797
+ async get(options) {
798
+ const { projectId } = this.options;
799
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
800
+ return await this.apiClient(fetchUri);
801
+ }
802
+ /** Updates or creates (based on id) a Test */
803
+ async upsert(body) {
804
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
805
+ await this.apiClient(fetchUri, {
806
+ method: "PUT",
807
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
808
+ expectNoContent: true
809
+ });
810
+ }
811
+ /** Deletes a Test */
812
+ async remove(body) {
813
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
814
+ await this.apiClient(fetchUri, {
815
+ method: "DELETE",
816
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
817
+ expectNoContent: true
818
+ });
819
+ }
820
+ };
821
+ _url7 = /* @__PURE__ */ new WeakMap();
822
+ __privateAdd2(_TestClient, _url7, "/api/v2/test");
278
823
 
279
824
  // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
280
825
  var Node = class {
@@ -347,7 +892,7 @@ _tail = new WeakMap();
347
892
  _size = new WeakMap();
348
893
 
349
894
  // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
350
- function pLimit(concurrency) {
895
+ function pLimit2(concurrency) {
351
896
  validateConcurrency(concurrency);
352
897
  const queue = new Queue();
353
898
  let activeCount = 0;
@@ -627,44 +1172,19 @@ function pThrottle({ limit, interval, strict, onDelay }) {
627
1172
  }
628
1173
 
629
1174
  // ../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) => {
1175
+ var __typeError3 = (msg) => {
656
1176
  throw TypeError(msg);
657
1177
  };
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);
1178
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1179
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1180
+ 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
1181
  function createLimitPolicy({
662
1182
  throttle = { interval: 1e3, limit: 10 },
663
1183
  retry: retry3 = { retries: 1, factor: 1.66 },
664
1184
  limit = 10
665
1185
  }) {
666
1186
  const throttler = throttle ? pThrottle(throttle) : null;
667
- const limiter = limit ? pLimit(limit) : null;
1187
+ const limiter = limit ? pLimit2(limit) : null;
668
1188
  return function limitPolicy(func) {
669
1189
  let currentFunc = async () => await func();
670
1190
  if (throttler) {
@@ -692,16 +1212,6 @@ function createLimitPolicy({
692
1212
  return currentFunc();
693
1213
  };
694
1214
  }
695
- var ContentClientBase = class extends ApiClient2 {
696
- constructor(options, defaultBypassCache) {
697
- var _a, _b;
698
- super({
699
- ...options,
700
- limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
701
- bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
702
- });
703
- }
704
- };
705
1215
  var SELECT_QUERY_PREFIX = "select.";
706
1216
  function appendCsv(out, key, values) {
707
1217
  if (values === void 0) {
@@ -754,89 +1264,9 @@ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displa
754
1264
  var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
755
1265
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
756
1266
  var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
757
- function resolveCompositionSelector(args) {
758
- if ("compositionId" in args) {
759
- const { compositionId, editionId, versionId, ...readOptions } = args;
760
- return {
761
- readOptions,
762
- // raw mode matches on composition OR edition id via the compositionId param
763
- compositionId: editionId != null ? editionId : compositionId,
764
- versionId,
765
- hasCompositionId: true,
766
- pinnedEdition: editionId !== void 0
767
- };
768
- }
769
- return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
770
- }
771
- var DEFAULT_EDGE_API_HOST = "https://uniform.global";
772
- var DeliveryClientBase = class extends ContentClientBase {
773
- constructor(options) {
774
- var _a;
775
- super(
776
- options,
777
- /* defaultBypassCache */
778
- false
779
- );
780
- this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
781
- this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
782
- }
783
- /** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
784
- coerceDiagnostics(diagnostics) {
785
- return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
786
- }
787
- };
788
- var EDGE_SINGLE_URL = "/api/v1/composition";
789
- var EDGE_LIST_URL = "/api/v1/compositions";
790
- var CompositionDeliveryClient = class extends DeliveryClientBase {
791
- constructor(options) {
792
- super(options);
793
- }
794
- /** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
795
- get(args) {
796
- var _a;
797
- const { diagnostics, select, ...rest } = args;
798
- const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
799
- const url = this.createUrl(
800
- EDGE_SINGLE_URL,
801
- {
802
- ...readOptions,
803
- ...projectionToQuery(select),
804
- // A pinned edition is folded into compositionId (raw matches edition or
805
- // composition id); there is no editionId query param on this endpoint.
806
- compositionId,
807
- versionId,
808
- projectId: this.options.projectId,
809
- state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
810
- // editionId pins a specific edition for preview; otherwise locale-best.
811
- editions: pinnedEdition ? "raw" : "auto",
812
- diagnostics: this.coerceDiagnostics(diagnostics)
813
- },
814
- this.edgeApiHost
815
- );
816
- return this.apiClient(url, this.edgeRequestInit);
817
- }
818
- /** Fetches a list of compositions, optionally filtered. */
819
- list(args = {}) {
820
- var _a;
821
- const { diagnostics, filters, select, ...rest } = args;
822
- const url = this.createUrl(
823
- EDGE_LIST_URL,
824
- {
825
- ...rest,
826
- ...rewriteFiltersForApi(filters),
827
- ...projectionToQuery(select),
828
- projectId: this.options.projectId,
829
- state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
830
- diagnostics: this.coerceDiagnostics(diagnostics)
831
- },
832
- this.edgeApiHost
833
- );
834
- return this.apiClient(url, this.edgeRequestInit);
835
- }
836
- };
837
1267
  var _contentTypesUrl;
838
1268
  var _entriesUrl;
839
- var _ContentClient = class _ContentClient2 extends ApiClient4 {
1269
+ var _ContentClient = class _ContentClient2 extends ApiClient {
840
1270
  constructor(options) {
841
1271
  var _a;
842
1272
  super(options);
@@ -844,16 +1274,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
844
1274
  }
845
1275
  getContentTypes(options) {
846
1276
  const { projectId } = this.options;
847
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1277
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
848
1278
  return this.apiClient(fetchUri);
849
1279
  }
850
1280
  getEntries(options) {
851
1281
  const { projectId } = this.options;
852
1282
  const { skipDataResolution, filters, select, ...params } = options;
853
- const rewrittenFilters = rewriteFiltersForApi6(filters);
1283
+ const rewrittenFilters = rewriteFiltersForApi(filters);
854
1284
  const rewrittenSelect = projectionToQuery(select);
855
1285
  if (skipDataResolution) {
856
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
1286
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
857
1287
  ...params,
858
1288
  ...rewrittenFilters,
859
1289
  ...rewrittenSelect,
@@ -862,7 +1292,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
862
1292
  return this.apiClient(url);
863
1293
  }
864
1294
  const edgeUrl = this.createUrl(
865
- __privateGet2(_ContentClient2, _entriesUrl),
1295
+ __privateGet3(_ContentClient2, _entriesUrl),
866
1296
  { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
867
1297
  this.edgeApiHost
868
1298
  );
@@ -880,7 +1310,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
880
1310
  return this.apiClient(historyUrl);
881
1311
  }
882
1312
  async upsertContentType(body, opts = {}) {
883
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1313
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
884
1314
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
885
1315
  delete body.contentType.slugSettings;
886
1316
  }
@@ -892,7 +1322,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
892
1322
  });
893
1323
  }
894
1324
  async upsertEntry(body, options) {
895
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1325
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
896
1326
  const headers = {};
897
1327
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
898
1328
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -906,7 +1336,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
906
1336
  return { modified: response.headers.get("x-modified-at") };
907
1337
  }
908
1338
  async deleteContentType(body) {
909
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1339
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
910
1340
  await this.apiClient(fetchUri, {
911
1341
  method: "DELETE",
912
1342
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -914,7 +1344,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
914
1344
  });
915
1345
  }
916
1346
  async deleteEntry(body) {
917
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1347
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
918
1348
  await this.apiClient(fetchUri, {
919
1349
  method: "DELETE",
920
1350
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -933,17 +1363,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
933
1363
  };
934
1364
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
935
1365
  _entriesUrl = /* @__PURE__ */ new WeakMap();
936
- __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
937
- __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
938
- var _url;
939
- var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
1366
+ __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1367
+ __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1368
+ var _url8;
1369
+ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
940
1370
  constructor(options) {
941
1371
  super(options);
942
1372
  }
943
1373
  /** Fetches a list of DataTypes for a project */
944
1374
  async list(options) {
945
1375
  const { projectId } = this.options;
946
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
1376
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
947
1377
  return await this.apiClient(fetchUri);
948
1378
  }
949
1379
  /** @deprecated Use {@link list} instead. */
@@ -952,7 +1382,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
952
1382
  }
953
1383
  /** Updates or creates (based on id) a DataType */
954
1384
  async save(body) {
955
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1385
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
956
1386
  await this.apiClient(fetchUri, {
957
1387
  method: "PUT",
958
1388
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -965,7 +1395,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
965
1395
  }
966
1396
  /** Deletes a DataType */
967
1397
  async remove(body) {
968
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1398
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
969
1399
  await this.apiClient(fetchUri, {
970
1400
  method: "DELETE",
971
1401
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -973,10 +1403,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
973
1403
  });
974
1404
  }
975
1405
  };
976
- _url = /* @__PURE__ */ new WeakMap();
977
- __privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
1406
+ _url8 = /* @__PURE__ */ new WeakMap();
1407
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
978
1408
  var _baseUrl;
979
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient8 {
1409
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
980
1410
  constructor(options) {
981
1411
  super(options);
982
1412
  this.teamId = options.teamId;
@@ -985,7 +1415,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
985
1415
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
986
1416
  */
987
1417
  get(options) {
988
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1418
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
989
1419
  ...options,
990
1420
  teamId: this.teamId
991
1421
  });
@@ -995,7 +1425,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
995
1425
  * Creates or updates a custom AI property editor on a Mesh app.
996
1426
  */
997
1427
  async deploy(body) {
998
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1428
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
999
1429
  await this.apiClient(fetchUri, {
1000
1430
  method: "PUT",
1001
1431
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1006,7 +1436,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1006
1436
  * Removes a custom AI property editor from a Mesh app.
1007
1437
  */
1008
1438
  async delete(body) {
1009
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1439
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1010
1440
  await this.apiClient(fetchUri, {
1011
1441
  method: "DELETE",
1012
1442
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1015,16 +1445,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1015
1445
  }
1016
1446
  };
1017
1447
  _baseUrl = /* @__PURE__ */ new WeakMap();
1018
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1019
- var _url2;
1448
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1449
+ var _url22;
1020
1450
  var _projectsUrl;
1021
- var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1451
+ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1022
1452
  constructor(options) {
1023
1453
  super({ ...options, bypassCache: true });
1024
1454
  }
1025
1455
  /** Fetches single Project */
1026
1456
  async get(options) {
1027
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
1457
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1028
1458
  return await this.apiClient(fetchUri);
1029
1459
  }
1030
1460
  /**
@@ -1033,7 +1463,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1033
1463
  * When omitted, returns all accessible teams and their projects.
1034
1464
  */
1035
1465
  async list(options) {
1036
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1466
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1037
1467
  return await this.apiClient(fetchUri);
1038
1468
  }
1039
1469
  /** @deprecated Use {@link list} instead. */
@@ -1042,7 +1472,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1042
1472
  }
1043
1473
  /** Updates or creates (based on id) a Project */
1044
1474
  async save(body) {
1045
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1475
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1046
1476
  return await this.apiClient(fetchUri, {
1047
1477
  method: "PUT",
1048
1478
  body: JSON.stringify({ ...body })
@@ -1054,7 +1484,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1054
1484
  }
1055
1485
  /** Deletes a Project */
1056
1486
  async remove(body) {
1057
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1487
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1058
1488
  await this.apiClient(fetchUri, {
1059
1489
  method: "DELETE",
1060
1490
  body: JSON.stringify({ ...body }),
@@ -1066,12 +1496,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
1066
1496
  return this.remove(body);
1067
1497
  }
1068
1498
  };
1069
- _url2 = /* @__PURE__ */ new WeakMap();
1499
+ _url22 = /* @__PURE__ */ new WeakMap();
1070
1500
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1071
- __privateAdd2(_ProjectClient, _url2, "/api/v1/project");
1072
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1501
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1502
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1073
1503
  var ROUTE_URL = "/api/v1/route";
1074
- var RouteClient = class extends ApiClient17 {
1504
+ var RouteClient = class extends ApiClient {
1075
1505
  constructor(options) {
1076
1506
  var _a;
1077
1507
  if (!options.limitPolicy) {
@@ -1114,38 +1544,10 @@ var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
1114
1544
  return dataSourceVariant;
1115
1545
  };
1116
1546
 
1117
- // src/cache.ts
1118
- import { cacheTag } from "next/cache";
1119
-
1120
- // src/utils/tag.ts
1121
- var encodePathForTag = (path) => path.split("/").map((segment) => /[^\x00-\x7F]/.test(segment) ? encodeURIComponent(segment) : segment).join("/");
1122
- var buildPathTag = (path) => {
1123
- const actualPath = path.startsWith("/") ? path : `/${path}`;
1124
- return `path:${encodePathForTag(actualPath)}`.toLowerCase();
1125
- };
1126
- var buildCompositionTag = (compositionId) => {
1127
- return `composition:${compositionId}`.toLowerCase();
1128
- };
1129
- var buildCompositionSlugTag = (slug) => {
1130
- return `composition-slug:${encodePathForTag(slug)}`.toLowerCase();
1131
- };
1132
-
1133
- // src/clients/tags.ts
1134
- var generateRouteCacheTags = ({ path }) => {
1135
- const tags = ["route"];
1136
- if (path) {
1137
- const pathWithoutQuery = path.split("?")[0];
1138
- const pieces = pathWithoutQuery.split("/");
1139
- for (let i = 0; i < pieces.length; i++) {
1140
- const segmentPieces = pieces.slice(0, i + 1);
1141
- const segment = segmentPieces.join("/");
1142
- tags.push(buildPathTag(segment));
1143
- }
1144
- }
1145
- return tags;
1146
- };
1547
+ // src/data/client.ts
1548
+ import { getCache, waitUntil } from "@vercel/functions";
1147
1549
 
1148
- // src/clients/canvas.ts
1550
+ // src/clients/manifest.ts
1149
1551
  import "server-only";
1150
1552
 
1151
1553
  // src/utils/env.ts
@@ -1198,6 +1600,11 @@ var isStateCacheMode = (options) => {
1198
1600
  var isDetectCacheMode = (options) => {
1199
1601
  return "searchParams" in options && "draftModeEnabled" in options;
1200
1602
  };
1603
+ var resolveManifestCache = (options) => {
1604
+ return resolveCache({
1605
+ options
1606
+ });
1607
+ };
1201
1608
  var resolveCanvasCache = (options) => {
1202
1609
  return resolveCache({
1203
1610
  options
@@ -1265,7 +1672,6 @@ var determineFetchCacheOptions = (mode) => {
1265
1672
  };
1266
1673
 
1267
1674
  // src/clients/retry.ts
1268
- import { ApiClientError as ApiClientError6 } from "@uniformdev/context/api";
1269
1675
  function createThrottler(limit, interval) {
1270
1676
  let available = limit;
1271
1677
  let refillScheduled = false;
@@ -1376,7 +1782,7 @@ function createLimitPolicy2({
1376
1782
  if (retryOptions.onFailedAttempt) {
1377
1783
  await retryOptions.onFailedAttempt(error);
1378
1784
  }
1379
- if (error instanceof ApiClientError6 && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1785
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1380
1786
  throw error;
1381
1787
  }
1382
1788
  }
@@ -1386,66 +1792,67 @@ function createLimitPolicy2({
1386
1792
  };
1387
1793
  }
1388
1794
 
1389
- // src/clients/canvas.ts
1390
- var buildCanvasClientOptions = (options) => {
1391
- const cache = resolveCanvasCache(options);
1392
- return {
1393
- projectId: env.getProjectId(),
1795
+ // src/utils/tag.ts
1796
+ var buildPathTag = (path) => {
1797
+ const actualPath = path.startsWith("/") ? path : `/${path}`;
1798
+ return `path:${actualPath}`.toLowerCase();
1799
+ };
1800
+
1801
+ // src/clients/tags.ts
1802
+ var generateRouteCacheTags = ({ path, old }) => {
1803
+ const tags = old ? ["route-old"] : ["route"];
1804
+ if (path) {
1805
+ const pathWithoutQuery = path.split("?")[0];
1806
+ const pieces = pathWithoutQuery.split("/");
1807
+ for (let i = 0; i < pieces.length; i++) {
1808
+ const segmentPieces = pieces.slice(0, i + 1);
1809
+ const segment = segmentPieces.join("/");
1810
+ tags.push(buildPathTag(segment));
1811
+ }
1812
+ }
1813
+ return tags;
1814
+ };
1815
+ var generateManifestCacheTags = () => {
1816
+ return ["manifest"];
1817
+ };
1818
+
1819
+ // src/clients/manifest.ts
1820
+ var getManifestClient = (options) => {
1821
+ const cache = resolveManifestCache(options);
1822
+ const manifestClient = new ManifestClient({
1394
1823
  apiHost: env.getApiHost(),
1395
1824
  apiKey: env.getApiKey(),
1396
- edgeApiHost: env.getEdgeApiHost(),
1397
- disableSWR: typeof cache.disableSWR !== "undefined" ? cache.disableSWR : true,
1825
+ projectId: env.getProjectId(),
1398
1826
  limitPolicy: createLimitPolicy2({
1399
1827
  limit: 6
1400
1828
  }),
1401
1829
  fetch: (req, init) => {
1402
- let requestedUrl;
1403
- if (typeof req === "string") {
1404
- requestedUrl = new URL(req);
1405
- } else if (req instanceof URL) {
1406
- requestedUrl = req;
1407
- } else {
1408
- requestedUrl = new URL(req.url);
1409
- }
1410
- const tags = [];
1411
- if (requestedUrl) {
1412
- const compositionIdKey = "compositionId";
1413
- const compositionIdsKey = "compositionIDs";
1414
- const slugKey = "slug";
1415
- const compositionId = requestedUrl.searchParams.get(compositionIdKey);
1416
- const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
1417
- const slug = requestedUrl.searchParams.get(slugKey);
1418
- if (compositionId) {
1419
- tags.push(buildCompositionTag(compositionId));
1420
- }
1421
- if (slug) {
1422
- tags.push(buildCompositionSlugTag(slug));
1423
- }
1424
- if (compositionIds) {
1425
- const ids = compositionIds.split(",");
1426
- for (let i = 0; i < ids.length; i++) {
1427
- tags.push(buildCompositionTag(ids[i]));
1428
- }
1429
- }
1430
- }
1431
1830
  const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
1432
1831
  return fetch(req, {
1433
1832
  ...init,
1434
- cache: fetchCache,
1435
1833
  headers: {
1436
1834
  ...init == null ? void 0 : init.headers,
1437
1835
  "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
1438
1836
  },
1837
+ cache: fetchCache,
1439
1838
  next: {
1440
1839
  revalidate,
1441
- tags: tags.length ? tags : void 0
1840
+ tags: generateManifestCacheTags()
1442
1841
  }
1443
1842
  });
1444
1843
  }
1445
- };
1844
+ });
1845
+ return manifestClient;
1446
1846
  };
1447
- var getCompositionDeliveryClient = (options) => {
1448
- return new CompositionDeliveryClient(buildCanvasClientOptions(options));
1847
+ var getManifest = async (options) => {
1848
+ let preview = false;
1849
+ if (options && isStateCacheMode(options)) {
1850
+ preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
1851
+ }
1852
+ const manifestClient = getManifestClient(options);
1853
+ return manifestClient.get({
1854
+ preview
1855
+ });
1449
1856
  };
1450
1857
 
1451
1858
  // src/clients/route.ts
@@ -1499,200 +1906,217 @@ var getRouteClient = (options) => {
1499
1906
  return client;
1500
1907
  };
1501
1908
 
1909
+ // src/config/helpers.ts
1910
+ import config from "@uniformdev/next-app-router/config/resolved";
1911
+ var getMiddlewareRuntimeCache = () => {
1912
+ if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
1913
+ return false;
1914
+ }
1915
+ if (typeof config.middlewareRuntimeCache === "boolean") {
1916
+ return config.middlewareRuntimeCache;
1917
+ }
1918
+ return true;
1919
+ };
1920
+ var getDisableSwrMiddlewareCache = () => {
1921
+ var _a;
1922
+ if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
1923
+ return config.experimental.disableSwrMiddlewareCache;
1924
+ }
1925
+ return false;
1926
+ };
1927
+
1502
1928
  // src/data/client.ts
1503
- var DataClient = class {
1504
- constructor({ fetchCache = true } = {}) {
1505
- this.fetchCache = fetchCache;
1506
- }
1507
- async getRoute({ pageState }) {
1508
- const routeClient = getRouteClient({ cache: this.resolveCache(pageState) });
1509
- const parameters = {
1510
- path: pageState.routePath,
1511
- state: pageState.compositionState,
1512
- dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, pageState.compositionState),
1513
- withComponentIDs: true,
1514
- releaseId: pageState.releaseId,
1515
- locale: pageState.locale,
1516
- ignoreRedirects: shouldIgnoreRedirects({ state: pageState.compositionState })
1517
- };
1518
- return routeClient.get(parameters);
1929
+ var MANIFEST_CACHE_KEY = "uniform-manifest";
1930
+ var DefaultDataClient = class {
1931
+ async getManifest(options) {
1932
+ const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
1933
+ if (cache) {
1934
+ const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
1935
+ if (cachedManifest) {
1936
+ return cachedManifest;
1937
+ }
1938
+ }
1939
+ const manifest = await getManifest({
1940
+ cache: isDevelopmentEnvironment() ? {
1941
+ type: "no-cache",
1942
+ bypassCache: true
1943
+ } : {
1944
+ type: "force-cache"
1945
+ }
1946
+ });
1947
+ if (cache) {
1948
+ waitUntil(
1949
+ (async () => {
1950
+ await cache.set(MANIFEST_CACHE_KEY, manifest, {
1951
+ tags: generateManifestCacheTags()
1952
+ });
1953
+ })()
1954
+ );
1955
+ }
1956
+ return manifest;
1519
1957
  }
1520
- /** Returns `null` when no composition matches the selector in the page state's composition state. */
1521
- async getComposition({
1522
- pageState,
1523
- selector
1958
+ async getRouteFromApi({
1959
+ route,
1960
+ routeClient,
1961
+ enableRuntimeCache,
1962
+ disableSwrCache
1524
1963
  }) {
1525
- const client = getCompositionDeliveryClient({ cache: this.resolveCache(pageState) });
1526
- try {
1527
- return await client.get({
1528
- ...selector,
1529
- state: pageState.compositionState,
1530
- withComponentIDs: true,
1531
- releaseId: pageState.releaseId,
1532
- locale: pageState.locale
1533
- });
1534
- } catch (e) {
1535
- if (e instanceof ApiClientError5 && e.statusCode === 404) {
1536
- return null;
1964
+ const newCacheKey = `uniform-route-${route.state}-${route.releaseId}-${route.path}`;
1965
+ const oldCacheKey = `uniform-route-old-${route.state}-${route.releaseId}-${route.path}`;
1966
+ const cache = enableRuntimeCache ? getCache() : null;
1967
+ const cacheNewRoute = async (result2) => {
1968
+ if (cache && result2.type === "composition") {
1969
+ const tags = generateRouteCacheTags({ path: route.path });
1970
+ await cache.set(newCacheKey, result2, {
1971
+ tags
1972
+ });
1973
+ }
1974
+ };
1975
+ const cacheOldRoute = async (result2) => {
1976
+ if (cache && result2.type === "composition" && !disableSwrCache) {
1977
+ const tags = generateRouteCacheTags({ path: route.path, old: true });
1978
+ await cache.set(oldCacheKey, result2, {
1979
+ tags
1980
+ });
1981
+ }
1982
+ };
1983
+ if (cache) {
1984
+ const [cachedRoute, oldCachedRoute] = await Promise.all([
1985
+ cache.get(newCacheKey),
1986
+ disableSwrCache ? null : cache.get(oldCacheKey)
1987
+ ]);
1988
+ if (cachedRoute) {
1989
+ return cachedRoute;
1990
+ }
1991
+ if (oldCachedRoute) {
1992
+ waitUntil(
1993
+ (async () => {
1994
+ const result2 = await routeClient.get(route);
1995
+ await cacheNewRoute(result2);
1996
+ })()
1997
+ );
1998
+ return oldCachedRoute;
1537
1999
  }
1538
- throw e;
1539
2000
  }
2001
+ const result = await routeClient.get(route);
2002
+ waitUntil(
2003
+ (async () => {
2004
+ await Promise.all([
2005
+ cacheNewRoute(result),
2006
+ disableSwrCache ? Promise.resolve() : cacheOldRoute(result)
2007
+ ]);
2008
+ })()
2009
+ );
2010
+ return result;
1540
2011
  }
1541
- resolveCache(pageState) {
1542
- if (pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment()) {
1543
- return { type: "no-cache", bypassCache: true };
2012
+ async getRoute(options) {
2013
+ if (options.source === "middleware") {
2014
+ return this.getRouteMiddleware(options);
1544
2015
  }
1545
- return this.fetchCache ? { type: "force-cache" } : { type: "no-cache" };
2016
+ return this.getRoutePageState(options);
1546
2017
  }
1547
- };
1548
-
1549
- // src/data/deserializePageState.ts
1550
- import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
1551
- var deserializePageState = ({ code }) => deserializeEvaluationResult({ input: code });
1552
-
1553
- // src/data/resolveCompositionForPageState.ts
1554
- var resolveCompositionForPageState = async ({
1555
- pageState,
1556
- selector,
1557
- matchedRoute,
1558
- dataClient = new DataClient()
1559
- }) => {
1560
- const states = pageState.compositionState === CANVAS_EDITOR_STATE ? [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE] : [pageState.compositionState];
1561
- let composition = null;
1562
- for (const state of states) {
1563
- try {
1564
- composition = await dataClient.getComposition({
1565
- pageState: { ...pageState, compositionState: state },
1566
- selector
2018
+ async enhanceRoute(_options) {
2019
+ }
2020
+ async getRouteMiddleware(options) {
2021
+ const routeClient = getRouteClient({
2022
+ searchParams: options.searchParams,
2023
+ draftModeEnabled: options.draftModeEnabled
2024
+ });
2025
+ const resolvedRoute = await this.getRouteFromApi({
2026
+ source: "middleware",
2027
+ route: options.route,
2028
+ routeClient,
2029
+ // The runtime cache is keyed on the route path. Development bypasses it so an author sees
2030
+ // an edit right away, the same way the fetch cache is bypassed for development.
2031
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache() && !isDevelopmentEnvironment(),
2032
+ disableSwrCache: getDisableSwrMiddlewareCache()
2033
+ });
2034
+ if (resolvedRoute.type === "composition") {
2035
+ await this.enhanceRoute({
2036
+ source: "middleware",
2037
+ parameters: options.route,
2038
+ route: resolvedRoute,
2039
+ routeClient,
2040
+ keys: void 0
1567
2041
  });
1568
- } catch (e) {
1569
- console.warn(`Failed to get composition ${JSON.stringify(selector)} with state ${state}`, e);
1570
2042
  }
1571
- if (composition) {
1572
- break;
1573
- }
1574
- }
1575
- if (!composition) {
1576
- return { pageState, route: void 0 };
2043
+ return {
2044
+ route: resolvedRoute
2045
+ };
1577
2046
  }
1578
- return {
1579
- pageState: { ...pageState, compositionState: composition.state },
1580
- route: {
1581
- type: "composition",
1582
- compositionApiResponse: composition,
1583
- matchedRoute
2047
+ async getRoutePageState(options) {
2048
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2049
+ const routeClient = getRouteClient({
2050
+ cache: shouldBypassCache ? {
2051
+ type: "no-cache",
2052
+ bypassCache: true
2053
+ } : {
2054
+ type: "force-cache"
2055
+ }
2056
+ });
2057
+ const originalRoute = {
2058
+ path: options.pageState.routePath,
2059
+ state: options.pageState.compositionState,
2060
+ dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
2061
+ withComponentIDs: true,
2062
+ releaseId: options.pageState.releaseId,
2063
+ locale: options.pageState.locale,
2064
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2065
+ };
2066
+ const resolvedRoute = await this.getRouteFromApi({
2067
+ source: "pageState",
2068
+ route: originalRoute,
2069
+ routeClient,
2070
+ enableRuntimeCache: false,
2071
+ disableSwrCache: false
2072
+ });
2073
+ if (resolvedRoute.type === "composition") {
2074
+ await this.enhanceRoute({
2075
+ source: "pageState",
2076
+ parameters: originalRoute,
2077
+ route: resolvedRoute,
2078
+ routeClient,
2079
+ keys: options.pageState.keys
2080
+ });
1584
2081
  }
1585
- };
2082
+ return {
2083
+ route: resolvedRoute
2084
+ };
2085
+ }
1586
2086
  };
1587
2087
 
1588
- // src/data/resolveCompositionById.ts
1589
- var resolveCompositionById = ({
1590
- pageState,
1591
- compositionId,
1592
- matchedRoute = pageState.routePath
1593
- }) => resolveCompositionForPageState({ pageState, selector: { compositionId }, matchedRoute });
1594
-
1595
- // src/data/resolveCompositionBySlug.ts
1596
- var resolveCompositionBySlug = ({
1597
- pageState,
1598
- slug,
1599
- matchedRoute = pageState.routePath
1600
- }) => resolveCompositionForPageState({ pageState, selector: { slug }, matchedRoute });
1601
-
1602
- // src/data/resolveRouteForPageState.ts
1603
- var resolveRouteForPageState = async ({
1604
- pageState: providedPageState,
1605
- dataClient = new DataClient()
2088
+ // src/data/resolveRouteFromCode.ts
2089
+ var resolveRouteFromCode = async ({
2090
+ code,
2091
+ dataClient: providedDataClient
1606
2092
  }) => {
1607
- const states = providedPageState.compositionState === CANVAS_EDITOR_STATE ? [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE] : [providedPageState.compositionState];
1608
- let pageState = providedPageState;
1609
- let route = null;
1610
- for (const state of states) {
1611
- pageState = { ...providedPageState, compositionState: state };
1612
- try {
1613
- route = await dataClient.getRoute({ pageState });
1614
- } catch (e) {
1615
- console.warn(`Failed to retrieve route by path: ${pageState.routePath} with state ${state}`, e);
1616
- }
1617
- if (route && route.type !== "notFound") {
1618
- break;
1619
- }
1620
- }
1621
- if ((route == null ? void 0 : route.type) === "composition" || (route == null ? void 0 : route.type) === "redirect") {
1622
- return { pageState, route };
1623
- }
1624
- return { pageState, route: void 0 };
2093
+ const pageState = deserializeEvaluationResult({ input: code });
2094
+ const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
2095
+ const { route } = await dataClient.getRoute({
2096
+ source: "pageState",
2097
+ pageState
2098
+ });
2099
+ return {
2100
+ pageState,
2101
+ // suppress the route if it's not a composition
2102
+ route: (route == null ? void 0 : route.type) === "composition" ? route : void 0,
2103
+ // the code that was used to resolve the route
2104
+ code
2105
+ };
1625
2106
  };
1626
2107
 
1627
2108
  // src/cache.ts
1628
- var tagScope = (result, requestedTags) => {
1629
- var _a;
1630
- const tags = [...requestedTags];
1631
- if (((_a = result.route) == null ? void 0 : _a.type) === "composition") {
1632
- tags.push(buildCompositionTag(result.route.compositionApiResponse.composition._id));
1633
- }
1634
- cacheTag(...tags);
1635
- return result;
1636
- };
1637
- var createScopeDataClient = () => new DataClient({ fetchCache: false });
1638
- var isPublished = (pageState) => pageState.compositionState === CANVAS_PUBLISHED_STATE;
1639
- var resolveRouteCached = async (pageState) => {
1640
- "use cache";
1641
- return tagScope(
1642
- await resolveRouteForPageState({ pageState, dataClient: createScopeDataClient() }),
1643
- generateRouteCacheTags({ path: pageState.routePath })
1644
- );
1645
- };
1646
- var resolveCompositionByIdCached = async ({
1647
- pageState,
1648
- compositionId,
1649
- matchedRoute = pageState.routePath
2109
+ var resolveRouteFromCode2 = async ({
2110
+ code,
2111
+ dataClient: providedDataClient
1650
2112
  }) => {
1651
2113
  "use cache";
1652
- return tagScope(
1653
- await resolveCompositionForPageState({
1654
- pageState,
1655
- selector: { compositionId },
1656
- matchedRoute,
1657
- dataClient: createScopeDataClient()
1658
- }),
1659
- [buildCompositionTag(compositionId)]
1660
- );
1661
- };
1662
- var resolveCompositionBySlugCached = async ({
1663
- pageState,
1664
- slug,
1665
- matchedRoute = pageState.routePath
1666
- }) => {
1667
- "use cache";
1668
- return tagScope(
1669
- await resolveCompositionForPageState({
1670
- pageState,
1671
- selector: { slug },
1672
- matchedRoute,
1673
- dataClient: createScopeDataClient()
1674
- }),
1675
- [buildCompositionSlugTag(slug)]
1676
- );
1677
- };
1678
- var resolveRouteFromCode = async ({
1679
- code
1680
- }) => {
1681
- const pageState = deserializePageState({ code });
1682
- return isPublished(pageState) ? resolveRouteCached(pageState) : resolveRouteForPageState({ pageState });
1683
- };
1684
- var resolveRouteFromPath = async ({
1685
- pageState,
1686
- path
1687
- }) => {
1688
- const pathPageState = { ...pageState, routePath: path };
1689
- return isPublished(pageState) ? resolveRouteCached(pathPageState) : resolveRouteForPageState({ pageState: pathPageState });
2114
+ const result = await resolveRouteFromCode({
2115
+ code,
2116
+ dataClient: providedDataClient
2117
+ });
2118
+ return result;
1690
2119
  };
1691
- var resolveCompositionById2 = async (options) => isPublished(options.pageState) ? resolveCompositionByIdCached(options) : resolveCompositionById(options);
1692
- var resolveCompositionBySlug2 = async (options) => isPublished(options.pageState) ? resolveCompositionBySlugCached(options) : resolveCompositionBySlug(options);
1693
2120
  export {
1694
- resolveCompositionById2 as resolveCompositionById,
1695
- resolveCompositionBySlug2 as resolveCompositionBySlug,
1696
- resolveRouteFromCode,
1697
- resolveRouteFromPath
2121
+ resolveRouteFromCode2 as resolveRouteFromCode
1698
2122
  };