@hkdigital/lib-sveltekit 0.0.59 → 0.0.61
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/classes/promise/HkPromise.d.ts +2 -2
- package/dist/classes/promise/HkPromise.js +2 -2
- package/dist/classes/stores/SubscribersCount.js +1 -1
- package/dist/classes/streams/LogTransformStream.js +2 -2
- package/dist/components/icon/HkIcon.svelte +1 -1
- package/dist/components/layout/HkAppLayout.state.svelte.js +1 -1
- package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +1 -1
- package/dist/components/tab-bar/HkTabBar.state.svelte.js +1 -1
- package/dist/constants/errors/api.d.ts +10 -0
- package/dist/constants/errors/api.js +9 -0
- package/dist/constants/errors/generic.d.ts +6 -0
- package/dist/constants/errors/generic.js +5 -0
- package/dist/constants/errors/index.d.ts +3 -0
- package/dist/constants/errors/index.js +3 -0
- package/dist/constants/errors/jwt.d.ts +8 -0
- package/dist/constants/errors/jwt.js +5 -0
- package/dist/constants/http/headers.d.ts +4 -0
- package/dist/constants/http/headers.js +5 -0
- package/dist/constants/http/index.d.ts +2 -0
- package/dist/constants/http/index.js +2 -0
- package/dist/constants/http/methods.d.ts +2 -0
- package/dist/constants/http/methods.js +2 -0
- package/dist/constants/mime/application.d.ts +2 -0
- package/dist/constants/mime/application.js +2 -0
- package/dist/constants/mime/image.d.ts +3 -0
- package/dist/constants/mime/image.js +3 -0
- package/dist/constants/mime/index.d.ts +3 -0
- package/dist/constants/mime/index.js +3 -0
- package/dist/constants/mime/text.d.ts +2 -0
- package/dist/constants/mime/text.js +2 -0
- package/dist/util/array/index.d.ts +3 -3
- package/dist/util/array/index.js +2 -2
- package/dist/util/compare/index.d.ts +14 -14
- package/dist/util/compare/index.js +14 -14
- package/dist/util/expect/index.d.ts +30 -30
- package/dist/util/expect/index.js +36 -29
- package/dist/util/http/errors.d.ts +18 -0
- package/dist/util/http/errors.js +97 -0
- package/dist/util/http/headers.d.ts +12 -0
- package/dist/util/http/headers.js +39 -0
- package/dist/util/http/http-request.d.ts +78 -0
- package/dist/util/http/http-request.js +259 -0
- package/dist/util/http/index.d.ts +4 -0
- package/dist/util/http/index.js +20 -0
- package/dist/util/http/json-request.d.ts +47 -0
- package/dist/util/http/json-request.js +141 -0
- package/dist/util/http/mocks.d.ts +12 -0
- package/dist/util/http/mocks.js +12 -0
- package/dist/util/http/response.d.ts +24 -0
- package/dist/util/http/response.js +105 -0
- package/dist/util/http/url.d.ts +8 -0
- package/dist/util/http/url.js +19 -0
- package/dist/util/is/index.d.ts +12 -12
- package/dist/util/is/index.js +7 -7
- package/dist/util/object/index.d.ts +16 -16
- package/dist/util/object/index.js +11 -11
- package/dist/util/singleton/index.d.ts +1 -1
- package/dist/util/singleton/index.js +1 -1
- package/package.json +33 -16
@@ -36,7 +36,7 @@ export default class HkPromise extends Promise<any> {
|
|
36
36
|
/**
|
37
37
|
* Resolve the promise
|
38
38
|
*
|
39
|
-
* @param {
|
39
|
+
* @param {any} [value] - Value to pass to the "then" callbacks
|
40
40
|
*
|
41
41
|
* @returns {object} this
|
42
42
|
*/
|
@@ -44,7 +44,7 @@ export default class HkPromise extends Promise<any> {
|
|
44
44
|
/**
|
45
45
|
* Resolve the promise if the promise is still pending
|
46
46
|
*
|
47
|
-
* @param {
|
47
|
+
* @param {any} [value] - Value to pass to the "catch" callbacks
|
48
48
|
*
|
49
49
|
* @returns {object} this
|
50
50
|
*/
|
@@ -141,7 +141,7 @@ export default class HkPromise extends Promise {
|
|
141
141
|
/**
|
142
142
|
* Resolve the promise
|
143
143
|
*
|
144
|
-
* @param {
|
144
|
+
* @param {any} [value] - Value to pass to the "then" callbacks
|
145
145
|
*
|
146
146
|
* @returns {object} this
|
147
147
|
*/
|
@@ -179,7 +179,7 @@ export default class HkPromise extends Promise {
|
|
179
179
|
/**
|
180
180
|
* Resolve the promise if the promise is still pending
|
181
181
|
*
|
182
|
-
* @param {
|
182
|
+
* @param {any} [value] - Value to pass to the "catch" callbacks
|
183
183
|
*
|
184
184
|
* @returns {object} this
|
185
185
|
*/
|
@@ -4,8 +4,8 @@ export default class LogTransformStream extends TransformStream {
|
|
4
4
|
/**
|
5
5
|
* Log the chunk and enqueue the unchanged chunk
|
6
6
|
*
|
7
|
-
* @param {
|
8
|
-
* @param {
|
7
|
+
* @param {any} chunk
|
8
|
+
* @param {any} controller
|
9
9
|
*/
|
10
10
|
transform: (chunk, controller) => {
|
11
11
|
console.log('log', chunk);
|
@@ -2,7 +2,7 @@ import { defineStateContext } from '../../util/svelte/state-context';
|
|
2
2
|
|
3
3
|
import { browser } from '$app/environment';
|
4
4
|
|
5
|
-
import { MediaQuery } from '
|
5
|
+
import { MediaQuery } from 'svelte/reactivity';
|
6
6
|
|
7
7
|
/* ------------------------------------------------------- Define state class */
|
8
8
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* - If the value is undefined or null, an empty array is returned
|
5
5
|
* - A primitive value is "wrapped" in an array
|
6
6
|
*
|
7
|
-
* @param {
|
7
|
+
* @param {any} value - Item to convert
|
8
8
|
*
|
9
9
|
* @param {number} [start]
|
10
10
|
* Index of the array to start extraction.
|
@@ -22,7 +22,7 @@
|
|
22
22
|
* @example
|
23
23
|
* toArray( [ 1, 2, 3, 4, 5 ], 2, 4 ) returns [ 3, 4 ]
|
24
24
|
*/
|
25
|
-
export function toArray(value:
|
25
|
+
export function toArray(value: any, start?: number, end?: number): any[];
|
26
26
|
/**
|
27
27
|
* Convert an async iterator to an array
|
28
28
|
* - If no async iterator is passed, the value will be processed by `from()`
|
@@ -53,7 +53,7 @@ export function toArrayPath(path: string | string[], pathSeparator?: string): st
|
|
53
53
|
*
|
54
54
|
* @template {arrray} T
|
55
55
|
* @param {T} arr
|
56
|
-
* @param {
|
56
|
+
* @param {any} value
|
57
57
|
*
|
58
58
|
* @returns {T} arr
|
59
59
|
*/
|
package/dist/util/array/index.js
CHANGED
@@ -29,7 +29,7 @@ export { arraySlice, arrayConcat };
|
|
29
29
|
* - If the value is undefined or null, an empty array is returned
|
30
30
|
* - A primitive value is "wrapped" in an array
|
31
31
|
*
|
32
|
-
* @param {
|
32
|
+
* @param {any} value - Item to convert
|
33
33
|
*
|
34
34
|
* @param {number} [start]
|
35
35
|
* Index of the array to start extraction.
|
@@ -150,7 +150,7 @@ export function toArrayPath(path, pathSeparator = PATH_SEPARATOR) {
|
|
150
150
|
*
|
151
151
|
* @template {arrray} T
|
152
152
|
* @param {T} arr
|
153
|
-
* @param {
|
153
|
+
* @param {any} value
|
154
154
|
*
|
155
155
|
* @returns {T} arr
|
156
156
|
*/
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
2
|
* Check if the values of two variables should be considered the same
|
3
3
|
*
|
4
|
-
* @param {
|
5
|
-
* @param {
|
4
|
+
* @param {any} value1 - First value for comparison
|
5
|
+
* @param {any} value2 - Second value for comparison
|
6
6
|
*
|
7
7
|
* @return {boolean} true if the two values can be considered the same
|
8
8
|
*/
|
@@ -10,23 +10,23 @@ export function equals(value1: any, value2: any, _pendingComparisons: any): bool
|
|
10
10
|
/**
|
11
11
|
* Returns true if x is greater than y
|
12
12
|
*
|
13
|
-
* @param {
|
14
|
-
* @param {
|
13
|
+
* @param {any} x - First value
|
14
|
+
* @param {any} y - Second value
|
15
15
|
*/
|
16
16
|
export function isGreaterThan(x: any, y: any): boolean;
|
17
17
|
/**
|
18
18
|
* Returns true if x is less than y
|
19
19
|
*
|
20
|
-
* @param {
|
21
|
-
* @param {
|
20
|
+
* @param {any} x - First value
|
21
|
+
* @param {any} y - Second value
|
22
22
|
*/
|
23
23
|
export function isLessThan(x: any, y: any): boolean;
|
24
24
|
/**
|
25
25
|
* Compare function that can be used for sorting smallest values first
|
26
26
|
* - undefined values are placed at the ...???FIXME???... of the sorted array
|
27
27
|
*
|
28
|
-
* @param {
|
29
|
-
* @param {
|
28
|
+
* @param {any} x - First value
|
29
|
+
* @param {any} y - Second value
|
30
30
|
*
|
31
31
|
* @returns {number} 0 = keep original order,
|
32
32
|
* 1 = sort x after y,
|
@@ -37,8 +37,8 @@ export function smallestFirst(x: any, y: any): number;
|
|
37
37
|
* Compare function that can be used for sorting largest values first
|
38
38
|
* - undefined values are placed at the ...???FIXME???... of the sorted array
|
39
39
|
*
|
40
|
-
* @param {
|
41
|
-
* @param {
|
40
|
+
* @param {any} x - First value
|
41
|
+
* @param {any} y - Second value
|
42
42
|
*
|
43
43
|
* @returns {number} 0 = keep original order,
|
44
44
|
* 1 = sort x after y,
|
@@ -50,8 +50,8 @@ export function largestFirst(x: any, y: any): number;
|
|
50
50
|
*
|
51
51
|
* @param {function} compareFn - Function to use to compare the values
|
52
52
|
*
|
53
|
-
* @param {
|
54
|
-
* @param {
|
53
|
+
* @param {any} a - First value
|
54
|
+
* @param {any} b - Second value
|
55
55
|
*
|
56
56
|
* @param {string|string[]} path - Object path
|
57
57
|
*/
|
@@ -62,7 +62,7 @@ export function compareUsingPath(compareFn: Function, a: any, b: any, path: stri
|
|
62
62
|
* @param {function} compareFn - Function to use to compare the values
|
63
63
|
* @param {string|string[]} path - Object path
|
64
64
|
*
|
65
|
-
* @param {
|
66
|
-
* @param {
|
65
|
+
* @param {any} x - First value
|
66
|
+
* @param {any} y - Second value
|
67
67
|
*/
|
68
68
|
export function compareUsingKey(compareFn: Function, key: any, a: any, b: any): any;
|
@@ -7,8 +7,8 @@ import { objectGet } from '../object/index.js';
|
|
7
7
|
/**
|
8
8
|
* Check if the values of two variables should be considered the same
|
9
9
|
*
|
10
|
-
* @param {
|
11
|
-
* @param {
|
10
|
+
* @param {any} value1 - First value for comparison
|
11
|
+
* @param {any} value2 - Second value for comparison
|
12
12
|
*
|
13
13
|
* @return {boolean} true if the two values can be considered the same
|
14
14
|
*/
|
@@ -107,8 +107,8 @@ export function equals(value1, value2, _pendingComparisons) {
|
|
107
107
|
/**
|
108
108
|
* Returns true if x is greater than y
|
109
109
|
*
|
110
|
-
* @param {
|
111
|
-
* @param {
|
110
|
+
* @param {any} x - First value
|
111
|
+
* @param {any} y - Second value
|
112
112
|
*/
|
113
113
|
export function isGreaterThan(x, y) {
|
114
114
|
if (typeof x === 'undefined') {
|
@@ -131,8 +131,8 @@ export function isGreaterThan(x, y) {
|
|
131
131
|
/**
|
132
132
|
* Returns true if x is less than y
|
133
133
|
*
|
134
|
-
* @param {
|
135
|
-
* @param {
|
134
|
+
* @param {any} x - First value
|
135
|
+
* @param {any} y - Second value
|
136
136
|
*/
|
137
137
|
export function isLessThan(x, y) {
|
138
138
|
if (typeof x === 'undefined') {
|
@@ -156,8 +156,8 @@ export function isLessThan(x, y) {
|
|
156
156
|
* Compare function that can be used for sorting smallest values first
|
157
157
|
* - undefined values are placed at the ...???FIXME???... of the sorted array
|
158
158
|
*
|
159
|
-
* @param {
|
160
|
-
* @param {
|
159
|
+
* @param {any} x - First value
|
160
|
+
* @param {any} y - Second value
|
161
161
|
*
|
162
162
|
* @returns {number} 0 = keep original order,
|
163
163
|
* 1 = sort x after y,
|
@@ -185,8 +185,8 @@ export function smallestFirst(x, y) {
|
|
185
185
|
* Compare function that can be used for sorting largest values first
|
186
186
|
* - undefined values are placed at the ...???FIXME???... of the sorted array
|
187
187
|
*
|
188
|
-
* @param {
|
189
|
-
* @param {
|
188
|
+
* @param {any} x - First value
|
189
|
+
* @param {any} y - Second value
|
190
190
|
*
|
191
191
|
* @returns {number} 0 = keep original order,
|
192
192
|
* 1 = sort x after y,
|
@@ -215,8 +215,8 @@ export function largestFirst(x, y) {
|
|
215
215
|
*
|
216
216
|
* @param {function} compareFn - Function to use to compare the values
|
217
217
|
*
|
218
|
-
* @param {
|
219
|
-
* @param {
|
218
|
+
* @param {any} a - First value
|
219
|
+
* @param {any} b - Second value
|
220
220
|
*
|
221
221
|
* @param {string|string[]} path - Object path
|
222
222
|
*/
|
@@ -237,8 +237,8 @@ export function compareUsingPath(compareFn, a, b, path) {
|
|
237
237
|
* @param {function} compareFn - Function to use to compare the values
|
238
238
|
* @param {string|string[]} path - Object path
|
239
239
|
*
|
240
|
-
* @param {
|
241
|
-
* @param {
|
240
|
+
* @param {any} x - First value
|
241
|
+
* @param {any} y - Second value
|
242
242
|
*/
|
243
243
|
export function compareUsingKey(compareFn, key, a, b) {
|
244
244
|
// @note assume a and b are objects
|
@@ -2,149 +2,149 @@
|
|
2
2
|
/**
|
3
3
|
* Throws a validation error if value is not a string
|
4
4
|
*
|
5
|
-
* @param {
|
5
|
+
* @param {any} value
|
6
6
|
*/
|
7
7
|
export function string(value: any): void;
|
8
8
|
/**
|
9
9
|
* Throws a validation error if value is not a boolean
|
10
10
|
*
|
11
|
-
* @param {
|
11
|
+
* @param {any} value
|
12
12
|
*/
|
13
13
|
export function boolean(value: any): void;
|
14
14
|
/**
|
15
15
|
* Throws a validation error if value is not a number
|
16
16
|
*
|
17
|
-
* @param {
|
17
|
+
* @param {any} value
|
18
18
|
*/
|
19
19
|
export function number(value: any): void;
|
20
20
|
/**
|
21
21
|
* Throws a validation error if value is not a Symbol
|
22
22
|
*
|
23
|
-
* @param {
|
23
|
+
* @param {any} value
|
24
24
|
*/
|
25
25
|
export function symbol(value: any): void;
|
26
|
+
/**
|
27
|
+
* Throws a validation error if value is not defined
|
28
|
+
*
|
29
|
+
* @param {any} value
|
30
|
+
*/
|
31
|
+
export function defined(value: any): void;
|
26
32
|
/**
|
27
33
|
* Throws a validation error if value is not an array of strings
|
28
34
|
*
|
29
|
-
* @param {
|
35
|
+
* @param {any} value
|
30
36
|
*/
|
31
37
|
export function stringArray(value: any): void;
|
32
38
|
/**
|
33
39
|
* Throws a validation error if value is not an array of objects
|
34
40
|
*
|
35
|
-
* @param {
|
41
|
+
* @param {any} value
|
36
42
|
*/
|
37
43
|
export function objectArray(value: any): void;
|
38
44
|
/**
|
39
45
|
* Throws a validation error if value is not an Error instance
|
40
46
|
*
|
41
|
-
* @param {
|
47
|
+
* @param {any} value
|
42
48
|
*/
|
43
49
|
export function error_(value: any): void;
|
44
50
|
/**
|
45
51
|
* Expect a value not to be null
|
46
52
|
*
|
47
|
-
* @param {
|
53
|
+
* @param {any} value
|
48
54
|
*/
|
49
55
|
export function notNull(value: any): void;
|
50
56
|
/**
|
51
57
|
* Expect a value to be a boolean and true
|
52
58
|
*
|
53
|
-
* @param {
|
59
|
+
* @param {any} value
|
54
60
|
*/
|
55
61
|
export function _true(value: any): void;
|
56
62
|
/**
|
57
63
|
* Throws a validation error if value is not a string
|
58
64
|
*
|
59
|
-
* @param {
|
65
|
+
* @param {any} value
|
60
66
|
*/
|
61
67
|
export function notEmptyString(value: any): void;
|
62
68
|
/**
|
63
69
|
* Throws a validation error if value is not iterable
|
64
70
|
*
|
65
|
-
* @param {
|
71
|
+
* @param {any} value
|
66
72
|
*/
|
67
73
|
export function iterable(value: any): void;
|
68
74
|
/**
|
69
75
|
* Throws a validation error if value is not a a store (has not subscribe
|
70
76
|
* method)
|
71
77
|
*
|
72
|
-
* @param {
|
78
|
+
* @param {any} value
|
73
79
|
*/
|
74
80
|
export function store(value: any): void;
|
75
81
|
/**
|
76
82
|
* Throws a validation error if value is not array like
|
77
83
|
* - Checks if the value is an object and has a property `length`
|
78
84
|
*
|
79
|
-
* @param {
|
85
|
+
* @param {any} value
|
80
86
|
*/
|
81
87
|
export function arrayLike(value: any): void;
|
82
88
|
/**
|
83
89
|
* Throws a validation error if value is not an object or the value
|
84
90
|
* is an array
|
85
91
|
*
|
86
|
-
* @param {
|
92
|
+
* @param {any} value
|
87
93
|
*/
|
88
94
|
export function objectNoArray(value: any): void;
|
89
95
|
/**
|
90
96
|
* Throws a validation error if value is not an object or the value
|
91
97
|
* is a function
|
92
98
|
*
|
93
|
-
* @param {
|
99
|
+
* @param {any} value
|
94
100
|
*/
|
95
101
|
export function objectNoFunction(value: any): void;
|
96
102
|
/**
|
97
103
|
* Throws a validation error if value is not an object or null
|
98
104
|
*
|
99
|
-
* @param {
|
105
|
+
* @param {any} value
|
100
106
|
*/
|
101
107
|
export function objectOrNull(value: any): void;
|
102
108
|
/**
|
103
109
|
* Throws a validation error if value is not an array or Set
|
104
110
|
*
|
105
|
-
* @param {
|
111
|
+
* @param {any} value
|
106
112
|
*/
|
107
113
|
export function arrayOrSet(value: any): void;
|
108
|
-
/**
|
109
|
-
* Throws a validation error if value is undefined
|
110
|
-
*
|
111
|
-
* @param {*} value
|
112
|
-
*/
|
113
|
-
declare function undefined_(value: any): void;
|
114
114
|
/**
|
115
115
|
* Throws a validation error if value is not an object
|
116
116
|
*
|
117
|
-
* @param {
|
117
|
+
* @param {any} value
|
118
118
|
*/
|
119
119
|
declare function object_(value: any): void;
|
120
120
|
/**
|
121
121
|
* Throws a validation error if value is not an array
|
122
122
|
*
|
123
|
-
* @param {
|
123
|
+
* @param {any} value
|
124
124
|
*/
|
125
125
|
declare function array_(value: any): void;
|
126
126
|
/**
|
127
127
|
* Throws a validation error if value is not a function
|
128
128
|
*
|
129
|
-
* @param {
|
129
|
+
* @param {any} value
|
130
130
|
*/
|
131
131
|
declare function function_(value: any): void;
|
132
132
|
/**
|
133
133
|
* Throws a validation error if value is not a Promise
|
134
134
|
*
|
135
|
-
* @param {
|
135
|
+
* @param {any} value
|
136
136
|
*/
|
137
137
|
declare function promise_(value: any): void;
|
138
138
|
/**
|
139
139
|
* Throws a validation error if value is not a Map
|
140
140
|
*
|
141
|
-
* @param {
|
141
|
+
* @param {any} value
|
142
142
|
*/
|
143
143
|
declare function map_(value: any): void;
|
144
144
|
/**
|
145
145
|
* Throws a validation error if value is not a Set
|
146
146
|
*
|
147
|
-
* @param {
|
147
|
+
* @param {any} value
|
148
148
|
*/
|
149
149
|
declare function set_(value: any): void;
|
150
|
-
export {
|
150
|
+
export { object_ as object, array_ as array, function_ as function, _function as function, function_ as class, _class as class, promise_ as promise, map_ as map, set_ as set, error_ as error, _true as true, _true as true };
|