bx-rest 1.5.0 → 1.5.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.en.md +3 -3
  3. package/README.md +3 -3
  4. package/esm2022/functions/mapResult.mjs +4 -2
  5. package/esm2022/map/disk.mjs +13 -0
  6. package/esm2022/map/im/recent.mjs +1 -9
  7. package/esm2022/map/task.mjs +11 -5
  8. package/esm2022/map/tasks/task.mjs +3 -3
  9. package/esm2022/map/tasks.mjs +4 -3
  10. package/esm2022/map/user.mjs +5 -4
  11. package/esm2022/public-api.mjs +1 -1
  12. package/esm2022/request-navvy/bizproc.mjs +2 -2
  13. package/esm2022/request-navvy/pull/config.mjs +1 -3
  14. package/esm2022/request-navvy/task/operation/elapseditem.mjs +8 -65
  15. package/esm2022/rest/map.mjs +3 -3
  16. package/esm2022/services/base.mjs +7 -4
  17. package/esm2022/services/http/HttpBX.mjs +8 -3
  18. package/esm2022/services/navvy/extends/navvy-pag-base.mjs +63 -9
  19. package/esm2022/services/navvy/navvy-alternative-pagination-navigation.mjs +21 -71
  20. package/esm2022/services/navvy/navvy-pag-nav-result-key-object.mjs +10 -49
  21. package/esm2022/services/navvy/navvy-pag-nav-result-key.mjs +14 -73
  22. package/esm2022/services/navvy/navvy-pag-nav-tasks.mjs +4 -76
  23. package/esm2022/services/navvy/navvy-pag-nav-with-useless-key.mjs +10 -76
  24. package/esm2022/services/navvy/navvy-pag.mjs +7 -65
  25. package/esm2022/typification/rest/settings.mjs +1 -1
  26. package/esm2022/typification/rest/user/user.mjs +1 -1
  27. package/fesm2022/bx-rest.mjs +491 -1656
  28. package/fesm2022/bx-rest.mjs.map +1 -1
  29. package/map/disk.d.ts +10 -0
  30. package/map/task.d.ts +3 -3
  31. package/map/tasks/task.d.ts +1 -1
  32. package/map/tasks.d.ts +1 -1
  33. package/package.json +5 -2
  34. package/public-api.d.ts +5 -2
  35. package/request-navvy/pull/config.d.ts +0 -2
  36. package/rest/map.d.ts +2 -2
  37. package/services/navvy/extends/navvy-pag-base.d.ts +16 -2
  38. package/services/navvy/navvy-alternative-pagination-navigation.d.ts +5 -2
  39. package/services/navvy/navvy-pag-nav-result-key-object.d.ts +0 -2
  40. package/services/navvy/navvy-pag-nav-result-key.d.ts +1 -4
  41. package/services/navvy/navvy-pag-nav-tasks.d.ts +2 -9
  42. package/services/navvy/navvy-pag-nav-with-useless-key.d.ts +0 -2
  43. package/services/navvy/navvy-pag.d.ts +0 -2
  44. package/typification/rest/settings.d.ts +1 -0
  45. package/typification/rest/user/user.d.ts +3 -3
package/map/disk.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { BXRestMapDiskFolder } from './disk/folder';
2
+ import { BXRestMapDiskAttachedObject } from './disk/attachedObject';
3
+ import { BXRestMapDiskFile } from './disk/file';
4
+ import { BXRestMapDiskStorage } from './disk/storage';
5
+ export declare class BXRestMapDisk {
6
+ readonly folder: BXRestMapDiskFolder;
7
+ readonly attachedObject: BXRestMapDiskAttachedObject;
8
+ readonly file: BXRestMapDiskFile;
9
+ readonly storage: BXRestMapDiskStorage;
10
+ }
package/map/task.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BXRestMapTaskCommentItem } from './task/commentitem';
2
2
  import { BXRestMapTaskElapsedItem } from './task/elapseditem';
3
3
  import { BXRestMapTaskStage } from './task/stages';
4
4
  export declare class BXRestMapTask {
5
- readonly commentItem: BXRestMapTaskCommentItem;
6
- readonly elapsedItem: BXRestMapTaskElapsedItem;
7
- readonly stages: BXRestMapTaskStage;
5
+ static get commentItem(): typeof BXRestMapTaskCommentItem;
6
+ static get elapsedItem(): typeof BXRestMapTaskElapsedItem;
7
+ static get stages(): typeof BXRestMapTaskStage;
8
8
  }
@@ -5,7 +5,7 @@ import { BXRestMapTasksTaskResult } from './task/result';
5
5
  import { iBXRestHttpTask, iBXRestTask } from '../../typification/rest/tasks/task';
6
6
  import { iBXRestTaskFieldsName } from '../../typification/rest/tasks/base/fields-name';
7
7
  export declare class BXRestMapTasksTask {
8
- readonly result: typeof BXRestMapTasksTaskResult;
8
+ static get result(): typeof BXRestMapTasksTaskResult;
9
9
  static getAccess(v: iBXRestTaskGetAccess | undefined): Record<number, import("../../typification/rest/task/access/getaccess").iBXRestTaskGetAccessItem> | undefined;
10
10
  static add(item: {
11
11
  task: iBXRestTasksTaskGetHttpDefault;
package/map/tasks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { BXRestMapTasksTask } from './tasks/task';
2
2
  export declare class BXRestMapTasks {
3
- readonly task: BXRestMapTasksTask;
3
+ static get task(): typeof BXRestMapTasksTask;
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bx-rest",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Bitrix24 REST API client and TypeScript SDK for Angular, Vue and browser apps",
5
5
  "keywords": [
6
6
  "bitrix",
@@ -32,7 +32,7 @@
32
32
  "url": "git+https://github.com/Aricatofuka/bx-rest.git"
33
33
  },
34
34
  "dependencies": {
35
- "axios": "^1.19.0",
35
+ "axios": "^1.21.0",
36
36
  "countries-and-timezones": "^3.7.2",
37
37
  "just-camel-case": "^6.2.0",
38
38
  "just-clone": "^6.2.0",
@@ -68,6 +68,9 @@
68
68
  "./typification/app": {
69
69
  "types": "./typification/rest/app.d.ts"
70
70
  },
71
+ "./typification/batch": {
72
+ "types": "./typification/rest/batch.d.ts"
73
+ },
71
74
  "./typification/bizproc": {
72
75
  "types": "./typification/rest/bizproc.d.ts"
73
76
  },
package/public-api.d.ts CHANGED
@@ -10,11 +10,14 @@ export { HttpBXServices as BXRestRequest } from './services/http/HttpBX';
10
10
  export { SessionKeyServices, SessionKeyError } from './services/http/sessionKey';
11
11
  export { instanceOfiBXRestAnswerSuccess as isBXRestAnswerSuccess } from './functions/mapResult';
12
12
  export { BXRestApiError, getAuthRefreshError } from './functions/errors';
13
+ export type { BXRestApiErrorDetails } from './functions/errors';
13
14
  export { isBXRestAuthError } from './services/http/authRefresh';
14
15
  export { BXRestFrame } from './services/frame/frame';
15
- export { BXRestFrameError, BXRestFrameErrorCode } from './services/frame/transport';
16
+ export { BXRestFrameError } from './services/frame/transport';
17
+ export type { BXRestFrameErrorCode } from './services/frame/transport';
16
18
  export * from './services/frame/types';
17
- export { BXRestResOptions } from './services/navvy/extends/navvy-pag-base';
19
+ export type { BXRestResOptions } from './services/navvy/extends/navvy-pag-base';
20
+ export type { iBXRestSettings } from './typification/settings';
18
21
  export { HttpNavvyServices } from './services/http/httpNavvy';
19
22
  export * as partNameMethods from './consts/part-name-methods';
20
23
  export * as BXBaseServices from './services/base';
@@ -1,5 +1,4 @@
1
1
  import { iBXRestPullConfigGet, iBXRestPullConfigGetHttp } from '../../typification/rest/pull';
2
- import { BXRestMapPullChannelPublic } from '../../map/channel/public';
3
2
  export declare class BXRestNavvyPullConfig {
4
3
  url: {
5
4
  /**
@@ -8,7 +7,6 @@ export declare class BXRestNavvyPullConfig {
8
7
  get: string[];
9
8
  };
10
9
  private Navvy;
11
- static public: BXRestMapPullChannelPublic;
12
10
  /**
13
11
  * @experimental
14
12
  * Этот метод находится в процессе тестирования и может измениться.
package/rest/map.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BXRestMapLists } from '../map/lists';
2
2
  import { BXRestMapUser } from '../map/user';
3
3
  import { BXRestMapSonetGroup } from '../map/sonet_group';
4
4
  import { BXRestMapServer } from '../map/server';
5
- import { BXRestDisk } from '../request/disk';
5
+ import { BXRestMapDisk } from '../map/disk';
6
6
  import { BXRestMapCalendar } from '../map/calendar';
7
7
  import { BXRestMapLog } from '../map/log';
8
8
  import { BXRestMapTask } from '../map/task';
@@ -12,7 +12,7 @@ export declare class BXRestMap {
12
12
  get sonet_group(): typeof BXRestMapSonetGroup;
13
13
  get server(): typeof BXRestMapServer;
14
14
  get lists(): typeof BXRestMapLists;
15
- get disk(): typeof BXRestDisk;
15
+ get disk(): typeof BXRestMapDisk;
16
16
  get calendar(): typeof BXRestMapCalendar;
17
17
  get log(): typeof BXRestMapLog;
18
18
  get task(): typeof BXRestMapTask;
@@ -1,7 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- import { iBXRestAnswer } from '../../../typification/rest/base/answer';
2
+ import { iBXRestAnswer, iBXRestAnswerSuccess } from '../../../typification/rest/base/answer';
3
3
  import { HttpBXServices } from '../../http/HttpBX';
4
4
  import { ReturnTypeNavvy } from '../navvy-support';
5
+ import { iBXRestPagination } from '../../../typification/rest/base/api-pagination-bx';
5
6
  export interface BXRestResOptions {
6
7
  /**
7
8
  * When `true`, a Bitrix-level API error that comes in the body of a 2xx
@@ -16,6 +17,11 @@ export interface BXRestResOptions {
16
17
  */
17
18
  throwOnApiError?: boolean;
18
19
  }
20
+ /**
21
+ * Параметры остальных страниц для методов с постраничной навигацией через `start`.
22
+ * Отсчёт идёт от `start` самого запроса: первая страница уже получена именно с него.
23
+ */
24
+ export declare function offsetPageParams<P extends iBXRestPagination>(param: P, total: number | undefined, pageSize: number): P[];
19
25
  export declare abstract class NavvyPagBase<T, R, P> {
20
26
  protected url: string[];
21
27
  protected param: P;
@@ -43,6 +49,14 @@ export declare abstract class NavvyPagBase<T, R, P> {
43
49
  * Первая страница для `.resAll()`. Ошибка Bitrix в теле ответа 2xx становится `BXRestApiError`:
44
50
  * страниц в таком ответе нет, и без этого `.resAll()` завершился бы безликим `EmptyError`.
45
51
  */
46
- protected resFirstPage(): Observable<iBXRestAnswer<T> | undefined>;
52
+ protected resFirstPage(): Observable<iBXRestAnswerSuccess<T>>;
53
+ /**
54
+ * Остальные страницы для `.resAll()`, в порядке `params`. Команды уходят через `batch`,
55
+ * пакеты — по очереди. Ошибка любой страницы завершает весь запрос: неполный список
56
+ * выглядел бы для вызывающего кода как полный.
57
+ */
58
+ protected resPages<Page>(params: P[]): Observable<Page[]>;
59
+ private batchPages;
60
+ private notRestAnswerError;
47
61
  private apiErrorFromBody;
48
62
  }
@@ -9,6 +9,9 @@ import { NavvyPagBase } from './extends/navvy-pag-base';
9
9
  */
10
10
  export declare class NavvyAlterPagNav<T, R, P extends iBXRestAlternativePagination> extends NavvyPagBase<T[], R[], P> {
11
11
  resAll(): import("rxjs").Observable<ReturnTypeNavvy<T, R>[]>;
12
- private resultAllEnd;
13
- private mapResultForGetAll;
12
+ /**
13
+ * Параметры остальных страниц. Размер страницы берётся из запроса: портал ограничивает
14
+ * его 50 записями, но вызывающий код может попросить и меньше.
15
+ */
16
+ private pageParams;
14
17
  }
@@ -6,7 +6,5 @@ export declare class NavvyPagNavResultKeyObject<T, R, P extends iBXRestPaginatio
6
6
  private readonly key;
7
7
  constructor(url: string[], param: P, key: K, mapResult?: (param: KeyedObjectResult<K, T> | undefined) => R[] | undefined);
8
8
  resAll(): import("rxjs").Observable<R[] | undefined>;
9
- private resultAllEnd;
10
- private mapResult;
11
9
  }
12
10
  export {};
@@ -4,10 +4,7 @@ import { NavvyPagBase } from './extends/navvy-pag-base';
4
4
  type KeyedResult<K extends string, T> = Record<K, T[] | undefined>;
5
5
  export declare class NavvyPagNavResultKey<T, R, P extends iBXRestPagination, K extends string> extends NavvyPagBase<KeyedResult<K, T>, R[], P> {
6
6
  private readonly key;
7
- save: ReturnTypeNavvy<T, R>[];
8
- constructor(url: string[], param: P, key: K, map?: (param: KeyedResult<K, T> | undefined) => R[] | undefined);
7
+ constructor(url: string[], param: P, key: K, map?: (param: KeyedResult<K, T> | undefined) => R[] | undefined, restApi?: boolean);
9
8
  resAll(): import("rxjs").Observable<ReturnTypeNavvy<T, R>[]>;
10
- private resultAllEnd;
11
- private mapResForGetAll;
12
9
  }
13
10
  export {};
@@ -1,14 +1,7 @@
1
1
  import { iBXRestPagination } from '../../typification/rest/base/api-pagination-bx';
2
- import { ReturnTypeNavvy } from './navvy-support';
3
- import { NavvyPagBase } from './extends/navvy-pag-base';
4
- export declare class NavvyPagNavTasks<T, R, P extends iBXRestPagination> extends NavvyPagBase<{
5
- tasks: T[] | undefined;
6
- }, R[], P> {
7
- save: ReturnTypeNavvy<T, R>[];
2
+ import { NavvyPagNavResultKey } from './navvy-pag-nav-result-key';
3
+ export declare class NavvyPagNavTasks<T, R, P extends iBXRestPagination> extends NavvyPagNavResultKey<T, R, P, 'tasks'> {
8
4
  constructor(url: string[], param: P, map?: (param: {
9
5
  tasks: T[] | undefined;
10
6
  } | undefined) => R[] | undefined, restApi?: boolean);
11
- resAll(): import("rxjs").Observable<ReturnTypeNavvy<T, R>[]>;
12
- private resultAllEnd;
13
- private mapResForGetAll;
14
7
  }
@@ -1,7 +1,5 @@
1
1
  import { iBXRestPagination } from '../../typification/rest/base/api-pagination-bx';
2
2
  import { NavvyPagBase } from './extends/navvy-pag-base';
3
- import { ReturnTypeNavvy } from './navvy-support';
4
3
  export declare class NavvyPagNavWithUselessKey<T, R, P extends iBXRestPagination> extends NavvyPagBase<Record<string, T>, R[], P> {
5
- save: ReturnTypeNavvy<Record<string, T>, R[]>;
6
4
  resAll(): import("rxjs").Observable<R[] | undefined>;
7
5
  }
@@ -2,7 +2,5 @@ import { iBXRestPagination } from '../../typification/rest/base/api-pagination-b
2
2
  import { ReturnTypeNavvy } from './navvy-support';
3
3
  import { NavvyPagBase } from './extends/navvy-pag-base';
4
4
  export declare class NavvyPag<T, R, P extends iBXRestPagination> extends NavvyPagBase<T[], R[], P> {
5
- save: ReturnTypeNavvy<T, R>[];
6
5
  resAll(): import("rxjs").Observable<ReturnTypeNavvy<T, R>[]>;
7
- private mapResForGetAll;
8
6
  }
@@ -1,3 +1,4 @@
1
+ export type { iBXRestSettings } from '../settings';
1
2
  export interface iHttpParamSettings {
2
3
  timeZone: {
3
4
  calc: boolean;
@@ -2,8 +2,8 @@ import { iBXRestYesNo } from '../base/yes-no';
2
2
  export interface iBXRestUser extends iBXRestUserBase {
3
3
  ID: number;
4
4
  IS_ONLINE: boolean;
5
- DATE_REGISTER: Date;
6
- PERSONAL_BIRTHDAY: Date;
5
+ DATE_REGISTER?: Date;
6
+ PERSONAL_BIRTHDAY?: Date;
7
7
  LAST_LOGIN?: Date;
8
8
  }
9
9
  export interface iBXRestUserHttp extends iBXRestUserBase {
@@ -22,7 +22,7 @@ interface iBXRestUserBase {
22
22
  PERSONAL_GENDER?: iAllBXGender;
23
23
  PERSONAL_PROFESSION?: string;
24
24
  PERSONAL_WWW?: string;
25
- PERSONAL_BIRTHDAY: string | Date;
25
+ PERSONAL_BIRTHDAY?: string | Date;
26
26
  PERSONAL_PHOTO: string | null;
27
27
  PERSONAL_ICQ: string | null;
28
28
  PERSONAL_PHONE: string | null;