@hkdigital/lib-sveltekit 0.1.103 → 0.2.2

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.
@@ -32,8 +32,6 @@
32
32
  * }
33
33
  */
34
34
 
35
- import { HkPromise } from '../promise';
36
-
37
35
  /** @typedef {import('./typedef').CacheEntry} CacheEntry */
38
36
 
39
37
  /** @typedef {import('./typedef').IDBRequestEvent} IDBRequestEvent */
@@ -347,10 +345,18 @@ export default class IndexedDbCache {
347
345
  return;
348
346
  }
349
347
 
348
+ // Skip old entries or corrupted blobs
349
+ if (!entry.bodyType || entry.bodyType !== 'ab') {
350
+ // Delete old/corrupted entry
351
+ this._deleteEntry(key).catch(console.error);
352
+ resolve(null);
353
+ return;
354
+ }
355
+
350
356
  // Clone Blob before reference becomes invalid
351
357
  let responseBody = entry.body;
352
358
 
353
- if (entry.bodyType === 'arrayBuffer') {
359
+ if (entry.bodyType === 'ab') {
354
360
  // Reconstruct Blob from ArrayBuffer
355
361
  responseBody = new Blob([entry.body], {
356
362
  type: entry.contentType || 'application/octet-stream'
@@ -469,7 +475,7 @@ export default class IndexedDbCache {
469
475
 
470
476
  // Extract response data - handle both browser Response and test mocks
471
477
  let body;
472
- let bodyType = 'arrayBuffer'; // Default to arrayBuffer
478
+ let bodyType = 'ab'; // Default is ArrayBuffer
473
479
  let contentType = '';
474
480
 
475
481
  try {
@@ -14,7 +14,7 @@ import {
14
14
  LOADED,
15
15
  UNLOAD,
16
16
  INITIAL
17
- } from '../loading-state-machine/index.js';
17
+ } from '$lib/classes/svelte/loading-state-machine/index.js';
18
18
 
19
19
  import AudioLoader from './AudioLoader.svelte.js';
20
20
 
@@ -6,7 +6,7 @@ import {
6
6
  NetworkLoader
7
7
  // ERROR_NOT_LOADED
8
8
  // ERROR_TRANSFERRED
9
- } from '../network-loader/index.js';
9
+ } from '$lib/classes/svelte/network-loader/index.js';
10
10
 
11
11
  /**
12
12
  * ImageLoader instance
@@ -16,7 +16,7 @@ import {
16
16
  LOADED,
17
17
  UNLOAD,
18
18
  INITIAL
19
- } from '../loading-state-machine/index.js';
19
+ } from '$lib/classes/svelte/loading-state-machine/index.js';
20
20
 
21
21
  import ImageLoader from './ImageLoader.svelte.js';
22
22
 
@@ -14,7 +14,7 @@ import {
14
14
  LOADED,
15
15
  UNLOAD,
16
16
  INITIAL
17
- } from '../loading-state-machine/index.js';
17
+ } from '$lib/classes/svelte/loading-state-machine/index.js';
18
18
 
19
19
  import * as expect from '../../../util/expect/index.js';
20
20
 
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * Schema to validate an URL
3
3
  */
4
- export const ValidateUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.CustomSchema<any, undefined>]>;
4
+ export const ValidateUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>, v.CustomSchema<any, undefined>]>;
5
5
  /**
6
6
  * Schema to validate an URL or empty string.
7
7
  */
8
- export const ValidateUrlOrEmptyString: v.UnionSchema<[v.LiteralSchema<"", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.UrlAction<string, undefined>]>], undefined>;
8
+ export const ValidateUrlOrEmptyString: v.UnionSchema<[v.LiteralSchema<"", undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>], undefined>;
9
9
  /**
10
10
  * Schema to validate an URL path
11
11
  */
12
- export const ValidateUrlPath: v.SchemaWithPipe<[v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.TransformAction<any, {
12
+ export const ValidateUrlPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.TransformAction<any, {
13
13
  url: URL;
14
14
  value: any;
15
15
  }>, v.CustomSchema<{
@@ -25,6 +25,6 @@ export const ValidateUrlPath: v.SchemaWithPipe<[v.StringSchema<undefined>, v.Cus
25
25
  /**
26
26
  * Schema to validate a relative URL
27
27
  */
28
- export const ValidateRelativeUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.CustomSchema<any, undefined>]>;
29
- export const ValidateAbsOrRelUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.CustomSchema<any, undefined>]>;
28
+ export const ValidateRelativeUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.CustomSchema<any, undefined>]>;
29
+ export const ValidateAbsOrRelUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CustomSchema<any, undefined>, v.CustomSchema<any, undefined>]>;
30
30
  import * as v from 'valibot';
@@ -5,7 +5,7 @@
5
5
  // AbortError,
6
6
  // TimeoutError,
7
7
  // TypeOrValueError
8
- // } from '../../constants/errors/index.js';
8
+ // } from '$lib/constants/errors/index.js';
9
9
 
10
10
  // import { setRequestHeaders } from './headers.js';
11
11
  // import { getErrorFromResponse } from './errors.js';
@@ -1,26 +1,26 @@
1
1
  /**
2
2
  * Schema to validate an URL or empty string.
3
3
  */
4
- export const UrlOrEmptyString: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UnionSchema<[v.LiteralSchema<"", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.UrlAction<string, undefined>]>], undefined>]>;
4
+ export const UrlOrEmptyString: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, v.UnionSchema<[v.LiteralSchema<"", undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>], undefined>]>;
5
5
  /**
6
6
  * Schema to validate an url that may miss the protocol part
7
7
  *
8
8
  * @note an empty string is not allowed!
9
9
  */
10
- export const HumanUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, string>, v.UrlAction<string, undefined>]>;
10
+ export const HumanUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, string>, v.UrlAction<string, undefined>]>;
11
11
  /**
12
12
  * Schema to validate url path, without a search and hash part
13
13
  */
14
- export const UrlPath: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname">, v.TransformAction<URL, string>]>;
14
+ export const UrlPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname">, v.TransformAction<URL, string>]>;
15
15
  /**
16
16
  * Schema to validate a url path, which consists of
17
17
  * a path and optionally search and hash parts
18
18
  */
19
- export const RelativeUrl: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>;
19
+ export const RelativeUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>;
20
20
  /**
21
21
  * Schema to validate an absolute or relative url
22
22
  *
23
23
  * @note an empty string is not allowed!
24
24
  */
25
- export const AbsOrRelUrl: v.UnionSchema<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.UrlAction<string, undefined>]>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>]>], undefined>;
25
+ export const AbsOrRelUrl: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.UrlAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, URL>, v.CustomSchema<URL, "Invalid URL pathname or search part">, v.TransformAction<URL, string>]>]>], undefined>;
26
26
  import * as v from 'valibot';
@@ -1,6 +1,6 @@
1
- export const Name: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
2
- export const Fullname: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
3
- export const Username: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
4
- export const Surname: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
5
- export const PhoneNumber: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
1
+ export const Name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
2
+ export const Fullname: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
3
+ export const Username: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
4
+ export const Surname: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
5
+ export const PhoneNumber: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.RegexAction<string, undefined>]>;
6
6
  import * as v from 'valibot';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.103",
3
+ "version": "0.2.2",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -57,56 +57,56 @@
57
57
  "./typedef": "./dist/typedef/index.js"
58
58
  },
59
59
  "peerDependencies": {
60
- "@eslint/js": "^9.27.0",
60
+ "@eslint/js": "^9.28.0",
61
61
  "@steeze-ui/heroicons": "^2.4.2",
62
- "@sveltejs/kit": "^2.15.2",
62
+ "@sveltejs/kit": "^2.21.2",
63
63
  "eslint-plugin-import": "^2.31.0",
64
- "pino": "^9.6.0",
64
+ "pino": "^9.7.0",
65
65
  "pino-pretty": "^13.0.0",
66
- "runed": "^0.23.0",
67
- "svelte": "^5.0.0",
66
+ "runed": "^0.23.1",
67
+ "svelte": "^5.33.16",
68
68
  "svelte-preprocess": "^6.0.3",
69
- "valibot": "^0.42.1",
69
+ "valibot": "^1.1.0",
70
70
  "zod": "^3.24.2"
71
71
  },
72
72
  "devDependencies": {
73
- "@eslint/js": "^9.27.0",
74
- "@playwright/test": "^1.50.1",
73
+ "@eslint/js": "^9.28.0",
74
+ "@playwright/test": "^1.52.0",
75
75
  "@skeletonlabs/skeleton": "3.0.0-next.2",
76
76
  "@skeletonlabs/skeleton-svelte": "1.0.0-next.4",
77
77
  "@steeze-ui/heroicons": "^2.4.2",
78
- "@sveltejs/adapter-auto": "^4.0.0",
79
- "@sveltejs/package": "2.3.7",
80
- "@sveltejs/vite-plugin-svelte": "^5.0.3",
78
+ "@sveltejs/adapter-auto": "^6.0.1",
79
+ "@sveltejs/package": "^2.3.11",
80
+ "@sveltejs/vite-plugin-svelte": "^5.1.0",
81
81
  "@tailwindcss/typography": "^0.5.16",
82
82
  "@testing-library/svelte": "^5.2.7",
83
83
  "@testing-library/user-event": "^14.6.1",
84
84
  "@types/eslint": "^9.6.1",
85
- "autoprefixer": "^10.4.20",
86
- "eslint": "^9.21.0",
87
- "eslint-config-prettier": "^10.0.2",
85
+ "autoprefixer": "^10.4.21",
86
+ "eslint": "^9.28.0",
87
+ "eslint-config-prettier": "^10.1.5",
88
88
  "eslint-plugin-import": "^2.31.0",
89
- "eslint-plugin-svelte": "^3.0.2",
89
+ "eslint-plugin-svelte": "^3.9.1",
90
90
  "fake-indexeddb": "^6.0.0",
91
- "globals": "^16.0.0",
92
- "jsdom": "^26.0.0",
93
- "pino": "^9.6.0",
91
+ "globals": "^16.2.0",
92
+ "jsdom": "^26.1.0",
93
+ "pino": "^9.7.0",
94
94
  "pino-pretty": "^13.0.0",
95
- "postcss": "^8.5.3",
95
+ "postcss": "^8.5.4",
96
96
  "postcss-mixins": "^11.0.3",
97
97
  "prettier": "^3.5.3",
98
- "prettier-plugin-svelte": "^3.3.3",
99
- "prettier-plugin-tailwindcss": "^0.6.11",
100
- "publint": "^0.3.7",
101
- "standardized-audio-context-mock": "^9.7.16",
102
- "svelte": "^5.20.5",
103
- "svelte-check": "^4.1.4",
98
+ "prettier-plugin-svelte": "^3.4.0",
99
+ "prettier-plugin-tailwindcss": "^0.6.12",
100
+ "publint": "^0.3.12",
101
+ "standardized-audio-context-mock": "^9.7.22",
102
+ "svelte": "^5.33.16",
103
+ "svelte-check": "^4.2.1",
104
104
  "svelte-preprocess": "^6.0.3",
105
105
  "tailwindcss": "^3.4.17",
106
- "typescript": "^5.8.2",
107
- "vite": "^6.2.0",
106
+ "typescript": "^5.8.3",
107
+ "vite": "^6.3.5",
108
108
  "vite-imagetools": "^7.1.0",
109
- "vitest": "^3.0.7",
109
+ "vitest": "^3.2.2",
110
110
  "zod": "^3.24.2"
111
111
  }
112
112
  }