@bisondesk/core-sdk 1.0.331 → 1.0.333

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.
Files changed (43) hide show
  1. package/lib/apis/debtors.d.ts +6 -0
  2. package/lib/apis/debtors.d.ts.map +1 -0
  3. package/lib/apis/debtors.js +25 -0
  4. package/lib/apis/debtors.js.map +1 -0
  5. package/lib/apis/leasing.d.ts +5 -1
  6. package/lib/apis/leasing.d.ts.map +1 -1
  7. package/lib/apis/leasing.js +17 -0
  8. package/lib/apis/leasing.js.map +1 -1
  9. package/lib/apis/picklists.d.ts +1 -5
  10. package/lib/apis/picklists.d.ts.map +1 -1
  11. package/lib/apis/picklists.js +1 -51
  12. package/lib/apis/picklists.js.map +1 -1
  13. package/lib/types/definitions.d.ts +1 -37
  14. package/lib/types/definitions.d.ts.map +1 -1
  15. package/lib/types/definitions.js +1 -1
  16. package/lib/types/definitions.js.map +1 -1
  17. package/lib/types/fields.d.ts +1 -82
  18. package/lib/types/fields.d.ts.map +1 -1
  19. package/lib/types/fields.js +1 -25
  20. package/lib/types/fields.js.map +1 -1
  21. package/lib/types/picklists.d.ts +1 -82
  22. package/lib/types/picklists.d.ts.map +1 -1
  23. package/lib/types/picklists.js +1 -1
  24. package/lib/types/picklists.js.map +1 -1
  25. package/lib/types/search.d.ts +1 -175
  26. package/lib/types/search.d.ts.map +1 -1
  27. package/lib/types/search.js +1 -32
  28. package/lib/types/search.js.map +1 -1
  29. package/lib/types/utils.d.ts +1 -46
  30. package/lib/types/utils.d.ts.map +1 -1
  31. package/lib/types/utils.js +1 -5
  32. package/lib/types/utils.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/apis/debtors.ts +37 -0
  35. package/src/apis/leasing.ts +30 -1
  36. package/src/apis/picklists.ts +1 -73
  37. package/src/types/definitions.ts +1 -43
  38. package/src/types/fields.ts +1 -123
  39. package/src/types/picklists.ts +1 -95
  40. package/src/types/search.ts +1 -222
  41. package/src/types/utils.ts +1 -52
  42. package/tsconfig.deploy.tsbuildinfo +1 -1
  43. package/tsconfig.tsbuildinfo +1 -1
@@ -1,176 +1,2 @@
1
- import { BusinessEntityIds, SUPPORTED_LANGUAGES } from '@bisondesk/commons-sdk/constants';
2
- import { MultiLangValue } from '@bisondesk/commons-sdk/types';
3
- import { FieldTypes, NumberMeta } from './fields.js';
4
- export declare enum ConditionType {
5
- and = "AND",
6
- or = "OR"
7
- }
8
- export declare enum ElasticsearchOperator {
9
- empty = "EMPTY",
10
- notEmpty = "NOT_EMPTY",
11
- is = "IS",
12
- isNot = "IS_NOT",
13
- greaterThanOrEqual = "GTE",
14
- greaterThan = "GT",
15
- lessThanEqual = "LTE",
16
- lessThan = "LT",
17
- between = "BETWEEN",
18
- contains = "CONTAINS",
19
- notContains = "NOT_CONTAINS",
20
- startsWith = "STARTS_WITH",
21
- endsWith = "ENDS_WITH"
22
- }
23
- export type Filter<OP = ElasticsearchOperator> = {
24
- data: string;
25
- fieldId: string;
26
- operator: OP;
27
- };
28
- export type ComplexFilter<OP = ElasticsearchOperator> = {
29
- condition: ConditionType;
30
- filters: Array<Filter<OP> | ComplexFilter<OP>>;
31
- };
32
- export type SearchResponse<T = any> = {
33
- took: number;
34
- timed_out: boolean;
35
- _scroll_id?: string;
36
- _shards: unknown;
37
- hits: {
38
- total: {
39
- value: number;
40
- relation: 'eq' | 'gte';
41
- };
42
- max_score: number;
43
- hits: Array<{
44
- _index: string;
45
- _type: string;
46
- _id: string;
47
- _score: number;
48
- _source?: T;
49
- _version?: number;
50
- _explanation?: unknown;
51
- fields?: any;
52
- highlight?: any;
53
- inner_hits?: any;
54
- matched_queries?: string[];
55
- sort?: Array<string | number>;
56
- }>;
57
- };
58
- aggregations?: {
59
- [aggName: string]: object;
60
- };
61
- };
62
- export declare const FILTER_RANGE_SEPARATOR = "__";
63
- export declare enum SortOrder {
64
- asc = "asc",
65
- desc = "desc"
66
- }
67
- export type SortFilter = {
68
- fieldId: string;
69
- order: SortOrder;
70
- };
71
- export type BaseSearchRequest = {
72
- fullText?: string;
73
- limit: number;
74
- query?: ComplexFilter<ElasticsearchOperator>;
75
- sortBy?: SortFilter[];
76
- };
77
- type InfiniteSearchRequest = {
78
- infinite: true;
79
- nextToken?: string;
80
- };
81
- type PaginatedSearchRequest = {
82
- infinite?: false;
83
- offset?: number;
84
- };
85
- export type SearchRequest = {
86
- fullText?: string;
87
- limit: number;
88
- query?: ComplexFilter<ElasticsearchOperator>;
89
- sortBy?: SortFilter[];
90
- } & (InfiniteSearchRequest | PaginatedSearchRequest);
91
- export type GlobalSearchRequest = {
92
- fullText: string;
93
- limit: number;
94
- } & {
95
- entityIds: BusinessEntityIds[];
96
- } & (InfiniteSearchRequest | PaginatedSearchRequest);
97
- export type GlobalSearchResult = {
98
- businessEntityId: BusinessEntityIds;
99
- recordId: string;
100
- title: string;
101
- description: string;
102
- tags?: string[];
103
- };
104
- export type GlobalSearchByIdRequest = {
105
- ids: {
106
- businessEntityId: BusinessEntityIds;
107
- recordId: string;
108
- }[];
109
- };
110
- export type PublicSearchRequest = {
111
- limit: number;
112
- offset?: number;
113
- query?: ComplexFilter;
114
- sortBy?: SortFilter[];
115
- };
116
- export type AggFilterOperator = ElasticsearchOperator.is | ElasticsearchOperator.greaterThan | ElasticsearchOperator.lessThan | ElasticsearchOperator.greaterThanOrEqual | ElasticsearchOperator.lessThanEqual;
117
- export declare enum AggregationType {
118
- term = "TERM",
119
- range = "RANGE"
120
- }
121
- export type TermAggregation = {
122
- titles: MultiLangValue & {
123
- [local in (typeof SUPPORTED_LANGUAGES)[number]]: string;
124
- };
125
- fieldId: string;
126
- type: AggregationType.term;
127
- orderBy?: 'count' | 'field';
128
- } & ({
129
- fieldType: FieldTypes.picklist;
130
- picklistId: string;
131
- } | {
132
- fieldType: FieldTypes.number;
133
- meta?: NumberMeta;
134
- } | {
135
- fieldType: Exclude<FieldTypes, FieldTypes.picklist | FieldTypes.number>;
136
- });
137
- export type Range = {
138
- start: number;
139
- end?: number;
140
- } | {
141
- start?: number;
142
- end: number;
143
- } | {
144
- start: number;
145
- end: number;
146
- };
147
- export type RangeAggregation = {
148
- titles: MultiLangValue & {
149
- [local in (typeof SUPPORTED_LANGUAGES)[number]]: string;
150
- };
151
- fieldId: string;
152
- type: AggregationType.range;
153
- step: number;
154
- ranges: Range[];
155
- format?: NumberMeta;
156
- };
157
- export type Aggregation = TermAggregation | RangeAggregation;
158
- export type AggregationRequest = {
159
- fullText?: string;
160
- filters: ComplexFilter<AggFilterOperator>[];
161
- };
162
- export type AggregationResult = {
163
- value: string;
164
- count: number;
165
- from?: number;
166
- to?: number;
167
- };
168
- export type AggregationResultSet = {
169
- [field: string]: AggregationResult[];
170
- };
171
- export type AggregationResponse<M = {}> = {
172
- results: AggregationResultSet;
173
- meta: M;
174
- };
175
- export {};
1
+ export * from '@bisondesk/commons-sdk/search';
176
2
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED,oBAAY,qBAAqB;IAE/B,KAAK,UAAU;IACf,QAAQ,cAAc;IACtB,EAAE,OAAO;IACT,KAAK,WAAW;IAEhB,kBAAkB,QAAQ;IAC1B,WAAW,OAAO;IAClB,aAAa,QAAQ;IACrB,QAAQ,OAAO;IACf,OAAO,YAAY;IAEnB,QAAQ,aAAa;IACrB,WAAW,iBAAiB;IAC5B,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;CACvB;AAED,MAAM,MAAM,MAAM,CAAC,EAAE,GAAG,qBAAqB,IAAI;IAC/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 -1,33 +1,2 @@
1
- export var ConditionType;
2
- (function (ConditionType) {
3
- ConditionType["and"] = "AND";
4
- ConditionType["or"] = "OR";
5
- })(ConditionType || (ConditionType = {}));
6
- export var ElasticsearchOperator;
7
- (function (ElasticsearchOperator) {
8
- ElasticsearchOperator["empty"] = "EMPTY";
9
- ElasticsearchOperator["notEmpty"] = "NOT_EMPTY";
10
- ElasticsearchOperator["is"] = "IS";
11
- ElasticsearchOperator["isNot"] = "IS_NOT";
12
- ElasticsearchOperator["greaterThanOrEqual"] = "GTE";
13
- ElasticsearchOperator["greaterThan"] = "GT";
14
- ElasticsearchOperator["lessThanEqual"] = "LTE";
15
- ElasticsearchOperator["lessThan"] = "LT";
16
- ElasticsearchOperator["between"] = "BETWEEN";
17
- ElasticsearchOperator["contains"] = "CONTAINS";
18
- ElasticsearchOperator["notContains"] = "NOT_CONTAINS";
19
- ElasticsearchOperator["startsWith"] = "STARTS_WITH";
20
- ElasticsearchOperator["endsWith"] = "ENDS_WITH";
21
- })(ElasticsearchOperator || (ElasticsearchOperator = {}));
22
- export const FILTER_RANGE_SEPARATOR = '__';
23
- export var SortOrder;
24
- (function (SortOrder) {
25
- SortOrder["asc"] = "asc";
26
- SortOrder["desc"] = "desc";
27
- })(SortOrder || (SortOrder = {}));
28
- export var AggregationType;
29
- (function (AggregationType) {
30
- AggregationType["term"] = "TERM";
31
- AggregationType["range"] = "RANGE";
32
- })(AggregationType || (AggregationType = {}));
1
+ export * from '@bisondesk/commons-sdk/search';
33
2
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,0BAAS,CAAA;AACX,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,qBAiBX;AAjBD,WAAY,qBAAqB;IAE/B,wCAAe,CAAA;IACf,+CAAsB,CAAA;IACtB,kCAAS,CAAA;IACT,yCAAgB,CAAA;IAEhB,mDAA0B,CAAA;IAC1B,2CAAkB,CAAA;IAClB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,4CAAmB,CAAA;IAEnB,8CAAqB,CAAA;IACrB,qDAA4B,CAAA;IAC5B,mDAA0B,CAAA;IAC1B,+CAAsB,CAAA;AACxB,CAAC,EAjBW,qBAAqB,KAArB,qBAAqB,QAiBhC;AA8CD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAuED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["///////////////////////////////////////////////////////\n// Generic stuff\n///////////////////////////////////////////////////////\n\nimport { BusinessEntityIds, SUPPORTED_LANGUAGES } from '@bisondesk/commons-sdk/constants';\nimport { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport { FieldTypes, NumberMeta } from './fields.js';\n\nexport enum ConditionType {\n and = 'AND',\n or = 'OR',\n}\n\nexport enum ElasticsearchOperator {\n // all properties\n empty = 'EMPTY',\n notEmpty = 'NOT_EMPTY',\n is = 'IS',\n isNot = 'IS_NOT',\n // number, date properties\n greaterThanOrEqual = 'GTE',\n greaterThan = 'GT',\n lessThanEqual = 'LTE',\n lessThan = 'LT',\n between = 'BETWEEN',\n // string properties\n contains = 'CONTAINS',\n notContains = 'NOT_CONTAINS',\n startsWith = 'STARTS_WITH',\n endsWith = 'ENDS_WITH',\n}\n\nexport type Filter<OP = ElasticsearchOperator> = {\n data: string;\n fieldId: string;\n operator: OP;\n};\n\nexport type ComplexFilter<OP = ElasticsearchOperator> = {\n condition: ConditionType;\n filters: Array<Filter<OP> | ComplexFilter<OP>>;\n};\n\nexport type SearchResponse<T = any> = {\n took: number;\n timed_out: boolean;\n _scroll_id?: string;\n _shards: unknown;\n hits: {\n total: {\n value: number;\n relation: 'eq' | 'gte';\n };\n max_score: number;\n hits: Array<{\n _index: string;\n _type: string;\n _id: string;\n _score: number;\n _source?: T;\n _version?: number;\n _explanation?: unknown;\n fields?: any;\n highlight?: any;\n inner_hits?: any;\n matched_queries?: string[];\n sort?: Array<string | number>;\n }>;\n };\n aggregations?: { [aggName: string]: object };\n};\n\n///////////////////////////////////////////////////////\n// Search\n///////////////////////////////////////////////////////\n\nexport const FILTER_RANGE_SEPARATOR = '__';\n\nexport enum SortOrder {\n asc = 'asc',\n desc = 'desc',\n}\n\nexport type SortFilter = {\n fieldId: string;\n order: SortOrder;\n};\n\nexport type BaseSearchRequest = {\n fullText?: string;\n limit: number;\n query?: ComplexFilter<ElasticsearchOperator>;\n sortBy?: SortFilter[];\n};\n\ntype InfiniteSearchRequest = {\n infinite: true;\n nextToken?: string;\n};\n\ntype PaginatedSearchRequest = {\n infinite?: false;\n offset?: number;\n};\n\nexport type SearchRequest = {\n fullText?: string;\n limit: number;\n query?: ComplexFilter<ElasticsearchOperator>;\n sortBy?: SortFilter[];\n} & (InfiniteSearchRequest | PaginatedSearchRequest);\n\nexport type GlobalSearchRequest = {\n fullText: string;\n limit: number;\n} & {\n entityIds: BusinessEntityIds[];\n} & (InfiniteSearchRequest | PaginatedSearchRequest);\n\nexport type GlobalSearchResult = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n title: string;\n description: string;\n tags?: string[];\n};\n\nexport type GlobalSearchByIdRequest = {\n ids: {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n }[];\n};\n\nexport type PublicSearchRequest = {\n limit: number;\n offset?: number;\n query?: ComplexFilter;\n sortBy?: SortFilter[];\n};\n\n///////////////////////////////////////////////////////\n// Aggregations\n///////////////////////////////////////////////////////\n\nexport type AggFilterOperator =\n | ElasticsearchOperator.is\n | ElasticsearchOperator.greaterThan\n | ElasticsearchOperator.lessThan\n | ElasticsearchOperator.greaterThanOrEqual\n | ElasticsearchOperator.lessThanEqual;\n\nexport enum AggregationType {\n term = 'TERM',\n range = 'RANGE',\n}\n\nexport type TermAggregation = {\n titles: MultiLangValue & { [local in (typeof SUPPORTED_LANGUAGES)[number]]: string };\n fieldId: string;\n type: AggregationType.term;\n\n orderBy?: 'count' | 'field';\n} & (\n | {\n fieldType: FieldTypes.picklist;\n picklistId: string;\n }\n | {\n fieldType: FieldTypes.number;\n meta?: NumberMeta;\n }\n | {\n fieldType: Exclude<FieldTypes, FieldTypes.picklist | FieldTypes.number>;\n }\n);\n\nexport type Range =\n | {\n start: number;\n end?: number;\n }\n | {\n start?: number;\n end: number;\n }\n | {\n start: number;\n end: number;\n };\n\nexport type RangeAggregation = {\n titles: MultiLangValue & { [local in (typeof SUPPORTED_LANGUAGES)[number]]: string };\n fieldId: string;\n type: AggregationType.range;\n step: number;\n ranges: Range[];\n format?: NumberMeta;\n};\n\nexport type Aggregation = TermAggregation | RangeAggregation;\n\nexport type AggregationRequest = {\n fullText?: string;\n filters: ComplexFilter<AggFilterOperator>[];\n};\n\nexport type AggregationResult = {\n value: string;\n count: number;\n from?: number;\n to?: number;\n};\n\nexport type AggregationResultSet = {\n [field: string]: AggregationResult[];\n};\n\nexport type AggregationResponse<M = {}> = {\n results: AggregationResultSet;\n meta: M;\n};\n"]}
1
+ {"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC","sourcesContent":["export * from '@bisondesk/commons-sdk/search';\n"]}
@@ -1,47 +1,2 @@
1
- import { MultiLangValue } from '@bisondesk/commons-sdk/types';
2
- import { AdHocPicklistValueDisplay } from './picklists.js';
3
- export type CountryInfo = {
4
- code: string;
5
- name: string;
6
- labels: {
7
- city: string;
8
- state: string;
9
- postalCode?: string;
10
- };
11
- required: {
12
- city: boolean;
13
- state: boolean;
14
- postalCode: boolean;
15
- };
16
- dialCode: number;
17
- currencyCode: string;
18
- states?: {
19
- [code: string]: string;
20
- };
21
- postalCodeFormat?: string;
22
- postalCodeEx?: string;
23
- };
24
- export type Country = {
25
- code: string;
26
- name: string;
27
- dialCode: number;
28
- };
29
- export type ReferenceData = {
30
- recordTitles: AdHocRecordTitles;
31
- picklistTitles: AdHocPicklistValueDisplay;
32
- };
33
- export type AdHocRecordTitles = {
34
- [businessEntityId: string]: {
35
- [recordId: string]: string | MultiLangValue;
36
- };
37
- };
38
- export type DataRecord<T, M = undefined> = {
39
- record: T;
40
- meta?: M;
41
- actions: string[];
42
- };
43
- export declare enum PricePercentageMode {
44
- CURRENCY = "currency",
45
- PERCENTAGE = "percentage"
46
- }
1
+ export * from '@bisondesk/commons-sdk/utils';
47
2
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;QACf,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QACP,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,EAAE,iBAAiB,CAAC;IAChC,cAAc,EAAE,yBAAyB,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,gBAAgB,EAAE,MAAM,GAAG;QAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;KAC7C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,IAAI;IACzC,MAAM,EAAE,CAAC,CAAC;IACV,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,oBAAY,mBAAmB;IAC7B,QAAQ,aAAa;IACrB,UAAU,eAAe;CAC1B"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -1,6 +1,2 @@
1
- export var PricePercentageMode;
2
- (function (PricePercentageMode) {
3
- PricePercentageMode["CURRENCY"] = "currency";
4
- PricePercentageMode["PERCENTAGE"] = "percentage";
5
- })(PricePercentageMode || (PricePercentageMode = {}));
1
+ export * from '@bisondesk/commons-sdk/utils';
6
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,4CAAqB,CAAA;IACrB,gDAAyB,CAAA;AAC3B,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B","sourcesContent":["import { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport { AdHocPicklistValueDisplay } from './picklists.js';\n\nexport type CountryInfo = {\n code: string; // code is ISO 3166-1 alpha-2\n name: string;\n labels: {\n city: string;\n state: string;\n postalCode?: string;\n };\n required: {\n city: boolean;\n state: boolean;\n postalCode: boolean;\n };\n dialCode: number;\n currencyCode: string;\n states?: {\n [code: string]: string; // code is ISO 3166-2\n };\n postalCodeFormat?: string;\n postalCodeEx?: string;\n};\n\nexport type Country = {\n code: string;\n name: string;\n dialCode: number;\n};\n\nexport type ReferenceData = {\n recordTitles: AdHocRecordTitles;\n picklistTitles: AdHocPicklistValueDisplay;\n};\n\nexport type AdHocRecordTitles = {\n [businessEntityId: string]: {\n [recordId: string]: string | MultiLangValue;\n };\n};\n\nexport type DataRecord<T, M = undefined> = {\n record: T;\n meta?: M; // typically ReferenceData\n actions: string[];\n};\n\nexport enum PricePercentageMode {\n CURRENCY = 'currency',\n PERCENTAGE = 'percentage',\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"/","sources":["types/utils.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC","sourcesContent":["export * from '@bisondesk/commons-sdk/utils';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/core-sdk",
3
- "version": "1.0.331",
3
+ "version": "1.0.333",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,37 @@
1
+ import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
2
+ import { XError } from '@bisondesk/commons-sdk/errors';
3
+ import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
+ import { PaginatedList } from '@bisondesk/commons-sdk/types';
5
+ import { SearchDebtorInfo } from '../types/leasing-debtors.js';
6
+ import { SearchRequest } from '../types/search.js';
7
+ import { ReferenceData } from '../types/utils.js';
8
+
9
+ export const searchDebtorsInfo = async (
10
+ tenantId: string,
11
+ request: SearchRequest
12
+ ): Promise<PaginatedList<SearchDebtorInfo, ReferenceData> | undefined> => {
13
+ const auth = await getAdminAuth();
14
+ const response: Response = await fetch(
15
+ `${process.env.CORE_API_ORIGIN}/api/leasing/debtors/search/results`,
16
+ {
17
+ method: 'POST',
18
+ headers: {
19
+ Authorization: auth,
20
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
21
+ },
22
+ body: JSON.stringify(request),
23
+ }
24
+ );
25
+
26
+ if (response.status === 200) {
27
+ return response.json() as any;
28
+ }
29
+
30
+ const body = await response.text();
31
+ throw new XError('core-sdk.search-debtors-info', {
32
+ tenantId,
33
+ request,
34
+ response: body,
35
+ status: response.status,
36
+ });
37
+ };
@@ -1,7 +1,9 @@
1
1
  import { SERVICE_ID_ADMIN_HEADER, TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
2
2
  import { XError } from '@bisondesk/commons-sdk/errors';
3
3
  import { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
+ import { PaginatedList } from '@bisondesk/commons-sdk/types';
4
5
  import fetch, { Response } from 'node-fetch';
6
+ import { SearchLeasingContract } from '../types/leasing-search.js';
5
7
  import {
6
8
  AmortizationDocs,
7
9
  AmortizationTable,
@@ -10,7 +12,8 @@ import {
10
12
  NewLeasingConditions,
11
13
  NewLeasingContract,
12
14
  } from '../types/leasing.js';
13
- import { DataRecord } from '../types/utils.js';
15
+ import { SearchRequest } from '../types/search.js';
16
+ import { DataRecord, ReferenceData } from '../types/utils.js';
14
17
 
15
18
  export const listLeasingClients = async (
16
19
  tenantId: string,
@@ -156,6 +159,32 @@ export const getLeasingContract = async (
156
159
  throw new XError(response.statusText, { tenantId, contractId, body });
157
160
  };
158
161
 
162
+ export const searchLeasingContracts = async (
163
+ tenantId: string,
164
+ request: SearchRequest
165
+ ): Promise<PaginatedList<SearchLeasingContract, ReferenceData> | undefined> => {
166
+ const auth = await getAdminAuth();
167
+ const response: Response = await fetch(
168
+ `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/search/results`,
169
+ {
170
+ headers: {
171
+ 'Content-Type': 'application/json',
172
+ Authorization: auth,
173
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
174
+ },
175
+ method: 'POST',
176
+ body: JSON.stringify(request),
177
+ }
178
+ );
179
+
180
+ if (response.ok) {
181
+ return response.status === 200 ? (response.json() as any) : undefined;
182
+ }
183
+
184
+ const body = await response.text();
185
+ throw new XError(response.statusText, { tenantId, body });
186
+ };
187
+
159
188
  export const findLeasingContracts = async (
160
189
  tenantId: string,
161
190
  clientId: string,
@@ -1,73 +1 @@
1
- import { XError } from '@bisondesk/commons-sdk/errors';
2
- import { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
3
- import { Option } from '@bisondesk/commons-sdk/types';
4
- import fetch, { Response } from 'node-fetch';
5
- import {
6
- AdHocPicklistRequest,
7
- AdHocPicklistValueDisplay,
8
- PicklistOptionsRequest,
9
- PicklistValue,
10
- PicklistValueUpdateRequest,
11
- } from '../types/picklists.js';
12
-
13
- export const getMultiplePicklistValues = async (
14
- request: AdHocPicklistRequest
15
- ): Promise<AdHocPicklistValueDisplay> => {
16
- const auth = await getAdminAuth();
17
- const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/picklists/bulk/read`, {
18
- method: 'POST',
19
- headers: {
20
- Authorization: auth,
21
- 'Content-Type': 'application/json',
22
- },
23
- body: JSON.stringify(request),
24
- });
25
-
26
- if (response.ok) {
27
- return response.json() as any;
28
- }
29
-
30
- const body = await response.text();
31
- throw new XError(response.statusText, { body });
32
- };
33
-
34
- export const getPicklistOptions = async (req: PicklistOptionsRequest): Promise<Option[]> => {
35
- const auth = await getAdminAuth();
36
-
37
- const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/picklists/options`, {
38
- method: 'POST',
39
- headers: cleanHeaders({
40
- Authorization: auth,
41
- 'Content-Type': 'application/json',
42
- }),
43
- body: JSON.stringify(req),
44
- });
45
-
46
- if (response.ok) {
47
- return response.json() as any;
48
- }
49
-
50
- const body = await response.text();
51
- throw new XError(response.statusText, { body, req });
52
- };
53
-
54
- export const upsertPicklistValue = async (
55
- request: PicklistValueUpdateRequest
56
- ): Promise<PicklistValue> => {
57
- const auth = await getAdminAuth();
58
- const response: Response = await fetch(`${process.env.CORE_API_ORIGIN}/api/picklists/value`, {
59
- method: 'POST',
60
- headers: {
61
- Authorization: auth,
62
- 'Content-Type': 'application/json',
63
- },
64
- body: JSON.stringify(request),
65
- });
66
-
67
- if (response.ok) {
68
- return response.json() as any;
69
- }
70
-
71
- const body = await response.text();
72
- throw new XError(response.statusText, { body });
73
- };
1
+ export * from '@bisondesk/commons-sdk/apis/picklists';
@@ -1,43 +1 @@
1
- import { SUPPORTED_LANGUAGES } from '@bisondesk/commons-sdk/constants';
2
- import { FieldTypeInfo } from './fields.js';
3
- import { Aggregation } from './search.js';
4
-
5
- //
6
- // These definitions are sent to the UI
7
- //
8
- export type PublicSearchDefinition = {
9
- fields: { [fieldId: string]: SearchField };
10
- aggs: Aggregation[];
11
- };
12
-
13
- //
14
- // These definitions are for internal consumption
15
- //
16
- export type SearchDefinition = {
17
- fields: { [fieldId: string]: SearchField };
18
- };
19
-
20
- export type SearchField = {
21
- id: string;
22
- titles: { [lang: string]: string } & (
23
- | { [local in (typeof SUPPORTED_LANGUAGES)[number]]: string }
24
- | { key: string }
25
- );
26
- } & FieldTypeInfo;
27
-
28
- export type EsDefinitionField = {
29
- esMapping: unknown;
30
- sortKey?: string;
31
- };
32
-
33
- export type EsDefinition = {
34
- name: string;
35
- nestedEsPaths: string[];
36
- fields: {
37
- [fieldId: string]: EsDefinitionField;
38
- };
39
- };
40
-
41
- export type EsFullTextSearchDefinition = ((lang: string) => string)[];
42
-
43
- export type EsAggregationsDefinition = Aggregation[];
1
+ export * from '@bisondesk/commons-sdk/definitions';
@@ -1,123 +1 @@
1
- export enum FieldTypes {
2
- attachment = 'attachment',
3
- checkbox = 'checkbox',
4
- collaborator = 'collaborator',
5
- date = 'date',
6
- email = 'email',
7
- image = 'image',
8
- link = 'link',
9
- location = 'location',
10
- multilang = 'multilang',
11
- multiline = 'multiline',
12
- number = 'number',
13
- phoneNumber = 'phoneNumber',
14
- picklist = 'picklist',
15
- rating = 'rating',
16
- text = 'text',
17
- }
18
-
19
- //
20
- // Field values
21
- //
22
- export enum DateGranularity {
23
- year = 'year',
24
- yearMonth = 'yearMonth',
25
- yearMonthDay = 'yearMonthDay',
26
- yearMonthDayTime = 'yearMonthDayTime',
27
- }
28
-
29
- //
30
- // Field metas
31
- //
32
- type BaseMeta = {};
33
-
34
- type NumberUnit =
35
- | 'acre'
36
- | 'bit'
37
- | 'byte'
38
- | 'celsius'
39
- | 'centimeter'
40
- | 'day'
41
- | 'degree'
42
- | 'fahrenheit'
43
- | 'fluid-ounce'
44
- | 'foot'
45
- | 'gallon'
46
- | 'gigabit'
47
- | 'gigabyte'
48
- | 'gram'
49
- | 'hectare'
50
- | 'hour'
51
- | 'inch'
52
- | 'kilobit'
53
- | 'kilobyte'
54
- | 'kilogram'
55
- | 'kilometer'
56
- | 'liter'
57
- | 'megabit'
58
- | 'megabyte'
59
- | 'meter'
60
- | 'mile'
61
- | 'mile-scandinavian'
62
- | 'milliliter'
63
- | 'millimeter'
64
- | 'millisecond'
65
- | 'minute'
66
- | 'month'
67
- | 'ounce'
68
- | 'percent'
69
- | 'petabyte'
70
- | 'pound'
71
- | 'second'
72
- | 'stone'
73
- | 'terabit'
74
- | 'terabyte'
75
- | 'week'
76
- | 'yard'
77
- | 'year';
78
-
79
- type BaseNumberMeta = {
80
- minimumFractionDigits?: number;
81
- maximumFractionDigits?: number;
82
- useGrouping?: boolean;
83
- } & (
84
- | {
85
- style: 'unit';
86
- unit: NumberUnit;
87
- }
88
- | {
89
- style?: 'currency' | 'decimal' | 'percent';
90
- unit?: NumberUnit;
91
- }
92
- );
93
-
94
- export type NumberMeta = BaseMeta & BaseNumberMeta;
95
-
96
- export type DateMeta = BaseMeta & {
97
- granularity: DateGranularity;
98
- };
99
-
100
- export type RatingMeta = BaseMeta & {
101
- max: number;
102
- };
103
-
104
- export type PicklistMeta = BaseMeta & {
105
- picklistId: string;
106
- };
107
-
108
- export type FieldTypeInfo =
109
- | { type: FieldTypes.attachment }
110
- | { type: FieldTypes.checkbox }
111
- | { type: FieldTypes.date; meta: DateMeta }
112
- | { type: FieldTypes.email }
113
- | { type: FieldTypes.image }
114
- | { type: FieldTypes.link }
115
- | { type: FieldTypes.location }
116
- | { type: FieldTypes.multilang }
117
- | { type: FieldTypes.multiline }
118
- | { type: FieldTypes.number; meta: NumberMeta }
119
- | { type: FieldTypes.phoneNumber }
120
- | { type: FieldTypes.picklist; meta: PicklistMeta }
121
- | { type: FieldTypes.rating; meta: RatingMeta }
122
- | { type: FieldTypes.text }
123
- | { type: FieldTypes.collaborator };
1
+ export * from '@bisondesk/commons-sdk/fields';