ayiin 2.0.8 → 2.0.10
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/ayiin/bin/cli.d.ts +2 -0
- package/ayiin/bin/cli.js +27 -0
- package/ayiin/methods/index.d.ts +26 -6
- package/ayiin/methods/index.js +6 -6
- package/package.json +4 -1
package/ayiin/bin/cli.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
|
+
// CLI entry point
|
|
9
|
+
console.log("Welcome to ayiin CLI!");
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
if (args.length === 0) {
|
|
12
|
+
console.log("Usage: ayiin <command>");
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
switch (args[0]) {
|
|
16
|
+
case "hello":
|
|
17
|
+
console.log("Hai Ayiin, CLI sudah jalan!");
|
|
18
|
+
break;
|
|
19
|
+
case "version":
|
|
20
|
+
console.log(`ayiin CLI v${package_json_1.default.version}`);
|
|
21
|
+
break;
|
|
22
|
+
case "help":
|
|
23
|
+
console.log("Available commands: hello, version, help");
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
console.log(`Unknown command: ${args[0]}`);
|
|
27
|
+
}
|
package/ayiin/methods/index.d.ts
CHANGED
|
@@ -48,37 +48,57 @@ declare class BaseMethods<C extends Crypt, T extends Tools, R extends ResponseAp
|
|
|
48
48
|
* @param {number} length
|
|
49
49
|
* */
|
|
50
50
|
randomString: (length: number, prefix?: string) => string;
|
|
51
|
-
successResponse: (caption
|
|
51
|
+
successResponse: ({ caption, data, code, }: {
|
|
52
|
+
caption: string;
|
|
53
|
+
data: any;
|
|
54
|
+
code?: number;
|
|
55
|
+
}) => {
|
|
52
56
|
responseCode: number;
|
|
53
57
|
responseSuccess: boolean;
|
|
54
58
|
responseMessage: string;
|
|
55
59
|
responseData: any;
|
|
56
60
|
};
|
|
57
|
-
badRequestResponse: (caption
|
|
61
|
+
badRequestResponse: ({ caption, title, data, }: {
|
|
62
|
+
caption: string;
|
|
63
|
+
title?: string;
|
|
64
|
+
data?: any;
|
|
65
|
+
}) => {
|
|
58
66
|
responseCode: number;
|
|
59
67
|
responseSuccess: boolean;
|
|
60
68
|
responseMessage: string;
|
|
61
69
|
responseData: any;
|
|
62
70
|
};
|
|
63
|
-
invalidFieldsResponse: (caption
|
|
71
|
+
invalidFieldsResponse: ({ caption, data, }: {
|
|
72
|
+
caption: string;
|
|
73
|
+
data?: any;
|
|
74
|
+
}) => {
|
|
64
75
|
responseCode: number;
|
|
65
76
|
responseSuccess: boolean;
|
|
66
77
|
responseMessage: string;
|
|
67
78
|
responseData: any;
|
|
68
79
|
};
|
|
69
|
-
notFoundResponse: (caption
|
|
80
|
+
notFoundResponse: ({ caption, data }: {
|
|
81
|
+
caption: string;
|
|
82
|
+
data?: any;
|
|
83
|
+
}) => {
|
|
70
84
|
responseCode: number;
|
|
71
85
|
responseSuccess: boolean;
|
|
72
86
|
responseMessage: string;
|
|
73
87
|
responseData: any;
|
|
74
88
|
};
|
|
75
|
-
unauthorizedResponse: (caption
|
|
89
|
+
unauthorizedResponse: ({ caption, data }: {
|
|
90
|
+
caption: string;
|
|
91
|
+
data?: any;
|
|
92
|
+
}) => {
|
|
76
93
|
responseCode: number;
|
|
77
94
|
responseSuccess: boolean;
|
|
78
95
|
responseMessage: string;
|
|
79
96
|
responseData: any;
|
|
80
97
|
};
|
|
81
|
-
internalServerErrorResponse: (caption
|
|
98
|
+
internalServerErrorResponse: ({ caption, data, }: {
|
|
99
|
+
caption: string;
|
|
100
|
+
data?: any;
|
|
101
|
+
}) => {
|
|
82
102
|
responseCode: number;
|
|
83
103
|
responseSuccess: boolean;
|
|
84
104
|
responseMessage: string;
|
package/ayiin/methods/index.js
CHANGED
|
@@ -57,12 +57,12 @@ class BaseMethods {
|
|
|
57
57
|
* @param {number} length
|
|
58
58
|
* */
|
|
59
59
|
randomString = (length, prefix) => this.tools.randomString(length, prefix);
|
|
60
|
-
successResponse = (caption, data, code) => this.response.successResponse(caption, data, code);
|
|
61
|
-
badRequestResponse = (caption, title) => this.response.badRequestResponse(caption, title);
|
|
62
|
-
invalidFieldsResponse = (caption) => this.response.invalidFieldsResponse(caption);
|
|
63
|
-
notFoundResponse = (caption) => this.response.notFoundResponse(caption);
|
|
64
|
-
unauthorizedResponse = (caption) => this.response.unauthorizedResponse(caption);
|
|
65
|
-
internalServerErrorResponse = (caption) => this.response.internalServerErrorResponse(caption);
|
|
60
|
+
successResponse = ({ caption, data, code, }) => this.response.successResponse(caption, data, code);
|
|
61
|
+
badRequestResponse = ({ caption, title, data, }) => this.response.badRequestResponse(caption, title, data);
|
|
62
|
+
invalidFieldsResponse = ({ caption, data, }) => this.response.invalidFieldsResponse(caption, data);
|
|
63
|
+
notFoundResponse = ({ caption, data }) => this.response.notFoundResponse(caption, data);
|
|
64
|
+
unauthorizedResponse = ({ caption, data }) => this.response.unauthorizedResponse(caption, data);
|
|
65
|
+
internalServerErrorResponse = ({ caption, data, }) => this.response.internalServerErrorResponse(caption, data);
|
|
66
66
|
}
|
|
67
67
|
class Methods extends BaseMethods {
|
|
68
68
|
}
|
package/package.json
CHANGED