@dereekb/util 11.1.8 → 12.0.1
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/fetch/index.cjs.js +3053 -2148
- package/fetch/index.esm.d.ts +1 -0
- package/fetch/index.esm.js +2906 -1890
- package/fetch/package.json +4 -3
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/json.d.ts +3 -3
- package/index.cjs.js +3773 -3654
- package/index.esm.d.ts +1 -0
- package/index.esm.js +3786 -5032
- package/package.json +4 -3
- package/src/lib/array/array.boolean.d.ts +50 -0
- package/src/lib/array/array.factory.d.ts +17 -14
- package/src/lib/array/array.filter.d.ts +34 -18
- package/src/lib/array/array.find.d.ts +17 -5
- package/src/lib/array/array.index.d.ts +2 -1
- package/src/lib/array/array.limit.d.ts +3 -2
- package/src/lib/assertion/assert.d.ts +9 -1
- package/src/lib/assertion/assert.error.d.ts +50 -7
- package/src/lib/auth/auth.role.d.ts +7 -0
- package/src/lib/boolean.d.ts +51 -6
- package/src/lib/contact/email.d.ts +33 -0
- package/src/lib/contact/phone.d.ts +48 -14
- package/src/lib/date/date.d.ts +109 -27
- package/src/lib/date/date.time.d.ts +25 -2
- package/src/lib/date/expires.d.ts +27 -21
- package/src/lib/date/time.d.ts +15 -24
- package/src/lib/grouping.d.ts +3 -0
- package/src/lib/nodejs/stream.d.ts +0 -2
- package/src/lib/relation/relation.d.ts +15 -11
- package/src/lib/set/set.delta.d.ts +1 -1
- package/src/lib/string/dencoder.d.ts +1 -1
- package/src/lib/string/html.d.ts +14 -1
- package/src/lib/string/index.d.ts +1 -0
- package/src/lib/string/prefix.d.ts +81 -0
- package/src/lib/string/replace.d.ts +2 -2
- package/src/lib/value/indexed.d.ts +7 -7
- package/src/lib/value/maybe.d.ts +10 -3
- package/test/CHANGELOG.md +13 -0
- package/test/package.json +3 -2
- package/test/src/lib/jest.d.ts +1 -1
- package/test/src/lib/jest.fail.d.ts +3 -3
- package/test/src/lib/jest.fail.js +15 -15
- package/test/src/lib/jest.fail.js.map +1 -1
- package/test/src/lib/jest.function.d.ts +1 -1
- package/test/src/lib/jest.function.js +2 -3
- package/test/src/lib/jest.function.js.map +1 -1
- package/test/src/lib/jest.js +3 -3
- package/test/src/lib/jest.js.map +1 -1
- package/test/src/lib/jest.wrap.d.ts +1 -1
- package/test/src/lib/jest.wrap.js +3 -3
- package/test/src/lib/jest.wrap.js.map +1 -1
package/fetch/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/fetch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
".": {
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"node": {
|
|
@@ -17,5 +17,6 @@
|
|
|
17
17
|
"@dereekb/util": "*"
|
|
18
18
|
},
|
|
19
19
|
"module": "./index.esm.js",
|
|
20
|
-
"main": "./index.cjs.js"
|
|
21
|
-
|
|
20
|
+
"main": "./index.cjs.js",
|
|
21
|
+
"types": "./index.esm.d.ts"
|
|
22
|
+
}
|
package/fetch/src/lib/fetch.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { type ConfiguredFetchWithTimeout, type RequestInitWithTimeout } from './
|
|
|
4
4
|
* Interface used for creating fetch related resource factories.
|
|
5
5
|
*/
|
|
6
6
|
export interface FetchService {
|
|
7
|
-
makeFetch: (config?: ConfigureFetchInput) => ConfiguredFetchWithTimeout;
|
|
8
|
-
makeRequest: FetchRequestFactory;
|
|
9
|
-
fetchRequestFactory: typeof fetchRequestFactory;
|
|
7
|
+
readonly makeFetch: (config?: ConfigureFetchInput) => ConfiguredFetchWithTimeout;
|
|
8
|
+
readonly makeRequest: FetchRequestFactory;
|
|
9
|
+
readonly fetchRequestFactory: typeof fetchRequestFactory;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* fetchService() configuration.
|
|
@@ -25,29 +25,29 @@ export type MapFetchResponseFunction = MapFunction<Promise<Response>, Promise<Re
|
|
|
25
25
|
*/
|
|
26
26
|
export type FetchHandler = (request: Request, makeFetch: typeof fetch) => Promise<Response>;
|
|
27
27
|
export interface ConfigureFetchInput extends FetchRequestFactoryInput {
|
|
28
|
-
makeFetch?: typeof fetch;
|
|
28
|
+
readonly makeFetch?: typeof fetch;
|
|
29
29
|
/**
|
|
30
30
|
* Whether or not to add timeout handling using timeoutFetch().
|
|
31
31
|
*
|
|
32
32
|
* Default: false
|
|
33
33
|
*/
|
|
34
|
-
useTimeout?: boolean;
|
|
34
|
+
readonly useTimeout?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* Whether or not to map the fetch response using requireOkResponse().
|
|
37
37
|
*
|
|
38
38
|
* Default: false
|
|
39
39
|
*/
|
|
40
|
-
requireOkResponse?: boolean;
|
|
40
|
+
readonly requireOkResponse?: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* (Optional) Custom fetch handler.
|
|
43
43
|
*/
|
|
44
|
-
fetchHandler?: FetchHandler;
|
|
44
|
+
readonly fetchHandler?: FetchHandler;
|
|
45
45
|
/**
|
|
46
46
|
* (Optional) MapFetchResponseFunction
|
|
47
47
|
*
|
|
48
48
|
* If requireOkResponse is true, this mapping occurs afterwards.
|
|
49
49
|
*/
|
|
50
|
-
mapResponse?: MapFetchResponseFunction;
|
|
50
|
+
readonly mapResponse?: MapFetchResponseFunction;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Default FetchHabdler
|
|
@@ -67,37 +67,37 @@ export interface FetchRequestFactoryInput {
|
|
|
67
67
|
/**
|
|
68
68
|
* Request factory to use. If not defined, will default to window/global.
|
|
69
69
|
*/
|
|
70
|
-
makeRequest?: FetchRequestFactory;
|
|
70
|
+
readonly makeRequest?: FetchRequestFactory;
|
|
71
71
|
/**
|
|
72
72
|
* Appends this URL to every fetch request.
|
|
73
73
|
*/
|
|
74
|
-
baseUrl?: WebsiteUrl;
|
|
74
|
+
readonly baseUrl?: WebsiteUrl;
|
|
75
75
|
/**
|
|
76
76
|
* Whether or not to append the base url to RequestInfo that is already configured, instead of only URL or strings.
|
|
77
77
|
*/
|
|
78
|
-
useBaseUrlForConfiguredFetchRequests?: boolean;
|
|
78
|
+
readonly useBaseUrlForConfiguredFetchRequests?: boolean;
|
|
79
79
|
/**
|
|
80
80
|
* Whether or not to force always using the base url even when a WebsiteUrlWithPrefix value is provided.
|
|
81
81
|
*
|
|
82
82
|
* Defaults to useBaseUrlForConfiguredFetchRequests's value.
|
|
83
83
|
*/
|
|
84
|
-
forceBaseUrlForWebsiteUrlWithPrefix?: boolean;
|
|
84
|
+
readonly forceBaseUrlForWebsiteUrlWithPrefix?: boolean;
|
|
85
85
|
/**
|
|
86
86
|
* Base request info to add to each value.
|
|
87
87
|
*/
|
|
88
|
-
baseRequest?: GetterOrValue<PromiseOrValue<RequestInit>>;
|
|
88
|
+
readonly baseRequest?: GetterOrValue<PromiseOrValue<RequestInit>>;
|
|
89
89
|
/**
|
|
90
90
|
* Default timeout to add to requestInit values.
|
|
91
91
|
*
|
|
92
92
|
* NOTE: This timeout is not used by this fetchRequest directly, but is added to the baseRequest.
|
|
93
93
|
*/
|
|
94
|
-
timeout?: number;
|
|
94
|
+
readonly timeout?: number;
|
|
95
95
|
/**
|
|
96
96
|
* Maps the input RequestInit value to another.
|
|
97
97
|
*
|
|
98
98
|
* If baseRequest is provided, the values will already be appended before reaching this factory.
|
|
99
99
|
*/
|
|
100
|
-
requestInitFactory?: FetchRequestInitFactory;
|
|
100
|
+
readonly requestInitFactory?: FetchRequestInitFactory;
|
|
101
101
|
}
|
|
102
102
|
export type FetchRequestInitFactory = (currRequest: PromiseOrValue<Request>, init?: PromiseOrValue<RequestInit>) => PromiseOrValue<RequestInitWithTimeout | undefined>;
|
|
103
103
|
export type FetchRequestFactory = (input: RequestInfo | URL, init?: RequestInit | undefined) => PromiseOrValue<Request>;
|
package/fetch/src/lib/json.d.ts
CHANGED
|
@@ -14,14 +14,14 @@ export declare class JsonResponseParseError extends Error {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function fetchJsonBodyString(body: FetchJsonBody | undefined): string | undefined;
|
|
16
16
|
export interface FetchJsonInput extends Omit<RequestInit, 'body'> {
|
|
17
|
-
method: FetchMethod;
|
|
18
|
-
body?: FetchJsonBody | undefined;
|
|
17
|
+
readonly method: FetchMethod;
|
|
18
|
+
readonly body?: FetchJsonBody | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* Optional intercept function to intercept/transform the response.
|
|
21
21
|
*
|
|
22
22
|
* Does not override any other configured interceptor and occurs after those configured interceptors.
|
|
23
23
|
*/
|
|
24
|
-
interceptResponse?: FetchJsonInterceptJsonResponseFunction;
|
|
24
|
+
readonly interceptResponse?: FetchJsonInterceptJsonResponseFunction;
|
|
25
25
|
}
|
|
26
26
|
export type FetchJsonInputMapFunction = MapSameFunction<FetchJsonInput>;
|
|
27
27
|
export type FetchJsonGetFunction = <R>(url: FetchURLInput) => Promise<R>;
|