itd-api 0.12.0 → 0.13.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.
Files changed (90) hide show
  1. package/dist/events/index.cjs +4 -4
  2. package/dist/events/index.d.cts +7 -2
  3. package/dist/events/index.d.ts +7 -2
  4. package/dist/events/index.js +4 -4
  5. package/dist/index.cjs +672 -90
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +497 -46
  8. package/dist/index.d.ts +497 -46
  9. package/dist/index.js +664 -91
  10. package/dist/index.js.map +1 -1
  11. package/dist/node/index.cjs +6 -7
  12. package/dist/node/index.cjs.map +1 -1
  13. package/dist/node/index.d.cts +24 -7
  14. package/dist/node/index.d.ts +24 -7
  15. package/dist/node/index.js +6 -7
  16. package/dist/node/index.js.map +1 -1
  17. package/dist/rest/index.cjs +19 -7
  18. package/dist/rest/index.cjs.map +1 -1
  19. package/dist/rest/index.d.cts +28 -7
  20. package/dist/rest/index.d.ts +28 -7
  21. package/dist/rest/index.js +17 -8
  22. package/dist/rest/index.js.map +1 -1
  23. package/dist/shared/{contracts-BoT7msmq.d.ts → contracts-DEbkC0cB.d.cts} +1 -4
  24. package/dist/shared/{contracts-BoT7msmq.d.cts → contracts-pxnDIsQP.d.ts} +1 -4
  25. package/dist/shared/{events-9L0Fonak.d.cts → events-B6uqXOSs.d.cts} +42 -63
  26. package/dist/shared/{events-D1BfefBT.js → events-C_MgYlXR.js} +30 -40
  27. package/dist/shared/events-C_MgYlXR.js.map +1 -0
  28. package/dist/shared/{events-C2DJZyI0.cjs → events-DV1i1t6J.cjs} +30 -40
  29. package/dist/shared/events-DV1i1t6J.cjs.map +1 -0
  30. package/dist/shared/{events-BpLAIiMj.d.ts → events-D_aMNrPd.d.ts} +2 -23
  31. package/dist/shared/{key-value-store-DYSPsqwq.cjs → key-value-store-6DHm_iNW.cjs} +3 -4
  32. package/dist/shared/{key-value-store-DYSPsqwq.cjs.map → key-value-store-6DHm_iNW.cjs.map} +1 -1
  33. package/dist/shared/{key-value-store-COZaNHZS.d.ts → key-value-store-BGoSgLze.d.cts} +1 -4
  34. package/dist/shared/{key-value-store-w1Dn5Pjb.js → key-value-store-PnZE_DFC.js} +3 -4
  35. package/dist/shared/{key-value-store-w1Dn5Pjb.js.map → key-value-store-PnZE_DFC.js.map} +1 -1
  36. package/dist/shared/{key-value-store-COZaNHZS.d.cts → key-value-store-WUQBeTAr.d.ts} +1 -4
  37. package/dist/shared/{multi-storage-DiBSx64p.js → multi-storage-DM0skcSO.js} +6 -7
  38. package/dist/shared/{multi-storage-DiBSx64p.js.map → multi-storage-DM0skcSO.js.map} +1 -1
  39. package/dist/shared/{multi-storage-LkljOSzA.d.ts → multi-storage-DQiERirK.d.ts} +3 -6
  40. package/dist/shared/{multi-storage-7Y3KCseI.cjs → multi-storage-DnonVBfO.cjs} +6 -7
  41. package/dist/shared/multi-storage-DnonVBfO.cjs.map +1 -0
  42. package/dist/shared/{multi-storage-BEL7tcKn.d.cts → multi-storage-OGWNMK3x.d.cts} +3 -6
  43. package/dist/shared/{options-D5ttspWk.cjs → options-SvAWOaqT.cjs} +8 -12
  44. package/dist/shared/{options-D5ttspWk.cjs.map → options-SvAWOaqT.cjs.map} +1 -1
  45. package/dist/shared/{options-DLlaETn_.js → options-bS27r_gR.js} +8 -12
  46. package/dist/shared/{options-DLlaETn_.js.map → options-bS27r_gR.js.map} +1 -1
  47. package/dist/shared/{redact-DSfdmeY7.js → redact-C4b2NzdB.js} +16 -16
  48. package/dist/shared/redact-C4b2NzdB.js.map +1 -0
  49. package/dist/shared/{redact-BbhtA9o-.cjs → redact-DDGkv8KF.cjs} +16 -16
  50. package/dist/shared/redact-DDGkv8KF.cjs.map +1 -0
  51. package/dist/shared/{render-CrGXcj6L.cjs → render-0-JJPOwb.cjs} +222 -111
  52. package/dist/shared/render-0-JJPOwb.cjs.map +1 -0
  53. package/dist/shared/{render-D3vSEbLL.js → render-CF49aBO8.js} +199 -112
  54. package/dist/shared/render-CF49aBO8.js.map +1 -0
  55. package/dist/shared/{render-Dzw3KeN5.d.cts → render-CYVOc_IW.d.cts} +191 -308
  56. package/dist/shared/{render-UsQ1hb2U.d.ts → render-eOxYgdoA.d.ts} +191 -159
  57. package/dist/shared/{storage-86wiHeXD.js → storage-B6OkSi38.js} +4 -5
  58. package/dist/shared/{storage-86wiHeXD.js.map → storage-B6OkSi38.js.map} +1 -1
  59. package/dist/shared/{storage-CTRGT5wF.d.ts → storage-C_ZujAZt.d.ts} +2 -5
  60. package/dist/shared/{storage-CIjejZDt.cjs → storage-CezF2Mvz.cjs} +4 -5
  61. package/dist/shared/{storage-CIjejZDt.cjs.map → storage-CezF2Mvz.cjs.map} +1 -1
  62. package/dist/shared/{storage-BQrtKon9.d.cts → storage-FtS4NIC7.d.cts} +2 -5
  63. package/dist/shared/{url-Dg1u29cu.js → url-CPKhcxf1.js} +250 -91
  64. package/dist/shared/url-CPKhcxf1.js.map +1 -0
  65. package/dist/shared/{url-C9YADYNg.d.cts → url-DCqxoxGX.d.cts} +1909 -1634
  66. package/dist/shared/{url-C9YADYNg.d.ts → url-DL5Mip4L.d.ts} +230 -104
  67. package/dist/shared/{url-B21Bdmw_.cjs → url-DOfjru6L.cjs} +250 -91
  68. package/dist/shared/url-DOfjru6L.cjs.map +1 -0
  69. package/dist/shared/{validate-D7_kq3g5.js → validate-B5l_vLKD.js} +5 -7
  70. package/dist/shared/validate-B5l_vLKD.js.map +1 -0
  71. package/dist/shared/{validate-CFx2dISs.cjs → validate-CfxCK1BC.cjs} +5 -7
  72. package/dist/shared/validate-CfxCK1BC.cjs.map +1 -0
  73. package/dist/web/index.cjs +4 -5
  74. package/dist/web/index.cjs.map +1 -1
  75. package/dist/web/index.d.cts +22 -5
  76. package/dist/web/index.d.ts +22 -5
  77. package/dist/web/index.js +4 -5
  78. package/dist/web/index.js.map +1 -1
  79. package/package.json +6 -6
  80. package/dist/shared/events-C2DJZyI0.cjs.map +0 -1
  81. package/dist/shared/events-D1BfefBT.js.map +0 -1
  82. package/dist/shared/multi-storage-7Y3KCseI.cjs.map +0 -1
  83. package/dist/shared/redact-BbhtA9o-.cjs.map +0 -1
  84. package/dist/shared/redact-DSfdmeY7.js.map +0 -1
  85. package/dist/shared/render-CrGXcj6L.cjs.map +0 -1
  86. package/dist/shared/render-D3vSEbLL.js.map +0 -1
  87. package/dist/shared/url-B21Bdmw_.cjs.map +0 -1
  88. package/dist/shared/url-Dg1u29cu.js.map +0 -1
  89. package/dist/shared/validate-CFx2dISs.cjs.map +0 -1
  90. package/dist/shared/validate-D7_kq3g5.js.map +0 -1
@@ -1,9 +1,9 @@
1
- const require_url = require("./url-B21Bdmw_.cjs");
2
- const require_validate = require("./validate-CFx2dISs.cjs");
3
- const require_redact = require("./redact-BbhtA9o-.cjs");
4
- const require_options = require("./options-D5ttspWk.cjs");
5
- const require_key_value_store = require("./key-value-store-DYSPsqwq.cjs");
6
- //#region src/core/feature-catalog.ts
1
+ const require_url = require("./url-DOfjru6L.cjs");
2
+ const require_validate = require("./validate-CfxCK1BC.cjs");
3
+ const require_redact = require("./redact-DDGkv8KF.cjs");
4
+ const require_options = require("./options-SvAWOaqT.cjs");
5
+ const require_key_value_store = require("./key-value-store-6DHm_iNW.cjs");
6
+ // src/core/feature-catalog.ts
7
7
  /**
8
8
  * Изменяемый слой над каталогом конкретного API.
9
9
  *
@@ -73,8 +73,7 @@ var ExtensibleOperationCatalog = class {
73
73
  };
74
74
  }
75
75
  };
76
- //#endregion
77
- //#region src/core/attachments/url-source.ts
76
+ // src/core/attachments/url-source.ts
78
77
  /** Убирает параметры MIME и приводит его к форме для сравнения. */
79
78
  function normalizeMimeType(contentType) {
80
79
  return contentType?.split(";", 1)[0]?.trim().toLowerCase() || void 0;
@@ -212,8 +211,7 @@ async function openUrlFile(target, options, context) {
212
211
  close: () => stream.cancel().catch(() => {})
213
212
  };
214
213
  }
215
- //#endregion
216
- //#region src/core/attachments/resolver.ts
214
+ // src/core/attachments/resolver.ts
217
215
  /** Возвращает функцию освобождения, которая исполняет действие не более одного раза. */
218
216
  function closeOnce(action) {
219
217
  let closing;
@@ -361,8 +359,7 @@ var DefaultFileResolver = class {
361
359
  function createFileResolver(fetchImplementation) {
362
360
  return new DefaultFileResolver(fetchImplementation);
363
361
  }
364
- //#endregion
365
- //#region src/core/features.ts
362
+ // src/core/features.ts
366
363
  var FeatureInstallationTransaction = class {
367
364
  #cleanup = [];
368
365
  add(cleanup) {
@@ -645,8 +642,7 @@ var FeatureRegistry = class {
645
642
  if (errors.length > 0) throw new AggregateError(errors, "Не удалось освободить feature");
646
643
  }
647
644
  };
648
- //#endregion
649
- //#region src/core/managed-resources.ts
645
+ // src/core/managed-resources.ts
650
646
  /** Реестр активных ресурсов клиента. @internal */
651
647
  var ManagedResourceRegistry = class {
652
648
  #resources = /* @__PURE__ */ new Set();
@@ -681,8 +677,7 @@ var ManagedResourceRegistry = class {
681
677
  this.#resources.clear();
682
678
  }
683
679
  };
684
- //#endregion
685
- //#region src/core/feature-host.ts
680
+ // src/core/feature-host.ts
686
681
  /**
687
682
  * Управляет подключаемыми модулями и их ресурсами.
688
683
  *
@@ -775,8 +770,7 @@ var ClientFeatureHost = class {
775
770
  function createFeatureHost(runtime, options) {
776
771
  return new ClientFeatureHost(runtime, options);
777
772
  }
778
- //#endregion
779
- //#region src/resources/pagination.ts
773
+ // src/resources/pagination.ts
780
774
  /** Схема пагинации эндпоинта. */
781
775
  const PaginationMode = Object.freeze({
782
776
  /** Следующая страница запрашивается непрозрачным курсором. */
@@ -1013,8 +1007,7 @@ var Paginator = class {
1013
1007
  return { offset: page.nextOffset ?? (previous.offset ?? 0) + page.items.length };
1014
1008
  }
1015
1009
  };
1016
- //#endregion
1017
- //#region src/resources/base.ts
1010
+ // src/resources/base.ts
1018
1011
  /** Общая основа всех групп методов клиента. */
1019
1012
  var BaseResource = class {
1020
1013
  /** @internal */
@@ -1090,8 +1083,7 @@ function withPageState(query, state) {
1090
1083
  ...state.offset !== void 0 ? { offset: state.offset } : {}
1091
1084
  };
1092
1085
  }
1093
- //#endregion
1094
- //#region src/resources/notifications.ts
1086
+ // src/resources/notifications.ts
1095
1087
  const NOTIFICATIONS_LIST = pageOperation("notifications.list", (body, request) => {
1096
1088
  const offset = Number(request.query?.offset ?? 0);
1097
1089
  const page = readOffsetPage(body, "notifications", Number.isFinite(offset) ? offset : 0);
@@ -1248,8 +1240,27 @@ var NotificationsResource = class extends BaseResource {
1248
1240
  });
1249
1241
  }
1250
1242
  };
1251
- //#endregion
1252
- //#region src/domain/time.ts
1243
+ // src/resources/account/lifecycle.ts
1244
+ const ACCOUNT_DEACTIVATE = require_url.voidOperation("account.deactivate");
1245
+ const ACCOUNT_RESTORE = require_url.voidOperation("account.restore");
1246
+ /** Деактивация и восстановление текущего аккаунта. */
1247
+ var AccountLifecycleResource = class extends BaseResource {
1248
+ /** Деактивирует аккаунт. Вернуть его можно через {@link restore}. */
1249
+ deactivate(options = {}) {
1250
+ return this.voidOperation(ACCOUNT_DEACTIVATE, {
1251
+ path: "/api/users/me",
1252
+ ...options
1253
+ });
1254
+ }
1255
+ /** Восстанавливает деактивированный аккаунт. */
1256
+ restore(options = {}) {
1257
+ return this.voidOperation(ACCOUNT_RESTORE, {
1258
+ path: "/api/users/me/restore",
1259
+ ...options
1260
+ });
1261
+ }
1262
+ };
1263
+ // src/domain/time.ts
1253
1264
  /**
1254
1265
  * Отметка времени PostgreSQL: `2026-07-23 23:14:25`, возможно с долями секунды и смещением
1255
1266
  * пояса (`+03`, `+05:30`).
@@ -1302,8 +1313,7 @@ function toDate(value) {
1302
1313
  const date = new Date(value);
1303
1314
  return Number.isFinite(date.getTime()) ? date : null;
1304
1315
  }
1305
- //#endregion
1306
- //#region src/resources/status.ts
1316
+ // src/resources/status.ts
1307
1317
  /** Приводит `last_checked` каждого сервиса к ISO. Остальное остаётся как прислал сервер. */
1308
1318
  function normalizeStatus(body) {
1309
1319
  if (!require_validate.isRecord(body) || !Array.isArray(body.services)) return body;
@@ -1346,8 +1356,7 @@ function createStatusFeature() {
1346
1356
  setup: (context) => ({ api: new StatusResource(context) })
1347
1357
  };
1348
1358
  }
1349
- //#endregion
1350
- //#region src/builders/base.ts
1359
+ // src/builders/base.ts
1351
1360
  /** Метка билдера. Через `Symbol.for` — чтобы распознавание переживало смешивание ESM и CJS. */
1352
1361
  const BUILDER = Symbol.for("itd.builder");
1353
1362
  /** Является ли значение билдером. */
@@ -1372,8 +1381,7 @@ function resolveInput(input, factory, validate) {
1372
1381
  if (isBuilder(input)) return input.build();
1373
1382
  return validate(input);
1374
1383
  }
1375
- //#endregion
1376
- //#region src/builders/comment.ts
1384
+ // src/builders/comment.ts
1377
1385
  /**
1378
1386
  * Проверяет данные комментария.
1379
1387
  *
@@ -1504,8 +1512,7 @@ function resolveComment(input, allowReplyTo = false) {
1504
1512
  if (!allowReplyTo && resolved.replyToUserId !== void 0) throw new require_validate.ItdConfigError("replyTo применим только к ответу на комментарий (itd.comments.reply). В комментарии к посту адресат не указывается.");
1505
1513
  return resolved;
1506
1514
  }
1507
- //#endregion
1508
- //#region src/domain/content.ts
1515
+ // src/domain/content.ts
1509
1516
  /** Поле с датой, приведённой к ISO-8601; без строкового значения поле не появляется. */
1510
1517
  function isoField(key, value) {
1511
1518
  return typeof value === "string" ? { [key]: utcStampToIso(value) } : {};
@@ -1536,8 +1543,23 @@ function normalizePost(post) {
1536
1543
  ...Array.isArray(post.comments) ? { comments: post.comments.map(normalizeComment) } : {}
1537
1544
  };
1538
1545
  }
1539
- //#endregion
1540
- //#region src/resources/content-operations.ts
1546
+ /** Читает ответ редактирования поста: `updatedAt` сервера становится `editedAt`. */
1547
+ function normalizePostUpdate(body) {
1548
+ const { updatedAt, ...rest } = body;
1549
+ return {
1550
+ ...rest,
1551
+ editedAt: utcStampToIso(updatedAt)
1552
+ };
1553
+ }
1554
+ /** Читает ответ редактирования комментария. */
1555
+ function normalizeCommentUpdate(body) {
1556
+ const result = body;
1557
+ return {
1558
+ ...result,
1559
+ editedAt: utcStampToIso(result.editedAt)
1560
+ };
1561
+ }
1562
+ // src/resources/content-operations.ts
1541
1563
  /** Операция, которая возвращает один пост. */
1542
1564
  function postOperation(id) {
1543
1565
  return require_url.defineBuiltInOperation(id, (body) => normalizePost(body));
@@ -1550,11 +1572,10 @@ function postPageOperation(id) {
1550
1572
  function commentOperation(id) {
1551
1573
  return require_url.defineBuiltInOperation(id, (body) => normalizeComment(body));
1552
1574
  }
1553
- //#endregion
1554
- //#region src/resources/comments.ts
1575
+ // src/resources/comments.ts
1555
1576
  const COMMENTS_REPLIES = pageOperation("comments.replies", (body) => mapPage(readPagedPage(body, "replies"), normalizeComment));
1556
1577
  const COMMENTS_REPLY = commentOperation("comments.reply");
1557
- const COMMENTS_UPDATE = require_url.passthroughOperation("comments.update");
1578
+ const COMMENTS_UPDATE = require_url.defineBuiltInOperation("comments.update", normalizeCommentUpdate);
1558
1579
  const COMMENTS_RESTORE = require_url.voidOperation("comments.restore");
1559
1580
  const COMMENTS_LIKE = require_url.passthroughOperation("comments.like");
1560
1581
  const COMMENTS_UNLIKE = require_url.passthroughOperation("comments.unlike");
@@ -1658,8 +1679,7 @@ var CommentsResource = class extends BaseResource {
1658
1679
  });
1659
1680
  }
1660
1681
  };
1661
- //#endregion
1662
- //#region src/core/multipart.ts
1682
+ // src/core/multipart.ts
1663
1683
  const encoder = new TextEncoder();
1664
1684
  /** Убирает возможность внедрить дополнительный multipart-заголовок через имя файла. */
1665
1685
  function quotedFilename(filename) {
@@ -1722,8 +1742,7 @@ function createMultipartFileBody(file) {
1722
1742
  cancel
1723
1743
  };
1724
1744
  }
1725
- //#endregion
1726
- //#region src/domain/mime.ts
1745
+ // src/domain/mime.ts
1727
1746
  /** Изображения, которые принимает `POST /api/files/upload`. */
1728
1747
  const IMAGE_MIME_TYPES = Object.freeze([
1729
1748
  "image/jpeg",
@@ -1795,9 +1814,9 @@ function assertAllowedMime(mimeType, filename) {
1795
1814
  if (!mimeType) throw new require_validate.ItdConfigError(`Не удалось определить тип файла${filename ? ` «${filename}»` : ""}. Укажите его явно: { file, filename, contentType }.`);
1796
1815
  if (!isAllowedMime(mimeType)) throw new require_validate.ItdConfigError(`Тип «${mimeType}» не поддерживается загрузкой. Допустимые: ${ALLOWED_MIME_TYPES.join(", ")}.`);
1797
1816
  }
1798
- //#endregion
1799
- //#region src/resources/files.ts
1817
+ // src/resources/files.ts
1800
1818
  const FILES_UPLOAD = require_url.passthroughOperation("files.upload");
1819
+ const FILES_UPLOAD_BANNER_DRAWING = require_url.passthroughOperation("files.uploadBannerDrawing");
1801
1820
  const FILES_REMOVE = require_url.voidOperation("files.remove");
1802
1821
  /** Файлы и медиа. */
1803
1822
  var FilesResource = class extends BaseResource {
@@ -1821,6 +1840,20 @@ var FilesResource = class extends BaseResource {
1821
1840
  timeout: requestOptions.timeout ?? 3e5
1822
1841
  });
1823
1842
  }
1843
+ /**
1844
+ * Отправляет описание рисунка и возвращает созданное сервером изображение.
1845
+ *
1846
+ * Чтобы установить баннер, передайте полученный `id` в
1847
+ * `itd.users.updateMe({ bannerId: id })`.
1848
+ */
1849
+ uploadBannerDrawing(drawing, options = {}) {
1850
+ return this.http.execute(FILES_UPLOAD_BANNER_DRAWING, {
1851
+ path: "/api/files/banner-drawing",
1852
+ body: drawing,
1853
+ ...options,
1854
+ timeout: options.timeout ?? 3e5
1855
+ });
1856
+ }
1824
1857
  /** Загружает несколько файлов последовательно, сохраняя порядок. */
1825
1858
  async uploadMany(files, uploadOptions = {}, requestOptions = {}) {
1826
1859
  const ids = [];
@@ -1898,8 +1931,7 @@ var FilesResource = class extends BaseResource {
1898
1931
  return extension ? `file.${extension}` : "file";
1899
1932
  }
1900
1933
  };
1901
- //#endregion
1902
- //#region src/resources/hashtags.ts
1934
+ // src/resources/hashtags.ts
1903
1935
  const HASHTAG_POSTS = postPageOperation("hashtags.posts");
1904
1936
  const HASHTAGS_TRENDING = require_url.defineBuiltInOperation("hashtags.trending", (body) => require_url.pickArray(body, "hashtags"));
1905
1937
  /**
@@ -1944,8 +1976,88 @@ var HashtagsResource = class extends BaseResource {
1944
1976
  }, options);
1945
1977
  }
1946
1978
  };
1947
- //#endregion
1948
- //#region src/resources/platform.ts
1979
+ // src/models/legal.ts
1980
+ /** Область действия документа. */
1981
+ const LegalDocumentScope = Object.freeze({ Social: "social" });
1982
+ /** Виды блоков текста документа. */
1983
+ const LegalDocumentBlockType = Object.freeze({
1984
+ Heading: "heading",
1985
+ List: "list",
1986
+ Lines: "lines"
1987
+ });
1988
+ // src/resources/legal.ts
1989
+ const LEGAL_PATH = "/api/legal-documents";
1990
+ /** Путь документа с отдельно закодированными областью и идентификатором. */
1991
+ function documentPath(scope, slug) {
1992
+ return `${LEGAL_PATH}/${require_redact.encodePathSegment(scope, "scope")}/${require_redact.encodePathSegment(slug, "slug")}`;
1993
+ }
1994
+ /** Извлекает редакцию из внешнего поля `document`. */
1995
+ function readDocument(body) {
1996
+ const document = require_url.pickObject(body, "document");
1997
+ if (!document) throw new require_validate.ItdConfigError("Сервер не вернул документ");
1998
+ return document;
1999
+ }
2000
+ const LEGAL_LIST = require_url.defineBuiltInOperation("legal.list", (body) => require_url.pickArray(body, "documents"));
2001
+ const LEGAL_CURRENT = require_url.defineBuiltInOperation("legal.current", readDocument);
2002
+ const LEGAL_VERSIONS = require_url.defineBuiltInOperation("legal.versions", (body) => require_url.pickArray(body, "versions"));
2003
+ const LEGAL_VERSION = require_url.defineBuiltInOperation("legal.version", readDocument);
2004
+ /** Публичные документы ИТД и история их редакций. Доступны через `itd.legal`. */
2005
+ var LegalResource = class extends BaseResource {
2006
+ /**
2007
+ * Возвращает список документов выбранной области.
2008
+ *
2009
+ * В списке указаны действующие редакции. Полный текст загружается через {@link current}.
2010
+ */
2011
+ list(scope = LegalDocumentScope.Social, options = {}) {
2012
+ return this.http.execute(LEGAL_LIST, {
2013
+ path: LEGAL_PATH,
2014
+ query: { scope },
2015
+ skipAuth: true,
2016
+ skipAuthRefresh: true,
2017
+ ...options
2018
+ });
2019
+ }
2020
+ /**
2021
+ * Загружает действующую редакцию документа с полным текстом.
2022
+ *
2023
+ * @example
2024
+ * ```ts
2025
+ * const terms = await itd.legal.current(LegalDocumentScope.Social, 'terms');
2026
+ * console.log(terms.version, terms.blocks);
2027
+ * ```
2028
+ */
2029
+ current(scope, slug, options = {}) {
2030
+ return this.http.execute(LEGAL_CURRENT, {
2031
+ path: documentPath(scope, slug),
2032
+ skipAuth: true,
2033
+ skipAuthRefresh: true,
2034
+ ...options
2035
+ });
2036
+ }
2037
+ /** Возвращает историю редакций без текста. Поле `current` отмечает действующую редакцию. */
2038
+ versions(scope, slug, options = {}) {
2039
+ return this.http.execute(LEGAL_VERSIONS, {
2040
+ path: `${documentPath(scope, slug)}/versions`,
2041
+ skipAuth: true,
2042
+ skipAuthRefresh: true,
2043
+ ...options
2044
+ });
2045
+ }
2046
+ /**
2047
+ * Загружает конкретную редакцию документа с полным текстом.
2048
+ *
2049
+ * @param version идентификатор редакции из {@link versions}, например `2026-04-03`
2050
+ */
2051
+ version(scope, slug, version, options = {}) {
2052
+ return this.http.execute(LEGAL_VERSION, {
2053
+ path: `${documentPath(scope, slug)}/versions/${require_redact.encodePathSegment(version, "version")}`,
2054
+ skipAuth: true,
2055
+ skipAuthRefresh: true,
2056
+ ...options
2057
+ });
2058
+ }
2059
+ };
2060
+ // src/resources/platform.ts
1949
2061
  const PLATFORM_CHANGELOG = require_url.defineBuiltInOperation("platform.changelog", (body) => Array.isArray(body) ? body : []);
1950
2062
  const PLATFORM_ANNOUNCEMENTS = require_url.defineBuiltInOperation("platform.announcements", (body) => require_url.pickArray(body, "announcements"));
1951
2063
  const PLATFORM_VERSION = require_url.passthroughOperation("platform.version");
@@ -2021,8 +2133,7 @@ var PlatformResource = class extends BaseResource {
2021
2133
  return this.#status.get(options);
2022
2134
  }
2023
2135
  };
2024
- //#endregion
2025
- //#region src/spans/validate.ts
2136
+ // src/spans/validate.ts
2026
2137
  /**
2027
2138
  * Проверяет, что spans целиком лежат внутри текста.
2028
2139
  *
@@ -2038,8 +2149,7 @@ function validateSpans(content, spans) {
2038
2149
  return { ...candidate };
2039
2150
  });
2040
2151
  }
2041
- //#endregion
2042
- //#region src/spans/parse.ts
2152
+ // src/spans/parse.ts
2043
2153
  const HTML_BLOCK_TAGS = /* @__PURE__ */ new Set([
2044
2154
  "address",
2045
2155
  "article",
@@ -2503,8 +2613,7 @@ function parseHtml(source, options = {}) {
2503
2613
  while (output.content.endsWith("\n")) output.content = output.content.slice(0, -1);
2504
2614
  return finish(output);
2505
2615
  }
2506
- //#endregion
2507
- //#region src/builders/markup.ts
2616
+ // src/builders/markup.ts
2508
2617
  function validateMarkup(value) {
2509
2618
  if (!value || typeof value.content !== "string" || !Array.isArray(value.spans)) throw new require_validate.ItdConfigError("Разметка должна содержать строку content и массив spans");
2510
2619
  return {
@@ -2737,8 +2846,7 @@ function autoSpans(text, options = {}) {
2737
2846
  }
2738
2847
  return spans.sort((left, right) => left.offset - right.offset || right.length - left.length);
2739
2848
  }
2740
- //#endregion
2741
- //#region src/builders/poll.ts
2849
+ // src/builders/poll.ts
2742
2850
  /** Минимальное число вариантов ответа. */
2743
2851
  const MIN_OPTIONS = 2;
2744
2852
  /** Ограничения опроса — те же, что действуют в интерфейсе итд.com. */
@@ -2857,8 +2965,7 @@ function poll(question = "") {
2857
2965
  function resolvePoll(input) {
2858
2966
  return resolveInput(input, () => poll(), validatePoll);
2859
2967
  }
2860
- //#endregion
2861
- //#region src/builders/post.ts
2968
+ // src/builders/post.ts
2862
2969
  /** UUID любой версии. */
2863
2970
  const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2864
2971
  const BUILD_UPDATE = Symbol.for("itd.postBuilder.update");
@@ -3112,8 +3219,7 @@ function resolvePostUpdate(input) {
3112
3219
  }
3113
3220
  return isBuilder(input) ? input[BUILD_UPDATE]() : validatePostUpdate(input);
3114
3221
  }
3115
- //#endregion
3116
- //#region src/resources/posts.ts
3222
+ // src/resources/posts.ts
3117
3223
  const POSTS_LIST = postPageOperation("posts.list");
3118
3224
  const POSTS_BY_USER = postPageOperation("posts.byUser");
3119
3225
  const POSTS_LIKED_BY_USER = postPageOperation("posts.likedByUser");
@@ -3121,7 +3227,7 @@ const POSTS_COMMENTS = pageOperation("posts.comments", (body) => mapPage(readFla
3121
3227
  const POSTS_STATS = require_url.defineBuiltInOperation("posts.stats", (body) => require_url.pickArray(body, "posts"));
3122
3228
  const POSTS_CREATE = postOperation("posts.create");
3123
3229
  const POSTS_GET = postOperation("posts.get");
3124
- const POSTS_UPDATE = require_url.passthroughOperation("posts.update");
3230
+ const POSTS_UPDATE = require_url.defineBuiltInOperation("posts.update", normalizePostUpdate);
3125
3231
  const POSTS_RESTORE = require_url.voidOperation("posts.restore");
3126
3232
  const POSTS_LIKE = require_url.passthroughOperation("posts.like");
3127
3233
  const POSTS_UNLIKE = require_url.passthroughOperation("posts.unlike");
@@ -3457,8 +3563,7 @@ var PostsResource = class extends BaseResource {
3457
3563
  return [...existing, ...uploaded];
3458
3564
  }
3459
3565
  };
3460
- //#endregion
3461
- //#region src/builders/report.ts
3566
+ // src/builders/report.ts
3462
3567
  const REASONS = new Set(Object.values(require_url.ReportReason));
3463
3568
  const TARGET_TYPES = new Set(Object.values(require_url.ReportTargetType));
3464
3569
  /**
@@ -3539,8 +3644,7 @@ const report = Object.freeze({
3539
3644
  function resolveReport(input) {
3540
3645
  return resolveInput(input, () => new ReportBuilder({}), validateReport);
3541
3646
  }
3542
- //#endregion
3543
- //#region src/resources/reports.ts
3647
+ // src/resources/reports.ts
3544
3648
  const REPORTS_CREATE = require_url.passthroughOperation("reports.create");
3545
3649
  /**
3546
3650
  * Жалобы на контент и пользователей.
@@ -3569,8 +3673,7 @@ var ReportsResource = class extends BaseResource {
3569
3673
  });
3570
3674
  }
3571
3675
  };
3572
- //#endregion
3573
- //#region src/resources/search.ts
3676
+ // src/resources/search.ts
3574
3677
  const SEARCH_ALL = require_url.defineBuiltInOperation("search.all", (body) => ({
3575
3678
  users: require_url.pickArray(body, "users"),
3576
3679
  hashtags: require_url.pickArray(body, "hashtags")
@@ -3597,8 +3700,7 @@ var SearchResource = class extends BaseResource {
3597
3700
  });
3598
3701
  }
3599
3702
  };
3600
- //#endregion
3601
- //#region src/resources/shop.ts
3703
+ // src/resources/shop.ts
3602
3704
  const PRODUCTS_LIST = require_url.passthroughOperation("shop.products.list");
3603
3705
  const PRODUCTS_GET = require_url.passthroughOperation("shop.products.get");
3604
3706
  const DELIVERY_COUNTRIES = require_url.passthroughOperation("shop.delivery.countries");
@@ -3786,8 +3888,7 @@ var ShopResource = class {
3786
3888
  this.consents = new ShopConsentsResource(http);
3787
3889
  }
3788
3890
  };
3789
- //#endregion
3790
- //#region src/resources/subscription.ts
3891
+ // src/resources/subscription.ts
3791
3892
  const SUBSCRIPTION_METHODS = require_url.defineBuiltInOperation("subscription.methods", (body) => Array.isArray(body) ? body : []);
3792
3893
  const SUBSCRIPTION_STATUS = require_url.passthroughOperation("subscription.status");
3793
3894
  const SUBSCRIPTION_PAY = require_url.passthroughOperation("subscription.pay");
@@ -3856,8 +3957,7 @@ var SubscriptionResource = class extends BaseResource {
3856
3957
  });
3857
3958
  }
3858
3959
  };
3859
- //#endregion
3860
- //#region src/resources/telemetry.ts
3960
+ // src/resources/telemetry.ts
3861
3961
  const DEFAULT_BATCH_SIZE = 50;
3862
3962
  const SYSTEM_CLOCK = Object.freeze({ now: () => Date.now() });
3863
3963
  function assertNonEmpty(value, name) {
@@ -4178,8 +4278,7 @@ function closeTelemetryForDispose(resource) {
4178
4278
  }
4179
4279
  const TELEMETRY_DWELL = require_url.defineBuiltInOperation("telemetry.dwell");
4180
4280
  const TELEMETRY_INTERACTION = require_url.defineBuiltInOperation("telemetry.interaction");
4181
- //#endregion
4182
- //#region src/resources/users.ts
4281
+ // src/resources/users.ts
4183
4282
  const userListOperation = (id) => pageOperation(id, (body) => readPagedPage(body, "users", "followers", "following", "blocked"));
4184
4283
  const USER_LIST_OPERATIONS = {
4185
4284
  "users.followers": userListOperation("users.followers"),
@@ -4207,8 +4306,6 @@ const USERS_FOLLOW = require_url.passthroughOperation("users.follow");
4207
4306
  const USERS_FOLLOW_STATUS = require_url.passthroughOperation("users.followStatus");
4208
4307
  const USERS_GET_PRIVACY = require_url.passthroughOperation("users.getPrivacy");
4209
4308
  const USERS_UPDATE_PRIVACY = require_url.passthroughOperation("users.updatePrivacy");
4210
- const USERS_DEACTIVATE = require_url.voidOperation("users.deactivate");
4211
- const USERS_RESTORE = require_url.voidOperation("users.restore");
4212
4309
  const USERS_UNFOLLOW = require_url.voidOperation("users.unfollow");
4213
4310
  const USERS_BLOCK = require_url.voidOperation("users.block");
4214
4311
  const USERS_UNBLOCK = require_url.voidOperation("users.unblock");
@@ -4274,20 +4371,6 @@ var UsersResource = class extends BaseResource {
4274
4371
  removeBanner(options = {}) {
4275
4372
  return this.updateMe({ bannerId: null }, options);
4276
4373
  }
4277
- /** Деактивирует аккаунт. Вернуть его можно через {@link restore}. */
4278
- deactivate(options = {}) {
4279
- return this.voidOperation(USERS_DEACTIVATE, {
4280
- path: "/api/users/me",
4281
- ...options
4282
- });
4283
- }
4284
- /** Восстанавливает деактивированный аккаунт. */
4285
- restore(options = {}) {
4286
- return this.voidOperation(USERS_RESTORE, {
4287
- path: "/api/users/me/restore",
4288
- ...options
4289
- });
4290
- }
4291
4374
  /** Создаёт профиль после регистрации. */
4292
4375
  createProfile(input, options = {}) {
4293
4376
  return this.http.execute(USERS_CREATE_PROFILE, {
@@ -4491,8 +4574,7 @@ var UsersResource = class extends BaseResource {
4491
4574
  }, options);
4492
4575
  }
4493
4576
  };
4494
- //#endregion
4495
- //#region src/resources/verification.ts
4577
+ // src/resources/verification.ts
4496
4578
  const VERIFICATION_STATUS = require_url.passthroughOperation("verification.status");
4497
4579
  const VERIFICATION_SUBMIT = require_url.passthroughOperation("verification.submit");
4498
4580
  /**
@@ -4517,8 +4599,7 @@ var VerificationResource = class extends BaseResource {
4517
4599
  });
4518
4600
  }
4519
4601
  };
4520
- //#endregion
4521
- //#region src/rest/resources.ts
4602
+ // src/rest/resources.ts
4522
4603
  /**
4523
4604
  * Собирает набор ресурсов, создавая каждый при первом обращении.
4524
4605
  *
@@ -4535,6 +4616,7 @@ function createResources(deps) {
4535
4616
  let files;
4536
4617
  let notifications;
4537
4618
  let hashtags;
4619
+ let legal;
4538
4620
  let search;
4539
4621
  let reports;
4540
4622
  let verification;
@@ -4567,6 +4649,10 @@ function createResources(deps) {
4567
4649
  hashtags ??= new HashtagsResource(deps.http);
4568
4650
  return hashtags;
4569
4651
  },
4652
+ get legal() {
4653
+ legal ??= new LegalResource(deps.http);
4654
+ return legal;
4655
+ },
4570
4656
  get search() {
4571
4657
  search ??= new SearchResource(deps.http);
4572
4658
  return search;
@@ -4602,10 +4688,9 @@ function createResources(deps) {
4602
4688
  const uploadFiles = (input, requestOptions) => bag.files.uploadMany(input, {}, requestOptions ?? {});
4603
4689
  return bag;
4604
4690
  }
4605
- //#endregion
4606
- //#region src/core/attachments/factories.ts
4691
+ // src/core/attachments/factories.ts
4607
4692
  function fromUrl(url, options = {}) {
4608
- if (require_options.resolveFileStreamOptions(options, 104857600).mode === require_options.FileTransferMode.Stream) return { open: (context) => openUrlFile(url, options, context) };
4693
+ if (require_options.resolveFileStreamOptions(options, 0x6400000).mode === require_options.FileTransferMode.Stream) return { open: (context) => openUrlFile(url, options, context) };
4609
4694
  return { load: (context) => downloadFile(url, options, context) };
4610
4695
  }
4611
4696
  /**
@@ -4654,8 +4739,16 @@ function fromStream(factory, options = {}) {
4654
4739
  };
4655
4740
  } };
4656
4741
  }
4657
- //#endregion
4658
- //#region src/models/guards.ts
4742
+ // src/models/banner-drawing.ts
4743
+ /** Инструменты редактора баннера в формате версии 1. */
4744
+ const BannerDrawingTool = Object.freeze({
4745
+ Brush: "brush",
4746
+ Eraser: "eraser",
4747
+ Line: "line",
4748
+ Rectangle: "rectangle",
4749
+ Circle: "circle"
4750
+ });
4751
+ // src/models/guards.ts
4659
4752
  /**
4660
4753
  * Свой ли это профиль.
4661
4754
  *
@@ -4667,8 +4760,7 @@ function fromStream(factory, options = {}) {
4667
4760
  function isMyProfile(profile) {
4668
4761
  return "subscription" in profile;
4669
4762
  }
4670
- //#endregion
4671
- //#region src/models/shop.ts
4763
+ // src/models/shop.ts
4672
4764
  /** Категория товара магазина. */
4673
4765
  const ShopProductCategory = Object.freeze({
4674
4766
  Apparel: "apparel",
@@ -4697,8 +4789,7 @@ const ShopOrderStatus = Object.freeze({
4697
4789
  Refunded: "refunded",
4698
4790
  Expired: "expired"
4699
4791
  });
4700
- //#endregion
4701
- //#region src/models/status-helpers.ts
4792
+ // src/models/status-helpers.ts
4702
4793
  const STATUS_WINDOW_DAYS = 90;
4703
4794
  /**
4704
4795
  * Разворачивает историю сервиса в массив на 90 суток.
@@ -4718,8 +4809,7 @@ const STATUS_WINDOW_DAYS = 90;
4718
4809
  function statusDays(service) {
4719
4810
  return Array.from({ length: STATUS_WINDOW_DAYS }, (_, index) => service.days[String(index)] ?? null);
4720
4811
  }
4721
- //#endregion
4722
- //#region src/shop/order-access.ts
4812
+ // src/shop/order-access.ts
4723
4813
  function copySession(session) {
4724
4814
  return { ...session };
4725
4815
  }
@@ -4753,8 +4843,7 @@ function createShopOrderAccessStorage(store, options = {}) {
4753
4843
  clear: () => backend.delete(key)
4754
4844
  };
4755
4845
  }
4756
- //#endregion
4757
- //#region src/shop/feature.ts
4846
+ // src/shop/feature.ts
4758
4847
  const Operation = Object.freeze({
4759
4848
  RequestCode: "request-code",
4760
4849
  VerifyCode: "verify-code",
@@ -4894,8 +4983,7 @@ function createShopFeature(options = {}) {
4894
4983
  }
4895
4984
  };
4896
4985
  }
4897
- //#endregion
4898
- //#region src/spans/render.ts
4986
+ // src/spans/render.ts
4899
4987
  /** Формат результата {@link renderSpans}. */
4900
4988
  const SpanRenderFormat = Object.freeze({
4901
4989
  Html: "html",
@@ -5096,7 +5184,6 @@ function renderSpans(content, spans = [], options = {}) {
5096
5184
  }
5097
5185
  return result;
5098
5186
  }
5099
- //#endregion
5100
5187
  Object.defineProperty(exports, "ALLOWED_MIME_TYPES", {
5101
5188
  enumerable: true,
5102
5189
  get: function() {
@@ -5109,6 +5196,18 @@ Object.defineProperty(exports, "AUDIO_MIME_TYPES", {
5109
5196
  return AUDIO_MIME_TYPES;
5110
5197
  }
5111
5198
  });
5199
+ Object.defineProperty(exports, "AccountLifecycleResource", {
5200
+ enumerable: true,
5201
+ get: function() {
5202
+ return AccountLifecycleResource;
5203
+ }
5204
+ });
5205
+ Object.defineProperty(exports, "BannerDrawingTool", {
5206
+ enumerable: true,
5207
+ get: function() {
5208
+ return BannerDrawingTool;
5209
+ }
5210
+ });
5112
5211
  Object.defineProperty(exports, "BaseResource", {
5113
5212
  enumerable: true,
5114
5213
  get: function() {
@@ -5127,6 +5226,18 @@ Object.defineProperty(exports, "IMAGE_MIME_TYPES", {
5127
5226
  return IMAGE_MIME_TYPES;
5128
5227
  }
5129
5228
  });
5229
+ Object.defineProperty(exports, "LegalDocumentBlockType", {
5230
+ enumerable: true,
5231
+ get: function() {
5232
+ return LegalDocumentBlockType;
5233
+ }
5234
+ });
5235
+ Object.defineProperty(exports, "LegalDocumentScope", {
5236
+ enumerable: true,
5237
+ get: function() {
5238
+ return LegalDocumentScope;
5239
+ }
5240
+ });
5130
5241
  Object.defineProperty(exports, "MemoryShopOrderAccessStorage", {
5131
5242
  enumerable: true,
5132
5243
  get: function() {
@@ -5320,4 +5431,4 @@ Object.defineProperty(exports, "utcStampToIso", {
5320
5431
  }
5321
5432
  });
5322
5433
 
5323
- //# sourceMappingURL=render-CrGXcj6L.cjs.map
5434
+ //# sourceMappingURL=render-0-JJPOwb.cjs.map