@uniformdev/next-app-router 20.49.1 → 20.49.3-alpha.47

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.
@@ -1,4 +1,4 @@
1
- import { RouteGetParameters, RouteGetResponseEdgehancedComposition, RouteClient, RouteGetResponse } from '@uniformdev/canvas';
1
+ import { RouteGetParameters, RouteGetResponse, RouteClient, RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
2
2
  import { ManifestV2 } from '@uniformdev/context';
3
3
  import { PageState } from '@uniformdev/next-app-router-shared';
4
4
 
@@ -68,6 +68,7 @@ declare class DefaultDataClient implements DataClient {
68
68
  projectId: string;
69
69
  created: string;
70
70
  modified: string;
71
+ deletedAt?: string;
71
72
  creator?: string;
72
73
  author?: string;
73
74
  categoryId?: string;
@@ -1,4 +1,4 @@
1
- import { RouteGetParameters, RouteGetResponseEdgehancedComposition, RouteClient, RouteGetResponse } from '@uniformdev/canvas';
1
+ import { RouteGetParameters, RouteGetResponse, RouteClient, RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
2
2
  import { ManifestV2 } from '@uniformdev/context';
3
3
  import { PageState } from '@uniformdev/next-app-router-shared';
4
4
 
@@ -68,6 +68,7 @@ declare class DefaultDataClient implements DataClient {
68
68
  projectId: string;
69
69
  created: string;
70
70
  modified: string;
71
+ deletedAt?: string;
71
72
  creator?: string;
72
73
  author?: string;
73
74
  categoryId?: string;
package/dist/compat.d.mts CHANGED
@@ -1,12 +1,12 @@
1
1
  import React, { ComponentType } from 'react';
2
2
  import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
3
3
  import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.mjs';
4
- import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-hhRIBHmn.mjs';
4
+ import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-Bo6UsTDC.mjs';
5
5
  import '@uniformdev/next-app-router-client';
6
6
  import '@uniformdev/canvas';
7
- import './client-BCGVjYM-.mjs';
7
+ import './client-DRMp2gpi.mjs';
8
8
  import '@uniformdev/context';
9
- import './resolveRouteFromCode-CKaYNXte.mjs';
9
+ import './resolveRouteFromCode-C0dkUV2T.mjs';
10
10
 
11
11
  type ComponentContext = ComponentProps$1['component'] & {
12
12
  parameters: Record<string, ComponentParameter>;
package/dist/compat.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import React, { ComponentType } from 'react';
2
2
  import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
3
3
  import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.js';
4
- import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-d7_93l3F.js';
4
+ import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-BWxMuY7i.js';
5
5
  import '@uniformdev/next-app-router-client';
6
6
  import '@uniformdev/canvas';
7
- import './client-BCGVjYM-.js';
7
+ import './client-DRMp2gpi.js';
8
8
  import '@uniformdev/context';
9
- import './resolveRouteFromCode-DgTsfMK8.js';
9
+ import './resolveRouteFromCode-Bhz8EJBu.js';
10
10
 
11
11
  type ComponentContext = ComponentProps$1['component'] & {
12
12
  parameters: Record<string, ComponentParameter>;
package/dist/component.js CHANGED
@@ -225,21 +225,28 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
225
225
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
226
226
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
227
227
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
228
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
228
229
  var ApiClientError = class _ApiClientError extends Error {
229
230
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
230
231
  super(
231
232
  `${errorMessage}
232
233
  ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
233
234
  );
234
- this.errorMessage = errorMessage;
235
- this.fetchMethod = fetchMethod;
236
- this.fetchUri = fetchUri;
237
- this.statusCode = statusCode;
238
- this.statusText = statusText;
239
- this.requestId = requestId;
235
+ __publicField(this, "errorMessage", errorMessage);
236
+ __publicField(this, "fetchMethod", fetchMethod);
237
+ __publicField(this, "fetchUri", fetchUri);
238
+ __publicField(this, "statusCode", statusCode);
239
+ __publicField(this, "statusText", statusText);
240
+ __publicField(this, "requestId", requestId);
240
241
  Object.setPrototypeOf(this, _ApiClientError.prototype);
241
242
  }
242
243
  };
244
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
245
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
246
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
247
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
248
+ }
249
+ };
243
250
  var ApiClient = class _ApiClient {
244
251
  constructor(options) {
245
252
  __publicField(this, "options");
@@ -273,7 +280,7 @@ var ApiClient = class _ApiClient {
273
280
  }
274
281
  async apiClientWithResponse(fetchUri, options) {
275
282
  return this.options.limitPolicy(async () => {
276
- var _a;
283
+ var _a, _b;
277
284
  const coreHeaders = this.options.apiKey ? {
278
285
  "x-api-key": this.options.apiKey
279
286
  } : {
@@ -309,9 +316,19 @@ var ApiClient = class _ApiClient {
309
316
  } catch (e) {
310
317
  message = `General error`;
311
318
  }
319
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
320
+ throw new BearerTokenNotValidOrExpiredError(
321
+ message,
322
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
323
+ fetchUri.toString(),
324
+ apiResponse.status,
325
+ apiResponse.statusText,
326
+ _ApiClient.getRequestId(apiResponse)
327
+ );
328
+ }
312
329
  throw new ApiClientError(
313
330
  message,
314
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
331
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
315
332
  fetchUri.toString(),
316
333
  apiResponse.status,
317
334
  apiResponse.statusText,
@@ -385,11 +402,25 @@ async function handleRateLimits(callApi) {
385
402
  }
386
403
  const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
387
404
  const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
388
- await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
405
+ await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
389
406
  backoffRetriesLeft -= 1;
390
407
  }
391
408
  return response;
392
409
  }
410
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
411
+ function rewriteFiltersForApi(filters) {
412
+ return Object.entries(filters != null ? filters : {}).reduce(
413
+ (acc, [key, value]) => {
414
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
415
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
416
+ return {
417
+ ...acc,
418
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
419
+ };
420
+ },
421
+ {}
422
+ );
423
+ }
393
424
  var _url;
394
425
  var _AggregateClient = class _AggregateClient2 extends ApiClient {
395
426
  constructor(options) {
@@ -610,391 +641,55 @@ _url7 = /* @__PURE__ */ new WeakMap();
610
641
  __privateAdd(_TestClient, _url7, "/api/v2/test");
611
642
 
612
643
  // ../canvas/dist/index.mjs
613
- var __create2 = Object.create;
614
- var __defProp3 = Object.defineProperty;
615
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
616
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
617
- var __getProtoOf2 = Object.getPrototypeOf;
618
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
619
644
  var __typeError2 = (msg) => {
620
645
  throw TypeError(msg);
621
646
  };
622
- var __commonJS2 = (cb, mod) => function __require() {
623
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
624
- };
625
- var __copyProps2 = (to, from, except, desc) => {
626
- if (from && typeof from === "object" || typeof from === "function") {
627
- for (let key of __getOwnPropNames2(from))
628
- if (!__hasOwnProp2.call(to, key) && key !== except)
629
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
630
- }
631
- return to;
632
- };
633
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
634
- // If the importer is in node compatibility mode or this is not an ESM
635
- // file that has been converted to a CommonJS file using a Babel-
636
- // compatible transform (i.e. "__esModule" has not been set), then set
637
- // "default" to the CommonJS "module.exports" for node compatibility.
638
- isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
639
- mod
640
- ));
641
647
  var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
642
648
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
643
649
  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);
644
- var require_yocto_queue2 = __commonJS2({
645
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
646
- "use strict";
647
- var Node = class {
648
- /// value;
649
- /// next;
650
- constructor(value) {
651
- this.value = value;
652
- this.next = void 0;
653
- }
654
- };
655
- var Queue = class {
656
- // TODO: Use private class fields when targeting Node.js 12.
657
- // #_head;
658
- // #_tail;
659
- // #_size;
660
- constructor() {
661
- this.clear();
662
- }
663
- enqueue(value) {
664
- const node = new Node(value);
665
- if (this._head) {
666
- this._tail.next = node;
667
- this._tail = node;
668
- } else {
669
- this._head = node;
670
- this._tail = node;
671
- }
672
- this._size++;
673
- }
674
- dequeue() {
675
- const current = this._head;
676
- if (!current) {
677
- return;
678
- }
679
- this._head = this._head.next;
680
- this._size--;
681
- return current.value;
682
- }
683
- clear() {
684
- this._head = void 0;
685
- this._tail = void 0;
686
- this._size = 0;
687
- }
688
- get size() {
689
- return this._size;
690
- }
691
- *[Symbol.iterator]() {
692
- let current = this._head;
693
- while (current) {
694
- yield current.value;
695
- current = current.next;
696
- }
697
- }
698
- };
699
- module2.exports = Queue;
650
+ var SELECT_QUERY_PREFIX = "select.";
651
+ function appendCsv(out, key, values) {
652
+ if (values === void 0) {
653
+ return;
700
654
  }
701
- });
702
- var require_p_limit2 = __commonJS2({
703
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
704
- "use strict";
705
- var Queue = require_yocto_queue2();
706
- var pLimit2 = (concurrency) => {
707
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
708
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
709
- }
710
- const queue = new Queue();
711
- let activeCount = 0;
712
- const next = () => {
713
- activeCount--;
714
- if (queue.size > 0) {
715
- queue.dequeue()();
716
- }
717
- };
718
- const run = async (fn, resolve, ...args) => {
719
- activeCount++;
720
- const result = (async () => fn(...args))();
721
- resolve(result);
722
- try {
723
- await result;
724
- } catch (e) {
725
- }
726
- next();
727
- };
728
- const enqueue = (fn, resolve, ...args) => {
729
- queue.enqueue(run.bind(null, fn, resolve, ...args));
730
- (async () => {
731
- await Promise.resolve();
732
- if (activeCount < concurrency && queue.size > 0) {
733
- queue.dequeue()();
734
- }
735
- })();
736
- };
737
- const generator = (fn, ...args) => new Promise((resolve) => {
738
- enqueue(fn, resolve, ...args);
739
- });
740
- Object.defineProperties(generator, {
741
- activeCount: {
742
- get: () => activeCount
743
- },
744
- pendingCount: {
745
- get: () => queue.size
746
- },
747
- clearQueue: {
748
- value: () => {
749
- queue.clear();
750
- }
751
- }
752
- });
753
- return generator;
754
- };
755
- module2.exports = pLimit2;
756
- }
757
- });
758
- var require_retry_operation = __commonJS2({
759
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
760
- "use strict";
761
- function RetryOperation(timeouts, options) {
762
- if (typeof options === "boolean") {
763
- options = { forever: options };
764
- }
765
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
766
- this._timeouts = timeouts;
767
- this._options = options || {};
768
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
769
- this._fn = null;
770
- this._errors = [];
771
- this._attempts = 1;
772
- this._operationTimeout = null;
773
- this._operationTimeoutCb = null;
774
- this._timeout = null;
775
- this._operationStart = null;
776
- this._timer = null;
777
- if (this._options.forever) {
778
- this._cachedTimeouts = this._timeouts.slice(0);
779
- }
655
+ out[key] = values.join(",");
656
+ }
657
+ function projectionToQuery(spec) {
658
+ const out = {};
659
+ if (!spec) {
660
+ return out;
661
+ }
662
+ const { fields, fieldTypes, slots } = spec;
663
+ const p = SELECT_QUERY_PREFIX;
664
+ if (fields) {
665
+ appendCsv(out, `${p}fields[only]`, fields.only);
666
+ appendCsv(out, `${p}fields[except]`, fields.except);
667
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
668
+ if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
669
+ out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
780
670
  }
781
- module2.exports = RetryOperation;
782
- RetryOperation.prototype.reset = function() {
783
- this._attempts = 1;
784
- this._timeouts = this._originalTimeouts.slice(0);
785
- };
786
- RetryOperation.prototype.stop = function() {
787
- if (this._timeout) {
788
- clearTimeout(this._timeout);
789
- }
790
- if (this._timer) {
791
- clearTimeout(this._timer);
792
- }
793
- this._timeouts = [];
794
- this._cachedTimeouts = null;
795
- };
796
- RetryOperation.prototype.retry = function(err) {
797
- if (this._timeout) {
798
- clearTimeout(this._timeout);
799
- }
800
- if (!err) {
801
- return false;
802
- }
803
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
804
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
805
- this._errors.push(err);
806
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
807
- return false;
808
- }
809
- this._errors.push(err);
810
- var timeout = this._timeouts.shift();
811
- if (timeout === void 0) {
812
- if (this._cachedTimeouts) {
813
- this._errors.splice(0, this._errors.length - 1);
814
- timeout = this._cachedTimeouts.slice(-1);
815
- } else {
816
- return false;
817
- }
818
- }
819
- var self = this;
820
- this._timer = setTimeout(function() {
821
- self._attempts++;
822
- if (self._operationTimeoutCb) {
823
- self._timeout = setTimeout(function() {
824
- self._operationTimeoutCb(self._attempts);
825
- }, self._operationTimeout);
826
- if (self._options.unref) {
827
- self._timeout.unref();
828
- }
829
- }
830
- self._fn(self._attempts);
831
- }, timeout);
832
- if (this._options.unref) {
833
- this._timer.unref();
834
- }
835
- return true;
836
- };
837
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
838
- this._fn = fn;
839
- if (timeoutOps) {
840
- if (timeoutOps.timeout) {
841
- this._operationTimeout = timeoutOps.timeout;
842
- }
843
- if (timeoutOps.cb) {
844
- this._operationTimeoutCb = timeoutOps.cb;
845
- }
846
- }
847
- var self = this;
848
- if (this._operationTimeoutCb) {
849
- this._timeout = setTimeout(function() {
850
- self._operationTimeoutCb();
851
- }, self._operationTimeout);
852
- }
853
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
854
- this._fn(this._attempts);
855
- };
856
- RetryOperation.prototype.try = function(fn) {
857
- console.log("Using RetryOperation.try() is deprecated");
858
- this.attempt(fn);
859
- };
860
- RetryOperation.prototype.start = function(fn) {
861
- console.log("Using RetryOperation.start() is deprecated");
862
- this.attempt(fn);
863
- };
864
- RetryOperation.prototype.start = RetryOperation.prototype.try;
865
- RetryOperation.prototype.errors = function() {
866
- return this._errors;
867
- };
868
- RetryOperation.prototype.attempts = function() {
869
- return this._attempts;
870
- };
871
- RetryOperation.prototype.mainError = function() {
872
- if (this._errors.length === 0) {
873
- return null;
874
- }
875
- var counts = {};
876
- var mainError = null;
877
- var mainErrorCount = 0;
878
- for (var i = 0; i < this._errors.length; i++) {
879
- var error = this._errors[i];
880
- var message = error.message;
881
- var count = (counts[message] || 0) + 1;
882
- counts[message] = count;
883
- if (count >= mainErrorCount) {
884
- mainError = error;
885
- mainErrorCount = count;
886
- }
887
- }
888
- return mainError;
889
- };
890
671
  }
891
- });
892
- var require_retry = __commonJS2({
893
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
894
- "use strict";
895
- var RetryOperation = require_retry_operation();
896
- exports2.operation = function(options) {
897
- var timeouts = exports2.timeouts(options);
898
- return new RetryOperation(timeouts, {
899
- forever: options && (options.forever || options.retries === Infinity),
900
- unref: options && options.unref,
901
- maxRetryTime: options && options.maxRetryTime
902
- });
903
- };
904
- exports2.timeouts = function(options) {
905
- if (options instanceof Array) {
906
- return [].concat(options);
907
- }
908
- var opts = {
909
- retries: 10,
910
- factor: 2,
911
- minTimeout: 1 * 1e3,
912
- maxTimeout: Infinity,
913
- randomize: false
914
- };
915
- for (var key in options) {
916
- opts[key] = options[key];
917
- }
918
- if (opts.minTimeout > opts.maxTimeout) {
919
- throw new Error("minTimeout is greater than maxTimeout");
920
- }
921
- var timeouts = [];
922
- for (var i = 0; i < opts.retries; i++) {
923
- timeouts.push(this.createTimeout(i, opts));
924
- }
925
- if (options && options.forever && !timeouts.length) {
926
- timeouts.push(this.createTimeout(i, opts));
927
- }
928
- timeouts.sort(function(a, b) {
929
- return a - b;
930
- });
931
- return timeouts;
932
- };
933
- exports2.createTimeout = function(attempt, opts) {
934
- var random = opts.randomize ? Math.random() + 1 : 1;
935
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
936
- timeout = Math.min(timeout, opts.maxTimeout);
937
- return timeout;
938
- };
939
- exports2.wrap = function(obj, options, methods) {
940
- if (options instanceof Array) {
941
- methods = options;
942
- options = null;
943
- }
944
- if (!methods) {
945
- methods = [];
946
- for (var key in obj) {
947
- if (typeof obj[key] === "function") {
948
- methods.push(key);
949
- }
672
+ if (fieldTypes) {
673
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
674
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
675
+ }
676
+ if (slots) {
677
+ appendCsv(out, `${p}slots[only]`, slots.only);
678
+ appendCsv(out, `${p}slots[except]`, slots.except);
679
+ if (typeof slots.depth === "number") {
680
+ out[`${p}slots[depth]`] = String(slots.depth);
681
+ }
682
+ if (slots.named) {
683
+ const slotNames = Object.keys(slots.named).sort();
684
+ for (const slotName of slotNames) {
685
+ const named = slots.named[slotName];
686
+ if (named && typeof named.depth === "number") {
687
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
950
688
  }
951
689
  }
952
- for (var i = 0; i < methods.length; i++) {
953
- var method = methods[i];
954
- var original = obj[method];
955
- obj[method] = function retryWrapper(original2) {
956
- var op = exports2.operation(options);
957
- var args = Array.prototype.slice.call(arguments, 1);
958
- var callback = args.pop();
959
- args.push(function(err) {
960
- if (op.retry(err)) {
961
- return;
962
- }
963
- if (err) {
964
- arguments[0] = op.mainError();
965
- }
966
- callback.apply(this, arguments);
967
- });
968
- op.attempt(function() {
969
- original2.apply(obj, args);
970
- });
971
- }.bind(obj, original);
972
- obj[method].options = options;
973
- }
974
- };
975
- }
976
- });
977
- var require_retry2 = __commonJS2({
978
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
979
- "use strict";
980
- module2.exports = require_retry();
690
+ }
981
691
  }
982
- });
983
- var import_p_limit2 = __toESM2(require_p_limit2());
984
- var import_retry = __toESM2(require_retry2(), 1);
985
- var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
986
- function rewriteFilters(filters) {
987
- return Object.entries(filters != null ? filters : {}).reduce(
988
- (acc, [key, value]) => {
989
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
990
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
991
- return {
992
- ...acc,
993
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
994
- };
995
- },
996
- {}
997
- );
692
+ return out;
998
693
  }
999
694
  var _contentTypesUrl;
1000
695
  var _entriesUrl;
@@ -1011,15 +706,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1011
706
  }
1012
707
  getEntries(options) {
1013
708
  const { projectId } = this.options;
1014
- const { skipDataResolution, filters, ...params } = options;
1015
- const rewrittenFilters = rewriteFilters(filters);
709
+ const { skipDataResolution, filters, select, ...params } = options;
710
+ const rewrittenFilters = rewriteFiltersForApi(filters);
711
+ const rewrittenSelect = projectionToQuery(select);
1016
712
  if (skipDataResolution) {
1017
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
713
+ const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
714
+ ...params,
715
+ ...rewrittenFilters,
716
+ ...rewrittenSelect,
717
+ projectId
718
+ });
1018
719
  return this.apiClient(url);
1019
720
  }
1020
721
  const edgeUrl = this.createUrl(
1021
722
  __privateGet2(_ContentClient2, _entriesUrl),
1022
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
723
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1023
724
  this.edgeApiHost
1024
725
  );
1025
726
  return this.apiClient(
@@ -1169,6 +870,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1169
870
  _baseUrl = /* @__PURE__ */ new WeakMap();
1170
871
  __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1171
872
  var _url22;
873
+ var _projectsUrl;
1172
874
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
1173
875
  constructor(options) {
1174
876
  super({ ...options, bypassCache: true });
@@ -1178,6 +880,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1178
880
  const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
1179
881
  return await this.apiClient(fetchUri);
1180
882
  }
883
+ /**
884
+ * Fetches projects grouped by team.
885
+ * When teamId is provided, returns a single team with its projects.
886
+ * When omitted, returns all accessible teams and their projects.
887
+ */
888
+ async getProjects(options) {
889
+ const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
890
+ return await this.apiClient(fetchUri);
891
+ }
1181
892
  /** Updates or creates (based on id) a Project */
1182
893
  async upsert(body) {
1183
894
  const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
@@ -1197,7 +908,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1197
908
  }
1198
909
  };
1199
910
  _url22 = /* @__PURE__ */ new WeakMap();
911
+ _projectsUrl = /* @__PURE__ */ new WeakMap();
1200
912
  __privateAdd2(_ProjectClient, _url22, "/api/v1/project");
913
+ __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1201
914
  var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
1202
915
  var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
1203
916
  var ATTRIBUTE_PARAMETER_TYPE = "data-uniform-parameter-type";
@@ -1249,7 +962,7 @@ var import_richtext = require("@uniformdev/richtext");
1249
962
  var import_react4 = __toESM(require("react"));
1250
963
  var LinkRichTextNode = ({ children, node }) => {
1251
964
  const { link } = node;
1252
- return /* @__PURE__ */ import_react4.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
965
+ return /* @__PURE__ */ import_react4.default.createElement("a", { ...(0, import_richtext.linkParamValueToAnchorProps)(link) }, children);
1253
966
  };
1254
967
 
1255
968
  // src/components/nodes/ListItemRichTextNode.tsx