bkper-js 2.15.2 → 2.16.1
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 +38 -4
- package/lib/model/Bkper.js +8 -0
- package/lib/model/ResourceProperty.js +58 -20
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1199,6 +1199,12 @@ export declare class Bkper {
|
|
|
1199
1199
|
* If not provided, uses the global configuration set via setConfig().
|
|
1200
1200
|
*/
|
|
1201
1201
|
constructor(config?: Config);
|
|
1202
|
+
/**
|
|
1203
|
+
* Gets the current instance configuration.
|
|
1204
|
+
*
|
|
1205
|
+
* @returns The Config object for this Bkper instance
|
|
1206
|
+
*/
|
|
1207
|
+
getConfig(): Config;
|
|
1202
1208
|
/**
|
|
1203
1209
|
* Gets the [[Book]] with the specified bookId from url param.
|
|
1204
1210
|
*
|
|
@@ -3012,13 +3018,12 @@ declare abstract class ResourceProperty<T extends {
|
|
|
3012
3018
|
* Sets the custom properties of this resource.
|
|
3013
3019
|
*
|
|
3014
3020
|
* @param properties - Object with key/value pair properties
|
|
3015
|
-
* @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
|
|
3016
3021
|
*
|
|
3017
3022
|
* @returns This resource, for chaining
|
|
3018
3023
|
*/
|
|
3019
3024
|
setProperties(properties: {
|
|
3020
3025
|
[key: string]: string;
|
|
3021
|
-
}
|
|
3026
|
+
}): this;
|
|
3022
3027
|
/**
|
|
3023
3028
|
* Gets the property value for given keys. First property found will be retrieved.
|
|
3024
3029
|
*
|
|
@@ -3032,11 +3037,10 @@ declare abstract class ResourceProperty<T extends {
|
|
|
3032
3037
|
*
|
|
3033
3038
|
* @param key - The property key
|
|
3034
3039
|
* @param value - The property value, or null/undefined to clean it
|
|
3035
|
-
* @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
|
|
3036
3040
|
*
|
|
3037
3041
|
* @returns This resource, for chaining
|
|
3038
3042
|
*/
|
|
3039
|
-
setProperty(key: string, value: string | null | undefined
|
|
3043
|
+
setProperty(key: string, value: string | null | undefined): this;
|
|
3040
3044
|
/**
|
|
3041
3045
|
* Deletes a custom property.
|
|
3042
3046
|
*
|
|
@@ -3051,6 +3055,36 @@ declare abstract class ResourceProperty<T extends {
|
|
|
3051
3055
|
* @returns Array of property keys sorted alphabetically
|
|
3052
3056
|
*/
|
|
3053
3057
|
getPropertyKeys(): string[];
|
|
3058
|
+
/**
|
|
3059
|
+
* Sets a custom property in this resource, filtering out hidden properties.
|
|
3060
|
+
* Hidden properties are those whose keys end with an underscore "_".
|
|
3061
|
+
*
|
|
3062
|
+
* @param key - The property key
|
|
3063
|
+
* @param value - The property value, or null/undefined to clean it
|
|
3064
|
+
*
|
|
3065
|
+
* @returns This resource, for chaining
|
|
3066
|
+
*/
|
|
3067
|
+
setVisibleProperty(key: string, value: string | null | undefined): this;
|
|
3068
|
+
/**
|
|
3069
|
+
* Sets the custom properties of this resource, filtering out hidden properties.
|
|
3070
|
+
* Hidden properties are those whose keys end with an underscore "_".
|
|
3071
|
+
*
|
|
3072
|
+
* @param properties - Object with key/value pair properties
|
|
3073
|
+
*
|
|
3074
|
+
* @returns This resource, for chaining
|
|
3075
|
+
*/
|
|
3076
|
+
setVisibleProperties(properties: {
|
|
3077
|
+
[key: string]: string;
|
|
3078
|
+
}): this;
|
|
3079
|
+
/**
|
|
3080
|
+
* Gets the visible custom properties stored in this resource.
|
|
3081
|
+
* Hidden properties (those ending with "_") are excluded from the result.
|
|
3082
|
+
*
|
|
3083
|
+
* @returns Object with key/value pair properties, excluding hidden properties
|
|
3084
|
+
*/
|
|
3085
|
+
getVisibleProperties(): {
|
|
3086
|
+
[key: string]: string;
|
|
3087
|
+
};
|
|
3054
3088
|
}
|
|
3055
3089
|
|
|
3056
3090
|
/**
|
package/lib/model/Bkper.js
CHANGED
|
@@ -65,6 +65,14 @@ export class Bkper {
|
|
|
65
65
|
constructor(config) {
|
|
66
66
|
this.config = config || Bkper.globalConfig;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets the current instance configuration.
|
|
70
|
+
*
|
|
71
|
+
* @returns The Config object for this Bkper instance
|
|
72
|
+
*/
|
|
73
|
+
getConfig() {
|
|
74
|
+
return this.config;
|
|
75
|
+
}
|
|
68
76
|
/**
|
|
69
77
|
* Gets the [[Book]] with the specified bookId from url param.
|
|
70
78
|
*
|
|
@@ -33,24 +33,11 @@ export class ResourceProperty extends Resource {
|
|
|
33
33
|
* Sets the custom properties of this resource.
|
|
34
34
|
*
|
|
35
35
|
* @param properties - Object with key/value pair properties
|
|
36
|
-
* @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
|
|
37
36
|
*
|
|
38
37
|
* @returns This resource, for chaining
|
|
39
38
|
*/
|
|
40
|
-
setProperties(properties
|
|
41
|
-
|
|
42
|
-
this.payload.properties = Object.assign({}, properties);
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
const filteredProperties = {};
|
|
46
|
-
for (const key in properties) {
|
|
47
|
-
if (Object.prototype.hasOwnProperty.call(properties, key)) {
|
|
48
|
-
if (!this.isHiddenProperty(key)) {
|
|
49
|
-
filteredProperties[key] = properties[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
this.payload.properties = Object.assign({}, filteredProperties);
|
|
39
|
+
setProperties(properties) {
|
|
40
|
+
this.payload.properties = Object.assign({}, properties);
|
|
54
41
|
return this;
|
|
55
42
|
}
|
|
56
43
|
/**
|
|
@@ -77,17 +64,13 @@ export class ResourceProperty extends Resource {
|
|
|
77
64
|
*
|
|
78
65
|
* @param key - The property key
|
|
79
66
|
* @param value - The property value, or null/undefined to clean it
|
|
80
|
-
* @param filterHidden - If true, hidden properties (ending with "_") will not be set. Defaults to false.
|
|
81
67
|
*
|
|
82
68
|
* @returns This resource, for chaining
|
|
83
69
|
*/
|
|
84
|
-
setProperty(key, value
|
|
70
|
+
setProperty(key, value) {
|
|
85
71
|
if (key == null || key.trim() == "") {
|
|
86
72
|
return this;
|
|
87
73
|
}
|
|
88
|
-
if (filterHidden && this.isHiddenProperty(key)) {
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
74
|
if (this.payload.properties == null) {
|
|
92
75
|
this.payload.properties = {};
|
|
93
76
|
}
|
|
@@ -126,5 +109,60 @@ export class ResourceProperty extends Resource {
|
|
|
126
109
|
propertyKeys = propertyKeys.sort();
|
|
127
110
|
return propertyKeys;
|
|
128
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Sets a custom property in this resource, filtering out hidden properties.
|
|
114
|
+
* Hidden properties are those whose keys end with an underscore "_".
|
|
115
|
+
*
|
|
116
|
+
* @param key - The property key
|
|
117
|
+
* @param value - The property value, or null/undefined to clean it
|
|
118
|
+
*
|
|
119
|
+
* @returns This resource, for chaining
|
|
120
|
+
*/
|
|
121
|
+
setVisibleProperty(key, value) {
|
|
122
|
+
if (this.isHiddenProperty(key)) {
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
return this.setProperty(key, value);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Sets the custom properties of this resource, filtering out hidden properties.
|
|
129
|
+
* Hidden properties are those whose keys end with an underscore "_".
|
|
130
|
+
*
|
|
131
|
+
* @param properties - Object with key/value pair properties
|
|
132
|
+
*
|
|
133
|
+
* @returns This resource, for chaining
|
|
134
|
+
*/
|
|
135
|
+
setVisibleProperties(properties) {
|
|
136
|
+
if (properties == null) {
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
const filteredProperties = {};
|
|
140
|
+
for (const key in properties) {
|
|
141
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) {
|
|
142
|
+
if (!this.isHiddenProperty(key)) {
|
|
143
|
+
filteredProperties[key] = properties[key];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return this.setProperties(filteredProperties);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Gets the visible custom properties stored in this resource.
|
|
151
|
+
* Hidden properties (those ending with "_") are excluded from the result.
|
|
152
|
+
*
|
|
153
|
+
* @returns Object with key/value pair properties, excluding hidden properties
|
|
154
|
+
*/
|
|
155
|
+
getVisibleProperties() {
|
|
156
|
+
const allProperties = this.getProperties();
|
|
157
|
+
const visibleProperties = {};
|
|
158
|
+
for (const key in allProperties) {
|
|
159
|
+
if (Object.prototype.hasOwnProperty.call(allProperties, key)) {
|
|
160
|
+
if (!this.isHiddenProperty(key)) {
|
|
161
|
+
visibleProperties[key] = allProperties[key];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return visibleProperties;
|
|
166
|
+
}
|
|
129
167
|
}
|
|
130
168
|
//# sourceMappingURL=ResourceProperty.js.map
|