@uniformdev/next-app-router 20.50.2-alpha.149 → 20.50.2-alpha.167

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.
@@ -216,12 +216,12 @@ var ApiClientError = class _ApiClientError extends Error {
216
216
  `${errorMessage}
217
217
  ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
218
218
  );
219
- this.errorMessage = errorMessage;
220
- this.fetchMethod = fetchMethod;
221
- this.fetchUri = fetchUri;
222
- this.statusCode = statusCode;
223
- this.statusText = statusText;
224
- this.requestId = requestId;
219
+ __publicField(this, "errorMessage", errorMessage);
220
+ __publicField(this, "fetchMethod", fetchMethod);
221
+ __publicField(this, "fetchUri", fetchUri);
222
+ __publicField(this, "statusCode", statusCode);
223
+ __publicField(this, "statusText", statusText);
224
+ __publicField(this, "requestId", requestId);
225
225
  Object.setPrototypeOf(this, _ApiClientError.prototype);
226
226
  }
227
227
  };
@@ -609,378 +609,57 @@ _url7 = /* @__PURE__ */ new WeakMap();
609
609
  __privateAdd(_TestClient, _url7, "/api/v2/test");
610
610
 
611
611
  // ../canvas/dist/index.mjs
612
- var __create2 = Object.create;
613
- var __defProp3 = Object.defineProperty;
614
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
615
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
616
- var __getProtoOf2 = Object.getPrototypeOf;
617
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
618
612
  var __typeError2 = (msg) => {
619
613
  throw TypeError(msg);
620
614
  };
621
- var __commonJS2 = (cb, mod) => function __require() {
622
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
623
- };
624
- var __copyProps2 = (to, from, except, desc) => {
625
- if (from && typeof from === "object" || typeof from === "function") {
626
- for (let key of __getOwnPropNames2(from))
627
- if (!__hasOwnProp2.call(to, key) && key !== except)
628
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
629
- }
630
- return to;
631
- };
632
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
633
- // If the importer is in node compatibility mode or this is not an ESM
634
- // file that has been converted to a CommonJS file using a Babel-
635
- // compatible transform (i.e. "__esModule" has not been set), then set
636
- // "default" to the CommonJS "module.exports" for node compatibility.
637
- isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
638
- mod
639
- ));
640
615
  var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
641
616
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
642
617
  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);
643
- var require_yocto_queue2 = __commonJS2({
644
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
645
- "use strict";
646
- var Node = class {
647
- /// value;
648
- /// next;
649
- constructor(value) {
650
- this.value = value;
651
- this.next = void 0;
652
- }
653
- };
654
- var Queue = class {
655
- // TODO: Use private class fields when targeting Node.js 12.
656
- // #_head;
657
- // #_tail;
658
- // #_size;
659
- constructor() {
660
- this.clear();
661
- }
662
- enqueue(value) {
663
- const node = new Node(value);
664
- if (this._head) {
665
- this._tail.next = node;
666
- this._tail = node;
667
- } else {
668
- this._head = node;
669
- this._tail = node;
670
- }
671
- this._size++;
672
- }
673
- dequeue() {
674
- const current = this._head;
675
- if (!current) {
676
- return;
677
- }
678
- this._head = this._head.next;
679
- this._size--;
680
- return current.value;
681
- }
682
- clear() {
683
- this._head = void 0;
684
- this._tail = void 0;
685
- this._size = 0;
686
- }
687
- get size() {
688
- return this._size;
689
- }
690
- *[Symbol.iterator]() {
691
- let current = this._head;
692
- while (current) {
693
- yield current.value;
694
- current = current.next;
695
- }
696
- }
697
- };
698
- module.exports = Queue;
618
+ var SELECT_QUERY_PREFIX = "select.";
619
+ function appendCsv(out, key, values) {
620
+ if (values === void 0) {
621
+ return;
699
622
  }
700
- });
701
- var require_p_limit2 = __commonJS2({
702
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
703
- "use strict";
704
- var Queue = require_yocto_queue2();
705
- var pLimit2 = (concurrency) => {
706
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
707
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
708
- }
709
- const queue = new Queue();
710
- let activeCount = 0;
711
- const next = () => {
712
- activeCount--;
713
- if (queue.size > 0) {
714
- queue.dequeue()();
715
- }
716
- };
717
- const run = async (fn, resolve, ...args) => {
718
- activeCount++;
719
- const result = (async () => fn(...args))();
720
- resolve(result);
721
- try {
722
- await result;
723
- } catch (e) {
724
- }
725
- next();
726
- };
727
- const enqueue = (fn, resolve, ...args) => {
728
- queue.enqueue(run.bind(null, fn, resolve, ...args));
729
- (async () => {
730
- await Promise.resolve();
731
- if (activeCount < concurrency && queue.size > 0) {
732
- queue.dequeue()();
733
- }
734
- })();
735
- };
736
- const generator = (fn, ...args) => new Promise((resolve) => {
737
- enqueue(fn, resolve, ...args);
738
- });
739
- Object.defineProperties(generator, {
740
- activeCount: {
741
- get: () => activeCount
742
- },
743
- pendingCount: {
744
- get: () => queue.size
745
- },
746
- clearQueue: {
747
- value: () => {
748
- queue.clear();
749
- }
750
- }
751
- });
752
- return generator;
753
- };
754
- module.exports = pLimit2;
755
- }
756
- });
757
- var require_retry_operation = __commonJS2({
758
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
759
- "use strict";
760
- function RetryOperation(timeouts, options) {
761
- if (typeof options === "boolean") {
762
- options = { forever: options };
763
- }
764
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
765
- this._timeouts = timeouts;
766
- this._options = options || {};
767
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
768
- this._fn = null;
769
- this._errors = [];
770
- this._attempts = 1;
771
- this._operationTimeout = null;
772
- this._operationTimeoutCb = null;
773
- this._timeout = null;
774
- this._operationStart = null;
775
- this._timer = null;
776
- if (this._options.forever) {
777
- this._cachedTimeouts = this._timeouts.slice(0);
778
- }
623
+ out[key] = values.join(",");
624
+ }
625
+ function projectionToQuery(spec) {
626
+ const out = {};
627
+ if (!spec) {
628
+ return out;
629
+ }
630
+ const { fields, fieldTypes, slots } = spec;
631
+ const p = SELECT_QUERY_PREFIX;
632
+ if (fields) {
633
+ appendCsv(out, `${p}fields[only]`, fields.only);
634
+ appendCsv(out, `${p}fields[except]`, fields.except);
635
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
636
+ }
637
+ if (fieldTypes) {
638
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
639
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
640
+ }
641
+ if (slots) {
642
+ appendCsv(out, `${p}slots[only]`, slots.only);
643
+ appendCsv(out, `${p}slots[except]`, slots.except);
644
+ if (typeof slots.depth === "number") {
645
+ out[`${p}slots[depth]`] = String(slots.depth);
779
646
  }
780
- module.exports = RetryOperation;
781
- RetryOperation.prototype.reset = function() {
782
- this._attempts = 1;
783
- this._timeouts = this._originalTimeouts.slice(0);
784
- };
785
- RetryOperation.prototype.stop = function() {
786
- if (this._timeout) {
787
- clearTimeout(this._timeout);
788
- }
789
- if (this._timer) {
790
- clearTimeout(this._timer);
791
- }
792
- this._timeouts = [];
793
- this._cachedTimeouts = null;
794
- };
795
- RetryOperation.prototype.retry = function(err) {
796
- if (this._timeout) {
797
- clearTimeout(this._timeout);
798
- }
799
- if (!err) {
800
- return false;
801
- }
802
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
803
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
804
- this._errors.push(err);
805
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
806
- return false;
807
- }
808
- this._errors.push(err);
809
- var timeout = this._timeouts.shift();
810
- if (timeout === void 0) {
811
- if (this._cachedTimeouts) {
812
- this._errors.splice(0, this._errors.length - 1);
813
- timeout = this._cachedTimeouts.slice(-1);
814
- } else {
815
- return false;
647
+ if (slots.named) {
648
+ const slotNames = Object.keys(slots.named).sort();
649
+ for (const slotName of slotNames) {
650
+ const named = slots.named[slotName];
651
+ if (named && typeof named.depth === "number") {
652
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
816
653
  }
817
654
  }
818
- var self = this;
819
- this._timer = setTimeout(function() {
820
- self._attempts++;
821
- if (self._operationTimeoutCb) {
822
- self._timeout = setTimeout(function() {
823
- self._operationTimeoutCb(self._attempts);
824
- }, self._operationTimeout);
825
- if (self._options.unref) {
826
- self._timeout.unref();
827
- }
828
- }
829
- self._fn(self._attempts);
830
- }, timeout);
831
- if (this._options.unref) {
832
- this._timer.unref();
833
- }
834
- return true;
835
- };
836
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
837
- this._fn = fn;
838
- if (timeoutOps) {
839
- if (timeoutOps.timeout) {
840
- this._operationTimeout = timeoutOps.timeout;
841
- }
842
- if (timeoutOps.cb) {
843
- this._operationTimeoutCb = timeoutOps.cb;
844
- }
845
- }
846
- var self = this;
847
- if (this._operationTimeoutCb) {
848
- this._timeout = setTimeout(function() {
849
- self._operationTimeoutCb();
850
- }, self._operationTimeout);
851
- }
852
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
853
- this._fn(this._attempts);
854
- };
855
- RetryOperation.prototype.try = function(fn) {
856
- console.log("Using RetryOperation.try() is deprecated");
857
- this.attempt(fn);
858
- };
859
- RetryOperation.prototype.start = function(fn) {
860
- console.log("Using RetryOperation.start() is deprecated");
861
- this.attempt(fn);
862
- };
863
- RetryOperation.prototype.start = RetryOperation.prototype.try;
864
- RetryOperation.prototype.errors = function() {
865
- return this._errors;
866
- };
867
- RetryOperation.prototype.attempts = function() {
868
- return this._attempts;
869
- };
870
- RetryOperation.prototype.mainError = function() {
871
- if (this._errors.length === 0) {
872
- return null;
873
- }
874
- var counts = {};
875
- var mainError = null;
876
- var mainErrorCount = 0;
877
- for (var i = 0; i < this._errors.length; i++) {
878
- var error = this._errors[i];
879
- var message = error.message;
880
- var count = (counts[message] || 0) + 1;
881
- counts[message] = count;
882
- if (count >= mainErrorCount) {
883
- mainError = error;
884
- mainErrorCount = count;
885
- }
886
- }
887
- return mainError;
888
- };
889
- }
890
- });
891
- var require_retry = __commonJS2({
892
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
893
- "use strict";
894
- var RetryOperation = require_retry_operation();
895
- exports.operation = function(options) {
896
- var timeouts = exports.timeouts(options);
897
- return new RetryOperation(timeouts, {
898
- forever: options && (options.forever || options.retries === Infinity),
899
- unref: options && options.unref,
900
- maxRetryTime: options && options.maxRetryTime
901
- });
902
- };
903
- exports.timeouts = function(options) {
904
- if (options instanceof Array) {
905
- return [].concat(options);
906
- }
907
- var opts = {
908
- retries: 10,
909
- factor: 2,
910
- minTimeout: 1 * 1e3,
911
- maxTimeout: Infinity,
912
- randomize: false
913
- };
914
- for (var key in options) {
915
- opts[key] = options[key];
916
- }
917
- if (opts.minTimeout > opts.maxTimeout) {
918
- throw new Error("minTimeout is greater than maxTimeout");
919
- }
920
- var timeouts = [];
921
- for (var i = 0; i < opts.retries; i++) {
922
- timeouts.push(this.createTimeout(i, opts));
923
- }
924
- if (options && options.forever && !timeouts.length) {
925
- timeouts.push(this.createTimeout(i, opts));
926
- }
927
- timeouts.sort(function(a, b) {
928
- return a - b;
929
- });
930
- return timeouts;
931
- };
932
- exports.createTimeout = function(attempt, opts) {
933
- var random = opts.randomize ? Math.random() + 1 : 1;
934
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
935
- timeout = Math.min(timeout, opts.maxTimeout);
936
- return timeout;
937
- };
938
- exports.wrap = function(obj, options, methods) {
939
- if (options instanceof Array) {
940
- methods = options;
941
- options = null;
942
- }
943
- if (!methods) {
944
- methods = [];
945
- for (var key in obj) {
946
- if (typeof obj[key] === "function") {
947
- methods.push(key);
948
- }
949
- }
950
- }
951
- for (var i = 0; i < methods.length; i++) {
952
- var method = methods[i];
953
- var original = obj[method];
954
- obj[method] = function retryWrapper(original2) {
955
- var op = exports.operation(options);
956
- var args = Array.prototype.slice.call(arguments, 1);
957
- var callback = args.pop();
958
- args.push(function(err) {
959
- if (op.retry(err)) {
960
- return;
961
- }
962
- if (err) {
963
- arguments[0] = op.mainError();
964
- }
965
- callback.apply(this, arguments);
966
- });
967
- op.attempt(function() {
968
- original2.apply(obj, args);
969
- });
970
- }.bind(obj, original);
971
- obj[method].options = options;
972
- }
973
- };
974
- }
975
- });
976
- var require_retry2 = __commonJS2({
977
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
978
- "use strict";
979
- module.exports = require_retry();
655
+ }
980
656
  }
981
- });
982
- var import_p_limit2 = __toESM2(require_p_limit2());
983
- var import_retry = __toESM2(require_retry2(), 1);
657
+ return out;
658
+ }
659
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
660
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
661
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
662
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
984
663
  var _contentTypesUrl;
985
664
  var _entriesUrl;
986
665
  var _ContentClient = class _ContentClient2 extends ApiClient {
@@ -996,15 +675,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
996
675
  }
997
676
  getEntries(options) {
998
677
  const { projectId } = this.options;
999
- const { skipDataResolution, filters, ...params } = options;
678
+ const { skipDataResolution, filters, select, ...params } = options;
1000
679
  const rewrittenFilters = rewriteFiltersForApi(filters);
680
+ const rewrittenSelect = projectionToQuery(select);
1001
681
  if (skipDataResolution) {
1002
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
682
+ const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
683
+ ...params,
684
+ ...rewrittenFilters,
685
+ ...rewrittenSelect,
686
+ projectId
687
+ });
1003
688
  return this.apiClient(url);
1004
689
  }
1005
690
  const edgeUrl = this.createUrl(
1006
691
  __privateGet2(_ContentClient2, _entriesUrl),
1007
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
692
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1008
693
  this.edgeApiHost
1009
694
  );
1010
695
  return this.apiClient(
@@ -1081,14 +766,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1081
766
  constructor(options) {
1082
767
  super(options);
1083
768
  }
1084
- /** Fetches all DataTypes for a project */
1085
- async get(options) {
769
+ /** Fetches a list of DataTypes for a project */
770
+ async list(options) {
1086
771
  const { projectId } = this.options;
1087
772
  const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
1088
773
  return await this.apiClient(fetchUri);
1089
774
  }
775
+ /** @deprecated Use {@link list} instead. */
776
+ async get(options) {
777
+ return this.list(options);
778
+ }
1090
779
  /** Updates or creates (based on id) a DataType */
1091
- async upsert(body) {
780
+ async save(body) {
1092
781
  const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1093
782
  await this.apiClient(fetchUri, {
1094
783
  method: "PUT",
@@ -1096,6 +785,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1096
785
  expectNoContent: true
1097
786
  });
1098
787
  }
788
+ /** @deprecated Use {@link save} instead. */
789
+ async upsert(body) {
790
+ return this.save(body);
791
+ }
1099
792
  /** Deletes a DataType */
1100
793
  async remove(body) {
1101
794
  const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
@@ -1108,10 +801,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1108
801
  };
1109
802
  _url8 = /* @__PURE__ */ new WeakMap();
1110
803
  __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1111
- var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1112
- var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1113
- var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1114
- var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1115
804
  var _baseUrl;
1116
805
  var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
1117
806
  constructor(options) {
@@ -1169,20 +858,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1169
858
  * When teamId is provided, returns a single team with its projects.
1170
859
  * When omitted, returns all accessible teams and their projects.
1171
860
  */
1172
- async getProjects(options) {
861
+ async list(options) {
1173
862
  const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1174
863
  return await this.apiClient(fetchUri);
1175
864
  }
865
+ /** @deprecated Use {@link list} instead. */
866
+ async getProjects(options) {
867
+ return this.list(options);
868
+ }
1176
869
  /** Updates or creates (based on id) a Project */
1177
- async upsert(body) {
870
+ async save(body) {
1178
871
  const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1179
872
  return await this.apiClient(fetchUri, {
1180
873
  method: "PUT",
1181
874
  body: JSON.stringify({ ...body })
1182
875
  });
1183
876
  }
877
+ /** @deprecated Use {@link save} instead. */
878
+ async upsert(body) {
879
+ return this.save(body);
880
+ }
1184
881
  /** Deletes a Project */
1185
- async delete(body) {
882
+ async remove(body) {
1186
883
  const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1187
884
  await this.apiClient(fetchUri, {
1188
885
  method: "DELETE",
@@ -1190,6 +887,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1190
887
  expectNoContent: true
1191
888
  });
1192
889
  }
890
+ /** @deprecated Use {@link remove} instead. */
891
+ async delete(body) {
892
+ return this.remove(body);
893
+ }
1193
894
  };
1194
895
  _url22 = /* @__PURE__ */ new WeakMap();
1195
896
  _projectsUrl = /* @__PURE__ */ new WeakMap();