@adviser/cement 0.2.12 → 0.2.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/{base_sys_abstraction-uF0nL2K3.d.ts → base_sys_abstraction-CJqRmTui.d.ts} +1 -1
- package/{base_sys_abstraction-B_h8JSlV.d.cts → base_sys_abstraction-nsNTl07w.d.cts} +1 -1
- package/{chunk-LK3TUJH3.js → chunk-O4F5AURC.js} +1 -1
- package/chunk-O4F5AURC.js.map +1 -0
- package/{chunk-BEOYQN5I.js → chunk-XJF7FQUN.js} +2 -2
- package/index.cjs +200 -185
- package/index.cjs.map +1 -1
- package/index.d.cts +6 -5
- package/index.d.ts +6 -5
- package/index.js +202 -187
- package/index.js.map +1 -1
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +2 -2
- package/node/index.d.ts +2 -2
- package/node/index.js +1 -1
- package/package.json +1 -1
- package/{sys_abstraction-C1-BRiiP.d.cts → sys_abstraction-CmSCeK7b.d.cts} +2 -2
- package/{sys_abstraction-C1-BRiiP.d.ts → sys_abstraction-CmSCeK7b.d.ts} +2 -2
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +2 -2
- package/web/index.d.ts +2 -2
- package/web/index.js +2 -2
- package/chunk-LK3TUJH3.js.map +0 -1
- /package/{chunk-BEOYQN5I.js.map → chunk-XJF7FQUN.js.map} +0 -0
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSysAbstraction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XJF7FQUN.js";
|
|
4
4
|
import {
|
|
5
5
|
BrowserEnvActions,
|
|
6
6
|
EnvImpl,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
TimeMode,
|
|
18
18
|
TimeUnits,
|
|
19
19
|
envFactory
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-O4F5AURC.js";
|
|
21
21
|
import {
|
|
22
22
|
__spreadValues,
|
|
23
23
|
__yieldStar
|
|
@@ -104,6 +104,200 @@ function IsLogger(obj) {
|
|
|
104
104
|
].map((fn) => typeof obj[fn] === "function").reduce((a, b) => a && b, true);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// src/uri.ts
|
|
108
|
+
function falsy2undef(value) {
|
|
109
|
+
return value === void 0 || value === null ? void 0 : value;
|
|
110
|
+
}
|
|
111
|
+
function ensureURLWithDefaultProto(url, defaultProtocol) {
|
|
112
|
+
if (!url) {
|
|
113
|
+
return new URL(`${defaultProtocol}//`);
|
|
114
|
+
}
|
|
115
|
+
if (typeof url === "string") {
|
|
116
|
+
try {
|
|
117
|
+
return new URL(url);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
return new URL(`${defaultProtocol}//${url}`);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
return url;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function isURL(value) {
|
|
126
|
+
return value instanceof URL || !!value && typeof value.searchParams === "object" && typeof value.searchParams.sort === "function" && typeof value.hash === "string";
|
|
127
|
+
}
|
|
128
|
+
function from(fac, strURLUri, defaultProtocol) {
|
|
129
|
+
switch (typeof falsy2undef(strURLUri)) {
|
|
130
|
+
case "undefined":
|
|
131
|
+
return fac(new URL(`${defaultProtocol}//`));
|
|
132
|
+
case "string":
|
|
133
|
+
return fac(ensureURLWithDefaultProto(strURLUri, defaultProtocol));
|
|
134
|
+
case "object":
|
|
135
|
+
if (BuildURI.is(strURLUri)) {
|
|
136
|
+
return fac(new URL(strURLUri._url.toString()));
|
|
137
|
+
} else if (URI.is(strURLUri)) {
|
|
138
|
+
return fac(new URL(strURLUri._url.toString()));
|
|
139
|
+
} else if (isURL(strURLUri)) {
|
|
140
|
+
return fac(new URL(strURLUri.toString()));
|
|
141
|
+
}
|
|
142
|
+
throw new Error(`unknown object type: ${strURLUri}`);
|
|
143
|
+
default:
|
|
144
|
+
throw new Error(`Invalid argument: ${typeof strURLUri}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
var BuildURI = class _BuildURI {
|
|
148
|
+
// pathname needs this
|
|
149
|
+
constructor(url) {
|
|
150
|
+
this._url = url;
|
|
151
|
+
}
|
|
152
|
+
static is(value) {
|
|
153
|
+
return value instanceof _BuildURI || !!value && typeof value.delParam === "function" && typeof value.setParam === "function";
|
|
154
|
+
}
|
|
155
|
+
static from(strURLUri, defaultProtocol = "file:") {
|
|
156
|
+
return from((url) => new _BuildURI(url), strURLUri, defaultProtocol);
|
|
157
|
+
}
|
|
158
|
+
hostname(h) {
|
|
159
|
+
this._url.hostname = h;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
password(p) {
|
|
163
|
+
this._url.password = p;
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
port(p) {
|
|
167
|
+
this._url.port = p;
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
username(u) {
|
|
171
|
+
this._url.username = u;
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
search(s) {
|
|
175
|
+
this._url.search = s;
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
protocol(p) {
|
|
179
|
+
if (!p.endsWith(":")) {
|
|
180
|
+
p = `${p}:`;
|
|
181
|
+
}
|
|
182
|
+
const mySrc = this._url.toString();
|
|
183
|
+
const myDst = mySrc.replace(new RegExp(`^${this._url.protocol}`), `${p}`);
|
|
184
|
+
this._url = new URL(myDst);
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
187
|
+
pathname(p) {
|
|
188
|
+
const myp = this.URI().pathname;
|
|
189
|
+
const mySrc = this._url.toString();
|
|
190
|
+
const myDst = mySrc.replace(new RegExp(`^${this._url.protocol}//${myp}`), `${this._url.protocol}//${p}`);
|
|
191
|
+
this._url = new URL(myDst);
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
hash(h) {
|
|
195
|
+
this._url.hash = h;
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
host(h) {
|
|
199
|
+
this._url.host = h;
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
delParam(key) {
|
|
203
|
+
this._url.searchParams.delete(key);
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
defParam(key, str) {
|
|
207
|
+
if (!this._url.searchParams.has(key)) {
|
|
208
|
+
this._url.searchParams.set(key, str);
|
|
209
|
+
}
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
setParam(key, str) {
|
|
213
|
+
this._url.searchParams.set(key, str);
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
toString() {
|
|
217
|
+
this._url.searchParams.sort();
|
|
218
|
+
return this._url.toString();
|
|
219
|
+
}
|
|
220
|
+
URI() {
|
|
221
|
+
return URI.from(this._url);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
var URI = class _URI {
|
|
225
|
+
// if no protocol is provided, default to file:
|
|
226
|
+
static merge(into, from2, defaultProtocol = "file:") {
|
|
227
|
+
const intoUrl = BuildURI.from(into, defaultProtocol);
|
|
228
|
+
const fromUrl = _URI.from(from2, defaultProtocol);
|
|
229
|
+
intoUrl.protocol(fromUrl.protocol);
|
|
230
|
+
if (fromUrl.pathname.length > 0) {
|
|
231
|
+
intoUrl.pathname(fromUrl.pathname);
|
|
232
|
+
}
|
|
233
|
+
for (const [key, value] of fromUrl.getParams) {
|
|
234
|
+
intoUrl.setParam(key, value);
|
|
235
|
+
}
|
|
236
|
+
return intoUrl.URI();
|
|
237
|
+
}
|
|
238
|
+
static is(value) {
|
|
239
|
+
return value instanceof _URI || !!value && typeof value.asURL === "function" && typeof value.getParam === "function" && typeof value.hasParam === "function";
|
|
240
|
+
}
|
|
241
|
+
// if no protocol is provided, default to file:
|
|
242
|
+
static from(strURLUri, defaultProtocol = "file:") {
|
|
243
|
+
return from((url) => new _URI(url), strURLUri, defaultProtocol);
|
|
244
|
+
}
|
|
245
|
+
constructor(url) {
|
|
246
|
+
this._url = url;
|
|
247
|
+
}
|
|
248
|
+
build() {
|
|
249
|
+
return BuildURI.from(this.asURL());
|
|
250
|
+
}
|
|
251
|
+
get hostname() {
|
|
252
|
+
return this._url.hostname;
|
|
253
|
+
}
|
|
254
|
+
get password() {
|
|
255
|
+
return this._url.password;
|
|
256
|
+
}
|
|
257
|
+
get port() {
|
|
258
|
+
return this._url.port;
|
|
259
|
+
}
|
|
260
|
+
get username() {
|
|
261
|
+
return this._url.username;
|
|
262
|
+
}
|
|
263
|
+
get search() {
|
|
264
|
+
return this._url.search;
|
|
265
|
+
}
|
|
266
|
+
get protocol() {
|
|
267
|
+
return this._url.protocol;
|
|
268
|
+
}
|
|
269
|
+
get pathname() {
|
|
270
|
+
return this._url.toString().replace(/^.*:\/\//, "").replace(/\?.*$/, "");
|
|
271
|
+
}
|
|
272
|
+
get hash() {
|
|
273
|
+
return this._url.hash;
|
|
274
|
+
}
|
|
275
|
+
get host() {
|
|
276
|
+
return this._url.host;
|
|
277
|
+
}
|
|
278
|
+
get getParams() {
|
|
279
|
+
return this._url.searchParams.entries();
|
|
280
|
+
}
|
|
281
|
+
hasParam(key) {
|
|
282
|
+
return this._url.searchParams.has(key);
|
|
283
|
+
}
|
|
284
|
+
getParam(key) {
|
|
285
|
+
return falsy2undef(this._url.searchParams.get(key));
|
|
286
|
+
}
|
|
287
|
+
clone() {
|
|
288
|
+
return new _URI(this.asURL());
|
|
289
|
+
}
|
|
290
|
+
asURL() {
|
|
291
|
+
const url = new URL(this._url.toString());
|
|
292
|
+
url.searchParams.sort();
|
|
293
|
+
return url;
|
|
294
|
+
}
|
|
295
|
+
toString() {
|
|
296
|
+
this._url.searchParams.sort();
|
|
297
|
+
return this._url.toString();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
107
301
|
// src/logger_impl.ts
|
|
108
302
|
var encoder = new TextEncoder();
|
|
109
303
|
var LevelHandlerImpl = class {
|
|
@@ -361,7 +555,7 @@ var LoggerImpl = class _LoggerImpl {
|
|
|
361
555
|
return this;
|
|
362
556
|
}
|
|
363
557
|
Url(url, key = "url") {
|
|
364
|
-
this.Ref(key, () => url.toString());
|
|
558
|
+
this.Ref(key, () => URI.from(url).toString());
|
|
365
559
|
return this;
|
|
366
560
|
}
|
|
367
561
|
Str(key, value) {
|
|
@@ -775,196 +969,17 @@ function isSet(value, ref = globalThis) {
|
|
|
775
969
|
return false;
|
|
776
970
|
}
|
|
777
971
|
function runtimeFn() {
|
|
778
|
-
const
|
|
779
|
-
const
|
|
972
|
+
const isReactNative = isSet("navigator.product") && globalThis.navigator.product === "ReactNative";
|
|
973
|
+
const isNodeIsh = isSet("process.versions.node") && !isReactNative;
|
|
974
|
+
const isDeno = isSet("Deno") && !isReactNative;
|
|
780
975
|
return {
|
|
781
976
|
isNodeIsh,
|
|
782
|
-
isBrowser: !(isNodeIsh || isDeno),
|
|
977
|
+
isBrowser: !(isNodeIsh || isDeno) && !isReactNative,
|
|
783
978
|
isDeno,
|
|
784
|
-
isReactNative
|
|
979
|
+
isReactNative
|
|
785
980
|
};
|
|
786
981
|
}
|
|
787
982
|
|
|
788
|
-
// src/uri.ts
|
|
789
|
-
function falsy2undef(value) {
|
|
790
|
-
return value === void 0 || value === null ? void 0 : value;
|
|
791
|
-
}
|
|
792
|
-
function ensureURLWithDefaultProto(url, defaultProtocol) {
|
|
793
|
-
if (!url) {
|
|
794
|
-
return new URL(`${defaultProtocol}//`);
|
|
795
|
-
}
|
|
796
|
-
if (typeof url === "string") {
|
|
797
|
-
try {
|
|
798
|
-
return new URL(url);
|
|
799
|
-
} catch (e) {
|
|
800
|
-
return new URL(`${defaultProtocol}//${url}`);
|
|
801
|
-
}
|
|
802
|
-
} else {
|
|
803
|
-
return url;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
function isURL(value) {
|
|
807
|
-
return value instanceof URL || !!value && typeof value.searchParams === "object" && typeof value.searchParams.sort === "function" && typeof value.hash === "string";
|
|
808
|
-
}
|
|
809
|
-
function from(fac, strURLUri, defaultProtocol) {
|
|
810
|
-
switch (typeof falsy2undef(strURLUri)) {
|
|
811
|
-
case "undefined":
|
|
812
|
-
return fac(new URL(`${defaultProtocol}//`));
|
|
813
|
-
case "string":
|
|
814
|
-
return fac(ensureURLWithDefaultProto(strURLUri, defaultProtocol));
|
|
815
|
-
case "object":
|
|
816
|
-
if (BuildURI.is(strURLUri)) {
|
|
817
|
-
return fac(new URL(strURLUri._url.toString()));
|
|
818
|
-
} else if (URI.is(strURLUri)) {
|
|
819
|
-
return fac(new URL(strURLUri._url.toString()));
|
|
820
|
-
} else if (isURL(strURLUri)) {
|
|
821
|
-
return fac(new URL(strURLUri.toString()));
|
|
822
|
-
}
|
|
823
|
-
throw new Error(`unknown object type: ${strURLUri}`);
|
|
824
|
-
default:
|
|
825
|
-
throw new Error(`Invalid argument: ${typeof strURLUri}`);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
var BuildURI = class _BuildURI {
|
|
829
|
-
constructor(url) {
|
|
830
|
-
this._url = url;
|
|
831
|
-
}
|
|
832
|
-
static is(value) {
|
|
833
|
-
return value instanceof _BuildURI || !!value && typeof value.delParam === "function" && typeof value.setParam === "function";
|
|
834
|
-
}
|
|
835
|
-
static from(strURLUri, defaultProtocol = "file:") {
|
|
836
|
-
return from((url) => new _BuildURI(url), strURLUri, defaultProtocol);
|
|
837
|
-
}
|
|
838
|
-
hostname(h) {
|
|
839
|
-
this._url.hostname = h;
|
|
840
|
-
return this;
|
|
841
|
-
}
|
|
842
|
-
password(p) {
|
|
843
|
-
this._url.password = p;
|
|
844
|
-
return this;
|
|
845
|
-
}
|
|
846
|
-
port(p) {
|
|
847
|
-
this._url.port = p;
|
|
848
|
-
return this;
|
|
849
|
-
}
|
|
850
|
-
username(u) {
|
|
851
|
-
this._url.username = u;
|
|
852
|
-
return this;
|
|
853
|
-
}
|
|
854
|
-
search(s) {
|
|
855
|
-
this._url.search = s;
|
|
856
|
-
return this;
|
|
857
|
-
}
|
|
858
|
-
protocol(p) {
|
|
859
|
-
this._url.protocol = p;
|
|
860
|
-
return this;
|
|
861
|
-
}
|
|
862
|
-
pathname(p) {
|
|
863
|
-
this._url.pathname = p;
|
|
864
|
-
return this;
|
|
865
|
-
}
|
|
866
|
-
hash(h) {
|
|
867
|
-
this._url.hash = h;
|
|
868
|
-
return this;
|
|
869
|
-
}
|
|
870
|
-
host(h) {
|
|
871
|
-
this._url.host = h;
|
|
872
|
-
return this;
|
|
873
|
-
}
|
|
874
|
-
delParam(key) {
|
|
875
|
-
this._url.searchParams.delete(key);
|
|
876
|
-
return this;
|
|
877
|
-
}
|
|
878
|
-
defParam(key, str) {
|
|
879
|
-
if (!this._url.searchParams.has(key)) {
|
|
880
|
-
this._url.searchParams.set(key, str);
|
|
881
|
-
}
|
|
882
|
-
return this;
|
|
883
|
-
}
|
|
884
|
-
setParam(key, str) {
|
|
885
|
-
this._url.searchParams.set(key, str);
|
|
886
|
-
return this;
|
|
887
|
-
}
|
|
888
|
-
toString() {
|
|
889
|
-
this._url.searchParams.sort();
|
|
890
|
-
return this._url.toString();
|
|
891
|
-
}
|
|
892
|
-
URI() {
|
|
893
|
-
return URI.from(this._url);
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
var URI = class _URI {
|
|
897
|
-
// if no protocol is provided, default to file:
|
|
898
|
-
static merge(into, from2, defaultProtocol = "file:") {
|
|
899
|
-
const intoUrl = _URI.from(into, defaultProtocol);
|
|
900
|
-
const fromUrl = _URI.from(from2, defaultProtocol);
|
|
901
|
-
for (const [key, value] of fromUrl._url.searchParams) {
|
|
902
|
-
if (!intoUrl._url.searchParams.has(key)) {
|
|
903
|
-
intoUrl._url.searchParams.set(key, value);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
return intoUrl;
|
|
907
|
-
}
|
|
908
|
-
static is(value) {
|
|
909
|
-
return value instanceof _URI || !!value && typeof value.asURL === "function" && typeof value.getParam === "function" && typeof value.hasParam === "function";
|
|
910
|
-
}
|
|
911
|
-
// if no protocol is provided, default to file:
|
|
912
|
-
static from(strURLUri, defaultProtocol = "file:") {
|
|
913
|
-
return from((url) => new _URI(url), strURLUri, defaultProtocol);
|
|
914
|
-
}
|
|
915
|
-
constructor(url) {
|
|
916
|
-
this._url = url;
|
|
917
|
-
}
|
|
918
|
-
build() {
|
|
919
|
-
return BuildURI.from(this.asURL());
|
|
920
|
-
}
|
|
921
|
-
get hostname() {
|
|
922
|
-
return this._url.hostname;
|
|
923
|
-
}
|
|
924
|
-
get password() {
|
|
925
|
-
return this._url.password;
|
|
926
|
-
}
|
|
927
|
-
get port() {
|
|
928
|
-
return this._url.port;
|
|
929
|
-
}
|
|
930
|
-
get username() {
|
|
931
|
-
return this._url.username;
|
|
932
|
-
}
|
|
933
|
-
get search() {
|
|
934
|
-
return this._url.search;
|
|
935
|
-
}
|
|
936
|
-
get protocol() {
|
|
937
|
-
return this._url.protocol;
|
|
938
|
-
}
|
|
939
|
-
get pathname() {
|
|
940
|
-
return this._url.toString().replace(/^.*:\/\//, "").replace(/\?.*$/, "");
|
|
941
|
-
}
|
|
942
|
-
get hash() {
|
|
943
|
-
return this._url.hash;
|
|
944
|
-
}
|
|
945
|
-
get host() {
|
|
946
|
-
return this._url.host;
|
|
947
|
-
}
|
|
948
|
-
hasParam(key) {
|
|
949
|
-
return this._url.searchParams.has(key);
|
|
950
|
-
}
|
|
951
|
-
getParam(key) {
|
|
952
|
-
return falsy2undef(this._url.searchParams.get(key));
|
|
953
|
-
}
|
|
954
|
-
clone() {
|
|
955
|
-
return new _URI(this.asURL());
|
|
956
|
-
}
|
|
957
|
-
asURL() {
|
|
958
|
-
const url = new URL(this._url.toString());
|
|
959
|
-
url.searchParams.sort();
|
|
960
|
-
return url;
|
|
961
|
-
}
|
|
962
|
-
toString() {
|
|
963
|
-
this._url.searchParams.sort();
|
|
964
|
-
return this._url.toString();
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
|
|
968
983
|
// src/crypto.ts
|
|
969
984
|
function randomBytes(size) {
|
|
970
985
|
const bytes = new Uint8Array(size);
|