@bejibun/core 0.2.12 → 0.2.14

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,7 +3,77 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  ---
5
5
 
6
- ## [v0.2.12](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.1...v0.2.12) - 2026-02-13
6
+ ## [v0.2.14](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.13...v0.2.14) - 2026-02-27
7
+
8
+ ### 🩹 Fixes
9
+
10
+ ### 📖 Changes
11
+ - Added support transaction for soft deletes
12
+
13
+ ### ❤️Contributors
14
+ - Havea Crenata ([@crenata](https://github.com/crenata))
15
+
16
+ **Full Changelog**: https://github.com/Bejibun-Framework/bejibun-core/blob/master/CHANGELOG.md
17
+
18
+ ---
19
+
20
+ ## [v0.2.13](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.12...v0.2.13) - 2026-02-24
21
+
22
+ ### 🩹 Fixes
23
+
24
+ ### 📖 Changes
25
+ - Added storage options - [#18](https://github.com/Bejibun-Framework/bejibun-core/pull/18)
26
+
27
+ ```ts
28
+ export type StorageOptions = {
29
+ mode?: number;
30
+ createPath?: boolean;
31
+ acl?:
32
+ | "private"
33
+ | "public-read"
34
+ | "public-read-write"
35
+ | "aws-exec-read"
36
+ | "authenticated-read"
37
+ | "bucket-owner-read"
38
+ | "bucket-owner-full-control"
39
+ | "log-delivery-write";
40
+ bucket?: string;
41
+ region?: string;
42
+ accessKeyId?: string;
43
+ secretAccessKey?: string;
44
+ sessionToken?: string;
45
+ endpoint?: string;
46
+ virtualHostedStyle?: boolean;
47
+ partSize?: number;
48
+ queueSize?: number;
49
+ retry?: number;
50
+ type?: string;
51
+ contentDisposition?: string | undefined;
52
+ storageClass?:
53
+ | "STANDARD"
54
+ | "DEEP_ARCHIVE"
55
+ | "EXPRESS_ONEZONE"
56
+ | "GLACIER"
57
+ | "GLACIER_IR"
58
+ | "INTELLIGENT_TIERING"
59
+ | "ONEZONE_IA"
60
+ | "OUTPOSTS"
61
+ | "REDUCED_REDUNDANCY"
62
+ | "SNOW"
63
+ | "STANDARD_IA";
64
+ requestPayer?: boolean;
65
+ highWaterMark?: number;
66
+ };
67
+ ```
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
+
76
+ ## [v0.2.12](https://github.com/Bejibun-Framework/bejibun-core/compare/v0.2.1...v0.2.12) - 2026-02-22
7
77
 
8
78
  ### 🩹 Fixes
9
79
 
@@ -20,11 +20,11 @@ export default class BaseModel extends Model {
20
20
  $beforeUpdate(opt: ModelOptions, queryContext: QueryContext): void;
21
21
  static setNamespace(namespace: string): void;
22
22
  static query<T extends Model>(this: Constructor<T>, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
23
- static withTrashed<T extends Model>(this: T): QueryBuilderType<T>;
24
- static onlyTrashed<T extends Model>(this: T): QueryBuilderType<T>;
25
- static all<T extends Model>(this: T): QueryBuilderType<T>;
26
- static create<T extends Model>(this: T, payload: Record<string, any>): QueryBuilderType<T>;
27
- static find<T extends Model>(this: T, id: bigint | number | string): QueryBuilderType<T>;
28
- static findOrFail<T extends Model>(this: T, id: bigint | number | string): Promise<T>;
23
+ static withTrashed<T extends Model>(this: T, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
24
+ static onlyTrashed<T extends Model>(this: T, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
25
+ static all<T extends Model>(this: T, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
26
+ static create<T extends Model>(this: T, payload: Record<string, any>, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
27
+ static find<T extends Model>(this: T, id: bigint | number | string, trxOrKnex?: TransactionOrKnex): QueryBuilderType<T>;
28
+ static findOrFail<T extends Model>(this: T, id: bigint | number | string, trxOrKnex?: TransactionOrKnex): Promise<T>;
29
29
  }
30
30
  export {};
@@ -50,23 +50,23 @@ export default class BaseModel extends Model {
50
50
  return super.query(trxOrKnex);
51
51
  }
52
52
  ;
53
- static withTrashed() {
54
- return this.query().withTrashed();
53
+ static withTrashed(trxOrKnex) {
54
+ return this.query(trxOrKnex).withTrashed();
55
55
  }
56
- static onlyTrashed() {
57
- return this.query().onlyTrashed();
56
+ static onlyTrashed(trxOrKnex) {
57
+ return this.query(trxOrKnex).onlyTrashed();
58
58
  }
59
- static all() {
60
- return this.query().select();
59
+ static all(trxOrKnex) {
60
+ return this.query(trxOrKnex).select();
61
61
  }
62
- static create(payload) {
63
- return this.query().insert(payload);
62
+ static create(payload, trxOrKnex) {
63
+ return this.query(trxOrKnex).insert(payload);
64
64
  }
65
- static find(id) {
66
- return this.query().findById(id);
65
+ static find(id, trxOrKnex) {
66
+ return this.query(trxOrKnex).findById(id);
67
67
  }
68
- static async findOrFail(id) {
69
- const result = await this.find(id);
68
+ static async findOrFail(id, trxOrKnex) {
69
+ const result = await this.query(trxOrKnex).findById(id);
70
70
  if (isEmpty(result))
71
71
  throw new ModelNotFoundException(`No query results for model [${this.namespace}] [${id}].`);
72
72
  return result;
@@ -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.12",
3
+ "version": "0.2.14",
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
  };