pyrus-api 2.2.1 → 2.3.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/build/cjs/index.cjs +6 -1
- package/build/esm/index.js +6 -2
- package/build/types/index.d.ts +14 -9
- package/package.json +1 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -176,6 +176,9 @@ function processFilters(filters) {
|
|
|
176
176
|
return prev;
|
|
177
177
|
}, {});
|
|
178
178
|
}
|
|
179
|
+
function prepareHeadersForCatalogApiRequest(headers) {
|
|
180
|
+
return headers.map((header) => typeof header === "string" ? header : header.name);
|
|
181
|
+
}
|
|
179
182
|
|
|
180
183
|
class ApiError extends Error {
|
|
181
184
|
constructor({ code, error }) {
|
|
@@ -751,7 +754,8 @@ class CatalogsApi extends BaseApi {
|
|
|
751
754
|
}
|
|
752
755
|
sync(request) {
|
|
753
756
|
return __awaiter(this, void 0, void 0, function* () {
|
|
754
|
-
|
|
757
|
+
const apiRequest = Object.assign(Object.assign({}, request), { catalog_headers: prepareHeadersForCatalogApiRequest(request.catalog_headers) });
|
|
758
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${request.id}`, "POST", JSON.stringify(apiRequest));
|
|
755
759
|
});
|
|
756
760
|
}
|
|
757
761
|
}
|
|
@@ -1060,6 +1064,7 @@ exports.SendSmsError = SendSmsError;
|
|
|
1060
1064
|
exports.SendSmsStatus = SendSmsStatus;
|
|
1061
1065
|
exports.SourceType = SourceType;
|
|
1062
1066
|
exports.fromJson = fromJson;
|
|
1067
|
+
exports.prepareHeadersForCatalogApiRequest = prepareHeadersForCatalogApiRequest;
|
|
1063
1068
|
exports.toDateString = toDateString;
|
|
1064
1069
|
exports.toDateTimeString = toDateTimeString;
|
|
1065
1070
|
exports.toJson = toJson;
|
package/build/esm/index.js
CHANGED
|
@@ -174,6 +174,9 @@ function processFilters(filters) {
|
|
|
174
174
|
return prev;
|
|
175
175
|
}, {});
|
|
176
176
|
}
|
|
177
|
+
function prepareHeadersForCatalogApiRequest(headers) {
|
|
178
|
+
return headers.map((header) => typeof header === "string" ? header : header.name);
|
|
179
|
+
}
|
|
177
180
|
|
|
178
181
|
class ApiError extends Error {
|
|
179
182
|
constructor({ code, error }) {
|
|
@@ -749,7 +752,8 @@ class CatalogsApi extends BaseApi {
|
|
|
749
752
|
}
|
|
750
753
|
sync(request) {
|
|
751
754
|
return __awaiter(this, void 0, void 0, function* () {
|
|
752
|
-
|
|
755
|
+
const apiRequest = Object.assign(Object.assign({}, request), { catalog_headers: prepareHeadersForCatalogApiRequest(request.catalog_headers) });
|
|
756
|
+
return yield this.fetchApi((yield this.getModulePath()) + `/${request.id}`, "POST", JSON.stringify(apiRequest));
|
|
753
757
|
});
|
|
754
758
|
}
|
|
755
759
|
}
|
|
@@ -1042,4 +1046,4 @@ class PyrusApiClient extends BaseApi {
|
|
|
1042
1046
|
}
|
|
1043
1047
|
}
|
|
1044
1048
|
|
|
1045
|
-
export { ActivityAction, ApiError, ApprovalChoice, CallEventType, ErrorCodeType, FilterMask, Flag, FormFieldType, ListType, OperatorId, PermissionLevel, PersonRights, PersonType, PyrusApiClient, SendSmsError, SendSmsStatus, SourceType, fromJson, toDateString, toDateTimeString, toJson, toTimeString };
|
|
1049
|
+
export { ActivityAction, ApiError, ApprovalChoice, CallEventType, ErrorCodeType, FilterMask, Flag, FormFieldType, ListType, OperatorId, PermissionLevel, PersonRights, PersonType, PyrusApiClient, SendSmsError, SendSmsStatus, SourceType, fromJson, prepareHeadersForCatalogApiRequest, toDateString, toDateTimeString, toJson, toTimeString };
|
package/build/types/index.d.ts
CHANGED
|
@@ -13,11 +13,20 @@ declare module "pyrus-api" {
|
|
|
13
13
|
operator_id: OperatorId;
|
|
14
14
|
values: string[];
|
|
15
15
|
};
|
|
16
|
+
export type CatalogHeader = {
|
|
17
|
+
name: string;
|
|
18
|
+
type: CatalogHeaderType;
|
|
19
|
+
};
|
|
20
|
+
enum CatalogHeaderType {
|
|
21
|
+
Text = "text",
|
|
22
|
+
Workflow = "workflow"
|
|
23
|
+
}
|
|
16
24
|
export function toJson(obj: any): string;
|
|
17
25
|
export function fromJson<T = any>(str: string): T;
|
|
18
26
|
export function toDateTimeString(date: Date | string): string;
|
|
19
27
|
export function toDateString(date: Date | string): string;
|
|
20
28
|
export function toTimeString(date: Date | string): string;
|
|
29
|
+
export function prepareHeadersForCatalogApiRequest(headers: string[] | CatalogHeader[]): string[];
|
|
21
30
|
export const ErrorCodeType: {
|
|
22
31
|
readonly ServerError: "server_error";
|
|
23
32
|
readonly AuthorizationError: "authorization_error";
|
|
@@ -662,6 +671,7 @@ declare module "pyrus-api" {
|
|
|
662
671
|
parent_task_id?: number;
|
|
663
672
|
last_note_id?: number;
|
|
664
673
|
subject?: string;
|
|
674
|
+
current_step?: number;
|
|
665
675
|
is_closed: boolean;
|
|
666
676
|
};
|
|
667
677
|
export type Role = {
|
|
@@ -1049,14 +1059,6 @@ declare module "pyrus-api" {
|
|
|
1049
1059
|
export type CatalogsResponse = {
|
|
1050
1060
|
catalogs: CatalogInfo[];
|
|
1051
1061
|
};
|
|
1052
|
-
export type CatalogHeader = {
|
|
1053
|
-
name: string;
|
|
1054
|
-
type: CatalogHeaderType;
|
|
1055
|
-
};
|
|
1056
|
-
enum CatalogHeaderType {
|
|
1057
|
-
Text = "text",
|
|
1058
|
-
Workflow = "workflow"
|
|
1059
|
-
}
|
|
1060
1062
|
export type CatalogItemResponse = CatalogItem & {
|
|
1061
1063
|
item_id: number;
|
|
1062
1064
|
};
|
|
@@ -1090,11 +1092,14 @@ declare module "pyrus-api" {
|
|
|
1090
1092
|
name: string;
|
|
1091
1093
|
source_type?: SourceType;
|
|
1092
1094
|
};
|
|
1093
|
-
export type
|
|
1095
|
+
export type SyncCatalogRequestApi = CatalogRequestBase & {
|
|
1094
1096
|
id: number;
|
|
1095
1097
|
apply: boolean;
|
|
1096
1098
|
force_update_first_column?: boolean;
|
|
1097
1099
|
};
|
|
1100
|
+
export type SyncCatalogRequest = Omit<SyncCatalogRequestApi, "catalog_headers"> & {
|
|
1101
|
+
catalog_headers: string[] | CatalogHeader[];
|
|
1102
|
+
};
|
|
1098
1103
|
export type SyncCatalogResponse = {
|
|
1099
1104
|
apply: boolean;
|
|
1100
1105
|
added?: CatalogItemResponse[];
|