bkper-js 1.32.4 → 1.33.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/lib/index.d.ts CHANGED
@@ -2048,6 +2048,47 @@ export declare class Message {
2048
2048
  * @returns This Message, for chaining
2049
2049
  */
2050
2050
  setContent(content: string): Message;
2051
+ /**
2052
+ * @returns The custom properties stored in this Message
2053
+ */
2054
+ getProperties(): {
2055
+ [key: string]: string;
2056
+ };
2057
+ /**
2058
+ * Sets the custom properties of the Message
2059
+ *
2060
+ * @param properties - Object with key/value pair properties
2061
+ *
2062
+ * @returns This Message, for chainning.
2063
+ */
2064
+ setProperties(properties: {
2065
+ [key: string]: string;
2066
+ }): Message;
2067
+ /**
2068
+ * Gets the property value for given keys. First property found will be retrieved.
2069
+ *
2070
+ * @param keys - The property key
2071
+ *
2072
+ * @returns The retrieved property value
2073
+ */
2074
+ getProperty(...keys: string[]): string | undefined;
2075
+ /**
2076
+ * Sets a custom property in the Message.
2077
+ *
2078
+ * @param key - The property key
2079
+ * @param value - The property value
2080
+ *
2081
+ * @returns This Message, for chainning.
2082
+ */
2083
+ setProperty(key: string, value: string | null): Message;
2084
+ /**
2085
+ * Deletes a custom property from the Message.
2086
+ *
2087
+ * @param key - The property key
2088
+ *
2089
+ * @returns This Message, for chainning.
2090
+ */
2091
+ deleteProperty(key: string): Message;
2051
2092
  }
2052
2093
 
2053
2094
  /**
@@ -63,5 +63,71 @@ export class Message {
63
63
  this.payload.content = content;
64
64
  return this;
65
65
  }
66
+ /**
67
+ * @returns The custom properties stored in this Message
68
+ */
69
+ getProperties() {
70
+ return this.payload.properties != null ? Object.assign({}, this.payload.properties) : {};
71
+ }
72
+ /**
73
+ * Sets the custom properties of the Message
74
+ *
75
+ * @param properties - Object with key/value pair properties
76
+ *
77
+ * @returns This Message, for chainning.
78
+ */
79
+ setProperties(properties) {
80
+ this.payload.properties = Object.assign({}, properties);
81
+ return this;
82
+ }
83
+ /**
84
+ * Gets the property value for given keys. First property found will be retrieved.
85
+ *
86
+ * @param keys - The property key
87
+ *
88
+ * @returns The retrieved property value
89
+ */
90
+ getProperty(...keys) {
91
+ for (let index = 0; index < keys.length; index++) {
92
+ const key = keys[index];
93
+ let value = this.payload.properties != null ? this.payload.properties[key] : null;
94
+ if (value != null && value.trim() != '') {
95
+ return value;
96
+ }
97
+ }
98
+ return undefined;
99
+ }
100
+ /**
101
+ * Sets a custom property in the Message.
102
+ *
103
+ * @param key - The property key
104
+ * @param value - The property value
105
+ *
106
+ * @returns This Message, for chainning.
107
+ */
108
+ setProperty(key, value) {
109
+ if (key == null || key.trim() == '') {
110
+ return this;
111
+ }
112
+ if (this.payload.properties == null) {
113
+ this.payload.properties = {};
114
+ }
115
+ if (!value) {
116
+ value = '';
117
+ }
118
+ this.payload.properties[key] = value;
119
+ return this;
120
+ }
121
+ /**
122
+ * Deletes a custom property from the Message.
123
+ *
124
+ * @param key - The property key
125
+ *
126
+ * @returns This Message, for chainning.
127
+ */
128
+ deleteProperty(key) {
129
+ this.setProperty(key, null);
130
+ return this;
131
+ }
66
132
  }
67
133
  //# sourceMappingURL=Message.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.32.4",
3
+ "version": "1.33.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -34,7 +34,7 @@
34
34
  "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
35
35
  },
36
36
  "peerDependencies": {
37
- "@bkper/bkper-api-types": "^5.15.3"
37
+ "@bkper/bkper-api-types": "^5.16.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@google-cloud/local-auth": "^3.0.1",