squarecommonblhelper 1.0.0
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/README.md +22 -0
- package/dist/greeting.d.ts +6 -0
- package/dist/greeting.js +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +17 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# squareCommonBLHelper
|
|
2
|
+
|
|
3
|
+
## about
|
|
4
|
+
|
|
5
|
+
helper for common bl for my projects.
|
|
6
|
+
|
|
7
|
+
## usage
|
|
8
|
+
|
|
9
|
+
[Example](./example.js)
|
|
10
|
+
|
|
11
|
+
## env
|
|
12
|
+
|
|
13
|
+
1. node js - v18.17.0
|
|
14
|
+
2. npm - v9.6.7
|
|
15
|
+
|
|
16
|
+
## changelog
|
|
17
|
+
|
|
18
|
+
### v1.0.0
|
|
19
|
+
|
|
20
|
+
- initial implementation.
|
|
21
|
+
|
|
22
|
+
## Feedback is appreciated. Thank you!
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare class GreetingCommonBL {
|
|
2
|
+
private commonBLBaseURL;
|
|
3
|
+
constructor(commonBLBaseURL?: string);
|
|
4
|
+
createGreetingV0(greetingIsAnonymous: boolean, appId?: number, greetingAnonymousSenderName?: string, userId?: string, greetingText?: string): Promise<import("squarecommons").APIOutput>;
|
|
5
|
+
}
|
|
6
|
+
export { GreetingCommonBL };
|
package/dist/greeting.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { fetchJSONData } from "squarecommons";
|
|
2
|
+
class GreetingCommonBL {
|
|
3
|
+
commonBLBaseURL;
|
|
4
|
+
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
5
|
+
this.commonBLBaseURL = commonBLBaseURL;
|
|
6
|
+
}
|
|
7
|
+
async createGreetingV0(greetingIsAnonymous, appId, greetingAnonymousSenderName, userId, greetingText) {
|
|
8
|
+
try {
|
|
9
|
+
const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", undefined, {
|
|
10
|
+
app_id: appId,
|
|
11
|
+
greeting_is_anonymous: greetingIsAnonymous,
|
|
12
|
+
greeting_anonymous_sender_name: greetingAnonymousSenderName,
|
|
13
|
+
user_id: userId,
|
|
14
|
+
greeting_text: greetingText,
|
|
15
|
+
});
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export { GreetingCommonBL };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fetchJSONData } from "squarecommons";
|
|
2
|
+
class UtilsCommonBL {
|
|
3
|
+
commonBLBaseURL;
|
|
4
|
+
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
5
|
+
this.commonBLBaseURL = commonBLBaseURL;
|
|
6
|
+
}
|
|
7
|
+
async getAppIdV0(appName) {
|
|
8
|
+
try {
|
|
9
|
+
const data = await fetchJSONData(this.commonBLBaseURL, "get_app_id/v0", "GET", undefined, undefined, { app_name: appName });
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { UtilsCommonBL };
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "squarecommonblhelper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "helper for common bl for my projects.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "",
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsc && node dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/thepmsquare/squareCommonBLHelper"
|
|
20
|
+
},
|
|
21
|
+
"author": "thePmSquare",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/thepmsquare/squareCommonBLHelper/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/thepmsquare/squareCommonBLHelper#readme",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.3.3"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"squarecommons": "^1.0.5"
|
|
35
|
+
}
|
|
36
|
+
}
|