@bejibun/core 0.2.11 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,76 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  ---
5
5
 
6
+ ## [v0.2.13](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.12...v0.2.13) - 2026-02-24
7
+
8
+ ### 🩹 Fixes
9
+
10
+ ### 📖 Changes
11
+ - Added storage options - [#18](https://github.com/Bejibun-Framework/bejibun-core/pull/18)
12
+
13
+ ```ts
14
+ export type StorageOptions = {
15
+ mode?: number;
16
+ createPath?: boolean;
17
+ acl?:
18
+ | "private"
19
+ | "public-read"
20
+ | "public-read-write"
21
+ | "aws-exec-read"
22
+ | "authenticated-read"
23
+ | "bucket-owner-read"
24
+ | "bucket-owner-full-control"
25
+ | "log-delivery-write";
26
+ bucket?: string;
27
+ region?: string;
28
+ accessKeyId?: string;
29
+ secretAccessKey?: string;
30
+ sessionToken?: string;
31
+ endpoint?: string;
32
+ virtualHostedStyle?: boolean;
33
+ partSize?: number;
34
+ queueSize?: number;
35
+ retry?: number;
36
+ type?: string;
37
+ contentDisposition?: string | undefined;
38
+ storageClass?:
39
+ | "STANDARD"
40
+ | "DEEP_ARCHIVE"
41
+ | "EXPRESS_ONEZONE"
42
+ | "GLACIER"
43
+ | "GLACIER_IR"
44
+ | "INTELLIGENT_TIERING"
45
+ | "ONEZONE_IA"
46
+ | "OUTPOSTS"
47
+ | "REDUCED_REDUNDANCY"
48
+ | "SNOW"
49
+ | "STANDARD_IA";
50
+ requestPayer?: boolean;
51
+ highWaterMark?: number;
52
+ };
53
+ ```
54
+
55
+ ### ❤️Contributors
56
+ - Havea Crenata ([@crenata](https://github.com/crenata))
57
+
58
+ **Full Changelog**: https://github.com/Bejibun-Framework/bejibun-core/blob/master/CHANGELOG.md
59
+
60
+ ---
61
+
62
+ ## [v0.2.12](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.1...v0.2.12) - 2026-02-22
63
+
64
+ ### 🩹 Fixes
65
+
66
+ ### 📖 Changes
67
+ - Added backward compatibility for queue jobs.
68
+
69
+ ### ❤️Contributors
70
+ - Havea Crenata ([@crenata](https://github.com/crenata))
71
+
72
+ **Full Changelog**: https://github.com/Bejibun-Framework/bejibun-core/blob/master/CHANGELOG.md
73
+
74
+ ---
75
+
6
76
  ## [v0.2.11](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.1...v0.2.11) - 2026-02-13
7
77
 
8
78
  ### 🩹 Fixes
@@ -11,15 +11,20 @@ export default class NamespaceBuilder {
11
11
  return parts.join("/");
12
12
  }
13
13
  async walk(directory) {
14
- const entries = readdirSync(directory, { withFileTypes: true });
15
- const files = await Promise.all(entries.map((entry) => {
16
- const fullPath = join(directory, entry.name);
17
- return entry.isDirectory() ?
18
- this.walk(fullPath) :
19
- ((fullPath.endsWith(".ts") ||
20
- fullPath.endsWith(".js")) ? [fullPath] : []);
21
- }));
22
- return files.flat();
14
+ try {
15
+ const entries = readdirSync(directory, { withFileTypes: true });
16
+ const files = await Promise.all(entries.map((entry) => {
17
+ const fullPath = join(directory, entry.name);
18
+ return entry.isDirectory() ?
19
+ this.walk(fullPath) :
20
+ ((fullPath.endsWith(".ts") ||
21
+ fullPath.endsWith(".js")) ? [fullPath] : []);
22
+ }));
23
+ return files.flat();
24
+ }
25
+ catch {
26
+ return [];
27
+ }
23
28
  }
24
29
  async load(directory) {
25
30
  const files = await this.walk(directory);
@@ -1,4 +1,4 @@
1
- import { StorageDisk } from "../types/storage";
1
+ import type { StorageDisk, StorageOptions } from "../types/storage";
2
2
  export default class StorageBuilder {
3
3
  protected conf: Record<string, any>;
4
4
  protected overrideDisk?: StorageDisk;
@@ -13,6 +13,6 @@ export default class StorageBuilder {
13
13
  exists(filepath: string): Promise<boolean>;
14
14
  missing(filepath: string): Promise<boolean>;
15
15
  get(filepath: string): Promise<any>;
16
- put(filepath: string, content: any): Promise<void>;
16
+ put(filepath: string, content: any, options?: StorageOptions): Promise<void>;
17
17
  delete(filepath: string): Promise<void>;
18
18
  }
@@ -104,7 +104,7 @@ export default class StorageBuilder {
104
104
  }
105
105
  return data;
106
106
  }
107
- async put(filepath, content) {
107
+ async put(filepath, content, options) {
108
108
  if (isEmpty(filepath))
109
109
  throw new DiskException("The file path is required.");
110
110
  if (isEmpty(content))
@@ -112,10 +112,10 @@ export default class StorageBuilder {
112
112
  try {
113
113
  switch (this.driver) {
114
114
  case DiskDriverEnum.Local:
115
- await Bun.write(path.resolve(this.currentDisk.root, filepath), content);
115
+ await Bun.write(path.resolve(this.currentDisk.root, filepath), content, options);
116
116
  break;
117
117
  case DiskDriverEnum.S3:
118
- await this.s3.write(filepath, content);
118
+ await this.s3.write(filepath, content, options);
119
119
  break;
120
120
  default:
121
121
  break;
@@ -1,11 +1,11 @@
1
+ import type { StorageDisk, StorageOptions } from "../types/storage";
1
2
  import StorageBuilder from "../builders/StorageBuilder";
2
- import { StorageDisk } from "../types/storage";
3
3
  export default class Storage {
4
4
  static build(disk: StorageDisk): StorageBuilder;
5
5
  static disk(disk: string): StorageBuilder;
6
6
  static exists(path: string): Promise<boolean>;
7
7
  static missing(path: string): Promise<boolean>;
8
8
  static get(path: string): Promise<any>;
9
- static put(path: string, content: any): Promise<void>;
9
+ static put(path: string, content: any, options?: StorageOptions): Promise<void>;
10
10
  static delete(path: string): Promise<any>;
11
11
  }
@@ -15,7 +15,7 @@ export default class Storage {
15
15
  static async get(path) {
16
16
  return await new StorageBuilder().get(path);
17
17
  }
18
- static async put(path, content) {
18
+ static async put(path, content, options) {
19
19
  return await new StorageBuilder().put(path, content);
20
20
  }
21
21
  static async delete(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bejibun/core",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "author": "Havea Crenata <havea.crenata@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
package/types/router.d.ts CHANGED
@@ -4,19 +4,19 @@ export type HandlerType = (request: Bun.BunRequest, server: Bun.Server) => Promi
4
4
  export type RouterMethodMap = Record<string, HandlerType>;
5
5
  export type RouterGroup = Record<string, RouterMethodMap | RouterGroup>;
6
6
  export type RawRoute = {
7
- prefix: string,
8
- middlewares: Array<IMiddleware>,
9
- namespace: string,
10
- method: string,
11
- path: string,
12
- handler: string | HandlerType
7
+ prefix: string;
8
+ middlewares: Array<IMiddleware>;
9
+ namespace: string;
10
+ method: string;
11
+ path: string;
12
+ handler: string | HandlerType;
13
13
  };
14
14
  export type Route = {
15
- raw: RawRoute,
16
- route: RouterGroup
15
+ raw: RawRoute;
16
+ route: RouterGroup;
17
17
  };
18
18
  export type RawsRoute = {
19
- raws: Array<Route>,
20
- routes: Array<RouterGroup>
19
+ raws: Array<Route>;
20
+ routes: Array<RouterGroup>;
21
21
  };
22
22
  export type ResourceAction = "index" | "store" | "show" | "update" | "destroy";
@@ -1,4 +1,44 @@
1
1
  export type StorageDisk = {
2
- driver: string,
3
- [key: string]: unknown
2
+ driver: string;
3
+ [key: string]: unknown;
4
+ };
5
+
6
+ export type StorageOptions = {
7
+ mode?: number;
8
+ createPath?: boolean;
9
+ acl?:
10
+ | "private"
11
+ | "public-read"
12
+ | "public-read-write"
13
+ | "aws-exec-read"
14
+ | "authenticated-read"
15
+ | "bucket-owner-read"
16
+ | "bucket-owner-full-control"
17
+ | "log-delivery-write";
18
+ bucket?: string;
19
+ region?: string;
20
+ accessKeyId?: string;
21
+ secretAccessKey?: string;
22
+ sessionToken?: string;
23
+ endpoint?: string;
24
+ virtualHostedStyle?: boolean;
25
+ partSize?: number;
26
+ queueSize?: number;
27
+ retry?: number;
28
+ type?: string;
29
+ contentDisposition?: string | undefined;
30
+ storageClass?:
31
+ | "STANDARD"
32
+ | "DEEP_ARCHIVE"
33
+ | "EXPRESS_ONEZONE"
34
+ | "GLACIER"
35
+ | "GLACIER_IR"
36
+ | "INTELLIGENT_TIERING"
37
+ | "ONEZONE_IA"
38
+ | "OUTPOSTS"
39
+ | "REDUCED_REDUNDANCY"
40
+ | "SNOW"
41
+ | "STANDARD_IA";
42
+ requestPayer?: boolean;
43
+ highWaterMark?: number;
4
44
  };