@bejibun/core 0.1.24 → 0.1.26

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.
@@ -18,7 +18,11 @@ class BunQueryBuilder extends SoftDeletes {
18
18
  }
19
19
  }
20
20
  // @ts-ignore
21
- class BaseModel extends Model {
21
+ export default class BaseModel extends Model {
22
+ static tableName;
23
+ static idColumn;
24
+ static deletedColumn = "deleted_at";
25
+ static QueryBuilder = BunQueryBuilder;
22
26
  static get namespace() {
23
27
  const filePath = fileURLToPath(import.meta.url);
24
28
  const appRoot = process.cwd();
@@ -63,6 +67,3 @@ class BaseModel extends Model {
63
67
  return result;
64
68
  }
65
69
  }
66
- BaseModel.deletedColumn = "deleted_at";
67
- BaseModel.QueryBuilder = BunQueryBuilder;
68
- export default BaseModel;
@@ -1,6 +1,9 @@
1
1
  import chalk from "chalk";
2
2
  import os from "os";
3
3
  export default class ChalkBuilder {
4
+ value;
5
+ isNewLine;
6
+ clk;
4
7
  constructor() {
5
8
  this.value = "";
6
9
  this.isNewLine = true;
@@ -1,5 +1,6 @@
1
1
  import { isEmpty } from "../utils/utils";
2
2
  export default class EnumBuilder {
3
+ enums;
3
4
  constructor(enums) {
4
5
  if (isEmpty(enums))
5
6
  throw new Error("The enum parameter is required.");
@@ -1,5 +1,8 @@
1
1
  import { cors } from "../utils/utils";
2
2
  export default class ResponseBuilder {
3
+ data;
4
+ message;
5
+ status;
3
6
  constructor() {
4
7
  this.data = null;
5
8
  this.message = "Success";
@@ -1,5 +1,5 @@
1
- import type { IMiddleware } from "@/types/middleware";
2
- import type { HandlerType, ResourceAction, RouterGroup } from "@/types/router";
1
+ import type { IMiddleware } from "../types/middleware";
2
+ import type { HandlerType, ResourceAction, RouterGroup } from "../types/router";
3
3
  import HttpMethodEnum from "../enums/HttpMethodEnum";
4
4
  export interface ResourceOptions {
5
5
  only?: Array<ResourceAction>;
@@ -2,10 +2,8 @@ import RouterInvalidException from "../exceptions/RouterInvalidException";
2
2
  import { isEmpty } from "../utils/utils";
3
3
  import path from "path";
4
4
  export default class RouterBuilder {
5
- constructor() {
6
- this.basePath = "";
7
- this.middlewares = [];
8
- }
5
+ basePath = "";
6
+ middlewares = [];
9
7
  prefix(basePath) {
10
8
  this.basePath = basePath;
11
9
  return this;
@@ -1,5 +1,6 @@
1
1
  import { defineValue, isNotEmpty } from "../utils/utils";
2
2
  export default class StrBuilder {
3
+ value;
3
4
  constructor() {
4
5
  this.value = "";
5
6
  }
@@ -1,5 +1,6 @@
1
1
  import { defineValue } from "../utils/utils";
2
2
  export default class ModelNotFoundException extends Error {
3
+ code;
3
4
  constructor(message, code) {
4
5
  super(message);
5
6
  this.name = "ModelNotFoundException";
@@ -1,5 +1,6 @@
1
1
  import { defineValue } from "../utils/utils";
2
2
  export default class RouterInvalidException extends Error {
3
+ code;
3
4
  constructor(message, code) {
4
5
  super(message);
5
6
  this.name = "RouterInvalidException";
@@ -1,5 +1,6 @@
1
1
  import { defineValue } from "../utils/utils";
2
2
  export default class ValidatorException extends Error {
3
+ code;
3
4
  constructor(message, code) {
4
5
  super(message);
5
6
  this.name = "ValidatorException";
@@ -1,5 +1,5 @@
1
- import type { IMiddleware } from "@/types/middleware";
2
- import type { HandlerType, RouterGroup } from "@/types/router";
1
+ import type { IMiddleware } from "../types/middleware";
2
+ import type { HandlerType, RouterGroup } from "../types/router";
3
3
  import RouterBuilder, { ResourceOptions } from "../builders/RouterBuilder";
4
4
  import HttpMethodEnum from "../enums/HttpMethodEnum";
5
5
  export default class Router {
@@ -1,10 +1,10 @@
1
1
  import { DateTime } from "luxon";
2
2
  import { QueryBuilder } from "objection";
3
3
  export default class SoftDeletes extends QueryBuilder {
4
+ hasFilterApplied = false;
4
5
  constructor(modelClass) {
5
6
  // @ts-ignore
6
7
  super(modelClass);
7
- this.hasFilterApplied = false;
8
8
  this.onBuild((builder) => {
9
9
  const context = this.context();
10
10
  if (!this.hasFilterApplied) {
package/dist/index.d.ts CHANGED
@@ -1 +1,9 @@
1
- export * from "@/types/index";
1
+ export * from "./facades/Chalk";
2
+ export * from "./facades/Enum";
3
+ export * from "./facades/Response";
4
+ export * from "./facades/Router";
5
+ export * from "./facades/SoftDeletes";
6
+ export * from "./facades/Str";
7
+ export * from "./types/index";
8
+ export * from "./utils/utils";
9
+ export * from "./utils/vine";
package/dist/index.js CHANGED
@@ -1 +1,9 @@
1
- export * from "@/types/index";
1
+ export * from "./facades/Chalk";
2
+ export * from "./facades/Enum";
3
+ export * from "./facades/Response";
4
+ export * from "./facades/Router";
5
+ export * from "./facades/SoftDeletes";
6
+ export * from "./facades/Str";
7
+ export * from "./types/index";
8
+ export * from "./utils/utils";
9
+ export * from "./utils/vine";
@@ -1,14 +1,4 @@
1
- export * from "@/facades/Chalk";
2
- export * from "@/facades/Enum";
3
- export * from "@/facades/Response";
4
- export * from "@/facades/Router";
5
- export * from "@/facades/SoftDeletes";
6
- export * from "@/facades/Str";
7
-
8
- export * from "@/types/middleware";
9
- export * from "@/types/router";
10
- export * from "@/types/validator";
11
- export * from "@/types/vine";
12
-
13
- export * from "@/utils/utils";
14
- export * from "@/utils/vine";
1
+ export * from "../types/middleware";
2
+ export * from "../types/router";
3
+ export * from "../types/validator";
4
+ export * from "../types/vine";
@@ -1,4 +1,4 @@
1
- import type {HandlerType} from "@/types/router";
1
+ import type {HandlerType} from "../types/router";
2
2
 
3
3
  export type MiddlewareType = (handler: HandlerType) => HandlerType;
4
4
 
package/package.json CHANGED
@@ -1,28 +1,26 @@
1
1
  {
2
2
  "name": "@bejibun/core",
3
- "version": "0.1.24",
4
- "description": "Core of Bejibun Framework",
5
- "keywords": [
6
- "bun",
7
- "bun framework",
8
- "core",
9
- "bejibun",
10
- "typescript"
11
- ],
12
- "homepage": "https://github.com/crenata/bejibun-core#readme",
13
- "bugs": {
14
- "url": "https://github.com/crenata/bejibun-core/issues"
15
- },
3
+ "version": "0.1.26",
4
+ "author": "Havea Crenata <havea.crenata@gmail.com>",
16
5
  "repository": {
17
6
  "type": "git",
18
7
  "url": "git+https://github.com/crenata/bejibun-core.git"
19
8
  },
20
- "license": "MIT",
21
- "author": "Havea Crenata <havea.crenata@gmail.com>",
22
- "type": "module",
23
9
  "main": "./dist/index.js",
24
10
  "module": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
11
+ "dependencies": {
12
+ "@vinejs/vine": "^3.0.1",
13
+ "chalk": "^5.6.2",
14
+ "knex": "^3.1.0",
15
+ "luxon": "^3.7.2",
16
+ "objection": "^3.1.5",
17
+ "pg": "^8.16.3"
18
+ },
19
+ "devDependencies": {
20
+ "@types/bun": "latest",
21
+ "@types/luxon": "^3.7.1",
22
+ "tsc-alias": "^1.8.16"
23
+ },
26
24
  "exports": {
27
25
  ".": {
28
26
  "import": "./dist/index.js",
@@ -53,29 +51,27 @@
53
51
  "types": "./dist/types/*.d.ts"
54
52
  }
55
53
  },
54
+ "bugs": {
55
+ "url": "https://github.com/crenata/bejibun-core/issues"
56
+ },
57
+ "description": "Core of Bejibun Framework",
56
58
  "files": [
57
59
  "dist"
58
60
  ],
61
+ "homepage": "https://github.com/crenata/bejibun-core#readme",
62
+ "keywords": [
63
+ "bun",
64
+ "bun framework",
65
+ "core",
66
+ "bejibun",
67
+ "typescript"
68
+ ],
69
+ "license": "MIT",
59
70
  "scripts": {
60
71
  "clean": "rm -rf dist",
61
- "build": "bun run clean && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && cp -rf src/types dist/types",
72
+ "build": "bun run clean && bunx tsc -p tsconfig.json && cp -rf src/types dist/types && bunx tsc-alias -p tsconfig.json",
62
73
  "deploy": "bun run build && npm publish --access public"
63
74
  },
64
- "dependencies": {
65
- "@vinejs/vine": "^3.0.1",
66
- "chalk": "^5.6.2",
67
- "knex": "^3.1.0",
68
- "luxon": "^3.7.2",
69
- "objection": "^3.1.5",
70
- "pg": "^8.16.3"
71
- },
72
- "devDependencies": {
73
- "@types/bun": "latest",
74
- "@types/luxon": "^3.7.1",
75
- "tsc-alias": "^1.8.16",
76
- "typescript": "^5.9.3"
77
- },
78
- "peerDependencies": {
79
- "typescript": "^5"
80
- }
75
+ "type": "module",
76
+ "types": "./dist/index.d.ts"
81
77
  }