pyrus-api 2.2.0 → 2.3.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/build/cjs/index.cjs +6 -1
- package/build/esm/index.js +6 -2
- package/build/types/index.d.ts +14 -10
- 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";
|
|
@@ -734,7 +743,7 @@ declare module "pyrus-api" {
|
|
|
734
743
|
task: TaskWithComments;
|
|
735
744
|
};
|
|
736
745
|
export type BotHookRequest = TaskResponse & {
|
|
737
|
-
event: "
|
|
746
|
+
event: "comment" | "close";
|
|
738
747
|
access_token: string;
|
|
739
748
|
user_id: number;
|
|
740
749
|
bot_settings: string;
|
|
@@ -1049,14 +1058,6 @@ declare module "pyrus-api" {
|
|
|
1049
1058
|
export type CatalogsResponse = {
|
|
1050
1059
|
catalogs: CatalogInfo[];
|
|
1051
1060
|
};
|
|
1052
|
-
export type CatalogHeader = {
|
|
1053
|
-
name: string;
|
|
1054
|
-
type: CatalogHeaderType;
|
|
1055
|
-
};
|
|
1056
|
-
enum CatalogHeaderType {
|
|
1057
|
-
Text = "text",
|
|
1058
|
-
Workflow = "workflow"
|
|
1059
|
-
}
|
|
1060
1061
|
export type CatalogItemResponse = CatalogItem & {
|
|
1061
1062
|
item_id: number;
|
|
1062
1063
|
};
|
|
@@ -1090,11 +1091,14 @@ declare module "pyrus-api" {
|
|
|
1090
1091
|
name: string;
|
|
1091
1092
|
source_type?: SourceType;
|
|
1092
1093
|
};
|
|
1093
|
-
export type
|
|
1094
|
+
export type SyncCatalogRequestApi = CatalogRequestBase & {
|
|
1094
1095
|
id: number;
|
|
1095
1096
|
apply: boolean;
|
|
1096
1097
|
force_update_first_column?: boolean;
|
|
1097
1098
|
};
|
|
1099
|
+
export type SyncCatalogRequest = Omit<SyncCatalogRequestApi, "catalog_headers"> & {
|
|
1100
|
+
catalog_headers: string[] | CatalogHeader[];
|
|
1101
|
+
};
|
|
1098
1102
|
export type SyncCatalogResponse = {
|
|
1099
1103
|
apply: boolean;
|
|
1100
1104
|
added?: CatalogItemResponse[];
|