ayiin 2.0.3 → 2.0.4
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/LICENSE +674 -674
- package/README.md +28 -28
- package/ayiin/index.js +18316 -14
- package/ayiin/methods/crypt.js +18182 -14
- package/ayiin/methods/index.js +18279 -14
- package/ayiin/methods/response.js +51 -0
- package/ayiin/methods/tools.js +21 -1
- package/package.json +1 -1
- package/save +25 -25
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/methods/response.ts
|
|
2
|
+
class ResponseApi {
|
|
3
|
+
successResponse = (caption, data, code) => {
|
|
4
|
+
code = code ? Number(String(code) + "7400") : 2007400;
|
|
5
|
+
return {
|
|
6
|
+
responseCode: code,
|
|
7
|
+
responseSuccess: true,
|
|
8
|
+
responseMessage: `[Success] - ${caption}`,
|
|
9
|
+
responseData: data
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
badRequestResponse = (caption, title) => {
|
|
13
|
+
return {
|
|
14
|
+
responseCode: 4007400,
|
|
15
|
+
responseSuccess: false,
|
|
16
|
+
responseMessage: `[${title ? title : "Bad Request"}] - ${caption}`
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
invalidFieldsResponse = (caption) => {
|
|
20
|
+
return {
|
|
21
|
+
responseCode: 4007401,
|
|
22
|
+
responseSuccess: false,
|
|
23
|
+
responseMessage: `[Invalid Fields] - ${caption}`
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
notFoundResponse = (caption) => {
|
|
27
|
+
return {
|
|
28
|
+
responseCode: 4047400,
|
|
29
|
+
responseSuccess: false,
|
|
30
|
+
responseMessage: `[Not Found] - ${caption}`
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
unauthorizedResponse = (caption) => {
|
|
34
|
+
return {
|
|
35
|
+
responseCode: 4017400,
|
|
36
|
+
responseSuccess: false,
|
|
37
|
+
responseMessage: `[Unauthorized] - ${caption}`
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
internalServerErrorResponse = (caption) => {
|
|
41
|
+
return {
|
|
42
|
+
responseCode: 5007400,
|
|
43
|
+
responseSuccess: false,
|
|
44
|
+
responseMessage: `[Internal Server Error] - ${caption}`
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var response_default = ResponseApi;
|
|
49
|
+
export {
|
|
50
|
+
response_default as default
|
|
51
|
+
};
|
package/ayiin/methods/tools.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
// src/methods/tools.ts
|
|
2
|
+
class Tools {
|
|
3
|
+
formatMoney = (amount, locales = "id-ID", options = {
|
|
4
|
+
style: "currency",
|
|
5
|
+
currency: "IDR"
|
|
6
|
+
}) => {
|
|
7
|
+
return new Intl.NumberFormat(locales, options).format(amount);
|
|
8
|
+
};
|
|
9
|
+
randomString = (length, prefix) => {
|
|
10
|
+
const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
11
|
+
let random = "";
|
|
12
|
+
for (let i = 0;i < length; i++) {
|
|
13
|
+
random += alphabet[Math.floor(Math.random() * alphabet.length)];
|
|
14
|
+
}
|
|
15
|
+
return prefix ? prefix + random : random;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var tools_default = Tools;
|
|
19
|
+
export {
|
|
20
|
+
tools_default as default
|
|
21
|
+
};
|
package/package.json
CHANGED
package/save
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
|
|
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
26
|
echo "Done"
|
package/tsconfig.json
CHANGED
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
// Some stricter flags (disabled by default)
|
|
33
33
|
"noUnusedLocals": false,
|
|
34
34
|
"noUnusedParameters": false,
|
|
35
|
-
"noPropertyAccessFromIndexSignature": false
|
|
35
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
36
|
+
"emitDeclarationOnly": true
|
|
36
37
|
},
|
|
37
38
|
"include": ["src/**/*"],
|
|
38
39
|
"exclude": ["node_modules", "**/*.spec.ts"]
|