@hkdigital/lib-sveltekit 0.0.59 → 0.0.62

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.
Files changed (59) hide show
  1. package/dist/classes/promise/HkPromise.d.ts +2 -2
  2. package/dist/classes/promise/HkPromise.js +2 -2
  3. package/dist/classes/stores/SubscribersCount.js +1 -1
  4. package/dist/classes/streams/LogTransformStream.js +2 -2
  5. package/dist/components/icon/HkIcon.svelte +1 -1
  6. package/dist/components/layout/HkAppLayout.state.svelte.js +1 -1
  7. package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +1 -1
  8. package/dist/components/tab-bar/HkTabBar.state.svelte.js +1 -1
  9. package/dist/constants/errors/api.d.ts +10 -0
  10. package/dist/constants/errors/api.js +9 -0
  11. package/dist/constants/errors/generic.d.ts +6 -0
  12. package/dist/constants/errors/generic.js +5 -0
  13. package/dist/constants/errors/index.d.ts +3 -0
  14. package/dist/constants/errors/index.js +3 -0
  15. package/dist/constants/errors/jwt.d.ts +8 -0
  16. package/dist/constants/errors/jwt.js +5 -0
  17. package/dist/constants/http/headers.d.ts +4 -0
  18. package/dist/constants/http/headers.js +5 -0
  19. package/dist/constants/http/index.d.ts +2 -0
  20. package/dist/constants/http/index.js +2 -0
  21. package/dist/constants/http/methods.d.ts +2 -0
  22. package/dist/constants/http/methods.js +2 -0
  23. package/dist/constants/mime/application.d.ts +2 -0
  24. package/dist/constants/mime/application.js +2 -0
  25. package/dist/constants/mime/image.d.ts +3 -0
  26. package/dist/constants/mime/image.js +3 -0
  27. package/dist/constants/mime/index.d.ts +3 -0
  28. package/dist/constants/mime/index.js +3 -0
  29. package/dist/constants/mime/text.d.ts +2 -0
  30. package/dist/constants/mime/text.js +2 -0
  31. package/dist/util/array/index.d.ts +3 -3
  32. package/dist/util/array/index.js +2 -2
  33. package/dist/util/compare/index.d.ts +14 -14
  34. package/dist/util/compare/index.js +14 -14
  35. package/dist/util/expect/index.d.ts +30 -30
  36. package/dist/util/expect/index.js +36 -29
  37. package/dist/util/http/errors.d.ts +18 -0
  38. package/dist/util/http/errors.js +97 -0
  39. package/dist/util/http/headers.d.ts +12 -0
  40. package/dist/util/http/headers.js +39 -0
  41. package/dist/util/http/http-request.d.ts +78 -0
  42. package/dist/util/http/http-request.js +259 -0
  43. package/dist/util/http/index.d.ts +6 -0
  44. package/dist/util/http/index.js +22 -0
  45. package/dist/util/http/json-request.d.ts +47 -0
  46. package/dist/util/http/json-request.js +141 -0
  47. package/dist/util/http/mocks.d.ts +12 -0
  48. package/dist/util/http/mocks.js +12 -0
  49. package/dist/util/http/response.d.ts +24 -0
  50. package/dist/util/http/response.js +105 -0
  51. package/dist/util/http/url.d.ts +8 -0
  52. package/dist/util/http/url.js +19 -0
  53. package/dist/util/is/index.d.ts +12 -12
  54. package/dist/util/is/index.js +7 -7
  55. package/dist/util/object/index.d.ts +16 -16
  56. package/dist/util/object/index.js +11 -11
  57. package/dist/util/singleton/index.d.ts +1 -1
  58. package/dist/util/singleton/index.js +1 -1
  59. package/package.json +33 -16
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * Check if a value looks like an array
3
3
  *
4
- * @param {mixed} item - Item to check
4
+ * @param {any} item - Item to check
5
5
  *
6
6
  * @return {boolean} true if the value looks like an array
7
7
  */
8
- export function isArrayLike(item: mixed): boolean;
8
+ export function isArrayLike(item: any): boolean;
9
9
  /**
10
10
  * Check if a value is an Arguments object
11
11
  *
12
- * @param {*} value
12
+ * @param {any} value
13
13
  *
14
14
  * @returns {boolean} true if the value is an Arguments object
15
15
  */
@@ -18,7 +18,7 @@ export function isArguments(value: any): boolean;
18
18
  * Check if a value is an array that only contains primitives
19
19
  * - A primitive is a not-object value
20
20
  *
21
- * @param {mixed} value - value to check
21
+ * @param {any} value - value to check
22
22
  *
23
23
  * @return {boolean} true if the value is an array of primitives
24
24
  */
@@ -27,11 +27,11 @@ export function isArrayOfPrimitives(arr: any): boolean;
27
27
  * Check if the supplied value is async iterable
28
28
  * - Aync iterable objects must implement the "@@asyncIterator" method
29
29
  *
30
- * @param {mixed} value
30
+ * @param {any} value
31
31
  *
32
32
  * @returns {boolean} true if the value is async iterable
33
33
  */
34
- export function isAsyncIterator(value: mixed): boolean;
34
+ export function isAsyncIterator(value: any): boolean;
35
35
  /**
36
36
  * Check if the supplied value is an async function
37
37
  * - Returns true for functions declared as "async function" or
@@ -40,28 +40,28 @@ export function isAsyncIterator(value: mixed): boolean;
40
40
  * @warning this function does not return [true] for (sync) functions that
41
41
  * return a promise.
42
42
  *
43
- * @param {mixed} value
43
+ * @param {any} value
44
44
  *
45
45
  * @returns {boolean} true if the value is an async function
46
46
  */
47
- export function isAsyncFunction(value: mixed): boolean;
47
+ export function isAsyncFunction(value: any): boolean;
48
48
  /**
49
49
  * Check if the supplied value is iterable
50
50
  * - Iterable objects must implement the "@@iterator" method
51
51
  * - Generators are also iterable
52
52
  *
53
- * @param {mixed} value
53
+ * @param {any} value
54
54
  *
55
55
  * @returns {boolean} true if the value is (not async) iterable
56
56
  */
57
- export function isIterable(value: mixed): boolean;
57
+ export function isIterable(value: any): boolean;
58
58
  /**
59
59
  * Check if the supplied value is an object bu not a promise
60
60
  * - Promises return false
61
61
  * - Arrays return true
62
62
  *
63
- * @param {mixed} value
63
+ * @param {any} value
64
64
  *
65
65
  * @returns {boolean} true if the value is an Object, but not a Promise
66
66
  */
67
- export function isObject(value: mixed): boolean;
67
+ export function isObject(value: any): boolean;
@@ -14,7 +14,7 @@ const objectToString = Object.prototype.toString;
14
14
  /**
15
15
  * Check if a value looks like an array
16
16
  *
17
- * @param {mixed} item - Item to check
17
+ * @param {any} item - Item to check
18
18
  *
19
19
  * @return {boolean} true if the value looks like an array
20
20
  */
@@ -35,7 +35,7 @@ export function isArrayLike(item) {
35
35
  /**
36
36
  * Check if a value is an Arguments object
37
37
  *
38
- * @param {*} value
38
+ * @param {any} value
39
39
  *
40
40
  * @returns {boolean} true if the value is an Arguments object
41
41
  */
@@ -49,7 +49,7 @@ export function isArguments(value) {
49
49
  * Check if a value is an array that only contains primitives
50
50
  * - A primitive is a not-object value
51
51
  *
52
- * @param {mixed} value - value to check
52
+ * @param {any} value - value to check
53
53
  *
54
54
  * @return {boolean} true if the value is an array of primitives
55
55
  */
@@ -74,7 +74,7 @@ export function isArrayOfPrimitives(arr) {
74
74
  * Check if the supplied value is async iterable
75
75
  * - Aync iterable objects must implement the "@@asyncIterator" method
76
76
  *
77
- * @param {mixed} value
77
+ * @param {any} value
78
78
  *
79
79
  * @returns {boolean} true if the value is async iterable
80
80
  */
@@ -96,7 +96,7 @@ export function isAsyncIterator(value) {
96
96
  * @warning this function does not return [true] for (sync) functions that
97
97
  * return a promise.
98
98
  *
99
- * @param {mixed} value
99
+ * @param {any} value
100
100
  *
101
101
  * @returns {boolean} true if the value is an async function
102
102
  */
@@ -115,7 +115,7 @@ export function isAsyncFunction(value) {
115
115
  * - Iterable objects must implement the "@@iterator" method
116
116
  * - Generators are also iterable
117
117
  *
118
- * @param {mixed} value
118
+ * @param {any} value
119
119
  *
120
120
  * @returns {boolean} true if the value is (not async) iterable
121
121
  */
@@ -134,7 +134,7 @@ export function isIterable(value) {
134
134
  * - Promises return false
135
135
  * - Arrays return true
136
136
  *
137
- * @param {mixed} value
137
+ * @param {any} value
138
138
  *
139
139
  * @returns {boolean} true if the value is an Object, but not a Promise
140
140
  */
@@ -60,31 +60,31 @@ export function keep(obj: object, keys: string[] | Set<any>, removeNullAndUndefi
60
60
  * - Allows non-objects to be passed as input parameter (non-objects are
61
61
  * immutable by default).
62
62
  *
63
- * @param {mixed} value
63
+ * @param {any} value
64
64
  *
65
- * @returns {mixed}
65
+ * @returns {any}
66
66
  * recursively frozen object or original input value if a non-object was
67
67
  * supplied as input parameter
68
68
  */
69
- export function deepFreeze(value: mixed, _found: any): mixed;
69
+ export function deepFreeze(value: any, _found: any): any;
70
70
  /**
71
71
  * Set a value in an object using a path and value pair.
72
72
  * - Automatically creates parent objects
73
73
  *
74
74
  * @param {object} obj - Object to set the value in
75
75
  * @param {string|Array} path - Dot separated string path or array path
76
- * @param {mixed} value - value to set
76
+ * @param {any} value - value to set
77
77
  *
78
78
  * @returns {boolean} true if the value was changed
79
79
  */
80
- export function objectSet(obj: object, path: string | any[], value: mixed, ...args: any[]): boolean;
80
+ export function objectSet(obj: object, path: string | any[], value: any, ...args: any[]): boolean;
81
81
  /**
82
82
  * Removes a value at the specified object path from the object.
83
83
  * - All parent objects that remain empty will be removed too (recursively)
84
84
  *
85
85
  * @param {object} obj - Object to set the value in
86
86
  * @param {string|Array} path - Dot separated string path or array path
87
- * @param {mixed} value - value to set
87
+ * @param {any} value - value to set
88
88
  */
89
89
  export function deletePath(obj: object, path: string | any[]): void;
90
90
  /**
@@ -94,12 +94,12 @@ export function deletePath(obj: object, path: string | any[]): void;
94
94
  * @param {object} obj - Object to get the value from
95
95
  * @param {string|Array} path - Dot separated string path or array path
96
96
  *
97
- * @param {mixed} [defaultValue=undefined]
97
+ * @param {any} [defaultValue=undefined]
98
98
  * Value to return if the value does not exist
99
99
  *
100
- * @return {*} value found at path, defaultValue or undefined
100
+ * @return {any} value found at path, defaultValue or undefined
101
101
  */
102
- export function objectGet(obj: object, path: string | any[], defaultValue?: mixed): any;
102
+ export function objectGet(obj: object, path: string | any[], defaultValue?: any): any;
103
103
  /**
104
104
  * Get a value from an object using a path
105
105
  * - Throws an exception if the path does not exist or the value is undefined
@@ -113,7 +113,7 @@ export function objectGet(obj: object, path: string | any[], defaultValue?: mixe
113
113
  * @throws No value found at path
114
114
  * @throws Invalid value
115
115
  *
116
- * @return {*} value found at path
116
+ * @return {any} value found at path
117
117
  */
118
118
  export function objectGetWithThrow(obj: object, path: string | any[], parseFn?: Function): any;
119
119
  /**
@@ -128,7 +128,7 @@ export function objectGetWithThrow(obj: object, path: string | any[], parseFn?:
128
128
  * DEPRECEATED >>> NOT COMPATIBLE WITH LIGHTWEIGHT ITERATOR
129
129
  * @param {object} [options.unique=false] - Only return unique values
130
130
  *
131
- * @param {mixed} [options.defaultValue]
131
+ * @param {any} [options.defaultValue]
132
132
  * Value to return if the value does not exist
133
133
  *
134
134
  * @returns {Iterator<mixed>} value at the specified path for each item
@@ -241,19 +241,19 @@ export function getTree(obj: object, tree: object, options?: {
241
241
  * - Browser objects
242
242
  * - Functions
243
243
  *
244
- * @param {mixed} objectToBeCloned - Variable to clone
244
+ * @param {any} objectToBeCloned - Variable to clone
245
245
  *
246
- * @returns {mixed} cloned output
246
+ * @returns {any} cloned output
247
247
  */
248
- export function clone(objectToBeCloned: mixed, _seenObjects: any): mixed;
248
+ export function clone(objectToBeCloned: any, _seenObjects: any): any;
249
249
  /**
250
250
  * Set a read only property in an object
251
251
  *
252
252
  * @param {object} obj - Object to set the read only property in
253
253
  * @param {string} propertyName - Name of the property to set
254
- * @param {mixed} value - Value to set
254
+ * @param {any} value - Value to set
255
255
  */
256
- export function setReadOnlyProperty(obj: object, propertyName: string, value: mixed): void;
256
+ export function setReadOnlyProperty(obj: object, propertyName: string, value: any): void;
257
257
  /**
258
258
  * Returns a clone of a (nested) object that has a maximum depth
259
259
  *
@@ -221,9 +221,9 @@ export function keep(obj, keys, removeNullAndUndefined = true) {
221
221
  * - Allows non-objects to be passed as input parameter (non-objects are
222
222
  * immutable by default).
223
223
  *
224
- * @param {mixed} value
224
+ * @param {any} value
225
225
  *
226
- * @returns {mixed}
226
+ * @returns {any}
227
227
  * recursively frozen object or original input value if a non-object was
228
228
  * supplied as input parameter
229
229
  */
@@ -263,7 +263,7 @@ export function deepFreeze(value, _found) {
263
263
  *
264
264
  * @param {object} obj - Object to set the value in
265
265
  * @param {string|Array} path - Dot separated string path or array path
266
- * @param {mixed} value - value to set
266
+ * @param {any} value - value to set
267
267
  *
268
268
  * @returns {boolean} true if the value was changed
269
269
  */
@@ -335,7 +335,7 @@ export function objectSet(obj, path, value) {
335
335
  *
336
336
  * @param {object} obj - Object to set the value in
337
337
  * @param {string|Array} path - Dot separated string path or array path
338
- * @param {mixed} value - value to set
338
+ * @param {any} value - value to set
339
339
  */
340
340
  export function deletePath(obj, path) {
341
341
  expect.object(obj);
@@ -455,10 +455,10 @@ export function deletePath(obj, path) {
455
455
  * @param {object} obj - Object to get the value from
456
456
  * @param {string|Array} path - Dot separated string path or array path
457
457
  *
458
- * @param {mixed} [defaultValue=undefined]
458
+ * @param {any} [defaultValue=undefined]
459
459
  * Value to return if the value does not exist
460
460
  *
461
- * @return {*} value found at path, defaultValue or undefined
461
+ * @return {any} value found at path, defaultValue or undefined
462
462
  */
463
463
  export function objectGet(obj, path, defaultValue) {
464
464
  expect.object(obj);
@@ -502,7 +502,7 @@ export function objectGet(obj, path, defaultValue) {
502
502
  * @throws No value found at path
503
503
  * @throws Invalid value
504
504
  *
505
- * @return {*} value found at path
505
+ * @return {any} value found at path
506
506
  */
507
507
  export function objectGetWithThrow(obj, path, parseFn) {
508
508
  let value = objectGet(obj, path);
@@ -540,7 +540,7 @@ export function objectGetWithThrow(obj, path, parseFn) {
540
540
  * DEPRECEATED >>> NOT COMPATIBLE WITH LIGHTWEIGHT ITERATOR
541
541
  * @param {object} [options.unique=false] - Only return unique values
542
542
  *
543
- * @param {mixed} [options.defaultValue]
543
+ * @param {any} [options.defaultValue]
544
544
  * Value to return if the value does not exist
545
545
  *
546
546
  * @returns {Iterator<mixed>} value at the specified path for each item
@@ -889,9 +889,9 @@ export function getTree(obj, tree, options) {
889
889
  * - Browser objects
890
890
  * - Functions
891
891
  *
892
- * @param {mixed} objectToBeCloned - Variable to clone
892
+ * @param {any} objectToBeCloned - Variable to clone
893
893
  *
894
- * @returns {mixed} cloned output
894
+ * @returns {any} cloned output
895
895
  */
896
896
  export function clone(objectToBeCloned, _seenObjects) {
897
897
  // const startTime = Date.now();
@@ -1017,7 +1017,7 @@ export function clone(objectToBeCloned, _seenObjects) {
1017
1017
  *
1018
1018
  * @param {object} obj - Object to set the read only property in
1019
1019
  * @param {string} propertyName - Name of the property to set
1020
- * @param {mixed} value - Value to set
1020
+ * @param {any} value - Value to set
1021
1021
  */
1022
1022
  export function setReadOnlyProperty(obj, propertyName, value) {
1023
1023
  expect.object(obj);
@@ -4,7 +4,7 @@
4
4
  * - The singleton is identified by a needle string
5
5
  *
6
6
  * @param {object} _
7
- * @param {*} _.class
7
+ * @param {any} _.class
8
8
  * @param {*[]} [_.args] - Constructor arguments
9
9
  * @param {string} [_.needle]
10
10
  * If not supplied, a needle will be constructed from the serialized
@@ -8,7 +8,7 @@ const instancesByNeedle = new Map();
8
8
  * - The singleton is identified by a needle string
9
9
  *
10
10
  * @param {object} _
11
- * @param {*} _.class
11
+ * @param {any} _.class
12
12
  * @param {*[]} [_.args] - Constructor arguments
13
13
  * @param {string} [_.needle]
14
14
  * If not supplied, a needle will be constructed from the serialized
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.0.59",
3
+ "version": "0.0.62",
4
4
  "author": "Jens Kleinhout, HKdigital (https://hkdigital.nl)",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -28,7 +28,8 @@
28
28
  "lint": "prettier --check . && eslint .",
29
29
  "test:unit": "vitest",
30
30
  "test": "npm run test:unit -- --run && npm run test:e2e",
31
- "test:e2e": "playwright test"
31
+ "test:e2e": "playwright test",
32
+ "upgrade:all": "ncu -u && pnpm install"
32
33
  },
33
34
  "files": [
34
35
  "dist",
@@ -100,6 +101,18 @@
100
101
  "types": "./dist/constants/index.d.ts",
101
102
  "svelte": "./dist/constants/index.js"
102
103
  },
104
+ "./constants/errors": {
105
+ "types": "./dist/constants/errors/index.d.ts",
106
+ "svelte": "./dist/constants/errors/index.js"
107
+ },
108
+ "./constants/http": {
109
+ "types": "./dist/constants/http/index.d.ts",
110
+ "svelte": "./dist/constants/http/index.js"
111
+ },
112
+ "./constants/mime": {
113
+ "types": "./dist/constants/mime/index.d.ts",
114
+ "svelte": "./dist/constants/mime/index.js"
115
+ },
103
116
  "./constants/regexp": {
104
117
  "types": "./dist/constants/regexp/index.d.ts",
105
118
  "svelte": "./dist/constants/regexp/index.js"
@@ -136,6 +149,10 @@
136
149
  "types": "./dist/util/function/index.d.ts",
137
150
  "svelte": "./dist/util/function/index.js"
138
151
  },
152
+ "./util/http": {
153
+ "types": "./dist/util/http/index.d.ts",
154
+ "svelte": "./dist/util/http/index.js"
155
+ },
139
156
  "./util/is": {
140
157
  "types": "./dist/util/is/index.d.ts",
141
158
  "svelte": "./dist/util/is/index.js"
@@ -181,31 +198,31 @@
181
198
  "svelte": "^5.0.0"
182
199
  },
183
200
  "devDependencies": {
184
- "@playwright/test": "^1.49.0",
201
+ "@playwright/test": "^1.49.1",
185
202
  "@sveltejs/adapter-auto": "^3.3.1",
186
203
  "@sveltejs/package": "^2.3.7",
187
- "@sveltejs/vite-plugin-svelte": "^4.0.2",
204
+ "@sveltejs/vite-plugin-svelte": "^5.0.2",
188
205
  "@types/eslint": "^9.6.1",
189
206
  "autoprefixer": "^10.4.20",
190
- "eslint": "^9.15.0",
207
+ "eslint": "^9.17.0",
191
208
  "eslint-config-prettier": "^9.1.0",
192
- "eslint-plugin-svelte": "^2.46.0",
193
- "globals": "^15.12.0",
194
- "prettier": "^3.3.3",
209
+ "eslint-plugin-svelte": "^2.46.1",
210
+ "globals": "^15.13.0",
211
+ "prettier": "^3.4.2",
195
212
  "prettier-plugin-svelte": "^3.3.2",
196
213
  "prettier-plugin-tailwindcss": "^0.6.9",
197
214
  "publint": "^0.2.12",
198
- "svelte": "^5.2.7",
199
- "svelte-check": "^4.1.0",
200
- "tailwindcss": "^3.4.15",
215
+ "svelte": "^5.14.1",
216
+ "svelte-check": "^4.1.1",
217
+ "tailwindcss": "^3.4.16",
201
218
  "typescript": "^5.7.2",
202
- "vite": "^5.4.11",
203
- "vitest": "^2.1.5"
219
+ "vite": "^6.0.3",
220
+ "vitest": "^2.1.8"
204
221
  },
205
222
  "dependencies": {
206
- "@sveltejs/kit": "^2.8.3",
207
- "runed": "^0.15.4",
223
+ "@sveltejs/kit": "^2.12.1",
224
+ "runed": "^0.19.0",
208
225
  "valibot": "^0.42.1",
209
- "zod": "^3.23.8"
226
+ "zod": "^3.24.1"
210
227
  }
211
228
  }