@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.js CHANGED
@@ -47,6 +47,124 @@ var __privateWrapper = (obj, member, setter, getter) => ({
47
47
  }
48
48
  });
49
49
 
50
+ // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
51
+ var require_yocto_queue = __commonJS({
52
+ "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
53
+ "use strict";
54
+ var Node2 = class {
55
+ /// value;
56
+ /// next;
57
+ constructor(value) {
58
+ this.value = value;
59
+ this.next = void 0;
60
+ }
61
+ };
62
+ var Queue2 = class {
63
+ // TODO: Use private class fields when targeting Node.js 12.
64
+ // #_head;
65
+ // #_tail;
66
+ // #_size;
67
+ constructor() {
68
+ this.clear();
69
+ }
70
+ enqueue(value) {
71
+ const node = new Node2(value);
72
+ if (this._head) {
73
+ this._tail.next = node;
74
+ this._tail = node;
75
+ } else {
76
+ this._head = node;
77
+ this._tail = node;
78
+ }
79
+ this._size++;
80
+ }
81
+ dequeue() {
82
+ const current = this._head;
83
+ if (!current) {
84
+ return;
85
+ }
86
+ this._head = this._head.next;
87
+ this._size--;
88
+ return current.value;
89
+ }
90
+ clear() {
91
+ this._head = void 0;
92
+ this._tail = void 0;
93
+ this._size = 0;
94
+ }
95
+ get size() {
96
+ return this._size;
97
+ }
98
+ *[Symbol.iterator]() {
99
+ let current = this._head;
100
+ while (current) {
101
+ yield current.value;
102
+ current = current.next;
103
+ }
104
+ }
105
+ };
106
+ module2.exports = Queue2;
107
+ }
108
+ });
109
+
110
+ // ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
111
+ var require_p_limit = __commonJS({
112
+ "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
113
+ "use strict";
114
+ var Queue2 = require_yocto_queue();
115
+ var pLimit3 = (concurrency) => {
116
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
117
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
118
+ }
119
+ const queue = new Queue2();
120
+ let activeCount = 0;
121
+ const next = () => {
122
+ activeCount--;
123
+ if (queue.size > 0) {
124
+ queue.dequeue()();
125
+ }
126
+ };
127
+ const run = async (fn, resolve, ...args) => {
128
+ activeCount++;
129
+ const result = (async () => fn(...args))();
130
+ resolve(result);
131
+ try {
132
+ await result;
133
+ } catch (e) {
134
+ }
135
+ next();
136
+ };
137
+ const enqueue = (fn, resolve, ...args) => {
138
+ queue.enqueue(run.bind(null, fn, resolve, ...args));
139
+ (async () => {
140
+ await Promise.resolve();
141
+ if (activeCount < concurrency && queue.size > 0) {
142
+ queue.dequeue()();
143
+ }
144
+ })();
145
+ };
146
+ const generator = (fn, ...args) => new Promise((resolve) => {
147
+ enqueue(fn, resolve, ...args);
148
+ });
149
+ Object.defineProperties(generator, {
150
+ activeCount: {
151
+ get: () => activeCount
152
+ },
153
+ pendingCount: {
154
+ get: () => queue.size
155
+ },
156
+ clearQueue: {
157
+ value: () => {
158
+ queue.clear();
159
+ }
160
+ }
161
+ });
162
+ return generator;
163
+ };
164
+ module2.exports = pLimit3;
165
+ }
166
+ });
167
+
50
168
  // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
51
169
  var require_retry_operation = __commonJS({
52
170
  "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
@@ -281,16 +399,440 @@ var require_retry2 = __commonJS({
281
399
  // src/cache.ts
282
400
  var cache_exports = {};
283
401
  __export(cache_exports, {
284
- resolveCompositionById: () => resolveCompositionById2,
285
- resolveCompositionBySlug: () => resolveCompositionBySlug2,
286
- resolveRouteFromCode: () => resolveRouteFromCode,
287
- resolveRouteFromPath: () => resolveRouteFromPath
402
+ resolveRouteFromCode: () => resolveRouteFromCode2
288
403
  });
289
404
  module.exports = __toCommonJS(cache_exports);
290
405
 
291
- // ../canvas/dist/index.mjs
292
- var import_api = require("@uniformdev/context/api");
293
- var import_api2 = require("@uniformdev/context/api");
406
+ // src/data/resolveRouteFromCode.ts
407
+ var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
408
+
409
+ // ../context/dist/api/api.mjs
410
+ var import_p_limit = __toESM(require_p_limit(), 1);
411
+ var __defProp2 = Object.defineProperty;
412
+ var __typeError2 = (msg) => {
413
+ throw TypeError(msg);
414
+ };
415
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
416
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
417
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
418
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
419
+ 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);
420
+ var defaultLimitPolicy = (0, import_p_limit.default)(6);
421
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
422
+ var ApiClientError = class _ApiClientError extends Error {
423
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
424
+ super(
425
+ `${errorMessage}
426
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
427
+ );
428
+ __publicField2(this, "errorMessage", errorMessage);
429
+ __publicField2(this, "fetchMethod", fetchMethod);
430
+ __publicField2(this, "fetchUri", fetchUri);
431
+ __publicField2(this, "statusCode", statusCode);
432
+ __publicField2(this, "statusText", statusText);
433
+ __publicField2(this, "requestId", requestId);
434
+ Object.setPrototypeOf(this, _ApiClientError.prototype);
435
+ }
436
+ };
437
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
438
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
439
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
440
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
441
+ }
442
+ };
443
+ var ApiClient = class _ApiClient {
444
+ constructor(options) {
445
+ __publicField2(this, "options");
446
+ var _a, _b, _c, _d, _e;
447
+ if (!options.apiKey && !options.bearerToken) {
448
+ throw new Error("You must provide an API key or a bearer token");
449
+ }
450
+ let leFetch = options.fetch;
451
+ if (!leFetch) {
452
+ if (typeof window !== "undefined") {
453
+ leFetch = window.fetch.bind(window);
454
+ } else if (typeof fetch !== "undefined") {
455
+ leFetch = fetch;
456
+ } else {
457
+ throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
458
+ }
459
+ }
460
+ this.options = {
461
+ ...options,
462
+ fetch: leFetch,
463
+ apiHost: this.ensureApiHost(options.apiHost),
464
+ apiKey: (_a = options.apiKey) != null ? _a : null,
465
+ projectId: (_b = options.projectId) != null ? _b : null,
466
+ bearerToken: (_c = options.bearerToken) != null ? _c : null,
467
+ limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
468
+ bypassCache: (_e = options.bypassCache) != null ? _e : false
469
+ };
470
+ }
471
+ async apiClient(fetchUri, options) {
472
+ return (await this.apiClientWithResponse(fetchUri, options)).body;
473
+ }
474
+ async apiClientWithResponse(fetchUri, options) {
475
+ return this.options.limitPolicy(async () => {
476
+ var _a, _b;
477
+ const coreHeaders = this.options.apiKey ? {
478
+ "x-api-key": this.options.apiKey
479
+ } : {
480
+ Authorization: `Bearer ${this.options.bearerToken}`
481
+ };
482
+ if (this.options.bypassCache) {
483
+ coreHeaders["x-bypass-cache"] = "true";
484
+ }
485
+ const { fetch: fetch2, signal } = this.options;
486
+ const callApi = () => fetch2(fetchUri.toString(), {
487
+ ...options,
488
+ signal,
489
+ headers: {
490
+ ...options == null ? void 0 : options.headers,
491
+ ...coreHeaders
492
+ }
493
+ });
494
+ const apiResponse = await handleRateLimits(callApi);
495
+ if (!apiResponse.ok) {
496
+ let message = "";
497
+ try {
498
+ const responseText = await apiResponse.text();
499
+ try {
500
+ const parsed = JSON.parse(responseText);
501
+ if (parsed.errorMessage) {
502
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
503
+ } else {
504
+ message = responseText;
505
+ }
506
+ } catch (e) {
507
+ message = responseText;
508
+ }
509
+ } catch (e) {
510
+ message = `General error`;
511
+ }
512
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
513
+ throw new BearerTokenNotValidOrExpiredError(
514
+ message,
515
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
516
+ fetchUri.toString(),
517
+ apiResponse.status,
518
+ apiResponse.statusText,
519
+ _ApiClient.getRequestId(apiResponse)
520
+ );
521
+ }
522
+ throw new ApiClientError(
523
+ message,
524
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
525
+ fetchUri.toString(),
526
+ apiResponse.status,
527
+ apiResponse.statusText,
528
+ _ApiClient.getRequestId(apiResponse)
529
+ );
530
+ }
531
+ if (options == null ? void 0 : options.expectNoContent) {
532
+ return { response: apiResponse, body: null };
533
+ }
534
+ return {
535
+ response: apiResponse,
536
+ body: await apiResponse.json()
537
+ };
538
+ });
539
+ }
540
+ createUrl(path, queryParams, hostOverride) {
541
+ const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
542
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
543
+ var _a;
544
+ if (typeof value !== "undefined" && value !== null) {
545
+ url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
546
+ }
547
+ });
548
+ return url;
549
+ }
550
+ ensureApiHost(apiHost) {
551
+ if (!apiHost) return "https://uniform.app";
552
+ if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
553
+ throw new Error('Your apiHost must start with "http"');
554
+ }
555
+ if (apiHost.indexOf("/", 8) > -1) {
556
+ throw new Error("Your apiHost must not contain a path element after the domain");
557
+ }
558
+ if (apiHost.indexOf("?") > -1) {
559
+ throw new Error("Your apiHost must not contain a query string");
560
+ }
561
+ if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
562
+ apiHost = apiHost.substring(0, apiHost.length - 1);
563
+ }
564
+ return apiHost;
565
+ }
566
+ static getRequestId(response) {
567
+ const apigRequestId = response.headers.get("apigw-requestid");
568
+ if (apigRequestId) {
569
+ return apigRequestId;
570
+ }
571
+ return void 0;
572
+ }
573
+ };
574
+ async function handleRateLimits(callApi) {
575
+ var _a;
576
+ const backoffRetries = 5;
577
+ let backoffRetriesLeft = backoffRetries;
578
+ let response;
579
+ while (backoffRetriesLeft > 0) {
580
+ response = await callApi();
581
+ if (response.status !== 429) {
582
+ break;
583
+ }
584
+ let resetWait = 0;
585
+ try {
586
+ const responseClone = response.clone();
587
+ const dateHeader = responseClone.headers.get("date");
588
+ const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
589
+ const body = await responseClone.json();
590
+ const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
591
+ if (typeof serverTime === "number" && typeof resetTime === "number") {
592
+ resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
593
+ }
594
+ } catch (e) {
595
+ }
596
+ const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
597
+ const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
598
+ await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
599
+ backoffRetriesLeft -= 1;
600
+ }
601
+ return response;
602
+ }
603
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
604
+ function rewriteFiltersForApi(filters) {
605
+ return Object.entries(filters != null ? filters : {}).reduce(
606
+ (acc, [key, value]) => {
607
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
608
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
609
+ return {
610
+ ...acc,
611
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
612
+ };
613
+ },
614
+ {}
615
+ );
616
+ }
617
+ var _url;
618
+ var _AggregateClient = class _AggregateClient2 extends ApiClient {
619
+ constructor(options) {
620
+ super(options);
621
+ }
622
+ /** Fetches all aggregates for a project */
623
+ async get(options) {
624
+ const { projectId } = this.options;
625
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
626
+ return await this.apiClient(fetchUri);
627
+ }
628
+ /** Updates or creates (based on id) an Aggregate */
629
+ async upsert(body) {
630
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
631
+ await this.apiClient(fetchUri, {
632
+ method: "PUT",
633
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
634
+ expectNoContent: true
635
+ });
636
+ }
637
+ /** Deletes an Aggregate */
638
+ async remove(body) {
639
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
640
+ await this.apiClient(fetchUri, {
641
+ method: "DELETE",
642
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
643
+ expectNoContent: true
644
+ });
645
+ }
646
+ };
647
+ _url = /* @__PURE__ */ new WeakMap();
648
+ __privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
649
+ var _url2;
650
+ var _DimensionClient = class _DimensionClient2 extends ApiClient {
651
+ constructor(options) {
652
+ super(options);
653
+ }
654
+ /** Fetches the known score dimensions for a project */
655
+ async get(options) {
656
+ const { projectId } = this.options;
657
+ const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
658
+ return await this.apiClient(fetchUri);
659
+ }
660
+ };
661
+ _url2 = /* @__PURE__ */ new WeakMap();
662
+ __privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
663
+ var _url3;
664
+ var _valueUrl;
665
+ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
666
+ constructor(options) {
667
+ super(options);
668
+ }
669
+ /** Fetches all enrichments and values for a project, grouped by category */
670
+ async get(options) {
671
+ const { projectId } = this.options;
672
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
673
+ return await this.apiClient(fetchUri);
674
+ }
675
+ /** Updates or creates (based on id) an enrichment category */
676
+ async upsertCategory(body) {
677
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
678
+ await this.apiClient(fetchUri, {
679
+ method: "PUT",
680
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
681
+ expectNoContent: true
682
+ });
683
+ }
684
+ /** Deletes an enrichment category */
685
+ async removeCategory(body) {
686
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
687
+ await this.apiClient(fetchUri, {
688
+ method: "DELETE",
689
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
690
+ expectNoContent: true
691
+ });
692
+ }
693
+ /** Updates or creates (based on id) an enrichment value within an enrichment category */
694
+ async upsertValue(body) {
695
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
696
+ await this.apiClient(fetchUri, {
697
+ method: "PUT",
698
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
699
+ expectNoContent: true
700
+ });
701
+ }
702
+ /** Deletes an enrichment value within an enrichment category. The category is left alone. */
703
+ async removeValue(body) {
704
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
705
+ await this.apiClient(fetchUri, {
706
+ method: "DELETE",
707
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
708
+ expectNoContent: true
709
+ });
710
+ }
711
+ };
712
+ _url3 = /* @__PURE__ */ new WeakMap();
713
+ _valueUrl = /* @__PURE__ */ new WeakMap();
714
+ __privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
715
+ __privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
716
+ var _url4;
717
+ var _ManifestClient = class _ManifestClient2 extends ApiClient {
718
+ constructor(options) {
719
+ super(options);
720
+ }
721
+ /** Fetches the Context manifest for a project */
722
+ async get(options) {
723
+ const { projectId } = this.options;
724
+ const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
725
+ return await this.apiClient(fetchUri);
726
+ }
727
+ /** Publishes the Context manifest for a project */
728
+ async publish() {
729
+ const { projectId } = this.options;
730
+ const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
731
+ await this.apiClient(fetchUri, {
732
+ method: "POST",
733
+ expectNoContent: true
734
+ });
735
+ }
736
+ };
737
+ _url4 = /* @__PURE__ */ new WeakMap();
738
+ __privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
739
+ var ManifestClient = _ManifestClient;
740
+ var _url5;
741
+ var _QuirkClient = class _QuirkClient2 extends ApiClient {
742
+ constructor(options) {
743
+ super(options);
744
+ }
745
+ /** Fetches all Quirks for a project */
746
+ async get(options) {
747
+ const { projectId } = this.options;
748
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
749
+ return await this.apiClient(fetchUri);
750
+ }
751
+ /** Updates or creates (based on id) a Quirk */
752
+ async upsert(body) {
753
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
754
+ await this.apiClient(fetchUri, {
755
+ method: "PUT",
756
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
757
+ expectNoContent: true
758
+ });
759
+ }
760
+ /** Deletes a Quirk */
761
+ async remove(body) {
762
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
763
+ await this.apiClient(fetchUri, {
764
+ method: "DELETE",
765
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
766
+ expectNoContent: true
767
+ });
768
+ }
769
+ };
770
+ _url5 = /* @__PURE__ */ new WeakMap();
771
+ __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
772
+ var _url6;
773
+ var _SignalClient = class _SignalClient2 extends ApiClient {
774
+ constructor(options) {
775
+ super(options);
776
+ }
777
+ /** Fetches all Signals for a project */
778
+ async get(options) {
779
+ const { projectId } = this.options;
780
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
781
+ return await this.apiClient(fetchUri);
782
+ }
783
+ /** Updates or creates (based on id) a Signal */
784
+ async upsert(body) {
785
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
786
+ await this.apiClient(fetchUri, {
787
+ method: "PUT",
788
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
789
+ expectNoContent: true
790
+ });
791
+ }
792
+ /** Deletes a Signal */
793
+ async remove(body) {
794
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
795
+ await this.apiClient(fetchUri, {
796
+ method: "DELETE",
797
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
798
+ expectNoContent: true
799
+ });
800
+ }
801
+ };
802
+ _url6 = /* @__PURE__ */ new WeakMap();
803
+ __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
804
+ var _url7;
805
+ var _TestClient = class _TestClient2 extends ApiClient {
806
+ constructor(options) {
807
+ super(options);
808
+ }
809
+ /** Fetches all Tests for a project */
810
+ async get(options) {
811
+ const { projectId } = this.options;
812
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
813
+ return await this.apiClient(fetchUri);
814
+ }
815
+ /** Updates or creates (based on id) a Test */
816
+ async upsert(body) {
817
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
818
+ await this.apiClient(fetchUri, {
819
+ method: "PUT",
820
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
821
+ expectNoContent: true
822
+ });
823
+ }
824
+ /** Deletes a Test */
825
+ async remove(body) {
826
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
827
+ await this.apiClient(fetchUri, {
828
+ method: "DELETE",
829
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
830
+ expectNoContent: true
831
+ });
832
+ }
833
+ };
834
+ _url7 = /* @__PURE__ */ new WeakMap();
835
+ __privateAdd2(_TestClient, _url7, "/api/v2/test");
294
836
 
295
837
  // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
296
838
  var Node = class {
@@ -363,7 +905,7 @@ _tail = new WeakMap();
363
905
  _size = new WeakMap();
364
906
 
365
907
  // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
366
- function pLimit(concurrency) {
908
+ function pLimit2(concurrency) {
367
909
  validateConcurrency(concurrency);
368
910
  const queue = new Queue();
369
911
  let activeCount = 0;
@@ -643,44 +1185,19 @@ function pThrottle({ limit, interval, strict, onDelay }) {
643
1185
  }
644
1186
 
645
1187
  // ../canvas/dist/index.mjs
646
- var import_api3 = require("@uniformdev/context/api");
647
- var import_api4 = require("@uniformdev/context/api");
648
- var import_api5 = require("@uniformdev/context/api");
649
- var import_api6 = require("@uniformdev/context/api");
650
- var import_api7 = require("@uniformdev/context/api");
651
- var import_api8 = require("@uniformdev/context/api");
652
- var import_api9 = require("@uniformdev/context/api");
653
- var import_api10 = require("@uniformdev/context/api");
654
- var import_api11 = require("@uniformdev/context/api");
655
- var import_api12 = require("@uniformdev/context/api");
656
- var import_api13 = require("@uniformdev/context/api");
657
- var import_api14 = require("@uniformdev/context/api");
658
- var import_api15 = require("@uniformdev/context/api");
659
- var import_api16 = require("@uniformdev/context/api");
660
- var import_api17 = require("@uniformdev/context/api");
661
- var import_api18 = require("@uniformdev/context/api");
662
- var import_api19 = require("@uniformdev/context/api");
663
- var import_api20 = require("@uniformdev/context/api");
664
- var import_api21 = require("@uniformdev/context/api");
665
- var import_api22 = require("@uniformdev/context/api");
666
- var import_api23 = require("@uniformdev/context/api");
667
- var import_api24 = require("@uniformdev/context/api");
668
- var import_api25 = require("@uniformdev/context/api");
669
- var import_api26 = require("@uniformdev/context/api");
670
- var import_api27 = require("@uniformdev/context/api");
671
- var __typeError2 = (msg) => {
1188
+ var __typeError3 = (msg) => {
672
1189
  throw TypeError(msg);
673
1190
  };
674
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
675
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
676
- 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);
1191
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1192
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1193
+ 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);
677
1194
  function createLimitPolicy({
678
1195
  throttle = { interval: 1e3, limit: 10 },
679
1196
  retry: retry3 = { retries: 1, factor: 1.66 },
680
1197
  limit = 10
681
1198
  }) {
682
1199
  const throttler = throttle ? pThrottle(throttle) : null;
683
- const limiter = limit ? pLimit(limit) : null;
1200
+ const limiter = limit ? pLimit2(limit) : null;
684
1201
  return function limitPolicy(func) {
685
1202
  let currentFunc = async () => await func();
686
1203
  if (throttler) {
@@ -699,7 +1216,7 @@ function createLimitPolicy({
699
1216
  if (retry3.onFailedAttempt) {
700
1217
  await retry3.onFailedAttempt(error);
701
1218
  }
702
- if (error instanceof import_api2.ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1219
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
703
1220
  throw error;
704
1221
  }
705
1222
  }
@@ -708,16 +1225,6 @@ function createLimitPolicy({
708
1225
  return currentFunc();
709
1226
  };
710
1227
  }
711
- var ContentClientBase = class extends import_api4.ApiClient {
712
- constructor(options, defaultBypassCache) {
713
- var _a, _b;
714
- super({
715
- ...options,
716
- limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
717
- bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
718
- });
719
- }
720
- };
721
1228
  var SELECT_QUERY_PREFIX = "select.";
722
1229
  function appendCsv(out, key, values) {
723
1230
  if (values === void 0) {
@@ -770,89 +1277,9 @@ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displa
770
1277
  var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
771
1278
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
772
1279
  var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
773
- function resolveCompositionSelector(args) {
774
- if ("compositionId" in args) {
775
- const { compositionId, editionId, versionId, ...readOptions } = args;
776
- return {
777
- readOptions,
778
- // raw mode matches on composition OR edition id via the compositionId param
779
- compositionId: editionId != null ? editionId : compositionId,
780
- versionId,
781
- hasCompositionId: true,
782
- pinnedEdition: editionId !== void 0
783
- };
784
- }
785
- return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
786
- }
787
- var DEFAULT_EDGE_API_HOST = "https://uniform.global";
788
- var DeliveryClientBase = class extends ContentClientBase {
789
- constructor(options) {
790
- var _a;
791
- super(
792
- options,
793
- /* defaultBypassCache */
794
- false
795
- );
796
- this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
797
- this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
798
- }
799
- /** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
800
- coerceDiagnostics(diagnostics) {
801
- return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
802
- }
803
- };
804
- var EDGE_SINGLE_URL = "/api/v1/composition";
805
- var EDGE_LIST_URL = "/api/v1/compositions";
806
- var CompositionDeliveryClient = class extends DeliveryClientBase {
807
- constructor(options) {
808
- super(options);
809
- }
810
- /** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
811
- get(args) {
812
- var _a;
813
- const { diagnostics, select, ...rest } = args;
814
- const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
815
- const url = this.createUrl(
816
- EDGE_SINGLE_URL,
817
- {
818
- ...readOptions,
819
- ...projectionToQuery(select),
820
- // A pinned edition is folded into compositionId (raw matches edition or
821
- // composition id); there is no editionId query param on this endpoint.
822
- compositionId,
823
- versionId,
824
- projectId: this.options.projectId,
825
- state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
826
- // editionId pins a specific edition for preview; otherwise locale-best.
827
- editions: pinnedEdition ? "raw" : "auto",
828
- diagnostics: this.coerceDiagnostics(diagnostics)
829
- },
830
- this.edgeApiHost
831
- );
832
- return this.apiClient(url, this.edgeRequestInit);
833
- }
834
- /** Fetches a list of compositions, optionally filtered. */
835
- list(args = {}) {
836
- var _a;
837
- const { diagnostics, filters, select, ...rest } = args;
838
- const url = this.createUrl(
839
- EDGE_LIST_URL,
840
- {
841
- ...rest,
842
- ...(0, import_api5.rewriteFiltersForApi)(filters),
843
- ...projectionToQuery(select),
844
- projectId: this.options.projectId,
845
- state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
846
- diagnostics: this.coerceDiagnostics(diagnostics)
847
- },
848
- this.edgeApiHost
849
- );
850
- return this.apiClient(url, this.edgeRequestInit);
851
- }
852
- };
853
1280
  var _contentTypesUrl;
854
1281
  var _entriesUrl;
855
- var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
1282
+ var _ContentClient = class _ContentClient2 extends ApiClient {
856
1283
  constructor(options) {
857
1284
  var _a;
858
1285
  super(options);
@@ -860,16 +1287,16 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
860
1287
  }
861
1288
  getContentTypes(options) {
862
1289
  const { projectId } = this.options;
863
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1290
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
864
1291
  return this.apiClient(fetchUri);
865
1292
  }
866
1293
  getEntries(options) {
867
1294
  const { projectId } = this.options;
868
1295
  const { skipDataResolution, filters, select, ...params } = options;
869
- const rewrittenFilters = (0, import_api12.rewriteFiltersForApi)(filters);
1296
+ const rewrittenFilters = rewriteFiltersForApi(filters);
870
1297
  const rewrittenSelect = projectionToQuery(select);
871
1298
  if (skipDataResolution) {
872
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
1299
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
873
1300
  ...params,
874
1301
  ...rewrittenFilters,
875
1302
  ...rewrittenSelect,
@@ -878,7 +1305,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
878
1305
  return this.apiClient(url);
879
1306
  }
880
1307
  const edgeUrl = this.createUrl(
881
- __privateGet2(_ContentClient2, _entriesUrl),
1308
+ __privateGet3(_ContentClient2, _entriesUrl),
882
1309
  { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
883
1310
  this.edgeApiHost
884
1311
  );
@@ -896,7 +1323,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
896
1323
  return this.apiClient(historyUrl);
897
1324
  }
898
1325
  async upsertContentType(body, opts = {}) {
899
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1326
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
900
1327
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
901
1328
  delete body.contentType.slugSettings;
902
1329
  }
@@ -908,7 +1335,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
908
1335
  });
909
1336
  }
910
1337
  async upsertEntry(body, options) {
911
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1338
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
912
1339
  const headers = {};
913
1340
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
914
1341
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -922,7 +1349,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
922
1349
  return { modified: response.headers.get("x-modified-at") };
923
1350
  }
924
1351
  async deleteContentType(body) {
925
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1352
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
926
1353
  await this.apiClient(fetchUri, {
927
1354
  method: "DELETE",
928
1355
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -930,7 +1357,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
930
1357
  });
931
1358
  }
932
1359
  async deleteEntry(body) {
933
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1360
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
934
1361
  await this.apiClient(fetchUri, {
935
1362
  method: "DELETE",
936
1363
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -949,17 +1376,17 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
949
1376
  };
950
1377
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
951
1378
  _entriesUrl = /* @__PURE__ */ new WeakMap();
952
- __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
953
- __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
954
- var _url;
955
- var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
1379
+ __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1380
+ __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1381
+ var _url8;
1382
+ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
956
1383
  constructor(options) {
957
1384
  super(options);
958
1385
  }
959
1386
  /** Fetches a list of DataTypes for a project */
960
1387
  async list(options) {
961
1388
  const { projectId } = this.options;
962
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
1389
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
963
1390
  return await this.apiClient(fetchUri);
964
1391
  }
965
1392
  /** @deprecated Use {@link list} instead. */
@@ -968,7 +1395,7 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
968
1395
  }
969
1396
  /** Updates or creates (based on id) a DataType */
970
1397
  async save(body) {
971
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1398
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
972
1399
  await this.apiClient(fetchUri, {
973
1400
  method: "PUT",
974
1401
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -981,7 +1408,7 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
981
1408
  }
982
1409
  /** Deletes a DataType */
983
1410
  async remove(body) {
984
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
1411
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
985
1412
  await this.apiClient(fetchUri, {
986
1413
  method: "DELETE",
987
1414
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -989,10 +1416,10 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
989
1416
  });
990
1417
  }
991
1418
  };
992
- _url = /* @__PURE__ */ new WeakMap();
993
- __privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
1419
+ _url8 = /* @__PURE__ */ new WeakMap();
1420
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
994
1421
  var _baseUrl;
995
- var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends import_api16.ApiClient {
1422
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
996
1423
  constructor(options) {
997
1424
  super(options);
998
1425
  this.teamId = options.teamId;
@@ -1001,7 +1428,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1001
1428
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1002
1429
  */
1003
1430
  get(options) {
1004
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1431
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1005
1432
  ...options,
1006
1433
  teamId: this.teamId
1007
1434
  });
@@ -1011,7 +1438,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1011
1438
  * Creates or updates a custom AI property editor on a Mesh app.
1012
1439
  */
1013
1440
  async deploy(body) {
1014
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1441
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1015
1442
  await this.apiClient(fetchUri, {
1016
1443
  method: "PUT",
1017
1444
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1022,7 +1449,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1022
1449
  * Removes a custom AI property editor from a Mesh app.
1023
1450
  */
1024
1451
  async delete(body) {
1025
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1452
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1026
1453
  await this.apiClient(fetchUri, {
1027
1454
  method: "DELETE",
1028
1455
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1031,16 +1458,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1031
1458
  }
1032
1459
  };
1033
1460
  _baseUrl = /* @__PURE__ */ new WeakMap();
1034
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1035
- var _url2;
1461
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1462
+ var _url22;
1036
1463
  var _projectsUrl;
1037
- var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
1464
+ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1038
1465
  constructor(options) {
1039
1466
  super({ ...options, bypassCache: true });
1040
1467
  }
1041
1468
  /** Fetches single Project */
1042
1469
  async get(options) {
1043
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
1470
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1044
1471
  return await this.apiClient(fetchUri);
1045
1472
  }
1046
1473
  /**
@@ -1049,7 +1476,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
1049
1476
  * When omitted, returns all accessible teams and their projects.
1050
1477
  */
1051
1478
  async list(options) {
1052
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1479
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1053
1480
  return await this.apiClient(fetchUri);
1054
1481
  }
1055
1482
  /** @deprecated Use {@link list} instead. */
@@ -1058,7 +1485,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
1058
1485
  }
1059
1486
  /** Updates or creates (based on id) a Project */
1060
1487
  async save(body) {
1061
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1488
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1062
1489
  return await this.apiClient(fetchUri, {
1063
1490
  method: "PUT",
1064
1491
  body: JSON.stringify({ ...body })
@@ -1070,7 +1497,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
1070
1497
  }
1071
1498
  /** Deletes a Project */
1072
1499
  async remove(body) {
1073
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
1500
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1074
1501
  await this.apiClient(fetchUri, {
1075
1502
  method: "DELETE",
1076
1503
  body: JSON.stringify({ ...body }),
@@ -1082,12 +1509,12 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
1082
1509
  return this.remove(body);
1083
1510
  }
1084
1511
  };
1085
- _url2 = /* @__PURE__ */ new WeakMap();
1512
+ _url22 = /* @__PURE__ */ new WeakMap();
1086
1513
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1087
- __privateAdd2(_ProjectClient, _url2, "/api/v1/project");
1088
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1514
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1515
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1089
1516
  var ROUTE_URL = "/api/v1/route";
1090
- var RouteClient = class extends import_api25.ApiClient {
1517
+ var RouteClient = class extends ApiClient {
1091
1518
  constructor(options) {
1092
1519
  var _a;
1093
1520
  if (!options.limitPolicy) {
@@ -1130,38 +1557,10 @@ var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
1130
1557
  return dataSourceVariant;
1131
1558
  };
1132
1559
 
1133
- // src/cache.ts
1134
- var import_cache5 = require("next/cache");
1135
-
1136
- // src/utils/tag.ts
1137
- var encodePathForTag = (path) => path.split("/").map((segment) => /[^\x00-\x7F]/.test(segment) ? encodeURIComponent(segment) : segment).join("/");
1138
- var buildPathTag = (path) => {
1139
- const actualPath = path.startsWith("/") ? path : `/${path}`;
1140
- return `path:${encodePathForTag(actualPath)}`.toLowerCase();
1141
- };
1142
- var buildCompositionTag = (compositionId) => {
1143
- return `composition:${compositionId}`.toLowerCase();
1144
- };
1145
- var buildCompositionSlugTag = (slug) => {
1146
- return `composition-slug:${encodePathForTag(slug)}`.toLowerCase();
1147
- };
1148
-
1149
- // src/clients/tags.ts
1150
- var generateRouteCacheTags = ({ path }) => {
1151
- const tags = ["route"];
1152
- if (path) {
1153
- const pathWithoutQuery = path.split("?")[0];
1154
- const pieces = pathWithoutQuery.split("/");
1155
- for (let i = 0; i < pieces.length; i++) {
1156
- const segmentPieces = pieces.slice(0, i + 1);
1157
- const segment = segmentPieces.join("/");
1158
- tags.push(buildPathTag(segment));
1159
- }
1160
- }
1161
- return tags;
1162
- };
1560
+ // src/data/client.ts
1561
+ var import_functions = require("@vercel/functions");
1163
1562
 
1164
- // src/clients/canvas.ts
1563
+ // src/clients/manifest.ts
1165
1564
  var import_server_only = require("server-only");
1166
1565
 
1167
1566
  // src/utils/env.ts
@@ -1214,6 +1613,11 @@ var isStateCacheMode = (options) => {
1214
1613
  var isDetectCacheMode = (options) => {
1215
1614
  return "searchParams" in options && "draftModeEnabled" in options;
1216
1615
  };
1616
+ var resolveManifestCache = (options) => {
1617
+ return resolveCache({
1618
+ options
1619
+ });
1620
+ };
1217
1621
  var resolveCanvasCache = (options) => {
1218
1622
  return resolveCache({
1219
1623
  options
@@ -1281,7 +1685,6 @@ var determineFetchCacheOptions = (mode) => {
1281
1685
  };
1282
1686
 
1283
1687
  // src/clients/retry.ts
1284
- var import_api28 = require("@uniformdev/context/api");
1285
1688
  function createThrottler(limit, interval) {
1286
1689
  let available = limit;
1287
1690
  let refillScheduled = false;
@@ -1392,7 +1795,7 @@ function createLimitPolicy2({
1392
1795
  if (retryOptions.onFailedAttempt) {
1393
1796
  await retryOptions.onFailedAttempt(error);
1394
1797
  }
1395
- if (error instanceof import_api28.ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1798
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1396
1799
  throw error;
1397
1800
  }
1398
1801
  }
@@ -1402,66 +1805,67 @@ function createLimitPolicy2({
1402
1805
  };
1403
1806
  }
1404
1807
 
1405
- // src/clients/canvas.ts
1406
- var buildCanvasClientOptions = (options) => {
1407
- const cache = resolveCanvasCache(options);
1408
- return {
1409
- projectId: env.getProjectId(),
1808
+ // src/utils/tag.ts
1809
+ var buildPathTag = (path) => {
1810
+ const actualPath = path.startsWith("/") ? path : `/${path}`;
1811
+ return `path:${actualPath}`.toLowerCase();
1812
+ };
1813
+
1814
+ // src/clients/tags.ts
1815
+ var generateRouteCacheTags = ({ path, old }) => {
1816
+ const tags = old ? ["route-old"] : ["route"];
1817
+ if (path) {
1818
+ const pathWithoutQuery = path.split("?")[0];
1819
+ const pieces = pathWithoutQuery.split("/");
1820
+ for (let i = 0; i < pieces.length; i++) {
1821
+ const segmentPieces = pieces.slice(0, i + 1);
1822
+ const segment = segmentPieces.join("/");
1823
+ tags.push(buildPathTag(segment));
1824
+ }
1825
+ }
1826
+ return tags;
1827
+ };
1828
+ var generateManifestCacheTags = () => {
1829
+ return ["manifest"];
1830
+ };
1831
+
1832
+ // src/clients/manifest.ts
1833
+ var getManifestClient = (options) => {
1834
+ const cache = resolveManifestCache(options);
1835
+ const manifestClient = new ManifestClient({
1410
1836
  apiHost: env.getApiHost(),
1411
1837
  apiKey: env.getApiKey(),
1412
- edgeApiHost: env.getEdgeApiHost(),
1413
- disableSWR: typeof cache.disableSWR !== "undefined" ? cache.disableSWR : true,
1838
+ projectId: env.getProjectId(),
1414
1839
  limitPolicy: createLimitPolicy2({
1415
1840
  limit: 6
1416
1841
  }),
1417
1842
  fetch: (req, init) => {
1418
- let requestedUrl;
1419
- if (typeof req === "string") {
1420
- requestedUrl = new URL(req);
1421
- } else if (req instanceof URL) {
1422
- requestedUrl = req;
1423
- } else {
1424
- requestedUrl = new URL(req.url);
1425
- }
1426
- const tags = [];
1427
- if (requestedUrl) {
1428
- const compositionIdKey = "compositionId";
1429
- const compositionIdsKey = "compositionIDs";
1430
- const slugKey = "slug";
1431
- const compositionId = requestedUrl.searchParams.get(compositionIdKey);
1432
- const compositionIds = requestedUrl.searchParams.get(compositionIdsKey);
1433
- const slug = requestedUrl.searchParams.get(slugKey);
1434
- if (compositionId) {
1435
- tags.push(buildCompositionTag(compositionId));
1436
- }
1437
- if (slug) {
1438
- tags.push(buildCompositionSlugTag(slug));
1439
- }
1440
- if (compositionIds) {
1441
- const ids = compositionIds.split(",");
1442
- for (let i = 0; i < ids.length; i++) {
1443
- tags.push(buildCompositionTag(ids[i]));
1444
- }
1445
- }
1446
- }
1447
1843
  const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
1448
1844
  return fetch(req, {
1449
1845
  ...init,
1450
- cache: fetchCache,
1451
1846
  headers: {
1452
1847
  ...init == null ? void 0 : init.headers,
1453
1848
  "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
1454
1849
  },
1850
+ cache: fetchCache,
1455
1851
  next: {
1456
1852
  revalidate,
1457
- tags: tags.length ? tags : void 0
1853
+ tags: generateManifestCacheTags()
1458
1854
  }
1459
1855
  });
1460
1856
  }
1461
- };
1857
+ });
1858
+ return manifestClient;
1462
1859
  };
1463
- var getCompositionDeliveryClient = (options) => {
1464
- return new CompositionDeliveryClient(buildCanvasClientOptions(options));
1860
+ var getManifest = async (options) => {
1861
+ let preview = false;
1862
+ if (options && isStateCacheMode(options)) {
1863
+ preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
1864
+ }
1865
+ const manifestClient = getManifestClient(options);
1866
+ return manifestClient.get({
1867
+ preview
1868
+ });
1465
1869
  };
1466
1870
 
1467
1871
  // src/clients/route.ts
@@ -1515,201 +1919,218 @@ var getRouteClient = (options) => {
1515
1919
  return client;
1516
1920
  };
1517
1921
 
1922
+ // src/config/helpers.ts
1923
+ var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
1924
+ var getMiddlewareRuntimeCache = () => {
1925
+ if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
1926
+ return false;
1927
+ }
1928
+ if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
1929
+ return import_resolved.default.middlewareRuntimeCache;
1930
+ }
1931
+ return true;
1932
+ };
1933
+ var getDisableSwrMiddlewareCache = () => {
1934
+ var _a;
1935
+ if (typeof ((_a = import_resolved.default.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
1936
+ return import_resolved.default.experimental.disableSwrMiddlewareCache;
1937
+ }
1938
+ return false;
1939
+ };
1940
+
1518
1941
  // src/data/client.ts
1519
- var DataClient = class {
1520
- constructor({ fetchCache = true } = {}) {
1521
- this.fetchCache = fetchCache;
1522
- }
1523
- async getRoute({ pageState }) {
1524
- const routeClient = getRouteClient({ cache: this.resolveCache(pageState) });
1525
- const parameters = {
1526
- path: pageState.routePath,
1527
- state: pageState.compositionState,
1528
- dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, pageState.compositionState),
1529
- withComponentIDs: true,
1530
- releaseId: pageState.releaseId,
1531
- locale: pageState.locale,
1532
- ignoreRedirects: shouldIgnoreRedirects({ state: pageState.compositionState })
1533
- };
1534
- return routeClient.get(parameters);
1942
+ var MANIFEST_CACHE_KEY = "uniform-manifest";
1943
+ var DefaultDataClient = class {
1944
+ async getManifest(options) {
1945
+ const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
1946
+ if (cache) {
1947
+ const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
1948
+ if (cachedManifest) {
1949
+ return cachedManifest;
1950
+ }
1951
+ }
1952
+ const manifest = await getManifest({
1953
+ cache: isDevelopmentEnvironment() ? {
1954
+ type: "no-cache",
1955
+ bypassCache: true
1956
+ } : {
1957
+ type: "force-cache"
1958
+ }
1959
+ });
1960
+ if (cache) {
1961
+ (0, import_functions.waitUntil)(
1962
+ (async () => {
1963
+ await cache.set(MANIFEST_CACHE_KEY, manifest, {
1964
+ tags: generateManifestCacheTags()
1965
+ });
1966
+ })()
1967
+ );
1968
+ }
1969
+ return manifest;
1535
1970
  }
1536
- /** Returns `null` when no composition matches the selector in the page state's composition state. */
1537
- async getComposition({
1538
- pageState,
1539
- selector
1971
+ async getRouteFromApi({
1972
+ route,
1973
+ routeClient,
1974
+ enableRuntimeCache,
1975
+ disableSwrCache
1540
1976
  }) {
1541
- const client = getCompositionDeliveryClient({ cache: this.resolveCache(pageState) });
1542
- try {
1543
- return await client.get({
1544
- ...selector,
1545
- state: pageState.compositionState,
1546
- withComponentIDs: true,
1547
- releaseId: pageState.releaseId,
1548
- locale: pageState.locale
1549
- });
1550
- } catch (e) {
1551
- if (e instanceof import_api26.ApiClientError && e.statusCode === 404) {
1552
- return null;
1977
+ const newCacheKey = `uniform-route-${route.state}-${route.releaseId}-${route.path}`;
1978
+ const oldCacheKey = `uniform-route-old-${route.state}-${route.releaseId}-${route.path}`;
1979
+ const cache = enableRuntimeCache ? (0, import_functions.getCache)() : null;
1980
+ const cacheNewRoute = async (result2) => {
1981
+ if (cache && result2.type === "composition") {
1982
+ const tags = generateRouteCacheTags({ path: route.path });
1983
+ await cache.set(newCacheKey, result2, {
1984
+ tags
1985
+ });
1986
+ }
1987
+ };
1988
+ const cacheOldRoute = async (result2) => {
1989
+ if (cache && result2.type === "composition" && !disableSwrCache) {
1990
+ const tags = generateRouteCacheTags({ path: route.path, old: true });
1991
+ await cache.set(oldCacheKey, result2, {
1992
+ tags
1993
+ });
1994
+ }
1995
+ };
1996
+ if (cache) {
1997
+ const [cachedRoute, oldCachedRoute] = await Promise.all([
1998
+ cache.get(newCacheKey),
1999
+ disableSwrCache ? null : cache.get(oldCacheKey)
2000
+ ]);
2001
+ if (cachedRoute) {
2002
+ return cachedRoute;
2003
+ }
2004
+ if (oldCachedRoute) {
2005
+ (0, import_functions.waitUntil)(
2006
+ (async () => {
2007
+ const result2 = await routeClient.get(route);
2008
+ await cacheNewRoute(result2);
2009
+ })()
2010
+ );
2011
+ return oldCachedRoute;
1553
2012
  }
1554
- throw e;
1555
2013
  }
2014
+ const result = await routeClient.get(route);
2015
+ (0, import_functions.waitUntil)(
2016
+ (async () => {
2017
+ await Promise.all([
2018
+ cacheNewRoute(result),
2019
+ disableSwrCache ? Promise.resolve() : cacheOldRoute(result)
2020
+ ]);
2021
+ })()
2022
+ );
2023
+ return result;
1556
2024
  }
1557
- resolveCache(pageState) {
1558
- if (pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment()) {
1559
- return { type: "no-cache", bypassCache: true };
2025
+ async getRoute(options) {
2026
+ if (options.source === "middleware") {
2027
+ return this.getRouteMiddleware(options);
1560
2028
  }
1561
- return this.fetchCache ? { type: "force-cache" } : { type: "no-cache" };
2029
+ return this.getRoutePageState(options);
1562
2030
  }
1563
- };
1564
-
1565
- // src/data/deserializePageState.ts
1566
- var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
1567
- var deserializePageState = ({ code }) => (0, import_next_app_router_shared.deserializeEvaluationResult)({ input: code });
1568
-
1569
- // src/data/resolveCompositionForPageState.ts
1570
- var resolveCompositionForPageState = async ({
1571
- pageState,
1572
- selector,
1573
- matchedRoute,
1574
- dataClient = new DataClient()
1575
- }) => {
1576
- const states = pageState.compositionState === CANVAS_EDITOR_STATE ? [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE] : [pageState.compositionState];
1577
- let composition = null;
1578
- for (const state of states) {
1579
- try {
1580
- composition = await dataClient.getComposition({
1581
- pageState: { ...pageState, compositionState: state },
1582
- selector
2031
+ async enhanceRoute(_options) {
2032
+ }
2033
+ async getRouteMiddleware(options) {
2034
+ const routeClient = getRouteClient({
2035
+ searchParams: options.searchParams,
2036
+ draftModeEnabled: options.draftModeEnabled
2037
+ });
2038
+ const resolvedRoute = await this.getRouteFromApi({
2039
+ source: "middleware",
2040
+ route: options.route,
2041
+ routeClient,
2042
+ // The runtime cache is keyed on the route path. Development bypasses it so an author sees
2043
+ // an edit right away, the same way the fetch cache is bypassed for development.
2044
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache() && !isDevelopmentEnvironment(),
2045
+ disableSwrCache: getDisableSwrMiddlewareCache()
2046
+ });
2047
+ if (resolvedRoute.type === "composition") {
2048
+ await this.enhanceRoute({
2049
+ source: "middleware",
2050
+ parameters: options.route,
2051
+ route: resolvedRoute,
2052
+ routeClient,
2053
+ keys: void 0
1583
2054
  });
1584
- } catch (e) {
1585
- console.warn(`Failed to get composition ${JSON.stringify(selector)} with state ${state}`, e);
1586
2055
  }
1587
- if (composition) {
1588
- break;
1589
- }
1590
- }
1591
- if (!composition) {
1592
- return { pageState, route: void 0 };
2056
+ return {
2057
+ route: resolvedRoute
2058
+ };
1593
2059
  }
1594
- return {
1595
- pageState: { ...pageState, compositionState: composition.state },
1596
- route: {
1597
- type: "composition",
1598
- compositionApiResponse: composition,
1599
- matchedRoute
2060
+ async getRoutePageState(options) {
2061
+ const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
2062
+ const routeClient = getRouteClient({
2063
+ cache: shouldBypassCache ? {
2064
+ type: "no-cache",
2065
+ bypassCache: true
2066
+ } : {
2067
+ type: "force-cache"
2068
+ }
2069
+ });
2070
+ const originalRoute = {
2071
+ path: options.pageState.routePath,
2072
+ state: options.pageState.compositionState,
2073
+ dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
2074
+ withComponentIDs: true,
2075
+ releaseId: options.pageState.releaseId,
2076
+ locale: options.pageState.locale,
2077
+ ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
2078
+ };
2079
+ const resolvedRoute = await this.getRouteFromApi({
2080
+ source: "pageState",
2081
+ route: originalRoute,
2082
+ routeClient,
2083
+ enableRuntimeCache: false,
2084
+ disableSwrCache: false
2085
+ });
2086
+ if (resolvedRoute.type === "composition") {
2087
+ await this.enhanceRoute({
2088
+ source: "pageState",
2089
+ parameters: originalRoute,
2090
+ route: resolvedRoute,
2091
+ routeClient,
2092
+ keys: options.pageState.keys
2093
+ });
1600
2094
  }
1601
- };
2095
+ return {
2096
+ route: resolvedRoute
2097
+ };
2098
+ }
1602
2099
  };
1603
2100
 
1604
- // src/data/resolveCompositionById.ts
1605
- var resolveCompositionById = ({
1606
- pageState,
1607
- compositionId,
1608
- matchedRoute = pageState.routePath
1609
- }) => resolveCompositionForPageState({ pageState, selector: { compositionId }, matchedRoute });
1610
-
1611
- // src/data/resolveCompositionBySlug.ts
1612
- var resolveCompositionBySlug = ({
1613
- pageState,
1614
- slug,
1615
- matchedRoute = pageState.routePath
1616
- }) => resolveCompositionForPageState({ pageState, selector: { slug }, matchedRoute });
1617
-
1618
- // src/data/resolveRouteForPageState.ts
1619
- var resolveRouteForPageState = async ({
1620
- pageState: providedPageState,
1621
- dataClient = new DataClient()
2101
+ // src/data/resolveRouteFromCode.ts
2102
+ var resolveRouteFromCode = async ({
2103
+ code,
2104
+ dataClient: providedDataClient
1622
2105
  }) => {
1623
- const states = providedPageState.compositionState === CANVAS_EDITOR_STATE ? [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE] : [providedPageState.compositionState];
1624
- let pageState = providedPageState;
1625
- let route = null;
1626
- for (const state of states) {
1627
- pageState = { ...providedPageState, compositionState: state };
1628
- try {
1629
- route = await dataClient.getRoute({ pageState });
1630
- } catch (e) {
1631
- console.warn(`Failed to retrieve route by path: ${pageState.routePath} with state ${state}`, e);
1632
- }
1633
- if (route && route.type !== "notFound") {
1634
- break;
1635
- }
1636
- }
1637
- if ((route == null ? void 0 : route.type) === "composition" || (route == null ? void 0 : route.type) === "redirect") {
1638
- return { pageState, route };
1639
- }
1640
- return { pageState, route: void 0 };
2106
+ const pageState = (0, import_next_app_router_shared.deserializeEvaluationResult)({ input: code });
2107
+ const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
2108
+ const { route } = await dataClient.getRoute({
2109
+ source: "pageState",
2110
+ pageState
2111
+ });
2112
+ return {
2113
+ pageState,
2114
+ // suppress the route if it's not a composition
2115
+ route: (route == null ? void 0 : route.type) === "composition" ? route : void 0,
2116
+ // the code that was used to resolve the route
2117
+ code
2118
+ };
1641
2119
  };
1642
2120
 
1643
2121
  // src/cache.ts
1644
- var tagScope = (result, requestedTags) => {
1645
- var _a;
1646
- const tags = [...requestedTags];
1647
- if (((_a = result.route) == null ? void 0 : _a.type) === "composition") {
1648
- tags.push(buildCompositionTag(result.route.compositionApiResponse.composition._id));
1649
- }
1650
- (0, import_cache5.cacheTag)(...tags);
1651
- return result;
1652
- };
1653
- var createScopeDataClient = () => new DataClient({ fetchCache: false });
1654
- var isPublished = (pageState) => pageState.compositionState === CANVAS_PUBLISHED_STATE;
1655
- var resolveRouteCached = async (pageState) => {
1656
- "use cache";
1657
- return tagScope(
1658
- await resolveRouteForPageState({ pageState, dataClient: createScopeDataClient() }),
1659
- generateRouteCacheTags({ path: pageState.routePath })
1660
- );
1661
- };
1662
- var resolveCompositionByIdCached = async ({
1663
- pageState,
1664
- compositionId,
1665
- matchedRoute = pageState.routePath
2122
+ var resolveRouteFromCode2 = async ({
2123
+ code,
2124
+ dataClient: providedDataClient
1666
2125
  }) => {
1667
2126
  "use cache";
1668
- return tagScope(
1669
- await resolveCompositionForPageState({
1670
- pageState,
1671
- selector: { compositionId },
1672
- matchedRoute,
1673
- dataClient: createScopeDataClient()
1674
- }),
1675
- [buildCompositionTag(compositionId)]
1676
- );
1677
- };
1678
- var resolveCompositionBySlugCached = async ({
1679
- pageState,
1680
- slug,
1681
- matchedRoute = pageState.routePath
1682
- }) => {
1683
- "use cache";
1684
- return tagScope(
1685
- await resolveCompositionForPageState({
1686
- pageState,
1687
- selector: { slug },
1688
- matchedRoute,
1689
- dataClient: createScopeDataClient()
1690
- }),
1691
- [buildCompositionSlugTag(slug)]
1692
- );
1693
- };
1694
- var resolveRouteFromCode = async ({
1695
- code
1696
- }) => {
1697
- const pageState = deserializePageState({ code });
1698
- return isPublished(pageState) ? resolveRouteCached(pageState) : resolveRouteForPageState({ pageState });
1699
- };
1700
- var resolveRouteFromPath = async ({
1701
- pageState,
1702
- path
1703
- }) => {
1704
- const pathPageState = { ...pageState, routePath: path };
1705
- return isPublished(pageState) ? resolveRouteCached(pathPageState) : resolveRouteForPageState({ pageState: pathPageState });
2127
+ const result = await resolveRouteFromCode({
2128
+ code,
2129
+ dataClient: providedDataClient
2130
+ });
2131
+ return result;
1706
2132
  };
1707
- var resolveCompositionById2 = async (options) => isPublished(options.pageState) ? resolveCompositionByIdCached(options) : resolveCompositionById(options);
1708
- var resolveCompositionBySlug2 = async (options) => isPublished(options.pageState) ? resolveCompositionBySlugCached(options) : resolveCompositionBySlug(options);
1709
2133
  // Annotate the CommonJS export names for ESM import in node:
1710
2134
  0 && (module.exports = {
1711
- resolveCompositionById,
1712
- resolveCompositionBySlug,
1713
- resolveRouteFromCode,
1714
- resolveRouteFromPath
2135
+ resolveRouteFromCode
1715
2136
  });