@adviser/cement 0.3.12 → 0.3.14
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/cf/index.cjs +101 -83
- package/cf/index.cjs.map +1 -1
- package/cf/index.js +2 -2
- package/{chunk-YXJKUIKD.js → chunk-22GI5ETU.js} +23 -4
- package/chunk-22GI5ETU.js.map +1 -0
- package/{chunk-LAE3VSNM.js → chunk-GLUGMVET.js} +2 -2
- package/{chunk-K7DKFBLZ.js → chunk-KY47QBK3.js} +22 -3
- package/{chunk-K7DKFBLZ.js.map → chunk-KY47QBK3.js.map} +1 -1
- package/deno/index.cjs +101 -83
- package/deno/index.cjs.map +1 -1
- package/deno/index.js +1 -1
- package/{index-CbOCsgzP.d.ts → index-D2WPDt4R.d.ts} +2 -1
- package/{index-EnKo_jNv.d.cts → index-DixRvifF.d.cts} +2 -1
- package/index.cjs +132 -94
- package/index.cjs.map +1 -1
- package/index.d.cts +7 -4
- package/index.d.ts +7 -4
- package/index.js +5 -3
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/index.cjs +21 -3
- package/node/index.cjs.map +1 -1
- package/node/index.js +1 -1
- package/package.json +2 -2
- package/src/jsr.json +1 -1
- package/src/resolve-once.ts +29 -5
- package/src/uri.ts +20 -0
- package/test/index.cjs +21 -3
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +1 -1
- package/test/index.d.ts +1 -1
- package/test/index.js +3 -3
- package/ts/src/resolve-once.d.ts +6 -2
- package/ts/src/resolve-once.d.ts.map +1 -1
- package/ts/src/resolve-once.js +20 -3
- package/ts/src/resolve-once.js.map +1 -1
- package/ts/src/resolve-once.test.js +30 -1
- package/ts/src/resolve-once.test.js.map +1 -1
- package/ts/src/uri.d.ts +1 -0
- package/ts/src/uri.d.ts.map +1 -1
- package/ts/src/uri.js +18 -0
- package/ts/src/uri.js.map +1 -1
- package/ts/src/uri.test.js +11 -1
- package/ts/src/uri.test.js.map +1 -1
- package/web/index.cjs +101 -83
- package/web/index.cjs.map +1 -1
- package/web/index.js +2 -2
- package/chunk-YXJKUIKD.js.map +0 -1
- /package/{chunk-LAE3VSNM.js.map → chunk-GLUGMVET.js.map} +0 -0
package/index.cjs
CHANGED
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
93
93
|
envFactory: () => envFactory,
|
94
94
|
exception2Result: () => exception2Result,
|
95
95
|
hasHostPartProtocols: () => hasHostPartProtocols,
|
96
|
+
isCoerceURI: () => isCoerceURI,
|
96
97
|
isURL: () => isURL,
|
97
98
|
key: () => key,
|
98
99
|
logValue: () => logValue,
|
@@ -564,6 +565,97 @@ _promise = new WeakMap();
|
|
564
565
|
_resolveFn = new WeakMap();
|
565
566
|
_rejectFn = new WeakMap();
|
566
567
|
|
568
|
+
// src/result.ts
|
569
|
+
var Result = class _Result {
|
570
|
+
static Ok(t) {
|
571
|
+
return new ResultOK(t);
|
572
|
+
}
|
573
|
+
static Err(t) {
|
574
|
+
if (typeof t === "string") {
|
575
|
+
return new ResultError(new Error(t));
|
576
|
+
}
|
577
|
+
if (_Result.Is(t)) {
|
578
|
+
if (t.is_ok()) {
|
579
|
+
return new ResultError(new Error("Result Error is Ok"));
|
580
|
+
}
|
581
|
+
return t;
|
582
|
+
}
|
583
|
+
return new ResultError(t);
|
584
|
+
}
|
585
|
+
static Is(t) {
|
586
|
+
if (!t) {
|
587
|
+
return false;
|
588
|
+
}
|
589
|
+
if (t instanceof _Result) {
|
590
|
+
return true;
|
591
|
+
}
|
592
|
+
const rt = t;
|
593
|
+
if ([typeof rt.is_ok, typeof rt.is_err, typeof rt.unwrap, typeof rt.unwrap_err].every((x) => x === "function")) {
|
594
|
+
return true;
|
595
|
+
}
|
596
|
+
return false;
|
597
|
+
}
|
598
|
+
isOk() {
|
599
|
+
return this.is_ok();
|
600
|
+
}
|
601
|
+
isErr() {
|
602
|
+
return this.is_err();
|
603
|
+
}
|
604
|
+
Ok() {
|
605
|
+
return this.unwrap();
|
606
|
+
}
|
607
|
+
Err() {
|
608
|
+
return this.unwrap_err();
|
609
|
+
}
|
610
|
+
};
|
611
|
+
var ResultOK = class extends Result {
|
612
|
+
constructor(t) {
|
613
|
+
super();
|
614
|
+
this._t = t;
|
615
|
+
}
|
616
|
+
is_ok() {
|
617
|
+
return true;
|
618
|
+
}
|
619
|
+
is_err() {
|
620
|
+
return false;
|
621
|
+
}
|
622
|
+
unwrap_err() {
|
623
|
+
throw new Error("Result is Ok");
|
624
|
+
}
|
625
|
+
unwrap() {
|
626
|
+
return this._t;
|
627
|
+
}
|
628
|
+
};
|
629
|
+
var ResultError = class extends Result {
|
630
|
+
constructor(t) {
|
631
|
+
super();
|
632
|
+
this._error = t;
|
633
|
+
}
|
634
|
+
is_ok() {
|
635
|
+
return false;
|
636
|
+
}
|
637
|
+
is_err() {
|
638
|
+
return true;
|
639
|
+
}
|
640
|
+
unwrap() {
|
641
|
+
throw new Error(`Result is Err: ${this._error}`);
|
642
|
+
}
|
643
|
+
unwrap_err() {
|
644
|
+
return this._error;
|
645
|
+
}
|
646
|
+
};
|
647
|
+
function exception2Result(fn) {
|
648
|
+
try {
|
649
|
+
const res = fn();
|
650
|
+
if (res instanceof Promise) {
|
651
|
+
return res.then((value) => Result.Ok(value)).catch((e) => Result.Err(e));
|
652
|
+
}
|
653
|
+
return Result.Ok(res);
|
654
|
+
} catch (e) {
|
655
|
+
return Result.Err(e);
|
656
|
+
}
|
657
|
+
}
|
658
|
+
|
567
659
|
// src/resolve-once.ts
|
568
660
|
var ResolveSeq = class {
|
569
661
|
constructor(ctx) {
|
@@ -703,9 +795,6 @@ var Keyed = class {
|
|
703
795
|
async asyncGet(key2) {
|
704
796
|
return this.get(await key2());
|
705
797
|
}
|
706
|
-
entries() {
|
707
|
-
return this._map.entries();
|
708
|
-
}
|
709
798
|
get(key2) {
|
710
799
|
if (typeof key2 === "function") {
|
711
800
|
key2 = key2();
|
@@ -731,6 +820,27 @@ var KeyedResolvOnce = class extends Keyed {
|
|
731
820
|
constructor() {
|
732
821
|
super((key2) => new ResolveOnce(key2));
|
733
822
|
}
|
823
|
+
/**
|
824
|
+
*
|
825
|
+
* @returns The values of the resolved keys
|
826
|
+
*/
|
827
|
+
values() {
|
828
|
+
return Array.from(this._map.entries()).filter(([_, v]) => v._onceDone).map(([k, v]) => {
|
829
|
+
if (v._onceDone) {
|
830
|
+
if (v._onceError) {
|
831
|
+
return {
|
832
|
+
key: k,
|
833
|
+
value: Result.Err(v._onceError)
|
834
|
+
};
|
835
|
+
}
|
836
|
+
return {
|
837
|
+
key: k,
|
838
|
+
value: Result.Ok(v._onceValue)
|
839
|
+
};
|
840
|
+
}
|
841
|
+
throw new Error("KeyedResolvOnce.values impossible");
|
842
|
+
});
|
843
|
+
}
|
734
844
|
};
|
735
845
|
var KeyedResolvSeq = class extends Keyed {
|
736
846
|
constructor() {
|
@@ -939,97 +1049,6 @@ var CFEnvActions = class _CFEnvActions {
|
|
939
1049
|
}
|
940
1050
|
};
|
941
1051
|
|
942
|
-
// src/result.ts
|
943
|
-
var Result = class _Result {
|
944
|
-
static Ok(t) {
|
945
|
-
return new ResultOK(t);
|
946
|
-
}
|
947
|
-
static Err(t) {
|
948
|
-
if (typeof t === "string") {
|
949
|
-
return new ResultError(new Error(t));
|
950
|
-
}
|
951
|
-
if (_Result.Is(t)) {
|
952
|
-
if (t.is_ok()) {
|
953
|
-
return new ResultError(new Error("Result Error is Ok"));
|
954
|
-
}
|
955
|
-
return t;
|
956
|
-
}
|
957
|
-
return new ResultError(t);
|
958
|
-
}
|
959
|
-
static Is(t) {
|
960
|
-
if (!t) {
|
961
|
-
return false;
|
962
|
-
}
|
963
|
-
if (t instanceof _Result) {
|
964
|
-
return true;
|
965
|
-
}
|
966
|
-
const rt = t;
|
967
|
-
if ([typeof rt.is_ok, typeof rt.is_err, typeof rt.unwrap, typeof rt.unwrap_err].every((x) => x === "function")) {
|
968
|
-
return true;
|
969
|
-
}
|
970
|
-
return false;
|
971
|
-
}
|
972
|
-
isOk() {
|
973
|
-
return this.is_ok();
|
974
|
-
}
|
975
|
-
isErr() {
|
976
|
-
return this.is_err();
|
977
|
-
}
|
978
|
-
Ok() {
|
979
|
-
return this.unwrap();
|
980
|
-
}
|
981
|
-
Err() {
|
982
|
-
return this.unwrap_err();
|
983
|
-
}
|
984
|
-
};
|
985
|
-
var ResultOK = class extends Result {
|
986
|
-
constructor(t) {
|
987
|
-
super();
|
988
|
-
this._t = t;
|
989
|
-
}
|
990
|
-
is_ok() {
|
991
|
-
return true;
|
992
|
-
}
|
993
|
-
is_err() {
|
994
|
-
return false;
|
995
|
-
}
|
996
|
-
unwrap_err() {
|
997
|
-
throw new Error("Result is Ok");
|
998
|
-
}
|
999
|
-
unwrap() {
|
1000
|
-
return this._t;
|
1001
|
-
}
|
1002
|
-
};
|
1003
|
-
var ResultError = class extends Result {
|
1004
|
-
constructor(t) {
|
1005
|
-
super();
|
1006
|
-
this._error = t;
|
1007
|
-
}
|
1008
|
-
is_ok() {
|
1009
|
-
return false;
|
1010
|
-
}
|
1011
|
-
is_err() {
|
1012
|
-
return true;
|
1013
|
-
}
|
1014
|
-
unwrap() {
|
1015
|
-
throw new Error(`Result is Err: ${this._error}`);
|
1016
|
-
}
|
1017
|
-
unwrap_err() {
|
1018
|
-
return this._error;
|
1019
|
-
}
|
1020
|
-
};
|
1021
|
-
function exception2Result(fn) {
|
1022
|
-
try {
|
1023
|
-
const res = fn();
|
1024
|
-
if (res instanceof Promise) {
|
1025
|
-
return res.then((value) => Result.Ok(value)).catch((e) => Result.Err(e));
|
1026
|
-
}
|
1027
|
-
return Result.Ok(res);
|
1028
|
-
} catch (e) {
|
1029
|
-
return Result.Err(e);
|
1030
|
-
}
|
1031
|
-
}
|
1032
|
-
|
1033
1052
|
// src/utils/get-params-result.ts
|
1034
1053
|
var _REQUIRED = class {
|
1035
1054
|
constructor() {
|
@@ -1850,6 +1869,24 @@ var BuildURI = class _BuildURI {
|
|
1850
1869
|
return URI.from(this._url);
|
1851
1870
|
}
|
1852
1871
|
};
|
1872
|
+
function isCoerceURI(value) {
|
1873
|
+
if (!value) {
|
1874
|
+
return false;
|
1875
|
+
}
|
1876
|
+
if (isURL(value)) {
|
1877
|
+
return true;
|
1878
|
+
}
|
1879
|
+
if (URI.is(value)) {
|
1880
|
+
return true;
|
1881
|
+
}
|
1882
|
+
if (BuildURI.is(value)) {
|
1883
|
+
return true;
|
1884
|
+
}
|
1885
|
+
if (typeof value === "string") {
|
1886
|
+
return true;
|
1887
|
+
}
|
1888
|
+
return false;
|
1889
|
+
}
|
1853
1890
|
var hasHostPartProtocols = /* @__PURE__ */ new Set(["http", "https", "ws", "wss"]);
|
1854
1891
|
var URI = class _URI {
|
1855
1892
|
static protocolHasHostpart(protocol) {
|
@@ -3547,6 +3584,7 @@ var param2 = param;
|
|
3547
3584
|
envFactory,
|
3548
3585
|
exception2Result,
|
3549
3586
|
hasHostPartProtocols,
|
3587
|
+
isCoerceURI,
|
3550
3588
|
isURL,
|
3551
3589
|
key,
|
3552
3590
|
logValue,
|