@meith/drivers 0.21.1 → 0.22.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/drivers",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,11 +37,11 @@
37
37
  "nodemailer": "^9.0.5",
38
38
  "redis": "^6.2.1",
39
39
  "shiki": "^4.4.3",
40
- "@meith/attachments": "0.21.1",
41
- "@meith/db": "0.21.1",
42
- "@meith/i18n": "0.21.1",
43
- "@meith/core": "0.21.1",
44
- "@meith/settings": "0.21.1"
40
+ "@meith/core": "0.22.0",
41
+ "@meith/db": "0.22.0",
42
+ "@meith/attachments": "0.22.0",
43
+ "@meith/settings": "0.22.0",
44
+ "@meith/i18n": "0.22.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "next": "16.3.1"
package/src/files/keys.ts CHANGED
@@ -1,18 +1,26 @@
1
1
  import { ConfigurationError } from '@meith/core'
2
2
 
3
- export function assertUsableKey(key: string): void {
3
+ export function unusableKeyReason(key: string): string | undefined {
4
4
  if (key === '' || key.trim() !== key) {
5
- throw new ConfigurationError(`Invalid object key: ${JSON.stringify(key)}`)
5
+ return 'is empty, or has leading or trailing whitespace'
6
6
  }
7
7
  if (key.startsWith('/') || key.includes('//')) {
8
- throw new ConfigurationError(`Object key must not contain empty segments: ${key}`)
8
+ return 'has an empty path segment'
9
9
  }
10
10
  if (key.split('/').some((segment) => segment === '..' || segment === '.')) {
11
- throw new ConfigurationError(`Object key must not contain relative segments: ${key}`)
11
+ return 'has a relative path segment'
12
12
  }
13
13
  // biome-ignore lint/suspicious/noControlCharactersInRegex: rejecting control characters is the point
14
14
  if (/[\u0000-\u001f\u007f]/.test(key)) {
15
- throw new ConfigurationError('Object key must not contain control characters.')
15
+ return 'contains a control character'
16
+ }
17
+ return undefined
18
+ }
19
+
20
+ export function assertUsableKey(key: string): void {
21
+ const reason = unusableKeyReason(key)
22
+ if (reason !== undefined) {
23
+ throw new ConfigurationError(`Unusable object key ${JSON.stringify(key)}: it ${reason}.`)
16
24
  }
17
25
  }
18
26
 
@@ -82,9 +82,7 @@ export async function locateAsset(specifier: string, from = process.cwd()): Prom
82
82
  const path = required.resolve(specifier)
83
83
  found.set(key, path)
84
84
  return path
85
- } catch {
86
- /* ignore */
87
- }
85
+ } catch {}
88
86
  }
89
87
 
90
88
  for (const dir of ancestors(from)) {
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export {
6
6
  type BlobFileStoreConfig,
7
7
  type BlobLike,
8
8
  } from './files/blob-file-store'
9
+ export { unusableKeyReason } from './files/keys'
9
10
  export { LocalFileStore } from './files/local-file-store'
10
11
  export { S3FileStore, type S3FileStoreConfig, type S3Like } from './files/s3-file-store'
11
12
  export {