@adviser/cement 0.2.36 → 0.2.37
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +26 -16
- package/index.cjs.map +1 -1
- package/index.d.cts +5 -4
- package/index.d.ts +5 -4
- package/index.js +26 -16
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/jsr.json +1 -1
- package/src/logger-impl.ts +28 -13
- package/src/logger.ts +6 -1
- package/src/uri.ts +4 -3
- package/ts/logger-impl.d.ts +2 -2
- package/ts/logger-impl.d.ts.map +1 -1
- package/ts/logger-impl.js +30 -13
- package/ts/logger-impl.js.map +1 -1
- package/ts/logger.d.ts +2 -1
- package/ts/logger.d.ts.map +1 -1
- package/ts/logger.js.map +1 -1
- package/ts/logger.test.js +324 -64
- package/ts/logger.test.js.map +1 -1
- package/ts/uri.d.ts +1 -1
- package/ts/uri.d.ts.map +1 -1
- package/ts/uri.js +2 -2
- package/ts/uri.js.map +1 -1
- package/ts/uri.test.js +47 -0
- package/ts/uri.test.js.map +1 -1
package/index.cjs
CHANGED
@@ -1278,7 +1278,7 @@ function getParamsResult(keys, getParam) {
|
|
1278
1278
|
if (typeof i === "string") {
|
1279
1279
|
acc.push({ key: i });
|
1280
1280
|
} else if (typeof i === "object") {
|
1281
|
-
acc.push(...Object.keys(i).map((k) => ({ key: k, def: i[k] })));
|
1281
|
+
acc.push(...Object.keys(i).map((k) => ({ key: k, def: typeof i[k] === "string" ? i[k] : void 0 })));
|
1282
1282
|
}
|
1283
1283
|
return acc;
|
1284
1284
|
},
|
@@ -1293,7 +1293,7 @@ function getParamsResult(keys, getParam) {
|
|
1293
1293
|
for (const kd of keyDef) {
|
1294
1294
|
const val = getParam.getParam(kd.key);
|
1295
1295
|
if (val === void 0) {
|
1296
|
-
if (kd.def) {
|
1296
|
+
if (typeof kd.def === "string") {
|
1297
1297
|
result[kd.key] = kd.def;
|
1298
1298
|
} else {
|
1299
1299
|
errors.push(kd.key);
|
@@ -1957,19 +1957,29 @@ var LoggerImpl = class _LoggerImpl {
|
|
1957
1957
|
this.coerceKey(key, !!value);
|
1958
1958
|
return this;
|
1959
1959
|
}
|
1960
|
-
Http(
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
}
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1960
|
+
Http(...mix) {
|
1961
|
+
const key = mix.find((x) => typeof x === "string");
|
1962
|
+
mix = mix.filter((x) => typeof x !== "string");
|
1963
|
+
const resErrors = mix.filter((x) => Result.Is(x) && x.isErr());
|
1964
|
+
if (resErrors.length) {
|
1965
|
+
this.Err(resErrors.map((x) => x.Err().message).join("\n"));
|
1966
|
+
return this;
|
1967
|
+
}
|
1968
|
+
const req = mix.map((reqOrResult) => Result.Is(reqOrResult) ? reqOrResult.Ok() : reqOrResult).find((req2) => typeof req2.status !== "number");
|
1969
|
+
const res = mix.map((resOrResult) => Result.Is(resOrResult) ? resOrResult.Ok() : resOrResult).find((res2) => typeof res2.status === "number");
|
1970
|
+
let reqAndOrres;
|
1971
|
+
if (res && req) {
|
1972
|
+
reqAndOrres = { res, req };
|
1973
|
+
} else if (!res && !req) {
|
1974
|
+
reqAndOrres = void 0;
|
1975
|
+
} else if (res) {
|
1976
|
+
reqAndOrres = res;
|
1977
|
+
} else if (req) {
|
1978
|
+
reqAndOrres = req;
|
1979
|
+
}
|
1980
|
+
if (reqAndOrres) {
|
1981
|
+
this.Any(key || "Http", reqAndOrres);
|
1971
1982
|
}
|
1972
|
-
this.Any(key || "Http", reqRes);
|
1973
1983
|
return this;
|
1974
1984
|
}
|
1975
1985
|
Pair(x) {
|
@@ -2124,8 +2134,8 @@ var WithLoggerBuilder = class {
|
|
2124
2134
|
this._li.SetDebug(...modules);
|
2125
2135
|
return this;
|
2126
2136
|
}
|
2127
|
-
Http(
|
2128
|
-
this._li.Http(
|
2137
|
+
Http(...mix) {
|
2138
|
+
this._li.Http(...mix);
|
2129
2139
|
return this;
|
2130
2140
|
}
|
2131
2141
|
Pair(x) {
|