@uniformdev/next-app-router 20.50.2-alpha.149 → 20.50.2-alpha.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.js +622 -497
- package/dist/cache.mjs +622 -497
- package/dist/component.js +51 -370
- package/dist/component.mjs +51 -370
- package/dist/handler.js +716 -586
- package/dist/handler.mjs +716 -586
- package/dist/index.esm.js +717 -585
- package/dist/index.js +720 -588
- package/dist/index.mjs +717 -585
- package/dist/middleware.js +661 -536
- package/dist/middleware.mjs +661 -536
- package/package.json +19 -19
package/dist/component.mjs
CHANGED
|
@@ -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
|
|
220
|
-
this
|
|
221
|
-
this
|
|
222
|
-
this
|
|
223
|
-
this
|
|
224
|
-
this
|
|
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,53 @@ _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
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
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
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
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
|
-
|
|
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
|
-
|
|
983
|
-
var import_retry = __toESM2(require_retry2(), 1);
|
|
657
|
+
return out;
|
|
658
|
+
}
|
|
984
659
|
var _contentTypesUrl;
|
|
985
660
|
var _entriesUrl;
|
|
986
661
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -996,15 +671,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
996
671
|
}
|
|
997
672
|
getEntries(options) {
|
|
998
673
|
const { projectId } = this.options;
|
|
999
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
674
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1000
675
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
676
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1001
677
|
if (skipDataResolution) {
|
|
1002
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
678
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
679
|
+
...params,
|
|
680
|
+
...rewrittenFilters,
|
|
681
|
+
...rewrittenSelect,
|
|
682
|
+
projectId
|
|
683
|
+
});
|
|
1003
684
|
return this.apiClient(url);
|
|
1004
685
|
}
|
|
1005
686
|
const edgeUrl = this.createUrl(
|
|
1006
687
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1007
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
688
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1008
689
|
this.edgeApiHost
|
|
1009
690
|
);
|
|
1010
691
|
return this.apiClient(
|