@getstrata/core 2.2.26 → 2.2.28

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @getstrata/core changelog
2
2
 
3
+ ## 2.2.28
4
+
5
+ Generated JSON and HTML password resets validate input before consuming signed links and atomically commit token consumption, password updates and credential revocation. Adds real generated-app failure, retry, replay and cookie/token/JWT revocation regressions.
6
+
7
+ ## 2.2.27
8
+
9
+ Storage distinguishes missing objects from filesystem, authorization, missing-bucket and transport failures; S3 reads use a single native GET. Adds native Bun protocol regressions and documents failure/reconciliation contracts.
10
+
3
11
  ## 2.2.26
4
12
 
5
13
  - Integer validation checks complete safe values instead of accepting numeric prefixes. Whole signed decimal form strings, optional values and existing error messages remain supported; `allowNumericStrings: false` requires JSON numbers. Validated strings are not implicitly cast. Invalid range bounds reject at configuration time.
@@ -1,4 +1,5 @@
1
1
  import { S3Client } from "bun";
2
+ /** Missing objects are null/false; all other failures reject. */
2
3
  interface StorageDriver {
3
4
  put(path: string, contents: string | Uint8Array): Promise<string>;
4
5
  get(path: string): Promise<Uint8Array | null>;
@@ -530,6 +530,10 @@ function assertUrlPathUnderRoot(rootDirectory, urlPathname) {
530
530
  }
531
531
 
532
532
  // ../../src/core/storage/storage.ts
533
+ function hasErrorCode(error, code) {
534
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
535
+ }
536
+
533
537
  class LocalStorageDriver {
534
538
  rootDirectory;
535
539
  constructor(rootDirectory) {
@@ -550,16 +554,20 @@ class LocalStorageDriver {
550
554
  async get(path) {
551
555
  try {
552
556
  return await readFile(this.resolvePath(path));
553
- } catch {
554
- return null;
557
+ } catch (error) {
558
+ if (hasErrorCode(error, "ENOENT"))
559
+ return null;
560
+ throw error;
555
561
  }
556
562
  }
557
563
  async delete(path) {
558
564
  try {
559
565
  await unlink(this.resolvePath(path));
560
566
  return true;
561
- } catch {
562
- return false;
567
+ } catch (error) {
568
+ if (hasErrorCode(error, "ENOENT"))
569
+ return false;
570
+ throw error;
563
571
  }
564
572
  }
565
573
  }
@@ -575,18 +583,22 @@ class S3StorageDriver {
575
583
  }
576
584
  async get(path) {
577
585
  const normalizedPath = path.replace(/^\/+/, "");
578
- const file = this.client.file(normalizedPath);
579
- if (!await file.exists()) {
580
- return null;
586
+ try {
587
+ return new Uint8Array(await this.client.file(normalizedPath).arrayBuffer());
588
+ } catch (error) {
589
+ if (hasErrorCode(error, "NoSuchKey"))
590
+ return null;
591
+ throw error;
581
592
  }
582
- return new Uint8Array(await file.arrayBuffer());
583
593
  }
584
594
  async delete(path) {
585
595
  try {
586
596
  await this.client.unlink(path.replace(/^\/+/, ""));
587
597
  return true;
588
- } catch {
589
- return false;
598
+ } catch (error) {
599
+ if (hasErrorCode(error, "NoSuchKey"))
600
+ return false;
601
+ throw error;
590
602
  }
591
603
  }
592
604
  }
@@ -26,6 +26,10 @@ function assertUrlPathUnderRoot(rootDirectory, urlPathname) {
26
26
  }
27
27
 
28
28
  // ../../src/core/storage/storage.ts
29
+ function hasErrorCode(error, code) {
30
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
31
+ }
32
+
29
33
  class LocalStorageDriver {
30
34
  rootDirectory;
31
35
  constructor(rootDirectory) {
@@ -46,16 +50,20 @@ class LocalStorageDriver {
46
50
  async get(path) {
47
51
  try {
48
52
  return await readFile(this.resolvePath(path));
49
- } catch {
50
- return null;
53
+ } catch (error) {
54
+ if (hasErrorCode(error, "ENOENT"))
55
+ return null;
56
+ throw error;
51
57
  }
52
58
  }
53
59
  async delete(path) {
54
60
  try {
55
61
  await unlink(this.resolvePath(path));
56
62
  return true;
57
- } catch {
58
- return false;
63
+ } catch (error) {
64
+ if (hasErrorCode(error, "ENOENT"))
65
+ return false;
66
+ throw error;
59
67
  }
60
68
  }
61
69
  }
@@ -71,18 +79,22 @@ class S3StorageDriver {
71
79
  }
72
80
  async get(path) {
73
81
  const normalizedPath = path.replace(/^\/+/, "");
74
- const file = this.client.file(normalizedPath);
75
- if (!await file.exists()) {
76
- return null;
82
+ try {
83
+ return new Uint8Array(await this.client.file(normalizedPath).arrayBuffer());
84
+ } catch (error) {
85
+ if (hasErrorCode(error, "NoSuchKey"))
86
+ return null;
87
+ throw error;
77
88
  }
78
- return new Uint8Array(await file.arrayBuffer());
79
89
  }
80
90
  async delete(path) {
81
91
  try {
82
92
  await this.client.unlink(path.replace(/^\/+/, ""));
83
93
  return true;
84
- } catch {
85
- return false;
94
+ } catch (error) {
95
+ if (hasErrorCode(error, "NoSuchKey"))
96
+ return false;
97
+ throw error;
86
98
  }
87
99
  }
88
100
  }
package/dist/index.js CHANGED
@@ -11129,6 +11129,10 @@ function assertUrlPathUnderRoot(rootDirectory, urlPathname) {
11129
11129
  }
11130
11130
 
11131
11131
  // ../../src/core/storage/storage.ts
11132
+ function hasErrorCode(error, code) {
11133
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
11134
+ }
11135
+
11132
11136
  class LocalStorageDriver {
11133
11137
  rootDirectory;
11134
11138
  constructor(rootDirectory) {
@@ -11149,16 +11153,20 @@ class LocalStorageDriver {
11149
11153
  async get(path) {
11150
11154
  try {
11151
11155
  return await readFile(this.resolvePath(path));
11152
- } catch {
11153
- return null;
11156
+ } catch (error) {
11157
+ if (hasErrorCode(error, "ENOENT"))
11158
+ return null;
11159
+ throw error;
11154
11160
  }
11155
11161
  }
11156
11162
  async delete(path) {
11157
11163
  try {
11158
11164
  await unlink(this.resolvePath(path));
11159
11165
  return true;
11160
- } catch {
11161
- return false;
11166
+ } catch (error) {
11167
+ if (hasErrorCode(error, "ENOENT"))
11168
+ return false;
11169
+ throw error;
11162
11170
  }
11163
11171
  }
11164
11172
  }
@@ -11174,18 +11182,22 @@ class S3StorageDriver {
11174
11182
  }
11175
11183
  async get(path) {
11176
11184
  const normalizedPath = path.replace(/^\/+/, "");
11177
- const file = this.client.file(normalizedPath);
11178
- if (!await file.exists()) {
11179
- return null;
11185
+ try {
11186
+ return new Uint8Array(await this.client.file(normalizedPath).arrayBuffer());
11187
+ } catch (error) {
11188
+ if (hasErrorCode(error, "NoSuchKey"))
11189
+ return null;
11190
+ throw error;
11180
11191
  }
11181
- return new Uint8Array(await file.arrayBuffer());
11182
11192
  }
11183
11193
  async delete(path) {
11184
11194
  try {
11185
11195
  await this.client.unlink(path.replace(/^\/+/, ""));
11186
11196
  return true;
11187
- } catch {
11188
- return false;
11197
+ } catch (error) {
11198
+ if (hasErrorCode(error, "NoSuchKey"))
11199
+ return false;
11200
+ throw error;
11189
11201
  }
11190
11202
  }
11191
11203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/core",
3
- "version": "2.2.26",
3
+ "version": "2.2.28",
4
4
  "description": "Strata Bun framework public API",
5
5
  "type": "module",
6
6
  "license": "MIT",