squarecommonblhelper 1.0.1 → 1.0.3

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 CHANGED
@@ -15,6 +15,14 @@ helper for common bl for my projects.
15
15
 
16
16
  ## changelog
17
17
 
18
+ ### v1.0.3
19
+
20
+ - experimental release.
21
+
22
+ ### v1.0.2
23
+
24
+ - replace user_id with accessToken from greeting -> createGreetingV0.
25
+
18
26
  ### v1.0.1
19
27
 
20
28
  - remove app_id from greeting -> createGreetingV0.
@@ -1,6 +1,6 @@
1
1
  declare class GreetingCommonBL {
2
2
  private commonBLBaseURL;
3
3
  constructor(commonBLBaseURL?: string);
4
- createGreetingV0(greetingIsAnonymous: boolean, greetingAnonymousSenderName?: string, userId?: string, greetingText?: string): Promise<import("squarecommons").APIOutput>;
4
+ createGreetingV0(greetingIsAnonymous: boolean, greetingAnonymousSenderName?: string, accessToken?: string, greetingText?: string): Promise<import("squarecommons").APIOutput>;
5
5
  }
6
6
  export { GreetingCommonBL };
package/dist/greeting.js CHANGED
@@ -4,12 +4,20 @@ class GreetingCommonBL {
4
4
  constructor(commonBLBaseURL = "http://localhost:10110") {
5
5
  this.commonBLBaseURL = commonBLBaseURL;
6
6
  }
7
- async createGreetingV0(greetingIsAnonymous, greetingAnonymousSenderName, userId, greetingText) {
7
+ async createGreetingV0(greetingIsAnonymous, greetingAnonymousSenderName, accessToken, greetingText) {
8
8
  try {
9
- const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", undefined, {
9
+ let headers;
10
+ if (accessToken) {
11
+ headers = {
12
+ access_token: accessToken,
13
+ };
14
+ }
15
+ else {
16
+ headers = undefined;
17
+ }
18
+ const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", headers, {
10
19
  greeting_is_anonymous: greetingIsAnonymous,
11
20
  greeting_anonymous_sender_name: greetingAnonymousSenderName,
12
- user_id: userId,
13
21
  greeting_text: greetingText,
14
22
  });
15
23
  return data;
package/example.js ADDED
@@ -0,0 +1,7 @@
1
+ import { GreetingCommonBL, UtilsCommonBL } from "./dist/index.js";
2
+
3
+ let greetingCommonBL = new GreetingCommonBL();
4
+ console.log(await greetingCommonBL.createGreetingV0(true));
5
+
6
+ let utilsCommonBL = new UtilsCommonBL();
7
+ console.log(await utilsCommonBL.getAppIdV0("test"));
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
9
  "test": "",
10
- "build": "tsc",
10
+ "prepare": "npm run build",
11
+ "build": "rimraf /dist && tsc",
11
12
  "dev": "tsc && node dist/index.js"
12
13
  },
13
14
  "files": [
14
15
  "dist",
15
- "README.md"
16
+ "README.md",
17
+ "example.js"
16
18
  ],
17
19
  "repository": {
18
20
  "type": "git",
@@ -25,12 +27,13 @@
25
27
  },
26
28
  "homepage": "https://github.com/thepmsquare/squareCommonBLHelper#readme",
27
29
  "devDependencies": {
30
+ "rimraf": "^6.0.1",
28
31
  "typescript": "^5.3.3"
29
32
  },
30
33
  "engines": {
31
34
  "node": ">=18.0.0"
32
35
  },
33
36
  "dependencies": {
34
- "squarecommons": "^1.0.5"
37
+ "squarecommons": "^1.0.10"
35
38
  }
36
39
  }