@hkdigital/lib-sveltekit 0.0.58 → 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 +46 -46
- package/dist/util/expect/index.js +42 -35
- 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
|
-
/**
|
39
|
-
* Throws a validation error if value is not a Promise
|
40
|
-
*
|
41
|
-
* @param {*} value
|
42
|
-
*/
|
43
|
-
export function promise_(value: any): void;
|
44
|
-
/**
|
45
|
-
* Throws a validation error if value is not a Map
|
46
|
-
*
|
47
|
-
* @param {*} value
|
48
|
-
*/
|
49
|
-
export function map_(value: any): void;
|
50
|
-
/**
|
51
|
-
* Throws a validation error if value is not a Set
|
52
|
-
*
|
53
|
-
* @param {*} value
|
54
|
-
*/
|
55
|
-
export function set_(value: any): void;
|
56
44
|
/**
|
57
45
|
* Throws a validation error if value is not an Error instance
|
58
46
|
*
|
59
|
-
* @param {
|
47
|
+
* @param {any} value
|
60
48
|
*/
|
61
49
|
export function error_(value: any): void;
|
62
50
|
/**
|
63
51
|
* Expect a value not to be null
|
64
52
|
*
|
65
|
-
* @param {
|
53
|
+
* @param {any} value
|
66
54
|
*/
|
67
55
|
export function notNull(value: any): void;
|
68
56
|
/**
|
69
57
|
* Expect a value to be a boolean and true
|
70
58
|
*
|
71
|
-
* @param {
|
59
|
+
* @param {any} value
|
72
60
|
*/
|
73
61
|
export function _true(value: any): void;
|
74
62
|
/**
|
75
63
|
* Throws a validation error if value is not a string
|
76
64
|
*
|
77
|
-
* @param {
|
65
|
+
* @param {any} value
|
78
66
|
*/
|
79
67
|
export function notEmptyString(value: any): void;
|
80
68
|
/**
|
81
69
|
* Throws a validation error if value is not iterable
|
82
70
|
*
|
83
|
-
* @param {
|
71
|
+
* @param {any} value
|
84
72
|
*/
|
85
73
|
export function iterable(value: any): void;
|
86
74
|
/**
|
87
75
|
* Throws a validation error if value is not a a store (has not subscribe
|
88
76
|
* method)
|
89
77
|
*
|
90
|
-
* @param {
|
78
|
+
* @param {any} value
|
91
79
|
*/
|
92
80
|
export function store(value: any): void;
|
93
81
|
/**
|
94
82
|
* Throws a validation error if value is not array like
|
95
83
|
* - Checks if the value is an object and has a property `length`
|
96
84
|
*
|
97
|
-
* @param {
|
85
|
+
* @param {any} value
|
98
86
|
*/
|
99
87
|
export function arrayLike(value: any): void;
|
100
88
|
/**
|
101
89
|
* Throws a validation error if value is not an object or the value
|
102
90
|
* is an array
|
103
91
|
*
|
104
|
-
* @param {
|
92
|
+
* @param {any} value
|
105
93
|
*/
|
106
94
|
export function objectNoArray(value: any): void;
|
107
95
|
/**
|
108
96
|
* Throws a validation error if value is not an object or the value
|
109
97
|
* is a function
|
110
98
|
*
|
111
|
-
* @param {
|
99
|
+
* @param {any} value
|
112
100
|
*/
|
113
101
|
export function objectNoFunction(value: any): void;
|
114
102
|
/**
|
115
103
|
* Throws a validation error if value is not an object or null
|
116
104
|
*
|
117
|
-
* @param {
|
105
|
+
* @param {any} value
|
118
106
|
*/
|
119
107
|
export function objectOrNull(value: any): void;
|
120
108
|
/**
|
121
109
|
* Throws a validation error if value is not an array or Set
|
122
110
|
*
|
123
|
-
* @param {
|
111
|
+
* @param {any} value
|
124
112
|
*/
|
125
113
|
export function arrayOrSet(value: any): void;
|
126
|
-
/**
|
127
|
-
* Throws a validation error if value is undefined
|
128
|
-
*
|
129
|
-
* @param {*} value
|
130
|
-
*/
|
131
|
-
declare function undefined_(value: any): void;
|
132
114
|
/**
|
133
115
|
* Throws a validation error if value is not an object
|
134
116
|
*
|
135
|
-
* @param {
|
117
|
+
* @param {any} value
|
136
118
|
*/
|
137
119
|
declare function object_(value: any): void;
|
138
120
|
/**
|
139
121
|
* Throws a validation error if value is not an array
|
140
122
|
*
|
141
|
-
* @param {
|
123
|
+
* @param {any} value
|
142
124
|
*/
|
143
125
|
declare function array_(value: any): void;
|
144
126
|
/**
|
145
127
|
* Throws a validation error if value is not a function
|
146
128
|
*
|
147
|
-
* @param {
|
129
|
+
* @param {any} value
|
130
|
+
*/
|
131
|
+
declare function function_(value: any): void;
|
132
|
+
/**
|
133
|
+
* Throws a validation error if value is not a Promise
|
134
|
+
*
|
135
|
+
* @param {any} value
|
136
|
+
*/
|
137
|
+
declare function promise_(value: any): void;
|
138
|
+
/**
|
139
|
+
* Throws a validation error if value is not a Map
|
140
|
+
*
|
141
|
+
* @param {any} value
|
142
|
+
*/
|
143
|
+
declare function map_(value: any): void;
|
144
|
+
/**
|
145
|
+
* Throws a validation error if value is not a Set
|
146
|
+
*
|
147
|
+
* @param {any} value
|
148
148
|
*/
|
149
|
-
declare function
|
150
|
-
export {
|
149
|
+
declare function set_(value: any): void;
|
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 };
|