bkper-js 2.15.0 → 2.15.2
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 +82 -320
- package/lib/model/Account.js +2 -70
- package/lib/model/Book.js +2 -60
- package/lib/model/Connection.js +2 -89
- package/lib/model/File.js +2 -71
- package/lib/model/Group.js +2 -71
- package/lib/model/Integration.js +2 -71
- package/lib/model/ResourceProperty.js +130 -0
- package/lib/model/Transaction.js +19 -98
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
export declare class Account extends
|
|
18
|
+
export declare class Account extends ResourceProperty<bkper.Account> {
|
|
19
19
|
|
|
20
20
|
constructor(book: Book, payload?: bkper.Account);
|
|
21
21
|
|
|
@@ -65,49 +65,6 @@ export declare class Account extends Resource<bkper.Account> {
|
|
|
65
65
|
* @returns This Account, for chaining
|
|
66
66
|
*/
|
|
67
67
|
setType(type: AccountType): Account;
|
|
68
|
-
/**
|
|
69
|
-
* Gets the custom properties stored in this Account.
|
|
70
|
-
*
|
|
71
|
-
* @returns The custom properties object
|
|
72
|
-
*/
|
|
73
|
-
getProperties(): {
|
|
74
|
-
[key: string]: string;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Sets the custom properties of the Account.
|
|
78
|
-
*
|
|
79
|
-
* @param properties - Object with key/value pair properties
|
|
80
|
-
*
|
|
81
|
-
* @returns This Account, for chaining
|
|
82
|
-
*/
|
|
83
|
-
setProperties(properties: {
|
|
84
|
-
[key: string]: string;
|
|
85
|
-
}): Account;
|
|
86
|
-
/**
|
|
87
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
88
|
-
*
|
|
89
|
-
* @param keys - The property key
|
|
90
|
-
*
|
|
91
|
-
* @returns The property value or undefined if not found
|
|
92
|
-
*/
|
|
93
|
-
getProperty(...keys: string[]): string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Sets a custom property in the Account.
|
|
96
|
-
*
|
|
97
|
-
* @param key - The property key
|
|
98
|
-
* @param value - The property value, or null/undefined to clean it
|
|
99
|
-
*
|
|
100
|
-
* @returns This Account, for chaining
|
|
101
|
-
*/
|
|
102
|
-
setProperty(key: string, value: string | null | undefined): Account;
|
|
103
|
-
/**
|
|
104
|
-
* Deletes a custom property.
|
|
105
|
-
*
|
|
106
|
-
* @param key - The property key
|
|
107
|
-
*
|
|
108
|
-
* @returns This Account, for chaining
|
|
109
|
-
*/
|
|
110
|
-
deleteProperty(key: string): Account;
|
|
111
68
|
/**
|
|
112
69
|
* Tells if this Account is archived.
|
|
113
70
|
*
|
|
@@ -1306,7 +1263,7 @@ export declare class Bkper {
|
|
|
1306
1263
|
*
|
|
1307
1264
|
* @public
|
|
1308
1265
|
*/
|
|
1309
|
-
export declare class Book extends
|
|
1266
|
+
export declare class Book extends ResourceProperty<bkper.Book> {
|
|
1310
1267
|
private config?;
|
|
1311
1268
|
private allGroupsLoaded;
|
|
1312
1269
|
private allAccountsLoaded;
|
|
@@ -1548,41 +1505,6 @@ export declare class Book extends Resource<bkper.Book> {
|
|
|
1548
1505
|
* @returns This Book, for chaining
|
|
1549
1506
|
*/
|
|
1550
1507
|
setVisibility(visibility: Visibility): Book;
|
|
1551
|
-
/**
|
|
1552
|
-
* Gets the custom properties stored in this Book.
|
|
1553
|
-
*
|
|
1554
|
-
* @returns The custom properties object
|
|
1555
|
-
*/
|
|
1556
|
-
getProperties(): {
|
|
1557
|
-
[key: string]: string;
|
|
1558
|
-
};
|
|
1559
|
-
/**
|
|
1560
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
1561
|
-
*
|
|
1562
|
-
* @param keys - The property keys to search for
|
|
1563
|
-
*
|
|
1564
|
-
* @returns The property value or undefined if not found
|
|
1565
|
-
*/
|
|
1566
|
-
getProperty(...keys: string[]): string | undefined;
|
|
1567
|
-
/**
|
|
1568
|
-
* Sets the custom properties of the Book.
|
|
1569
|
-
*
|
|
1570
|
-
* @param properties - Object with key/value pair properties
|
|
1571
|
-
*
|
|
1572
|
-
* @returns This Book, for chaining
|
|
1573
|
-
*/
|
|
1574
|
-
setProperties(properties: {
|
|
1575
|
-
[key: string]: string;
|
|
1576
|
-
}): Book;
|
|
1577
|
-
/**
|
|
1578
|
-
* Sets a custom property in the Book.
|
|
1579
|
-
*
|
|
1580
|
-
* @param key - The property key
|
|
1581
|
-
* @param value - The property value, or null/undefined to clean it
|
|
1582
|
-
*
|
|
1583
|
-
* @returns This Book, for chaining
|
|
1584
|
-
*/
|
|
1585
|
-
setProperty(key: string, value: string | null | undefined): Book;
|
|
1586
1508
|
/**
|
|
1587
1509
|
* Formats a date according to date pattern of the Book.
|
|
1588
1510
|
*
|
|
@@ -2238,7 +2160,7 @@ export declare interface Config {
|
|
|
2238
2160
|
*
|
|
2239
2161
|
* @public
|
|
2240
2162
|
*/
|
|
2241
|
-
export declare class Connection extends
|
|
2163
|
+
export declare class Connection extends ResourceProperty<bkper.Connection> {
|
|
2242
2164
|
private config?;
|
|
2243
2165
|
constructor(payload?: bkper.Connection, config?: Config);
|
|
2244
2166
|
|
|
@@ -2322,59 +2244,10 @@ export declare class Connection extends Resource<bkper.Connection> {
|
|
|
2322
2244
|
* @returns The Connection, for chaining
|
|
2323
2245
|
*/
|
|
2324
2246
|
setType(type: "APP" | "BANK"): Connection;
|
|
2325
|
-
/**
|
|
2326
|
-
* Gets the custom properties stored in the Connection
|
|
2327
|
-
*
|
|
2328
|
-
* @returns Object with key/value pair properties
|
|
2329
|
-
*/
|
|
2330
|
-
getProperties(): {
|
|
2331
|
-
[key: string]: string;
|
|
2332
|
-
};
|
|
2333
|
-
/**
|
|
2334
|
-
* Sets the custom properties of the Connection.
|
|
2335
|
-
*
|
|
2336
|
-
* @param properties - Object with key/value pair properties
|
|
2337
|
-
*
|
|
2338
|
-
* @returns The Connection, for chaining
|
|
2339
|
-
*/
|
|
2340
|
-
setProperties(properties: {
|
|
2341
|
-
[key: string]: string;
|
|
2342
|
-
}): Connection;
|
|
2343
|
-
/**
|
|
2344
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
2345
|
-
*
|
|
2346
|
-
* @param keys - The property key
|
|
2347
|
-
*
|
|
2348
|
-
* @returns The retrieved property value
|
|
2349
|
-
*/
|
|
2350
|
-
getProperty(...keys: string[]): string | undefined;
|
|
2351
|
-
/**
|
|
2352
|
-
* Sets a custom property in the Connection.
|
|
2353
|
-
*
|
|
2354
|
-
* @param key - The property key
|
|
2355
|
-
* @param value - The property value, or null/undefined to clean it
|
|
2356
|
-
*
|
|
2357
|
-
* @returns The Connection, for chaining
|
|
2358
|
-
*/
|
|
2359
|
-
setProperty(key: string, value: string | null | undefined): Connection;
|
|
2360
|
-
/**
|
|
2361
|
-
* Deletes a custom property stored in the Connection.
|
|
2362
|
-
*
|
|
2363
|
-
* @param key - The property key
|
|
2364
|
-
*
|
|
2365
|
-
* @returns The Connection, for chaining
|
|
2366
|
-
*/
|
|
2367
|
-
deleteProperty(key: string): Connection;
|
|
2368
2247
|
/**
|
|
2369
2248
|
* Cleans any token property stored in the Connection.
|
|
2370
2249
|
*/
|
|
2371
2250
|
clearTokenProperties(): void;
|
|
2372
|
-
/**
|
|
2373
|
-
* Gets the custom properties keys stored in the Connection.
|
|
2374
|
-
*
|
|
2375
|
-
* @returns The retrieved property keys
|
|
2376
|
-
*/
|
|
2377
|
-
getPropertyKeys(): string[];
|
|
2378
2251
|
/**
|
|
2379
2252
|
* Gets the existing [[Integrations]] on the Connection.
|
|
2380
2253
|
*
|
|
@@ -2559,7 +2432,7 @@ export declare enum EventType {
|
|
|
2559
2432
|
*
|
|
2560
2433
|
* @public
|
|
2561
2434
|
*/
|
|
2562
|
-
export declare class File extends
|
|
2435
|
+
export declare class File extends ResourceProperty<bkper.File> {
|
|
2563
2436
|
|
|
2564
2437
|
constructor(book: Book, payload?: bkper.File);
|
|
2565
2438
|
/**
|
|
@@ -2629,49 +2502,6 @@ export declare class File extends Resource<bkper.File> {
|
|
|
2629
2502
|
* @returns The file size in bytes
|
|
2630
2503
|
*/
|
|
2631
2504
|
getSize(): number | undefined;
|
|
2632
|
-
/**
|
|
2633
|
-
* Gets the custom properties stored in this File.
|
|
2634
|
-
*
|
|
2635
|
-
* @returns The custom properties object
|
|
2636
|
-
*/
|
|
2637
|
-
getProperties(): {
|
|
2638
|
-
[key: string]: string;
|
|
2639
|
-
};
|
|
2640
|
-
/**
|
|
2641
|
-
* Sets the custom properties of the File.
|
|
2642
|
-
*
|
|
2643
|
-
* @param properties - Object with key/value pair properties
|
|
2644
|
-
*
|
|
2645
|
-
* @returns This File, for chaining
|
|
2646
|
-
*/
|
|
2647
|
-
setProperties(properties: {
|
|
2648
|
-
[key: string]: string;
|
|
2649
|
-
}): File;
|
|
2650
|
-
/**
|
|
2651
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
2652
|
-
*
|
|
2653
|
-
* @param keys - The property key
|
|
2654
|
-
*
|
|
2655
|
-
* @returns The property value or undefined if not found
|
|
2656
|
-
*/
|
|
2657
|
-
getProperty(...keys: string[]): string | undefined;
|
|
2658
|
-
/**
|
|
2659
|
-
* Sets a custom property in the File.
|
|
2660
|
-
*
|
|
2661
|
-
* @param key - The property key
|
|
2662
|
-
* @param value - The property value, or null/undefined to clean it
|
|
2663
|
-
*
|
|
2664
|
-
* @returns This File, for chaining
|
|
2665
|
-
*/
|
|
2666
|
-
setProperty(key: string, value: string | null | undefined): File;
|
|
2667
|
-
/**
|
|
2668
|
-
* Deletes a custom property.
|
|
2669
|
-
*
|
|
2670
|
-
* @param key - The property key
|
|
2671
|
-
*
|
|
2672
|
-
* @returns This File, for chaining
|
|
2673
|
-
*/
|
|
2674
|
-
deleteProperty(key: string): File;
|
|
2675
2505
|
/**
|
|
2676
2506
|
* Perform create new File.
|
|
2677
2507
|
*
|
|
@@ -2689,7 +2519,7 @@ export declare class File extends Resource<bkper.File> {
|
|
|
2689
2519
|
*
|
|
2690
2520
|
* @public
|
|
2691
2521
|
*/
|
|
2692
|
-
export declare class Group extends
|
|
2522
|
+
export declare class Group extends ResourceProperty<bkper.Group> {
|
|
2693
2523
|
|
|
2694
2524
|
|
|
2695
2525
|
|
|
@@ -2756,49 +2586,6 @@ export declare class Group extends Resource<bkper.Group> {
|
|
|
2756
2586
|
* @returns The type for of the accounts of this group. Null if mixed
|
|
2757
2587
|
*/
|
|
2758
2588
|
getType(): AccountType;
|
|
2759
|
-
/**
|
|
2760
|
-
* Gets the custom properties stored in this Group.
|
|
2761
|
-
*
|
|
2762
|
-
* @returns The custom properties as a key/value object
|
|
2763
|
-
*/
|
|
2764
|
-
getProperties(): {
|
|
2765
|
-
[key: string]: string;
|
|
2766
|
-
};
|
|
2767
|
-
/**
|
|
2768
|
-
* Sets the custom properties of the Group
|
|
2769
|
-
*
|
|
2770
|
-
* @param properties - Object with key/value pair properties
|
|
2771
|
-
*
|
|
2772
|
-
* @returns This Group, for chaining
|
|
2773
|
-
*/
|
|
2774
|
-
setProperties(properties: {
|
|
2775
|
-
[key: string]: string;
|
|
2776
|
-
}): Group;
|
|
2777
|
-
/**
|
|
2778
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
2779
|
-
*
|
|
2780
|
-
* @param keys - The property key
|
|
2781
|
-
*
|
|
2782
|
-
* @returns The property value, or undefined if not found
|
|
2783
|
-
*/
|
|
2784
|
-
getProperty(...keys: string[]): string | undefined;
|
|
2785
|
-
/**
|
|
2786
|
-
* Sets a custom property in the Group.
|
|
2787
|
-
*
|
|
2788
|
-
* @param key - The property key
|
|
2789
|
-
* @param value - The property value, or null/undefined to clean it
|
|
2790
|
-
*
|
|
2791
|
-
* @returns This Group, for chaining
|
|
2792
|
-
*/
|
|
2793
|
-
setProperty(key: string, value: string | null | undefined): Group;
|
|
2794
|
-
/**
|
|
2795
|
-
* Delete a custom property
|
|
2796
|
-
*
|
|
2797
|
-
* @param key - The property key
|
|
2798
|
-
*
|
|
2799
|
-
* @returns This Group, for chaining
|
|
2800
|
-
*/
|
|
2801
|
-
deleteProperty(key: string): Group;
|
|
2802
2589
|
/**
|
|
2803
2590
|
* Tells if the Group is hidden on main transactions menu.
|
|
2804
2591
|
*
|
|
@@ -2941,7 +2728,7 @@ export declare class Group extends Resource<bkper.Group> {
|
|
|
2941
2728
|
*
|
|
2942
2729
|
* @public
|
|
2943
2730
|
*/
|
|
2944
|
-
export declare class Integration extends
|
|
2731
|
+
export declare class Integration extends ResourceProperty<bkper.Integration> {
|
|
2945
2732
|
private config?;
|
|
2946
2733
|
constructor(payload?: bkper.Integration, config?: Config);
|
|
2947
2734
|
|
|
@@ -3007,49 +2794,6 @@ export declare class Integration extends Resource<bkper.Integration> {
|
|
|
3007
2794
|
* @returns The Integration last update date in milliseconds
|
|
3008
2795
|
*/
|
|
3009
2796
|
getLastUpdateMs(): string | undefined;
|
|
3010
|
-
/**
|
|
3011
|
-
* Gets the custom properties stored in the Integration.
|
|
3012
|
-
*
|
|
3013
|
-
* @returns Object with key/value pair properties
|
|
3014
|
-
*/
|
|
3015
|
-
getProperties(): {
|
|
3016
|
-
[key: string]: string;
|
|
3017
|
-
};
|
|
3018
|
-
/**
|
|
3019
|
-
* Sets the custom properties of the Integration.
|
|
3020
|
-
*
|
|
3021
|
-
* @param properties - Object with key/value pair properties
|
|
3022
|
-
*
|
|
3023
|
-
* @returns The Integration, for chaining
|
|
3024
|
-
*/
|
|
3025
|
-
setProperties(properties: {
|
|
3026
|
-
[key: string]: string;
|
|
3027
|
-
}): Integration;
|
|
3028
|
-
/**
|
|
3029
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
3030
|
-
*
|
|
3031
|
-
* @param keys - The property key
|
|
3032
|
-
*
|
|
3033
|
-
* @returns The retrieved property value
|
|
3034
|
-
*/
|
|
3035
|
-
getProperty(...keys: string[]): string | undefined;
|
|
3036
|
-
/**
|
|
3037
|
-
* Sets a custom property in the Integration.
|
|
3038
|
-
*
|
|
3039
|
-
* @param key - The property key
|
|
3040
|
-
* @param value - The property value, or null/undefined to clean it
|
|
3041
|
-
*
|
|
3042
|
-
* @returns The Integration, for chaining
|
|
3043
|
-
*/
|
|
3044
|
-
setProperty(key: string, value: string | null | undefined): Integration;
|
|
3045
|
-
/**
|
|
3046
|
-
* Deletes a custom property stored in the Integration.
|
|
3047
|
-
*
|
|
3048
|
-
* @param key - The property key
|
|
3049
|
-
*
|
|
3050
|
-
* @returns The Integration, for chaining
|
|
3051
|
-
*/
|
|
3052
|
-
deleteProperty(key: string): Integration;
|
|
3053
2797
|
/**
|
|
3054
2798
|
* Performs remove Integration.
|
|
3055
2799
|
*
|
|
@@ -3242,6 +2986,73 @@ declare abstract class Resource<T = any> {
|
|
|
3242
2986
|
|
|
3243
2987
|
}
|
|
3244
2988
|
|
|
2989
|
+
/**
|
|
2990
|
+
* Abstract base class for Bkper resources that support custom properties.
|
|
2991
|
+
*
|
|
2992
|
+
* Extends Resource<T> and adds property management methods for entities
|
|
2993
|
+
* that have a properties field in their payload.
|
|
2994
|
+
*
|
|
2995
|
+
* @public
|
|
2996
|
+
*/
|
|
2997
|
+
declare abstract class ResourceProperty<T extends {
|
|
2998
|
+
properties?: {
|
|
2999
|
+
[key: string]: string;
|
|
3000
|
+
};
|
|
3001
|
+
}> extends Resource<T> {
|
|
3002
|
+
|
|
3003
|
+
/**
|
|
3004
|
+
* Gets the custom properties stored in this resource.
|
|
3005
|
+
*
|
|
3006
|
+
* @returns Object with key/value pair properties
|
|
3007
|
+
*/
|
|
3008
|
+
getProperties(): {
|
|
3009
|
+
[key: string]: string;
|
|
3010
|
+
};
|
|
3011
|
+
/**
|
|
3012
|
+
* Sets the custom properties of this resource.
|
|
3013
|
+
*
|
|
3014
|
+
* @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
|
+
*
|
|
3017
|
+
* @returns This resource, for chaining
|
|
3018
|
+
*/
|
|
3019
|
+
setProperties(properties: {
|
|
3020
|
+
[key: string]: string;
|
|
3021
|
+
}, filterHidden?: boolean): this;
|
|
3022
|
+
/**
|
|
3023
|
+
* Gets the property value for given keys. First property found will be retrieved.
|
|
3024
|
+
*
|
|
3025
|
+
* @param keys - The property keys to search for
|
|
3026
|
+
*
|
|
3027
|
+
* @returns The property value or undefined if not found
|
|
3028
|
+
*/
|
|
3029
|
+
getProperty(...keys: string[]): string | undefined;
|
|
3030
|
+
/**
|
|
3031
|
+
* Sets a custom property in this resource.
|
|
3032
|
+
*
|
|
3033
|
+
* @param key - The property key
|
|
3034
|
+
* @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
|
+
*
|
|
3037
|
+
* @returns This resource, for chaining
|
|
3038
|
+
*/
|
|
3039
|
+
setProperty(key: string, value: string | null | undefined, filterHidden?: boolean): this;
|
|
3040
|
+
/**
|
|
3041
|
+
* Deletes a custom property.
|
|
3042
|
+
*
|
|
3043
|
+
* @param key - The property key
|
|
3044
|
+
*
|
|
3045
|
+
* @returns This resource, for chaining
|
|
3046
|
+
*/
|
|
3047
|
+
deleteProperty(key: string): this;
|
|
3048
|
+
/**
|
|
3049
|
+
* Gets the custom properties keys stored in this resource.
|
|
3050
|
+
*
|
|
3051
|
+
* @returns Array of property keys sorted alphabetically
|
|
3052
|
+
*/
|
|
3053
|
+
getPropertyKeys(): string[];
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3245
3056
|
/**
|
|
3246
3057
|
* This class defines a Template.
|
|
3247
3058
|
*
|
|
@@ -3311,7 +3122,7 @@ export declare class Template extends Resource<bkper.Template> {
|
|
|
3311
3122
|
*
|
|
3312
3123
|
* @public
|
|
3313
3124
|
*/
|
|
3314
|
-
export declare class Transaction extends
|
|
3125
|
+
export declare class Transaction extends ResourceProperty<bkper.Transaction> {
|
|
3315
3126
|
|
|
3316
3127
|
|
|
3317
3128
|
constructor(book: Book, payload?: bkper.Transaction);
|
|
@@ -3459,55 +3270,6 @@ export declare class Transaction extends Resource<bkper.Transaction> {
|
|
|
3459
3270
|
* @returns True if the transaction has the specified tag
|
|
3460
3271
|
*/
|
|
3461
3272
|
hasTag(tag: string): boolean;
|
|
3462
|
-
/**
|
|
3463
|
-
* Gets the custom properties stored in this Transaction.
|
|
3464
|
-
*
|
|
3465
|
-
* @returns Object with key/value pair properties
|
|
3466
|
-
*/
|
|
3467
|
-
getProperties(): {
|
|
3468
|
-
[key: string]: string;
|
|
3469
|
-
};
|
|
3470
|
-
/**
|
|
3471
|
-
* Sets the custom properties of the Transaction
|
|
3472
|
-
*
|
|
3473
|
-
* @param properties - Object with key/value pair properties
|
|
3474
|
-
*
|
|
3475
|
-
* @returns This Transaction, for chaining
|
|
3476
|
-
*/
|
|
3477
|
-
setProperties(properties: {
|
|
3478
|
-
[key: string]: string;
|
|
3479
|
-
}): Transaction;
|
|
3480
|
-
/**
|
|
3481
|
-
* Gets the property value for given keys. First property found will be retrieved
|
|
3482
|
-
*
|
|
3483
|
-
* @param keys - The property key
|
|
3484
|
-
*
|
|
3485
|
-
* @returns The property value or undefined if not found
|
|
3486
|
-
*/
|
|
3487
|
-
getProperty(...keys: string[]): string | undefined;
|
|
3488
|
-
/**
|
|
3489
|
-
* Gets the custom properties keys stored in this Transaction.
|
|
3490
|
-
*
|
|
3491
|
-
* @returns Array of property keys
|
|
3492
|
-
*/
|
|
3493
|
-
getPropertyKeys(): string[];
|
|
3494
|
-
/**
|
|
3495
|
-
* Sets a custom property in the Transaction.
|
|
3496
|
-
*
|
|
3497
|
-
* @param key - The property key
|
|
3498
|
-
* @param value - The property value, or null/undefined to clean it
|
|
3499
|
-
*
|
|
3500
|
-
* @returns This Transaction, for chaining
|
|
3501
|
-
*/
|
|
3502
|
-
setProperty(key: string, value: string | null | undefined): Transaction;
|
|
3503
|
-
/**
|
|
3504
|
-
* Delete a custom property
|
|
3505
|
-
*
|
|
3506
|
-
* @param key - The property key
|
|
3507
|
-
*
|
|
3508
|
-
* @returns This Transaction, for chaining
|
|
3509
|
-
*/
|
|
3510
|
-
deleteProperty(key: string): Transaction;
|
|
3511
3273
|
/**
|
|
3512
3274
|
* Gets the credit account associated with this Transaction. Same as origin account
|
|
3513
3275
|
*
|
|
@@ -3523,19 +3285,19 @@ export declare class Transaction extends Resource<bkper.Transaction> {
|
|
|
3523
3285
|
/**
|
|
3524
3286
|
* Sets the credit/origin [[Account]] of this Transaction. Same as from()
|
|
3525
3287
|
*
|
|
3526
|
-
* @param account - The Account object
|
|
3288
|
+
* @param account - The Account object, or null/undefined to clear
|
|
3527
3289
|
*
|
|
3528
3290
|
* @returns This Transaction, for chaining
|
|
3529
3291
|
*/
|
|
3530
|
-
setCreditAccount(account: Account | bkper.Account): Transaction;
|
|
3292
|
+
setCreditAccount(account: Account | bkper.Account | null | undefined): Transaction;
|
|
3531
3293
|
/**
|
|
3532
3294
|
* Sets the credit/origin [[Account]] of this Transaction. Same as setCreditAccount()
|
|
3533
3295
|
*
|
|
3534
|
-
* @param account - The Account object
|
|
3296
|
+
* @param account - The Account object, or null/undefined to clear
|
|
3535
3297
|
*
|
|
3536
3298
|
* @returns This Transaction, for chaining
|
|
3537
3299
|
*/
|
|
3538
|
-
from(account: Account | bkper.Account): Transaction;
|
|
3300
|
+
from(account: Account | bkper.Account | null | undefined): Transaction;
|
|
3539
3301
|
/**
|
|
3540
3302
|
* Gets the debit account associated with this Transaction. Same as destination account
|
|
3541
3303
|
*
|
|
@@ -3551,19 +3313,19 @@ export declare class Transaction extends Resource<bkper.Transaction> {
|
|
|
3551
3313
|
/**
|
|
3552
3314
|
* Sets the debit/destination [[Account]] of this Transaction. Same as to()
|
|
3553
3315
|
*
|
|
3554
|
-
* @param account - The Account object
|
|
3316
|
+
* @param account - The Account object, or null/undefined to clear
|
|
3555
3317
|
*
|
|
3556
3318
|
* @returns This Transaction, for chaining
|
|
3557
3319
|
*/
|
|
3558
|
-
setDebitAccount(account: Account | bkper.Account): Transaction;
|
|
3320
|
+
setDebitAccount(account: Account | bkper.Account | null | undefined): Transaction;
|
|
3559
3321
|
/**
|
|
3560
3322
|
* Sets the debit/destination [[Account]] of this Transaction. Same as setDebitAccount()
|
|
3561
3323
|
*
|
|
3562
|
-
* @param account - The Account object
|
|
3324
|
+
* @param account - The Account object, or null/undefined to clear
|
|
3563
3325
|
*
|
|
3564
3326
|
* @returns This Transaction, for chaining
|
|
3565
3327
|
*/
|
|
3566
|
-
to(account: Account | bkper.Account): Transaction;
|
|
3328
|
+
to(account: Account | bkper.Account | null | undefined): Transaction;
|
|
3567
3329
|
/**
|
|
3568
3330
|
* Gets the amount of this Transaction.
|
|
3569
3331
|
*
|
package/lib/model/Account.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as AccountService from "../service/account-service.js";
|
|
|
11
11
|
import * as GroupService from "../service/group-service.js";
|
|
12
12
|
import { Group } from "./Group.js";
|
|
13
13
|
import { normalizeText } from "../utils.js";
|
|
14
|
-
import {
|
|
14
|
+
import { ResourceProperty } from "./ResourceProperty.js";
|
|
15
15
|
/**
|
|
16
16
|
* This class defines an [Account](https://en.wikipedia.org/wiki/Account_(bookkeeping)) of a [[Book]].
|
|
17
17
|
*
|
|
@@ -21,7 +21,7 @@ import { Resource } from "./Resource.js";
|
|
|
21
21
|
*
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
export class Account extends
|
|
24
|
+
export class Account extends ResourceProperty {
|
|
25
25
|
constructor(book, payload) {
|
|
26
26
|
super(payload || { createdAt: `${Date.now()}` });
|
|
27
27
|
this.book = book;
|
|
@@ -97,74 +97,6 @@ export class Account extends Resource {
|
|
|
97
97
|
this.payload.type = type;
|
|
98
98
|
return this;
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Gets the custom properties stored in this Account.
|
|
102
|
-
*
|
|
103
|
-
* @returns The custom properties object
|
|
104
|
-
*/
|
|
105
|
-
getProperties() {
|
|
106
|
-
return this.payload.properties != null ? Object.assign({}, this.payload.properties) : {};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Sets the custom properties of the Account.
|
|
110
|
-
*
|
|
111
|
-
* @param properties - Object with key/value pair properties
|
|
112
|
-
*
|
|
113
|
-
* @returns This Account, for chaining
|
|
114
|
-
*/
|
|
115
|
-
setProperties(properties) {
|
|
116
|
-
this.payload.properties = Object.assign({}, properties);
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
121
|
-
*
|
|
122
|
-
* @param keys - The property key
|
|
123
|
-
*
|
|
124
|
-
* @returns The property value or undefined if not found
|
|
125
|
-
*/
|
|
126
|
-
getProperty(...keys) {
|
|
127
|
-
for (let index = 0; index < keys.length; index++) {
|
|
128
|
-
const key = keys[index];
|
|
129
|
-
let value = this.payload.properties != null ? this.payload.properties[key] : null;
|
|
130
|
-
if (value != null && value.trim() != "") {
|
|
131
|
-
return value;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Sets a custom property in the Account.
|
|
138
|
-
*
|
|
139
|
-
* @param key - The property key
|
|
140
|
-
* @param value - The property value, or null/undefined to clean it
|
|
141
|
-
*
|
|
142
|
-
* @returns This Account, for chaining
|
|
143
|
-
*/
|
|
144
|
-
setProperty(key, value) {
|
|
145
|
-
if (key == null || key.trim() == "") {
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
if (this.payload.properties == null) {
|
|
149
|
-
this.payload.properties = {};
|
|
150
|
-
}
|
|
151
|
-
if (!value) {
|
|
152
|
-
value = "";
|
|
153
|
-
}
|
|
154
|
-
this.payload.properties[key] = value;
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Deletes a custom property.
|
|
159
|
-
*
|
|
160
|
-
* @param key - The property key
|
|
161
|
-
*
|
|
162
|
-
* @returns This Account, for chaining
|
|
163
|
-
*/
|
|
164
|
-
deleteProperty(key) {
|
|
165
|
-
this.setProperty(key, null);
|
|
166
|
-
return this;
|
|
167
|
-
}
|
|
168
100
|
/**
|
|
169
101
|
* Tells if this Account is archived.
|
|
170
102
|
*
|
package/lib/model/Book.js
CHANGED
|
@@ -18,7 +18,7 @@ import * as TransactionService from "../service/transaction-service.js";
|
|
|
18
18
|
import * as EventService from "../service/event-service.js";
|
|
19
19
|
import * as CollaboratorService from "../service/collaborator-service.js";
|
|
20
20
|
import * as Utils from "../utils.js";
|
|
21
|
-
import {
|
|
21
|
+
import { ResourceProperty } from "./ResourceProperty.js";
|
|
22
22
|
import { Account } from "./Account.js";
|
|
23
23
|
import { Collaborator } from "./Collaborator.js";
|
|
24
24
|
import { Collection } from "./Collection.js";
|
|
@@ -41,7 +41,7 @@ import { Backlog } from "./Backlog.js";
|
|
|
41
41
|
*
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
export class Book extends
|
|
44
|
+
export class Book extends ResourceProperty {
|
|
45
45
|
constructor(payload, config) {
|
|
46
46
|
super(payload);
|
|
47
47
|
this.allGroupsLoaded = false;
|
|
@@ -379,64 +379,6 @@ export class Book extends Resource {
|
|
|
379
379
|
this.payload.visibility = visibility;
|
|
380
380
|
return this;
|
|
381
381
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Gets the custom properties stored in this Book.
|
|
384
|
-
*
|
|
385
|
-
* @returns The custom properties object
|
|
386
|
-
*/
|
|
387
|
-
getProperties() {
|
|
388
|
-
return this.payload.properties != null
|
|
389
|
-
? Object.assign({}, this.payload.properties) : {};
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Gets the property value for given keys. First property found will be retrieved.
|
|
393
|
-
*
|
|
394
|
-
* @param keys - The property keys to search for
|
|
395
|
-
*
|
|
396
|
-
* @returns The property value or undefined if not found
|
|
397
|
-
*/
|
|
398
|
-
getProperty(...keys) {
|
|
399
|
-
for (let index = 0; index < keys.length; index++) {
|
|
400
|
-
const key = keys[index];
|
|
401
|
-
let value = this.payload.properties != null ? this.payload.properties[key] : null;
|
|
402
|
-
if (value != null && value.trim() != "") {
|
|
403
|
-
return value;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return undefined;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Sets the custom properties of the Book.
|
|
410
|
-
*
|
|
411
|
-
* @param properties - Object with key/value pair properties
|
|
412
|
-
*
|
|
413
|
-
* @returns This Book, for chaining
|
|
414
|
-
*/
|
|
415
|
-
setProperties(properties) {
|
|
416
|
-
this.payload.properties = Object.assign({}, properties);
|
|
417
|
-
return this;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Sets a custom property in the Book.
|
|
421
|
-
*
|
|
422
|
-
* @param key - The property key
|
|
423
|
-
* @param value - The property value, or null/undefined to clean it
|
|
424
|
-
*
|
|
425
|
-
* @returns This Book, for chaining
|
|
426
|
-
*/
|
|
427
|
-
setProperty(key, value) {
|
|
428
|
-
if (key == null || key.trim() == "") {
|
|
429
|
-
return this;
|
|
430
|
-
}
|
|
431
|
-
if (this.payload.properties == null) {
|
|
432
|
-
this.payload.properties = {};
|
|
433
|
-
}
|
|
434
|
-
if (!value) {
|
|
435
|
-
value = "";
|
|
436
|
-
}
|
|
437
|
-
this.payload.properties[key] = value;
|
|
438
|
-
return this;
|
|
439
|
-
}
|
|
440
382
|
/**
|
|
441
383
|
* Formats a date according to date pattern of the Book.
|
|
442
384
|
*
|