@hkdigital/lib-core 0.4.12 → 0.4.13

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 (133) hide show
  1. package/README.md +4 -1
  2. package/dist/auth/errors.d.ts +1 -1
  3. package/dist/auth/errors.js +1 -1
  4. package/dist/auth/jwt/constants.d.ts +6 -0
  5. package/dist/auth/jwt/constants.js +13 -0
  6. package/dist/auth/jwt/core.d.ts +38 -0
  7. package/dist/auth/jwt/core.js +114 -0
  8. package/dist/auth/jwt/errors.d.ts +39 -0
  9. package/dist/auth/jwt/errors.js +74 -0
  10. package/dist/auth/jwt/generators.d.ts +29 -0
  11. package/dist/auth/jwt/generators.js +53 -0
  12. package/dist/auth/jwt/typedef.d.ts +159 -0
  13. package/dist/auth/jwt/typedef.js +72 -0
  14. package/dist/auth/jwt/util.d.ts +6 -0
  15. package/dist/auth/jwt/util.js +43 -0
  16. package/dist/auth/jwt.d.ts +4 -0
  17. package/dist/auth/jwt.js +12 -0
  18. package/dist/generic/data/classes/IterableTree.js +1 -1
  19. package/dist/generic/data/classes/Selector.js +1 -1
  20. package/dist/generic/promises/classes/HkPromise.js +1 -1
  21. package/dist/generic/streaming/classes/ServerEventsStore.js +1 -1
  22. package/dist/generic/typedef.d.ts +2 -0
  23. package/dist/generic/typedef.js +2 -0
  24. package/dist/logging/internal/adapters/console.js +3 -3
  25. package/dist/logging/internal/adapters/pino.js +17 -3
  26. package/dist/logging/internal/adapters/pino.js__ +260 -0
  27. package/dist/logging/internal/test-errors.js +3 -2
  28. package/dist/network/http/errors.js +10 -4
  29. package/dist/network/http/headers.js +1 -1
  30. package/dist/network/http/http-request.js +1 -1
  31. package/dist/network/http/json-request.js +1 -1
  32. package/dist/network/http/response.js +1 -1
  33. package/dist/network/loaders/audio/AudioScene.svelte.js +1 -1
  34. package/dist/network/loaders/image/ImageScene.svelte.js +1 -1
  35. package/dist/network/loaders/image/utils/index.js +1 -1
  36. package/dist/network/states/NetworkLoader.svelte.js +1 -1
  37. package/dist/network/typedef.d.ts +2 -0
  38. package/dist/network/typedef.js +3 -1
  39. package/dist/services/service-base/ServiceBase.js +1 -3
  40. package/dist/services/typedef.d.ts +2 -0
  41. package/dist/services/typedef.js +2 -0
  42. package/dist/state/typedef.d.ts +3 -0
  43. package/dist/state/typedef.js +3 -0
  44. package/dist/ui/components/drag-drop/drag-state.svelte.d.ts +3 -3
  45. package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +3 -3
  46. package/dist/ui/components/presenter/util.js +1 -1
  47. package/dist/ui/components/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
  48. package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +3 -3
  49. package/dist/util/array/index.d.ts +0 -4
  50. package/dist/util/array/index.js +1 -5
  51. package/dist/util/array.d.ts +1 -0
  52. package/dist/util/array.js +9 -0
  53. package/dist/util/bases/base64.d.ts +8 -0
  54. package/dist/util/bases/base64.js +23 -0
  55. package/dist/util/bases/index.d.ts +0 -1
  56. package/dist/util/bases/index.js +0 -1
  57. package/dist/util/bases.d.ts +2 -0
  58. package/dist/util/bases.js +10 -0
  59. package/dist/util/compare.d.ts +1 -0
  60. package/dist/util/compare.js +9 -0
  61. package/dist/util/css/index.d.ts +0 -1
  62. package/dist/util/css/index.js +0 -1
  63. package/dist/util/css.d.ts +1 -0
  64. package/dist/util/css.js +8 -0
  65. package/dist/util/env.d.ts +1 -0
  66. package/dist/util/env.js +8 -0
  67. package/dist/util/exceptions.d.ts +1 -0
  68. package/dist/util/exceptions.js +8 -0
  69. package/dist/util/expect/arrays.js +2 -0
  70. package/dist/util/expect/compounds.d.ts +20 -0
  71. package/dist/util/expect/compounds.js +48 -0
  72. package/dist/util/expect/objects.d.ts +28 -0
  73. package/dist/util/expect/objects.js +70 -0
  74. package/dist/util/expect/primitives.d.ts +31 -1
  75. package/dist/util/expect/primitives.js +56 -0
  76. package/dist/util/expect/values.d.ts +26 -0
  77. package/dist/util/expect/values.js +48 -0
  78. package/dist/util/expect.d.ts +6 -0
  79. package/dist/util/expect.js +31 -0
  80. package/dist/util/function/index.js +1 -1
  81. package/dist/util/function.d.ts +1 -0
  82. package/dist/util/function.js +8 -0
  83. package/dist/util/geometry.d.ts +1 -0
  84. package/dist/util/geometry.js +9 -0
  85. package/dist/util/is.d.ts +1 -0
  86. package/dist/util/is.js +8 -0
  87. package/dist/util/iterate/index.js +1 -1
  88. package/dist/util/iterate.d.ts +1 -0
  89. package/dist/util/iterate.js +8 -0
  90. package/dist/util/object/index.js +2 -2
  91. package/dist/util/object.d.ts +1 -0
  92. package/dist/util/object.js +8 -0
  93. package/dist/util/random/bytes.d.ts +28 -0
  94. package/dist/util/random/bytes.js +72 -0
  95. package/dist/util/random.d.ts +1 -0
  96. package/dist/util/random.js +9 -0
  97. package/dist/util/singleton/index.js +1 -1
  98. package/dist/util/singleton.d.ts +1 -0
  99. package/dist/util/singleton.js +8 -0
  100. package/dist/util/ssr.d.ts +1 -0
  101. package/dist/util/ssr.js +8 -0
  102. package/dist/util/string/convert.js +1 -1
  103. package/dist/util/string/index.d.ts +0 -5
  104. package/dist/util/string/index.js +0 -5
  105. package/dist/util/string/interpolate.js +1 -1
  106. package/dist/util/string.d.ts +5 -0
  107. package/dist/util/string.js +12 -0
  108. package/dist/util/svelte/index.d.ts +0 -3
  109. package/dist/util/svelte/index.js +0 -4
  110. package/dist/util/svelte.d.ts +3 -0
  111. package/dist/util/svelte.js +11 -0
  112. package/dist/util/sveltekit/index.d.ts +0 -1
  113. package/dist/util/sveltekit/index.js +0 -1
  114. package/dist/util/sveltekit/route-folders/index.js +1 -1
  115. package/dist/util/sveltekit.d.ts +1 -0
  116. package/dist/util/sveltekit.js +8 -0
  117. package/dist/util/time/index.d.ts +7 -0
  118. package/dist/util/time/index.js +12 -1
  119. package/dist/util/time.d.ts +1 -0
  120. package/dist/util/time.js +1 -0
  121. package/dist/util/unique.d.ts +1 -0
  122. package/dist/util/unique.js +8 -0
  123. package/dist/valibot/{index.d.ts → valibot.d.ts} +1 -2
  124. package/dist/valibot/{index.js → valibot.js} +1 -6
  125. package/package.json +3 -1
  126. package/dist/auth/errors/jwt.d.ts +0 -8
  127. package/dist/auth/errors/jwt.js +0 -5
  128. package/dist/util/expect/index.d.ts +0 -103
  129. package/dist/util/expect/index.js +0 -259
  130. package/dist/util/index.d.ts +0 -10
  131. /package/dist/util/{geo → geometry}/index.d.ts +0 -0
  132. /package/dist/util/{geo → geometry}/index.js +0 -0
  133. /package/dist/util/{index.js → index.js__} +0 -0
@@ -1,259 +0,0 @@
1
- /**
2
- * Validation functions that can be used as safe guards in your code
3
- *
4
- * @example
5
- *
6
- * import * as expect from '<path>/expect.js';
7
- *
8
- * function logText( text )
9
- * {
10
- * expect.string( text );
11
- * expect.true( 1 > 0 );
12
- *
13
- * console.log( text );
14
- * }
15
- *
16
- * logText( 'Hello' );
17
- * logText( 123 ); // <- Will throw an exception
18
- */
19
-
20
- import * as v from 'valibot';
21
-
22
- import * as is from '../is/index.js';
23
-
24
- /** Internals */
25
-
26
- const ObjectSchema = v.custom(is.object, `Invalid type: Expected object`);
27
-
28
- /** Exports */
29
-
30
- export * from './arrays.js';
31
- export * from './primitives.js';
32
- export * from './url.js';
33
-
34
- // > Base objects
35
-
36
- /**
37
- * Throws a validation error if value is not an object
38
- *
39
- * @param {any} value
40
- */
41
- function object_(value) {
42
- v.parse(ObjectSchema, value);
43
- // v.parse(v.looseObject({}), value);
44
- }
45
-
46
- export { object_ as object };
47
-
48
- /**
49
- * Throws a validation error if value is not a function
50
- *
51
- * @param {any} value
52
- */
53
- function function_(value) {
54
- v.parse(v.function(), value);
55
- }
56
-
57
- export { function_ as function };
58
-
59
- export { function_ as class };
60
-
61
- /**
62
- * Throws a validation error if value is not a Promise
63
- *
64
- * @param {any} value
65
- */
66
- function promise_(value) {
67
- v.parse(v.instance(Promise), value);
68
- }
69
-
70
- export { promise_ as promise };
71
-
72
- /**
73
- * Throws a validation error if value is not a Map
74
- *
75
- * @param {any} value
76
- */
77
- function map_(value) {
78
- v.parse(v.instance(Map), value);
79
- }
80
-
81
- export { map_ as map };
82
-
83
- /**
84
- * Throws a validation error if value is not a Set
85
- *
86
- * @param {any} value
87
- */
88
- function set_(value) {
89
- v.parse(v.instance(Set), value);
90
- }
91
-
92
- export { set_ as set };
93
-
94
- /**
95
- * Throws a validation error if value is not an Error instance
96
- *
97
- * @param {any} value
98
- */
99
- export function error_(value) {
100
- v.parse(v.instance(Map), value);
101
- }
102
-
103
- export { error_ as error };
104
-
105
- // > Common values
106
-
107
- /**
108
- * Expect a value not to be null
109
- *
110
- * @param {any} value
111
- */
112
- export function notNull(value) {
113
- v.notValue(null, value);
114
- }
115
-
116
- /**
117
- * Expect a value to be a boolean and true
118
- *
119
- * @param {any} value
120
- */
121
- export function _true(value) {
122
- v.value(true, value);
123
- }
124
-
125
- export { _true as true };
126
-
127
- // > Compounds
128
-
129
- /**
130
- * Expect a positive number
131
- *
132
- * @param {any} value
133
- */
134
- export function positiveNumber(value) {
135
- const schema = v.pipe(v.number(), v.minValue(0));
136
- v.parse(schema, value);
137
- }
138
-
139
- // notNegativeNumber
140
- // positiveInteger
141
- // notNegativeInteger
142
-
143
- // stringOrNull
144
- // stringOrUndefined
145
-
146
- /**
147
- * Throws a validation error if value is not a string
148
- *
149
- * @param {any} value
150
- */
151
- export function notEmptyString(value) {
152
- const schema = v.pipe(v.string(), v.minLength(1));
153
-
154
- v.parse(schema, value);
155
- }
156
-
157
- // notEmptyStringOrNull
158
-
159
- // asyncIterator
160
- // iterable
161
-
162
- /**
163
- * Throws a validation error if value is not iterable
164
- *
165
- * @param {any} value
166
- */
167
- export function iterable(value) {
168
- const schema = v.pipe(v.looseObject({ [Symbol.iterator]: v.function() }));
169
-
170
- v.parse(schema, value);
171
- }
172
-
173
- // iterator
174
-
175
- /**
176
- * Throws a validation error if value is not a a store (has not subscribe
177
- * method)
178
- *
179
- * @param {any} value
180
- */
181
- export function store(value) {
182
- v.parse(
183
- v.custom((value) => {
184
- if (!is.object(value) || typeof value?.subscribe !== 'function') {
185
- return false;
186
- }
187
-
188
- return true;
189
- }),
190
- value
191
- );
192
- }
193
-
194
- // ArrayBuffer
195
- // arrayOrUndefined
196
- // arangoCollectionId
197
- // uriComponent
198
-
199
- /**
200
- * Throws a validation error if value is not an object or the value
201
- * is an array
202
- *
203
- * @param {any} value
204
- */
205
- export function objectNoArray(value) {
206
- v.parse(
207
- v.custom((value) => {
208
- if (!is.object(value) || value instanceof Array) {
209
- return false;
210
- }
211
-
212
- return true;
213
- }),
214
- value
215
- );
216
- }
217
-
218
- /**
219
- * Throws a validation error if value is not an object or the value
220
- * is a function
221
- *
222
- * @param {any} value
223
- */
224
- export function objectNoFunction(value) {
225
- v.parse(
226
- v.custom((value) => {
227
- if (!is.object(value) || typeof value === 'function') {
228
- return false;
229
- }
230
-
231
- return true;
232
- }),
233
- value
234
- );
235
- }
236
-
237
- /**
238
- * Throws a validation error if value is not an object or null
239
- *
240
- * @param {any} value
241
- */
242
- export function objectOrNull(value) {
243
- v.parse(v.union([v.literal(null), v.looseObject({})]), value);
244
- }
245
-
246
- // objectOrUndefined
247
- // objectPath
248
-
249
- /**
250
- * Throws a validation error if value is not an array or Set
251
- *
252
- * @param {any} value
253
- */
254
- export function arrayOrSet(value) {
255
- v.parse(v.union([v.instance(Array), v.instance(Set)]), value);
256
- }
257
-
258
- // setOfStrings
259
- // emptyStringOrSymbol
@@ -1,10 +0,0 @@
1
- export { rethrow } from "./exceptions/index.js";
2
- export * as expect from "./expect/index.js";
3
- export * as is from "./is/index.js";
4
- export * as object from "./object/index.js";
5
- export * as singleton from "./singleton/index.js";
6
- /** @type {typeof originalValibot & { _parse: any }} */
7
- export const v: typeof originalValibot & {
8
- _parse: any;
9
- };
10
- import * as originalValibot from 'valibot';
File without changes
File without changes
File without changes