ayiin 2.0.4 → 2.0.6
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/index.d.ts +6 -0
- package/ayiin/index.js +10 -18314
- package/ayiin/methods/crypt.d.ts +37 -0
- package/ayiin/methods/crypt.js +65 -18180
- package/ayiin/methods/index.d.ts +85 -0
- package/ayiin/methods/index.js +64 -18276
- package/ayiin/methods/response.d.ts +34 -0
- package/ayiin/methods/response.js +41 -43
- package/ayiin/methods/tools.d.ts +17 -0
- package/ayiin/methods/tools.js +29 -19
- package/bun.lock +2 -8
- package/package.json +3 -5
- package/tsconfig.json +5 -10
- package/save +0 -26
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare class ResponseApi {
|
|
2
|
+
successResponse: (caption: string, data: any, code?: number) => {
|
|
3
|
+
responseCode: number;
|
|
4
|
+
responseSuccess: boolean;
|
|
5
|
+
responseMessage: string;
|
|
6
|
+
responseData: any;
|
|
7
|
+
};
|
|
8
|
+
badRequestResponse: (caption: string, title?: string) => {
|
|
9
|
+
responseCode: number;
|
|
10
|
+
responseSuccess: boolean;
|
|
11
|
+
responseMessage: string;
|
|
12
|
+
};
|
|
13
|
+
invalidFieldsResponse: (caption: string) => {
|
|
14
|
+
responseCode: number;
|
|
15
|
+
responseSuccess: boolean;
|
|
16
|
+
responseMessage: string;
|
|
17
|
+
};
|
|
18
|
+
notFoundResponse: (caption: string) => {
|
|
19
|
+
responseCode: number;
|
|
20
|
+
responseSuccess: boolean;
|
|
21
|
+
responseMessage: string;
|
|
22
|
+
};
|
|
23
|
+
unauthorizedResponse: (caption: string) => {
|
|
24
|
+
responseCode: number;
|
|
25
|
+
responseSuccess: boolean;
|
|
26
|
+
responseMessage: string;
|
|
27
|
+
};
|
|
28
|
+
internalServerErrorResponse: (caption: string) => {
|
|
29
|
+
responseCode: number;
|
|
30
|
+
responseSuccess: boolean;
|
|
31
|
+
responseMessage: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export default ResponseApi;
|
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
class ResponseApi {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
successResponse = (caption, data, code) => {
|
|
5
|
+
code = code ? Number(String(code) + "7400") : 2007400;
|
|
6
|
+
return {
|
|
7
|
+
responseCode: code,
|
|
8
|
+
responseSuccess: true,
|
|
9
|
+
responseMessage: `[Success] - ${caption}`,
|
|
10
|
+
responseData: data,
|
|
11
|
+
};
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
badRequestResponse = (caption, title) => {
|
|
14
|
+
return {
|
|
15
|
+
responseCode: 4007400,
|
|
16
|
+
responseSuccess: false,
|
|
17
|
+
responseMessage: `[${title ? title : "Bad Request"}] - ${caption}`,
|
|
18
|
+
};
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
invalidFieldsResponse = (caption) => {
|
|
21
|
+
return {
|
|
22
|
+
responseCode: 4007401,
|
|
23
|
+
responseSuccess: false,
|
|
24
|
+
responseMessage: `[Invalid Fields] - ${caption}`,
|
|
25
|
+
};
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
notFoundResponse = (caption) => {
|
|
28
|
+
return {
|
|
29
|
+
responseCode: 4047400,
|
|
30
|
+
responseSuccess: false,
|
|
31
|
+
responseMessage: `[Not Found] - ${caption}`,
|
|
32
|
+
};
|
|
31
33
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
unauthorizedResponse = (caption) => {
|
|
35
|
+
return {
|
|
36
|
+
responseCode: 4017400,
|
|
37
|
+
responseSuccess: false,
|
|
38
|
+
responseMessage: `[Unauthorized] - ${caption}`,
|
|
39
|
+
};
|
|
38
40
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
internalServerErrorResponse = (caption) => {
|
|
42
|
+
return {
|
|
43
|
+
responseCode: 5007400,
|
|
44
|
+
responseSuccess: false,
|
|
45
|
+
responseMessage: `[Internal Server Error] - ${caption}`,
|
|
46
|
+
};
|
|
45
47
|
};
|
|
46
|
-
};
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
response_default as default
|
|
51
|
-
};
|
|
49
|
+
exports.default = ResponseApi;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare class Tools {
|
|
2
|
+
/**
|
|
3
|
+
* Format money
|
|
4
|
+
* @returns {string}
|
|
5
|
+
* @memberof Tools
|
|
6
|
+
* @param {number} amount
|
|
7
|
+
* */
|
|
8
|
+
formatMoney: (amount: number, locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a random string
|
|
11
|
+
* @returns {string}
|
|
12
|
+
* @memberof Tools
|
|
13
|
+
* @param {number} length
|
|
14
|
+
* */
|
|
15
|
+
randomString: (length: number, prefix?: string) => string;
|
|
16
|
+
}
|
|
17
|
+
export default Tools;
|
package/ayiin/methods/tools.js
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
class Tools {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Format money
|
|
6
|
+
* @returns {string}
|
|
7
|
+
* @memberof Tools
|
|
8
|
+
* @param {number} amount
|
|
9
|
+
* */
|
|
10
|
+
formatMoney = (amount, locales = "id-ID", options = {
|
|
11
|
+
style: "currency",
|
|
12
|
+
currency: "IDR",
|
|
13
|
+
}) => {
|
|
14
|
+
return new Intl.NumberFormat(locales, options).format(amount);
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Generate a random string
|
|
18
|
+
* @returns {string}
|
|
19
|
+
* @memberof Tools
|
|
20
|
+
* @param {number} length
|
|
21
|
+
* */
|
|
22
|
+
randomString = (length, prefix) => {
|
|
23
|
+
const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
24
|
+
let random = "";
|
|
25
|
+
for (let i = 0; i < length; i++) {
|
|
26
|
+
random += alphabet[Math.floor(Math.random() * alphabet.length)];
|
|
27
|
+
}
|
|
28
|
+
return prefix ? prefix + random : random;
|
|
29
|
+
};
|
|
17
30
|
}
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
tools_default as default
|
|
21
|
-
};
|
|
31
|
+
exports.default = Tools;
|
package/bun.lock
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"lockfileVersion": 2,
|
|
3
|
-
"configVersion":
|
|
3
|
+
"configVersion": 0,
|
|
4
4
|
"workspaces": {
|
|
5
5
|
"": {
|
|
6
6
|
"name": "ayiin",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@types/
|
|
9
|
-
},
|
|
10
|
-
"peerDependencies": {
|
|
8
|
+
"@types/node": "^26.3.0",
|
|
11
9
|
"typescript": "^7",
|
|
12
10
|
},
|
|
13
11
|
},
|
|
14
12
|
},
|
|
15
13
|
"packages": {
|
|
16
|
-
"@types/bun": ["@types/bun@1.4.0", "", { "dependencies": { "bun-types": "1.4.0" } }, "sha512-K+lZULY23vRgK/CfTjFIV+tyifaNdSMlPh9j+6mQ/cLfpOznLyAuzgV/JQysyECpkBQLVMSyvjlr2fBUSA9wFQ=="],
|
|
17
|
-
|
|
18
14
|
"@types/node": ["@types/node@26.3.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-L3fgrnchriRC2ExBflb8j4uZZURHZfQsmQeyVzhjcHW4kkwVyo8/0h1B2MVzMTrYUJYu6G7EWs14hW/L9putqw=="],
|
|
19
15
|
|
|
20
16
|
"@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="],
|
|
@@ -57,8 +53,6 @@
|
|
|
57
53
|
|
|
58
54
|
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
|
|
59
55
|
|
|
60
|
-
"bun-types": ["bun-types@1.4.0", "", { "dependencies": { "@types/node": "*" } }, "sha512-iIKw23BspnQQYd3prITOBxeUsxBHnwzX6YJfGMuNOZzeNcMmVqzIIVGRm1l69ogaPQmb4wB6BN8mA5bE9YuC5Q=="],
|
|
61
|
-
|
|
62
56
|
"typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
|
|
63
57
|
|
|
64
58
|
"undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ayiin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Library Pribadi Yang Gak Ada Isinya",
|
|
5
5
|
"main": "ayiin/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "tsc"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "GPL-3.0-only",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/
|
|
23
|
-
},
|
|
24
|
-
"peerDependencies": {
|
|
22
|
+
"@types/node": "^26.3.0",
|
|
25
23
|
"typescript": "^7"
|
|
26
24
|
}
|
|
27
25
|
}
|
package/tsconfig.json
CHANGED
|
@@ -9,18 +9,14 @@
|
|
|
9
9
|
"alwaysStrict": true,
|
|
10
10
|
"incremental": true,
|
|
11
11
|
// Environment setup & latest features
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"module": "Preserve",
|
|
15
|
-
"moduleDetection": "force",
|
|
12
|
+
"target": "esnext",
|
|
13
|
+
"module": "nodenext",
|
|
16
14
|
"jsx": "react-jsx",
|
|
17
15
|
"allowJs": true,
|
|
18
|
-
"types": ["
|
|
16
|
+
"types": ["@types/node"],
|
|
19
17
|
|
|
20
18
|
// Bundler mode
|
|
21
|
-
"moduleResolution": "
|
|
22
|
-
"allowImportingTsExtensions": true,
|
|
23
|
-
"noEmit": true,
|
|
19
|
+
"moduleResolution": "nodenext",
|
|
24
20
|
|
|
25
21
|
// Best practices
|
|
26
22
|
"strict": true,
|
|
@@ -32,8 +28,7 @@
|
|
|
32
28
|
// Some stricter flags (disabled by default)
|
|
33
29
|
"noUnusedLocals": false,
|
|
34
30
|
"noUnusedParameters": false,
|
|
35
|
-
"noPropertyAccessFromIndexSignature": false
|
|
36
|
-
"emitDeclarationOnly": true
|
|
31
|
+
"noPropertyAccessFromIndexSignature": false
|
|
37
32
|
},
|
|
38
33
|
"include": ["src/**/*"],
|
|
39
34
|
"exclude": ["node_modules", "**/*.spec.ts"]
|
package/save
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
date=$(date +"%d-%m-%Y %H:%M:%S")
|
|
4
|
-
|
|
5
|
-
# Tanya dulu
|
|
6
|
-
read -p "Apakah ingin bump versi package.json? (y/N): " answer
|
|
7
|
-
|
|
8
|
-
if [[ "$answer" == "y" || "$answer" == "Y" ]]; then
|
|
9
|
-
echo "📦 Bump patch version package.json"
|
|
10
|
-
npm version patch --no-git-tag-version
|
|
11
|
-
else
|
|
12
|
-
echo "ℹ️ Skip bump version"
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
echo date: $date
|
|
16
|
-
|
|
17
|
-
echo "Adding all files to git"
|
|
18
|
-
git add .
|
|
19
|
-
|
|
20
|
-
echo "Committing to git"
|
|
21
|
-
git commit -m "Ayiin commit on $date"
|
|
22
|
-
|
|
23
|
-
echo "Pushing to git"
|
|
24
|
-
git push
|
|
25
|
-
|
|
26
|
-
echo "Done"
|