bkper-js 2.36.0 → 2.37.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
@@ -2574,7 +2574,7 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
2574
2574
  *
2575
2575
  * @returns The Connection type
2576
2576
  */
2577
- getType(): "APP" | "BANK" | undefined;
2577
+ getType(): 'APP' | 'BANK' | undefined;
2578
2578
  /**
2579
2579
  * Sets the Connection type.
2580
2580
  *
@@ -2582,7 +2582,7 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
2582
2582
  *
2583
2583
  * @returns The Connection, for chaining
2584
2584
  */
2585
- setType(type: "APP" | "BANK"): Connection;
2585
+ setType(type: 'APP' | 'BANK'): Connection;
2586
2586
  /**
2587
2587
  * Cleans any token property stored in the Connection.
2588
2588
  */
@@ -2599,6 +2599,12 @@ export declare class Connection extends ResourceProperty<bkper.Connection> {
2599
2599
  * @returns The created Connection, for chaining
2600
2600
  */
2601
2601
  create(): Promise<Connection>;
2602
+ /**
2603
+ * Performs update Connection.
2604
+ *
2605
+ * @returns The updated Connection object
2606
+ */
2607
+ update(): Promise<Connection>;
2602
2608
  /**
2603
2609
  * Performs remove Connection.
2604
2610
  *
@@ -3197,6 +3203,14 @@ export declare class Integration extends ResourceProperty<bkper.Integration> {
3197
3203
  * @returns The Integration's name
3198
3204
  */
3199
3205
  getName(): string | undefined;
3206
+ /**
3207
+ * Sets the name of the Integration.
3208
+ *
3209
+ * @param name - The name of the Integration
3210
+ *
3211
+ * @returns The Integration, for chaining
3212
+ */
3213
+ setName(name: string): Integration;
3200
3214
  /**
3201
3215
  * Gets the name of the user who added the Integration.
3202
3216
  *
@@ -3241,6 +3255,12 @@ export declare class Integration extends ResourceProperty<bkper.Integration> {
3241
3255
  * @returns The Integration last update date in milliseconds
3242
3256
  */
3243
3257
  getLastUpdateMs(): string | undefined;
3258
+ /**
3259
+ * Performs update Integration.
3260
+ *
3261
+ * @returns The updated Integration object
3262
+ */
3263
+ update(): Promise<Integration>;
3244
3264
  /**
3245
3265
  * Performs remove Integration.
3246
3266
  *
@@ -3457,6 +3477,16 @@ declare abstract class Resource<T = any> {
3457
3477
  * Extends Resource<T> and adds property management methods for entities
3458
3478
  * that have a properties field in their payload.
3459
3479
  *
3480
+ * Custom property keys are normalized and validated by the Bkper API when
3481
+ * resources are persisted:
3482
+ *
3483
+ * - Keys can have up to 30 characters after normalization.
3484
+ * - Keys are normalized to lowercase, spaces become underscores, and unsupported
3485
+ * punctuation is removed.
3486
+ * - Keys ending with an underscore (`_`) are treated as hidden/internal by SDK
3487
+ * visible-property helpers.
3488
+ * - Empty, null, or undefined values clear the property when saved.
3489
+ *
3460
3490
  * @public
3461
3491
  */
3462
3492
  declare abstract class ResourceProperty<T extends {
@@ -3494,6 +3524,10 @@ declare abstract class ResourceProperty<T extends {
3494
3524
  /**
3495
3525
  * Sets a custom property in this resource.
3496
3526
  *
3527
+ * Property keys are normalized and validated by the API when saved. Keep keys
3528
+ * to 30 characters or fewer after normalization. Use a trailing underscore
3529
+ * (`_`) for hidden/internal properties.
3530
+ *
3497
3531
  * @param key - The property key
3498
3532
  * @param value - The property value, or null/undefined to clean it
3499
3533
  *
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { ResourceProperty } from "./ResourceProperty.js";
11
- import { Bkper } from "./Bkper.js";
12
- import * as ConnectionService from "../service/connection-service.js";
13
- import { Integration } from "./Integration.js";
10
+ import { ResourceProperty } from './ResourceProperty.js';
11
+ import { Bkper } from './Bkper.js';
12
+ import * as ConnectionService from '../service/connection-service.js';
13
+ import { Integration } from './Integration.js';
14
14
  /**
15
15
  * This class defines a Connection from an [[User]] to an external service.
16
16
  *
@@ -138,8 +138,8 @@ export class Connection extends ResourceProperty {
138
138
  */
139
139
  clearTokenProperties() {
140
140
  this.getPropertyKeys()
141
- .filter((key) => key.includes("token"))
142
- .forEach((key) => this.deleteProperty(key));
141
+ .filter(key => key.includes('token'))
142
+ .forEach(key => this.deleteProperty(key));
143
143
  }
144
144
  /**
145
145
  * Gets the existing [[Integrations]] on the Connection.
@@ -153,7 +153,7 @@ export class Connection extends ResourceProperty {
153
153
  return [];
154
154
  }
155
155
  const integrationsPlain = yield ConnectionService.listIntegrations(id, this.getConfig());
156
- const integrations = integrationsPlain.map((i) => new Integration(i, this.config));
156
+ const integrations = integrationsPlain.map(i => new Integration(i, this.config));
157
157
  return integrations;
158
158
  });
159
159
  }
@@ -168,6 +168,17 @@ export class Connection extends ResourceProperty {
168
168
  return this;
169
169
  });
170
170
  }
171
+ /**
172
+ * Performs update Connection.
173
+ *
174
+ * @returns The updated Connection object
175
+ */
176
+ update() {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ this.payload = yield ConnectionService.updateConnection(this.payload, this.getConfig());
179
+ return this;
180
+ });
181
+ }
171
182
  /**
172
183
  * Performs remove Connection.
173
184
  *
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import * as IntegrationService from "../service/integration-service.js";
11
- import { ResourceProperty } from "./ResourceProperty.js";
12
- import { Bkper } from "./Bkper.js";
10
+ import * as IntegrationService from '../service/integration-service.js';
11
+ import { ResourceProperty } from './ResourceProperty.js';
12
+ import { Bkper } from './Bkper.js';
13
13
  /**
14
14
  * This class defines a Integration from an [[User]] to an external service.
15
15
  *
@@ -48,6 +48,17 @@ export class Integration extends ResourceProperty {
48
48
  getName() {
49
49
  return this.payload.name;
50
50
  }
51
+ /**
52
+ * Sets the name of the Integration.
53
+ *
54
+ * @param name - The name of the Integration
55
+ *
56
+ * @returns The Integration, for chaining
57
+ */
58
+ setName(name) {
59
+ this.payload.name = name;
60
+ return this;
61
+ }
51
62
  /**
52
63
  * Gets the name of the user who added the Integration.
53
64
  *
@@ -106,6 +117,20 @@ export class Integration extends ResourceProperty {
106
117
  getLastUpdateMs() {
107
118
  return this.payload.lastUpdateMs;
108
119
  }
120
+ /**
121
+ * Performs update Integration.
122
+ *
123
+ * @returns The updated Integration object
124
+ */
125
+ update() {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ const bookId = this.getBookId();
128
+ if (bookId) {
129
+ this.payload = yield IntegrationService.updateIntegration(bookId, this.payload, this.getConfig());
130
+ }
131
+ return this;
132
+ });
133
+ }
109
134
  /**
110
135
  * Performs remove Integration.
111
136
  *
@@ -5,6 +5,16 @@ import { Resource } from "./Resource.js";
5
5
  * Extends Resource<T> and adds property management methods for entities
6
6
  * that have a properties field in their payload.
7
7
  *
8
+ * Custom property keys are normalized and validated by the Bkper API when
9
+ * resources are persisted:
10
+ *
11
+ * - Keys can have up to 30 characters after normalization.
12
+ * - Keys are normalized to lowercase, spaces become underscores, and unsupported
13
+ * punctuation is removed.
14
+ * - Keys ending with an underscore (`_`) are treated as hidden/internal by SDK
15
+ * visible-property helpers.
16
+ * - Empty, null, or undefined values clear the property when saved.
17
+ *
8
18
  * @public
9
19
  */
10
20
  export class ResourceProperty extends Resource {
@@ -62,6 +72,10 @@ export class ResourceProperty extends Resource {
62
72
  /**
63
73
  * Sets a custom property in this resource.
64
74
  *
75
+ * Property keys are normalized and validated by the API when saved. Keep keys
76
+ * to 30 characters or fewer after normalization. Use a trailing underscore
77
+ * (`_`) for hidden/internal properties.
78
+ *
65
79
  * @param key - The property key
66
80
  * @param value - The property value, or null/undefined to clean it
67
81
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.36.0",
3
+ "version": "2.37.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",