@torrow/sdk-client 0.2.0 → 0.4.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/README.md +5 -1
- package/dist/index.d.ts +282 -51
- package/dist/index.js +1098 -342
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,10 @@ function pickApiCode(body) {
|
|
|
36
36
|
return void 0;
|
|
37
37
|
}
|
|
38
38
|
const c = body.code;
|
|
39
|
-
|
|
39
|
+
if (typeof c === "string") {
|
|
40
|
+
return c;
|
|
41
|
+
}
|
|
42
|
+
return typeof c === "number" && Number.isFinite(c) ? String(c) : void 0;
|
|
40
43
|
}
|
|
41
44
|
function pickTraceIdentifier(body) {
|
|
42
45
|
if (body === null || typeof body !== "object") {
|
|
@@ -61,6 +64,7 @@ var TorrowHttpError = class _TorrowHttpError extends Error {
|
|
|
61
64
|
status;
|
|
62
65
|
body;
|
|
63
66
|
apiErrorName;
|
|
67
|
+
/** Код ошибки API строкой: числовой `TorrowErrorClient.code` приводится к строке (`"311293"`). */
|
|
64
68
|
code;
|
|
65
69
|
requestId;
|
|
66
70
|
/**
|
|
@@ -111,10 +115,13 @@ function parseJsonWithIsoDates(json) {
|
|
|
111
115
|
if (json === "") {
|
|
112
116
|
return void 0;
|
|
113
117
|
}
|
|
114
|
-
return JSON.parse(json, (
|
|
118
|
+
return JSON.parse(json, function(key, value) {
|
|
115
119
|
if (typeof value !== "string") {
|
|
116
120
|
return value;
|
|
117
121
|
}
|
|
122
|
+
if (key === "data" && (this.noteType === "Html" || this.noteType === "Markdown")) {
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
118
125
|
return ISO_DATE_REGEX.exec(value) ? new Date(value) : value;
|
|
119
126
|
});
|
|
120
127
|
}
|
|
@@ -371,6 +378,15 @@ function encodePathSegment(id) {
|
|
|
371
378
|
return encodeURIComponent(id);
|
|
372
379
|
}
|
|
373
380
|
|
|
381
|
+
// ../../src/resources/common/item-update-id.ts
|
|
382
|
+
function requireItemUpdateId(body, itemName) {
|
|
383
|
+
const id = body.id;
|
|
384
|
+
if (!id?.trim() || id !== id.trim()) {
|
|
385
|
+
throw new TypeError(`${itemName} update requires a non-empty, normalized body.id`);
|
|
386
|
+
}
|
|
387
|
+
return id;
|
|
388
|
+
}
|
|
389
|
+
|
|
374
390
|
// ../../src/resources/common/discriminator.ts
|
|
375
391
|
var Discriminator = /* @__PURE__ */ ((Discriminator2) => {
|
|
376
392
|
Discriminator2["ActionHistoryInfo"] = "ActionHistoryInfo";
|
|
@@ -440,13 +456,18 @@ function applyItemCreateDefaults(body, discriminator) {
|
|
|
440
456
|
}
|
|
441
457
|
|
|
442
458
|
// ../../src/util/torrow-id.ts
|
|
443
|
-
import { randomBytes } from "crypto";
|
|
444
459
|
var TORROW_OBJECT_ID_HEX_LENGTH = 24;
|
|
445
460
|
var OBJECT_ID_HEX_LENGTH = TORROW_OBJECT_ID_HEX_LENGTH;
|
|
446
461
|
var RID_HEX_PATTERN = /^[0-9a-fA-F]{24}$/;
|
|
447
462
|
var TORROW_ID_HEX_PATTERN = /^[0-9a-fA-F]+$/;
|
|
448
463
|
function generateRid() {
|
|
449
|
-
|
|
464
|
+
const bytes = new Uint8Array(12);
|
|
465
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
466
|
+
let hex = "";
|
|
467
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
468
|
+
hex += bytes[i].toString(16).padStart(2, "0");
|
|
469
|
+
}
|
|
470
|
+
return hex;
|
|
450
471
|
}
|
|
451
472
|
function isValidRid(value) {
|
|
452
473
|
return typeof value === "string" && RID_HEX_PATTERN.test(value);
|
|
@@ -1324,11 +1345,12 @@ var CalendarsFacade = class extends TorrowItemFacade {
|
|
|
1324
1345
|
signal: options?.signal
|
|
1325
1346
|
});
|
|
1326
1347
|
}
|
|
1327
|
-
/** `PUT /api/v1/calendars/{
|
|
1328
|
-
update(body,
|
|
1348
|
+
/** `PUT /api/v1/calendars/{body.id}` */
|
|
1349
|
+
update(body, options) {
|
|
1350
|
+
const itemId = requireItemUpdateId(body, "Calendar");
|
|
1329
1351
|
return this.http.requestJson({
|
|
1330
1352
|
method: "PUT",
|
|
1331
|
-
path: `${BASE}/${encodePathSegment(
|
|
1353
|
+
path: `${BASE}/${encodePathSegment(itemId)}`,
|
|
1332
1354
|
query: {
|
|
1333
1355
|
checkVersion: options?.checkVersion,
|
|
1334
1356
|
isNeedAnnouncement: options?.isNeedAnnouncement,
|
|
@@ -1466,12 +1488,39 @@ var CaseTypeValues = {
|
|
|
1466
1488
|
State: "State"
|
|
1467
1489
|
};
|
|
1468
1490
|
|
|
1469
|
-
// ../../src/resources/cases/
|
|
1491
|
+
// ../../src/resources/cases/case-requests.ts
|
|
1470
1492
|
var BASE2 = "/api/v1/cases";
|
|
1493
|
+
function getCase(http, torrowId, options) {
|
|
1494
|
+
return http.requestJson({
|
|
1495
|
+
method: "GET",
|
|
1496
|
+
path: `${BASE2}/${encodePathSegment(torrowId)}`,
|
|
1497
|
+
query: {
|
|
1498
|
+
profileId: options?.profileId,
|
|
1499
|
+
caseParticipantProfileId: options?.caseParticipantProfileId,
|
|
1500
|
+
versionToCheck: options?.versionToCheck,
|
|
1501
|
+
includeDeleted: options?.includeDeleted,
|
|
1502
|
+
includeChildTypes: options?.includeChildTypes,
|
|
1503
|
+
securityToken: options?.securityToken,
|
|
1504
|
+
caseParticipantId: options?.caseParticipantId
|
|
1505
|
+
},
|
|
1506
|
+
signal: options?.signal
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function cancelCaseParticipation(http, torrowId, body, options) {
|
|
1510
|
+
return http.requestJson({
|
|
1511
|
+
method: "PUT",
|
|
1512
|
+
path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/cancelcaseparticipation`,
|
|
1513
|
+
body,
|
|
1514
|
+
signal: options?.signal
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// ../../src/resources/cases/CasesFacade.ts
|
|
1519
|
+
var BASE3 = "/api/v1/cases";
|
|
1471
1520
|
var CasesFacade = class extends TorrowItemFacade {
|
|
1472
1521
|
itemObjectTypeCode = TorrowObjectTypeCode.Case;
|
|
1473
1522
|
constructor(http) {
|
|
1474
|
-
super(http,
|
|
1523
|
+
super(http, BASE3);
|
|
1475
1524
|
}
|
|
1476
1525
|
/** Id события до `createWithOptions` / `createCaseItem` / presigned upload. */
|
|
1477
1526
|
generateCaseId(ownerTorrowId) {
|
|
@@ -1489,7 +1538,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1489
1538
|
};
|
|
1490
1539
|
return this.http.requestJson({
|
|
1491
1540
|
method: "PUT",
|
|
1492
|
-
path:
|
|
1541
|
+
path: BASE3,
|
|
1493
1542
|
query: {
|
|
1494
1543
|
parentId: options?.parentId,
|
|
1495
1544
|
profileId: options?.profileId
|
|
@@ -1506,7 +1555,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1506
1555
|
const payload = this.withCreateDefaults(body);
|
|
1507
1556
|
return this.http.requestJson({
|
|
1508
1557
|
method: "POST",
|
|
1509
|
-
path:
|
|
1558
|
+
path: BASE3,
|
|
1510
1559
|
query: {
|
|
1511
1560
|
parentId: options?.parentId,
|
|
1512
1561
|
profileId: options?.profileId,
|
|
@@ -1520,11 +1569,12 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1520
1569
|
signal: options?.signal
|
|
1521
1570
|
});
|
|
1522
1571
|
}
|
|
1523
|
-
/** `PUT /api/v1/cases/{
|
|
1524
|
-
update(body,
|
|
1572
|
+
/** `PUT /api/v1/cases/{body.id}` */
|
|
1573
|
+
update(body, options) {
|
|
1574
|
+
const itemId = requireItemUpdateId(body, "Case");
|
|
1525
1575
|
return this.http.requestJson({
|
|
1526
1576
|
method: "PUT",
|
|
1527
|
-
path: `${
|
|
1577
|
+
path: `${BASE3}/${encodePathSegment(itemId)}`,
|
|
1528
1578
|
query: {
|
|
1529
1579
|
profileId: options?.profileId,
|
|
1530
1580
|
checkVersion: options?.checkVersion,
|
|
@@ -1555,7 +1605,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1555
1605
|
async delete(torrowId, options) {
|
|
1556
1606
|
const resp = await this.http.requestJson({
|
|
1557
1607
|
method: "DELETE",
|
|
1558
|
-
path: `${
|
|
1608
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}`,
|
|
1559
1609
|
query: {
|
|
1560
1610
|
cascade: options.cascade,
|
|
1561
1611
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -1568,27 +1618,14 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1568
1618
|
}
|
|
1569
1619
|
/** `GET /api/v1/cases/{torrowId}` */
|
|
1570
1620
|
getById(torrowId, options) {
|
|
1571
|
-
return this.http
|
|
1572
|
-
method: "GET",
|
|
1573
|
-
path: `${BASE2}/${encodePathSegment(torrowId)}`,
|
|
1574
|
-
query: {
|
|
1575
|
-
profileId: options?.profileId,
|
|
1576
|
-
caseParticipantProfileId: options?.caseParticipantProfileId,
|
|
1577
|
-
versionToCheck: options?.versionToCheck,
|
|
1578
|
-
includeDeleted: options?.includeDeleted,
|
|
1579
|
-
includeChildTypes: options?.includeChildTypes,
|
|
1580
|
-
securityToken: options?.securityToken,
|
|
1581
|
-
caseParticipantId: options?.caseParticipantId
|
|
1582
|
-
},
|
|
1583
|
-
signal: options?.signal
|
|
1584
|
-
});
|
|
1621
|
+
return getCase(this.http, torrowId, options);
|
|
1585
1622
|
}
|
|
1586
1623
|
/** `GET /api/v1/cases/personallist` */
|
|
1587
1624
|
listPersonal(options) {
|
|
1588
1625
|
const { signal, ...rest } = options ?? {};
|
|
1589
1626
|
return this.http.requestJson({
|
|
1590
1627
|
method: "GET",
|
|
1591
|
-
path: `${
|
|
1628
|
+
path: `${BASE3}/personallist`,
|
|
1592
1629
|
query: { ...rest },
|
|
1593
1630
|
signal
|
|
1594
1631
|
});
|
|
@@ -1597,7 +1634,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1597
1634
|
includeToGroups(body, options) {
|
|
1598
1635
|
return this.http.requestJson({
|
|
1599
1636
|
method: "PUT",
|
|
1600
|
-
path: `${
|
|
1637
|
+
path: `${BASE3}/include/togroups`,
|
|
1601
1638
|
body,
|
|
1602
1639
|
signal: options?.signal
|
|
1603
1640
|
});
|
|
@@ -1606,7 +1643,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1606
1643
|
excludeFromGroups(body, options) {
|
|
1607
1644
|
return this.http.requestJson({
|
|
1608
1645
|
method: "PUT",
|
|
1609
|
-
path: `${
|
|
1646
|
+
path: `${BASE3}/exclude/fromgroups`,
|
|
1610
1647
|
body,
|
|
1611
1648
|
signal: options?.signal
|
|
1612
1649
|
});
|
|
@@ -1615,7 +1652,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1615
1652
|
getByUniqueName(uniqueName, options) {
|
|
1616
1653
|
return this.http.requestJson({
|
|
1617
1654
|
method: "GET",
|
|
1618
|
-
path: `${
|
|
1655
|
+
path: `${BASE3}/uniquename/${encodePathSegment(uniqueName)}`,
|
|
1619
1656
|
query: { profileId: options?.profileId },
|
|
1620
1657
|
signal: options?.signal
|
|
1621
1658
|
});
|
|
@@ -1624,7 +1661,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1624
1661
|
listResources(torrowId, query, options) {
|
|
1625
1662
|
return this.http.requestJson({
|
|
1626
1663
|
method: "GET",
|
|
1627
|
-
path: `${
|
|
1664
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/resources`,
|
|
1628
1665
|
query: { ...query ?? {} },
|
|
1629
1666
|
signal: options?.signal
|
|
1630
1667
|
});
|
|
@@ -1633,7 +1670,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1633
1670
|
listCaseParticipants(torrowId, query, options) {
|
|
1634
1671
|
return this.http.requestJson({
|
|
1635
1672
|
method: "GET",
|
|
1636
|
-
path: `${
|
|
1673
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants`,
|
|
1637
1674
|
query: { ...query ?? {} },
|
|
1638
1675
|
signal: options?.signal
|
|
1639
1676
|
});
|
|
@@ -1642,7 +1679,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1642
1679
|
getCaseParticipantById(torrowId, caseParticipantId, options) {
|
|
1643
1680
|
return this.http.requestJson({
|
|
1644
1681
|
method: "GET",
|
|
1645
|
-
path: `${
|
|
1682
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}`,
|
|
1646
1683
|
query: { securityToken: options?.securityToken },
|
|
1647
1684
|
signal: options?.signal
|
|
1648
1685
|
});
|
|
@@ -1651,7 +1688,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1651
1688
|
getCaseParticipantsCount(torrowId, query, options) {
|
|
1652
1689
|
return this.http.requestJson({
|
|
1653
1690
|
method: "GET",
|
|
1654
|
-
path: `${
|
|
1691
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/count`,
|
|
1655
1692
|
query: { ...query ?? {} },
|
|
1656
1693
|
signal: options?.signal
|
|
1657
1694
|
});
|
|
@@ -1660,7 +1697,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1660
1697
|
getCaseParticipantsNonAnonymousCount(torrowId, query, options) {
|
|
1661
1698
|
return this.http.requestJson({
|
|
1662
1699
|
method: "GET",
|
|
1663
|
-
path: `${
|
|
1700
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/nonanonymous`,
|
|
1664
1701
|
query: { ...query ?? {} },
|
|
1665
1702
|
signal: options?.signal
|
|
1666
1703
|
});
|
|
@@ -1669,7 +1706,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1669
1706
|
patchCaseParticipantFields(torrowId, caseParticipantId, body, options) {
|
|
1670
1707
|
return this.http.requestJson({
|
|
1671
1708
|
method: "PATCH",
|
|
1672
|
-
path: `${
|
|
1709
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}/fields`,
|
|
1673
1710
|
query: {
|
|
1674
1711
|
userMessage: options?.userMessage,
|
|
1675
1712
|
versionToCheck: options?.versionToCheck,
|
|
@@ -1683,7 +1720,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1683
1720
|
confirmCaseParticipantParticipation(torrowId, caseParticipantId, options) {
|
|
1684
1721
|
return this.http.requestJson({
|
|
1685
1722
|
method: "PATCH",
|
|
1686
|
-
path: `${
|
|
1723
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}/confirmparticipation`,
|
|
1687
1724
|
query: {
|
|
1688
1725
|
userMessage: options?.userMessage,
|
|
1689
1726
|
profileId: options?.profileId,
|
|
@@ -1698,7 +1735,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1698
1735
|
caseParticipationCheckIn(torrowId, body, options) {
|
|
1699
1736
|
return this.http.requestJson({
|
|
1700
1737
|
method: "PUT",
|
|
1701
|
-
path: `${
|
|
1738
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipation/checkin`,
|
|
1702
1739
|
body,
|
|
1703
1740
|
signal: options?.signal
|
|
1704
1741
|
});
|
|
@@ -1707,7 +1744,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1707
1744
|
bookResourcesForMe(torrowId, body, options) {
|
|
1708
1745
|
return this.http.requestJson({
|
|
1709
1746
|
method: "PUT",
|
|
1710
|
-
path: `${
|
|
1747
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipation/bookresourcesforme`,
|
|
1711
1748
|
query: { profileId: options?.profileId },
|
|
1712
1749
|
body,
|
|
1713
1750
|
signal: options?.signal
|
|
@@ -1717,7 +1754,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1717
1754
|
bookResourcesForOthers(torrowId, body, options) {
|
|
1718
1755
|
return this.http.requestJson({
|
|
1719
1756
|
method: "PUT",
|
|
1720
|
-
path: `${
|
|
1757
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipation/bookresourcesforother`,
|
|
1721
1758
|
body,
|
|
1722
1759
|
signal: options?.signal
|
|
1723
1760
|
});
|
|
@@ -1726,7 +1763,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1726
1763
|
approveMoneyReceive(torrowId, body, options) {
|
|
1727
1764
|
return this.http.requestJson({
|
|
1728
1765
|
method: "PUT",
|
|
1729
|
-
path: `${
|
|
1766
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/approvemoneyreceive`,
|
|
1730
1767
|
body,
|
|
1731
1768
|
signal: options?.signal
|
|
1732
1769
|
});
|
|
@@ -1735,7 +1772,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1735
1772
|
rejectMoneyReceive(torrowId, body, options) {
|
|
1736
1773
|
return this.http.requestJson({
|
|
1737
1774
|
method: "PUT",
|
|
1738
|
-
path: `${
|
|
1775
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/rejectmoneyreceive`,
|
|
1739
1776
|
body,
|
|
1740
1777
|
signal: options?.signal
|
|
1741
1778
|
});
|
|
@@ -1744,25 +1781,20 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1744
1781
|
approveCaseParticipation(torrowId, body, options) {
|
|
1745
1782
|
return this.http.requestJson({
|
|
1746
1783
|
method: "PUT",
|
|
1747
|
-
path: `${
|
|
1784
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipation/approvecaseparticipation`,
|
|
1748
1785
|
body,
|
|
1749
1786
|
signal: options?.signal
|
|
1750
1787
|
});
|
|
1751
1788
|
}
|
|
1752
1789
|
/** `PUT /api/v1/cases/{torrowId}/caseparticipation/cancelcaseparticipation` */
|
|
1753
1790
|
cancelCaseParticipation(torrowId, body, options) {
|
|
1754
|
-
return this.http
|
|
1755
|
-
method: "PUT",
|
|
1756
|
-
path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/cancelcaseparticipation`,
|
|
1757
|
-
body,
|
|
1758
|
-
signal: options?.signal
|
|
1759
|
-
});
|
|
1791
|
+
return cancelCaseParticipation(this.http, torrowId, body, options);
|
|
1760
1792
|
}
|
|
1761
1793
|
/** `POST /api/v1/cases/{torrowId}/reject` */
|
|
1762
1794
|
rejectCase(torrowId, options) {
|
|
1763
1795
|
return this.http.requestJson({
|
|
1764
1796
|
method: "POST",
|
|
1765
|
-
path: `${
|
|
1797
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/reject`,
|
|
1766
1798
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1767
1799
|
signal: options?.signal
|
|
1768
1800
|
});
|
|
@@ -1771,7 +1803,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1771
1803
|
declineWork(torrowId, options) {
|
|
1772
1804
|
return this.http.requestJson({
|
|
1773
1805
|
method: "POST",
|
|
1774
|
-
path: `${
|
|
1806
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/declinework`,
|
|
1775
1807
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1776
1808
|
signal: options?.signal
|
|
1777
1809
|
});
|
|
@@ -1780,7 +1812,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1780
1812
|
planCase(torrowId, options) {
|
|
1781
1813
|
return this.http.requestJson({
|
|
1782
1814
|
method: "POST",
|
|
1783
|
-
path: `${
|
|
1815
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/plan`,
|
|
1784
1816
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1785
1817
|
signal: options?.signal
|
|
1786
1818
|
});
|
|
@@ -1789,7 +1821,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1789
1821
|
takeInWork(torrowId, options) {
|
|
1790
1822
|
return this.http.requestJson({
|
|
1791
1823
|
method: "POST",
|
|
1792
|
-
path: `${
|
|
1824
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/takeinwork`,
|
|
1793
1825
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1794
1826
|
signal: options?.signal
|
|
1795
1827
|
});
|
|
@@ -1798,7 +1830,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1798
1830
|
completeCase(torrowId, options) {
|
|
1799
1831
|
return this.http.requestJson({
|
|
1800
1832
|
method: "POST",
|
|
1801
|
-
path: `${
|
|
1833
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/complete`,
|
|
1802
1834
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1803
1835
|
signal: options?.signal
|
|
1804
1836
|
});
|
|
@@ -1807,7 +1839,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1807
1839
|
acceptCase(torrowId, options) {
|
|
1808
1840
|
return this.http.requestJson({
|
|
1809
1841
|
method: "POST",
|
|
1810
|
-
path: `${
|
|
1842
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/accept`,
|
|
1811
1843
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1812
1844
|
signal: options?.signal
|
|
1813
1845
|
});
|
|
@@ -1816,7 +1848,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1816
1848
|
returnToVerification(torrowId, options) {
|
|
1817
1849
|
return this.http.requestJson({
|
|
1818
1850
|
method: "POST",
|
|
1819
|
-
path: `${
|
|
1851
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/returntoverification`,
|
|
1820
1852
|
query: { profileId: options?.profileId, userMessage: options?.userMessage },
|
|
1821
1853
|
signal: options?.signal
|
|
1822
1854
|
});
|
|
@@ -1825,7 +1857,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1825
1857
|
cancelCase(torrowId, options) {
|
|
1826
1858
|
return this.http.requestJson({
|
|
1827
1859
|
method: "POST",
|
|
1828
|
-
path: `${
|
|
1860
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/cancel`,
|
|
1829
1861
|
query: {
|
|
1830
1862
|
profileId: options?.profileId,
|
|
1831
1863
|
userMessage: options?.userMessage,
|
|
@@ -1838,7 +1870,7 @@ var CasesFacade = class extends TorrowItemFacade {
|
|
|
1838
1870
|
patchCase(torrowId, body, options) {
|
|
1839
1871
|
return this.http.requestJson({
|
|
1840
1872
|
method: "POST",
|
|
1841
|
-
path: `${
|
|
1873
|
+
path: `${BASE3}/${encodePathSegment(torrowId)}/patch`,
|
|
1842
1874
|
body,
|
|
1843
1875
|
signal: options?.signal
|
|
1844
1876
|
});
|
|
@@ -1951,7 +1983,7 @@ function normalizeContactVisitCardFieldsForWrite(body) {
|
|
|
1951
1983
|
}
|
|
1952
1984
|
|
|
1953
1985
|
// ../../src/resources/contacts/ContactsFacade.ts
|
|
1954
|
-
var
|
|
1986
|
+
var BASE4 = "/api/v1/contacts";
|
|
1955
1987
|
var CONTACT_SOCIAL_OPTS = {
|
|
1956
1988
|
imagePutUrlSecurityToken: true,
|
|
1957
1989
|
withPhotoEndpoints: true
|
|
@@ -1959,7 +1991,7 @@ var CONTACT_SOCIAL_OPTS = {
|
|
|
1959
1991
|
var ContactsFacade = class extends TorrowItemFacade {
|
|
1960
1992
|
itemObjectTypeCode = TorrowObjectTypeCode.Contact;
|
|
1961
1993
|
constructor(http) {
|
|
1962
|
-
super(http,
|
|
1994
|
+
super(http, BASE4, CONTACT_SOCIAL_OPTS);
|
|
1963
1995
|
}
|
|
1964
1996
|
/** Id контакта до `create` / presigned upload. */
|
|
1965
1997
|
generateContactId(ownerTorrowId) {
|
|
@@ -1970,7 +2002,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
1970
2002
|
const payload = this.withCreateDefaults(body);
|
|
1971
2003
|
return this.http.requestJson({
|
|
1972
2004
|
method: "POST",
|
|
1973
|
-
path:
|
|
2005
|
+
path: BASE4,
|
|
1974
2006
|
query: {
|
|
1975
2007
|
parentId: options?.parentId,
|
|
1976
2008
|
profileId: options?.profileId
|
|
@@ -1986,15 +2018,16 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
1986
2018
|
normalizeContactVisitCardFieldsForWrite(payload);
|
|
1987
2019
|
return payload;
|
|
1988
2020
|
}
|
|
1989
|
-
/** `PUT /api/v1/contacts/{
|
|
1990
|
-
update(body,
|
|
2021
|
+
/** `PUT /api/v1/contacts/{body.id}` */
|
|
2022
|
+
update(body, options) {
|
|
2023
|
+
const itemId = requireItemUpdateId(body, "Contact");
|
|
1991
2024
|
const payload = { ...body };
|
|
1992
2025
|
normalizeContactStructuredArrayRidsForWrite(payload);
|
|
1993
2026
|
normalizeContactCommunicationsForWrite(payload);
|
|
1994
2027
|
normalizeContactVisitCardFieldsForWrite(payload);
|
|
1995
2028
|
return this.http.requestJson({
|
|
1996
2029
|
method: "PUT",
|
|
1997
|
-
path: `${
|
|
2030
|
+
path: `${BASE4}/${encodePathSegment(itemId)}`,
|
|
1998
2031
|
query: {
|
|
1999
2032
|
checkVersion: options?.checkVersion,
|
|
2000
2033
|
isNeedAnnouncement: options?.isNeedAnnouncement,
|
|
@@ -2008,7 +2041,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2008
2041
|
getById(torrowId, options) {
|
|
2009
2042
|
return this.http.requestJson({
|
|
2010
2043
|
method: "GET",
|
|
2011
|
-
path: `${
|
|
2044
|
+
path: `${BASE4}/${encodePathSegment(torrowId)}`,
|
|
2012
2045
|
query: {
|
|
2013
2046
|
versionToCheck: options?.versionToCheck,
|
|
2014
2047
|
includeDeleted: options?.includeDeleted,
|
|
@@ -2025,7 +2058,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2025
2058
|
async delete(torrowId, options) {
|
|
2026
2059
|
const resp = await this.http.requestJson({
|
|
2027
2060
|
method: "DELETE",
|
|
2028
|
-
path: `${
|
|
2061
|
+
path: `${BASE4}/${encodePathSegment(torrowId)}`,
|
|
2029
2062
|
query: {
|
|
2030
2063
|
cascade: options.cascade,
|
|
2031
2064
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -2041,7 +2074,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2041
2074
|
const { signal, securityToken, ...rest } = options ?? {};
|
|
2042
2075
|
return this.http.requestJson({
|
|
2043
2076
|
method: "GET",
|
|
2044
|
-
path: `${
|
|
2077
|
+
path: `${BASE4}/personallist`,
|
|
2045
2078
|
query: { ...rest, securityToken },
|
|
2046
2079
|
signal
|
|
2047
2080
|
});
|
|
@@ -2051,7 +2084,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2051
2084
|
const { signal, ...queryOpts } = options ?? {};
|
|
2052
2085
|
return this.http.requestJson({
|
|
2053
2086
|
method: "PUT",
|
|
2054
|
-
path: `${
|
|
2087
|
+
path: `${BASE4}/${encodePathSegment(contactId)}/timetable`,
|
|
2055
2088
|
query: buildTimetableQuery(queryOpts),
|
|
2056
2089
|
body,
|
|
2057
2090
|
signal
|
|
@@ -2061,7 +2094,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2061
2094
|
async getTimetableStatistics(body, options) {
|
|
2062
2095
|
const resp = await this.http.requestJson({
|
|
2063
2096
|
method: "POST",
|
|
2064
|
-
path: `${
|
|
2097
|
+
path: `${BASE4}/timetable/statistics`,
|
|
2065
2098
|
body,
|
|
2066
2099
|
signal: options?.signal
|
|
2067
2100
|
});
|
|
@@ -2071,7 +2104,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2071
2104
|
async sendCommunicationCode(body, options) {
|
|
2072
2105
|
const resp = await this.http.requestJson({
|
|
2073
2106
|
method: "POST",
|
|
2074
|
-
path: `${
|
|
2107
|
+
path: `${BASE4}/communication/sendcode`,
|
|
2075
2108
|
body,
|
|
2076
2109
|
signal: options?.signal
|
|
2077
2110
|
});
|
|
@@ -2081,7 +2114,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2081
2114
|
verifyCommunicationCode(body, options) {
|
|
2082
2115
|
return this.http.requestJson({
|
|
2083
2116
|
method: "POST",
|
|
2084
|
-
path: `${
|
|
2117
|
+
path: `${BASE4}/communication/verify`,
|
|
2085
2118
|
body,
|
|
2086
2119
|
signal: options?.signal
|
|
2087
2120
|
});
|
|
@@ -2090,7 +2123,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2090
2123
|
invite(torrowId, body, options) {
|
|
2091
2124
|
return this.http.requestJson({
|
|
2092
2125
|
method: "POST",
|
|
2093
|
-
path: `${
|
|
2126
|
+
path: `${BASE4}/${encodePathSegment(torrowId)}/invite`,
|
|
2094
2127
|
query: { communicationId: options?.communicationId },
|
|
2095
2128
|
body,
|
|
2096
2129
|
signal: options?.signal
|
|
@@ -2100,7 +2133,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2100
2133
|
listActivityStatuses(itemIds, options) {
|
|
2101
2134
|
return this.http.requestJson({
|
|
2102
2135
|
method: "POST",
|
|
2103
|
-
path: `${
|
|
2136
|
+
path: `${BASE4}/activitystatuslist`,
|
|
2104
2137
|
body: itemIds,
|
|
2105
2138
|
signal: options?.signal
|
|
2106
2139
|
});
|
|
@@ -2109,7 +2142,7 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2109
2142
|
async updateContactProperties(contactId, body, options) {
|
|
2110
2143
|
const resp = await this.http.requestJson({
|
|
2111
2144
|
method: "PUT",
|
|
2112
|
-
path: `${
|
|
2145
|
+
path: `${BASE4}/${encodePathSegment(contactId)}/contactproperties`,
|
|
2113
2146
|
body,
|
|
2114
2147
|
signal: options?.signal
|
|
2115
2148
|
});
|
|
@@ -2118,11 +2151,11 @@ var ContactsFacade = class extends TorrowItemFacade {
|
|
|
2118
2151
|
};
|
|
2119
2152
|
|
|
2120
2153
|
// ../../src/resources/contexts/ContextsFacade.ts
|
|
2121
|
-
var
|
|
2154
|
+
var BASE5 = "/api/v1/contexts";
|
|
2122
2155
|
var ContextsFacade = class extends TorrowItemFacade {
|
|
2123
2156
|
itemObjectTypeCode = TorrowObjectTypeCode.Context;
|
|
2124
2157
|
constructor(http) {
|
|
2125
|
-
super(http,
|
|
2158
|
+
super(http, BASE5, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
|
|
2126
2159
|
}
|
|
2127
2160
|
/** Id контекста до `create` / presigned upload. */
|
|
2128
2161
|
generateContextId(ownerTorrowId) {
|
|
@@ -2133,17 +2166,18 @@ var ContextsFacade = class extends TorrowItemFacade {
|
|
|
2133
2166
|
const payload = applyItemCreateDefaults(body, "ContextItem" /* ContextItem */);
|
|
2134
2167
|
return this.http.requestJson({
|
|
2135
2168
|
method: "POST",
|
|
2136
|
-
path:
|
|
2169
|
+
path: BASE5,
|
|
2137
2170
|
query: { profileId: options?.profileId },
|
|
2138
2171
|
body: payload,
|
|
2139
2172
|
signal: options?.signal
|
|
2140
2173
|
});
|
|
2141
2174
|
}
|
|
2142
|
-
/** `PUT /api/v1/contexts/{
|
|
2143
|
-
update(body,
|
|
2175
|
+
/** `PUT /api/v1/contexts/{body.id}` */
|
|
2176
|
+
update(body, options) {
|
|
2177
|
+
const itemId = requireItemUpdateId(body, "Context");
|
|
2144
2178
|
return this.http.requestJson({
|
|
2145
2179
|
method: "PUT",
|
|
2146
|
-
path: `${
|
|
2180
|
+
path: `${BASE5}/${encodePathSegment(itemId)}`,
|
|
2147
2181
|
query: {
|
|
2148
2182
|
checkVersion: options?.checkVersion,
|
|
2149
2183
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -2156,7 +2190,7 @@ var ContextsFacade = class extends TorrowItemFacade {
|
|
|
2156
2190
|
async delete(torrowId, options) {
|
|
2157
2191
|
const resp = await this.http.requestJson({
|
|
2158
2192
|
method: "DELETE",
|
|
2159
|
-
path: `${
|
|
2193
|
+
path: `${BASE5}/${encodePathSegment(torrowId)}`,
|
|
2160
2194
|
query: {
|
|
2161
2195
|
cascade: options.cascade,
|
|
2162
2196
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -2171,7 +2205,7 @@ var ContextsFacade = class extends TorrowItemFacade {
|
|
|
2171
2205
|
getById(torrowId, options) {
|
|
2172
2206
|
return this.http.requestJson({
|
|
2173
2207
|
method: "GET",
|
|
2174
|
-
path: `${
|
|
2208
|
+
path: `${BASE5}/${encodePathSegment(torrowId)}`,
|
|
2175
2209
|
query: {
|
|
2176
2210
|
versionToCheck: options?.versionToCheck,
|
|
2177
2211
|
includeDeleted: options?.includeDeleted,
|
|
@@ -2186,7 +2220,7 @@ var ContextsFacade = class extends TorrowItemFacade {
|
|
|
2186
2220
|
const { signal, ...rest } = options ?? {};
|
|
2187
2221
|
return this.http.requestJson({
|
|
2188
2222
|
method: "GET",
|
|
2189
|
-
path: `${
|
|
2223
|
+
path: `${BASE5}/personallist`,
|
|
2190
2224
|
query: { ...rest },
|
|
2191
2225
|
signal
|
|
2192
2226
|
});
|
|
@@ -2198,6 +2232,7 @@ var NoteTypeValues = {
|
|
|
2198
2232
|
Unknown: "Unknown",
|
|
2199
2233
|
Text: "Text",
|
|
2200
2234
|
Html: "Html",
|
|
2235
|
+
Markdown: "Markdown",
|
|
2201
2236
|
Hlink: "Hlink",
|
|
2202
2237
|
File: "File",
|
|
2203
2238
|
Photo: "Photo",
|
|
@@ -2218,12 +2253,12 @@ var ImagePreviewSizeValues = {
|
|
|
2218
2253
|
};
|
|
2219
2254
|
|
|
2220
2255
|
// ../../src/resources/notes/NotesFacade.ts
|
|
2221
|
-
var
|
|
2256
|
+
var BASE6 = "/api/v1/notes";
|
|
2222
2257
|
var DEFAULT_NOTE_NAME = "Untitled note";
|
|
2223
2258
|
var NotesFacade = class extends TorrowItemFacade {
|
|
2224
2259
|
itemObjectTypeCode = TorrowObjectTypeCode.Note;
|
|
2225
2260
|
constructor(http) {
|
|
2226
|
-
super(http,
|
|
2261
|
+
super(http, BASE6, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
|
|
2227
2262
|
}
|
|
2228
2263
|
/** Id заметки до `create` / presigned upload (`ownerTorrowId` — profileId и т.п.). */
|
|
2229
2264
|
generateNoteId(ownerTorrowId) {
|
|
@@ -2234,7 +2269,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2234
2269
|
const payload = this.withCreateDefaults(body);
|
|
2235
2270
|
return this.http.requestJson({
|
|
2236
2271
|
method: "POST",
|
|
2237
|
-
path:
|
|
2272
|
+
path: BASE6,
|
|
2238
2273
|
query: {
|
|
2239
2274
|
parentId: options?.parentId,
|
|
2240
2275
|
profileId: options?.profileId
|
|
@@ -2243,11 +2278,12 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2243
2278
|
signal: options?.signal
|
|
2244
2279
|
});
|
|
2245
2280
|
}
|
|
2246
|
-
/** `PUT /api/v1/notes/{
|
|
2247
|
-
update(body,
|
|
2281
|
+
/** `PUT /api/v1/notes/{body.id}` */
|
|
2282
|
+
update(body, options) {
|
|
2283
|
+
const itemId = requireItemUpdateId(body, "Note");
|
|
2248
2284
|
return this.http.requestJson({
|
|
2249
2285
|
method: "PUT",
|
|
2250
|
-
path: `${
|
|
2286
|
+
path: `${BASE6}/${encodePathSegment(itemId)}`,
|
|
2251
2287
|
query: {
|
|
2252
2288
|
checkVersion: options?.checkVersion,
|
|
2253
2289
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -2264,7 +2300,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2264
2300
|
async delete(torrowId, options) {
|
|
2265
2301
|
const resp = await this.http.requestJson({
|
|
2266
2302
|
method: "DELETE",
|
|
2267
|
-
path: `${
|
|
2303
|
+
path: `${BASE6}/${encodePathSegment(torrowId)}`,
|
|
2268
2304
|
query: {
|
|
2269
2305
|
cascade: options.cascade,
|
|
2270
2306
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -2279,7 +2315,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2279
2315
|
getById(torrowId, options) {
|
|
2280
2316
|
return this.http.requestJson({
|
|
2281
2317
|
method: "GET",
|
|
2282
|
-
path: `${
|
|
2318
|
+
path: `${BASE6}/${encodePathSegment(torrowId)}`,
|
|
2283
2319
|
query: {
|
|
2284
2320
|
versionToCheck: options?.versionToCheck,
|
|
2285
2321
|
includeDeleted: options?.includeDeleted,
|
|
@@ -2294,7 +2330,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2294
2330
|
const { signal, ...rest } = options ?? {};
|
|
2295
2331
|
return this.http.requestJson({
|
|
2296
2332
|
method: "GET",
|
|
2297
|
-
path: `${
|
|
2333
|
+
path: `${BASE6}/personallist`,
|
|
2298
2334
|
query: { ...rest },
|
|
2299
2335
|
signal
|
|
2300
2336
|
});
|
|
@@ -2303,7 +2339,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2303
2339
|
getFileInfo(torrowId, fileId, options) {
|
|
2304
2340
|
return this.http.requestJson({
|
|
2305
2341
|
method: "GET",
|
|
2306
|
-
path: `${
|
|
2342
|
+
path: `${BASE6}/${encodePathSegment(torrowId)}/file/info`,
|
|
2307
2343
|
query: { fileId },
|
|
2308
2344
|
signal: options?.signal
|
|
2309
2345
|
});
|
|
@@ -2312,7 +2348,7 @@ var NotesFacade = class extends TorrowItemFacade {
|
|
|
2312
2348
|
async getFilePutUrl(torrowId, fileId, fileName, fileSize, options) {
|
|
2313
2349
|
const resp = await this.http.requestJson({
|
|
2314
2350
|
method: "GET",
|
|
2315
|
-
path: `${
|
|
2351
|
+
path: `${BASE6}/${encodePathSegment(torrowId)}/file/puturl`,
|
|
2316
2352
|
query: {
|
|
2317
2353
|
fileId,
|
|
2318
2354
|
fileName,
|
|
@@ -2838,13 +2874,18 @@ var UsageTypeValues = {
|
|
|
2838
2874
|
Payment: "Payment",
|
|
2839
2875
|
Ticket: "Ticket"
|
|
2840
2876
|
};
|
|
2877
|
+
var UsageConditionTypeValues = {
|
|
2878
|
+
None: "None",
|
|
2879
|
+
Exclusion: "Exclusion",
|
|
2880
|
+
Additional: "Additional"
|
|
2881
|
+
};
|
|
2841
2882
|
|
|
2842
2883
|
// ../../src/resources/resources/ResourcesFacade.ts
|
|
2843
|
-
var
|
|
2884
|
+
var BASE7 = "/api/v1/resources";
|
|
2844
2885
|
var ResourcesFacade = class extends TorrowItemFacade {
|
|
2845
2886
|
itemObjectTypeCode = TorrowObjectTypeCode.Resource;
|
|
2846
2887
|
constructor(http) {
|
|
2847
|
-
super(http,
|
|
2888
|
+
super(http, BASE7, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
|
|
2848
2889
|
}
|
|
2849
2890
|
/** Id ресурса до `create` / presigned upload. */
|
|
2850
2891
|
generateResourceId(ownerTorrowId) {
|
|
@@ -2870,7 +2911,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2870
2911
|
const payload = this.withCreateDefaults(body);
|
|
2871
2912
|
return this.http.requestJson({
|
|
2872
2913
|
method: "POST",
|
|
2873
|
-
path:
|
|
2914
|
+
path: BASE7,
|
|
2874
2915
|
query: {
|
|
2875
2916
|
parentId: options?.parentId,
|
|
2876
2917
|
profileId: options?.profileId
|
|
@@ -2879,11 +2920,12 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2879
2920
|
signal: options?.signal
|
|
2880
2921
|
}).then((item) => this.toSdkResourceItem(item));
|
|
2881
2922
|
}
|
|
2882
|
-
/** `PUT /api/v1/resources/{
|
|
2883
|
-
update(body,
|
|
2923
|
+
/** `PUT /api/v1/resources/{body.id}`. Требует непустой `id` в теле ресурса. */
|
|
2924
|
+
update(body, options) {
|
|
2925
|
+
const resourceId = requireItemUpdateId(body, "Resource");
|
|
2884
2926
|
return this.http.requestJson({
|
|
2885
2927
|
method: "PUT",
|
|
2886
|
-
path: `${
|
|
2928
|
+
path: `${BASE7}/${encodePathSegment(resourceId)}`,
|
|
2887
2929
|
query: {
|
|
2888
2930
|
profileId: options?.profileId,
|
|
2889
2931
|
checkVersion: options?.checkVersion,
|
|
@@ -2904,7 +2946,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2904
2946
|
async delete(torrowId, options) {
|
|
2905
2947
|
const resp = await this.http.requestJson({
|
|
2906
2948
|
method: "DELETE",
|
|
2907
|
-
path: `${
|
|
2949
|
+
path: `${BASE7}/${encodePathSegment(torrowId)}`,
|
|
2908
2950
|
query: {
|
|
2909
2951
|
cascade: options.cascade,
|
|
2910
2952
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -2919,7 +2961,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2919
2961
|
getById(torrowId, options) {
|
|
2920
2962
|
return this.http.requestJson({
|
|
2921
2963
|
method: "GET",
|
|
2922
|
-
path: `${
|
|
2964
|
+
path: `${BASE7}/${encodePathSegment(torrowId)}`,
|
|
2923
2965
|
query: {
|
|
2924
2966
|
versionToCheck: options?.versionToCheck,
|
|
2925
2967
|
includeDeleted: options?.includeDeleted,
|
|
@@ -2978,7 +3020,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2978
3020
|
const { signal, ...rest } = options ?? {};
|
|
2979
3021
|
return this.http.requestJson({
|
|
2980
3022
|
method: "GET",
|
|
2981
|
-
path: `${
|
|
3023
|
+
path: `${BASE7}/personallist`,
|
|
2982
3024
|
query: { ...rest },
|
|
2983
3025
|
signal
|
|
2984
3026
|
}).then((items) => items.map((item) => this.toSdkResourceItem(item)));
|
|
@@ -2990,7 +3032,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
2990
3032
|
const { signal, ...queryOpts } = options ?? {};
|
|
2991
3033
|
return this.http.requestJson({
|
|
2992
3034
|
method: "PUT",
|
|
2993
|
-
path: `${
|
|
3035
|
+
path: `${BASE7}/${encodePathSegment(resourceId)}/timetable`,
|
|
2994
3036
|
query: buildTimetableQuery(queryOpts),
|
|
2995
3037
|
body,
|
|
2996
3038
|
signal
|
|
@@ -3003,7 +3045,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
3003
3045
|
const { signal, from, to, serviceId } = options;
|
|
3004
3046
|
return this.http.requestJson({
|
|
3005
3047
|
method: "GET",
|
|
3006
|
-
path: `${
|
|
3048
|
+
path: `${BASE7}/${encodePathSegment(resourceId)}/workload`,
|
|
3007
3049
|
query: {
|
|
3008
3050
|
From: from,
|
|
3009
3051
|
To: to,
|
|
@@ -3016,7 +3058,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
3016
3058
|
pickOrder(resourceId, body, options) {
|
|
3017
3059
|
return this.http.requestJson({
|
|
3018
3060
|
method: "POST",
|
|
3019
|
-
path: `${
|
|
3061
|
+
path: `${BASE7}/${encodePathSegment(resourceId)}/pickorder`,
|
|
3020
3062
|
body,
|
|
3021
3063
|
signal: options?.signal
|
|
3022
3064
|
});
|
|
@@ -3025,7 +3067,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
3025
3067
|
returnOrder(resourceId, body, options) {
|
|
3026
3068
|
return this.http.requestJson({
|
|
3027
3069
|
method: "POST",
|
|
3028
|
-
path: `${
|
|
3070
|
+
path: `${BASE7}/${encodePathSegment(resourceId)}/returnorder`,
|
|
3029
3071
|
body,
|
|
3030
3072
|
signal: options?.signal
|
|
3031
3073
|
});
|
|
@@ -3034,7 +3076,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
3034
3076
|
async getTimetableStatistics(body, options) {
|
|
3035
3077
|
const resp = await this.http.requestJson({
|
|
3036
3078
|
method: "POST",
|
|
3037
|
-
path: `${
|
|
3079
|
+
path: `${BASE7}/timetable/statistics`,
|
|
3038
3080
|
body,
|
|
3039
3081
|
signal: options?.signal
|
|
3040
3082
|
});
|
|
@@ -3042,23 +3084,65 @@ var ResourcesFacade = class extends TorrowItemFacade {
|
|
|
3042
3084
|
}
|
|
3043
3085
|
};
|
|
3044
3086
|
|
|
3087
|
+
// ../../src/resources/services/service-requests.ts
|
|
3088
|
+
var BASE8 = "/api/v1/services";
|
|
3089
|
+
function toSdkServiceItem(service) {
|
|
3090
|
+
return {
|
|
3091
|
+
...service,
|
|
3092
|
+
behaviorSettings: parseServiceImplicitTagParams(service.tags)
|
|
3093
|
+
};
|
|
3094
|
+
}
|
|
3095
|
+
async function getService(http, torrowId, options) {
|
|
3096
|
+
const item = await http.requestJson({
|
|
3097
|
+
method: "GET",
|
|
3098
|
+
path: `${BASE8}/${encodePathSegment(torrowId)}`,
|
|
3099
|
+
query: {
|
|
3100
|
+
profileId: options?.profileId,
|
|
3101
|
+
versionToCheck: options?.versionToCheck,
|
|
3102
|
+
includeDeleted: options?.includeDeleted,
|
|
3103
|
+
includeChildTypes: options?.includeChildTypes,
|
|
3104
|
+
securityToken: options?.securityToken
|
|
3105
|
+
},
|
|
3106
|
+
signal: options?.signal
|
|
3107
|
+
});
|
|
3108
|
+
return toSdkServiceItem(item);
|
|
3109
|
+
}
|
|
3110
|
+
function getServiceResources(http, serviceId, body, options) {
|
|
3111
|
+
return http.requestJson({
|
|
3112
|
+
method: "POST",
|
|
3113
|
+
path: `${BASE8}/${encodePathSegment(serviceId)}/resources`,
|
|
3114
|
+
body,
|
|
3115
|
+
signal: options?.signal
|
|
3116
|
+
});
|
|
3117
|
+
}
|
|
3118
|
+
function getCheckInSchedule(http, serviceId, body, options) {
|
|
3119
|
+
return http.requestJson({
|
|
3120
|
+
method: "POST",
|
|
3121
|
+
path: `${BASE8}/${encodePathSegment(serviceId)}/checkinschedule`,
|
|
3122
|
+
body,
|
|
3123
|
+
signal: options?.signal
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
function createOrder(http, serviceId, body, options) {
|
|
3127
|
+
return http.requestJson({
|
|
3128
|
+
method: "POST",
|
|
3129
|
+
path: `${BASE8}/${encodePathSegment(serviceId)}/order`,
|
|
3130
|
+
body,
|
|
3131
|
+
signal: options?.signal
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3045
3135
|
// ../../src/resources/services/ServicesFacade.ts
|
|
3046
|
-
var
|
|
3136
|
+
var BASE9 = "/api/v1/services";
|
|
3047
3137
|
var ServicesFacade = class extends TorrowItemFacade {
|
|
3048
3138
|
itemObjectTypeCode = TorrowObjectTypeCode.Service;
|
|
3049
3139
|
constructor(http) {
|
|
3050
|
-
super(http,
|
|
3140
|
+
super(http, BASE9, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
|
|
3051
3141
|
}
|
|
3052
3142
|
/** Id услуги до `create` / presigned upload. */
|
|
3053
3143
|
generateServiceId(ownerTorrowId) {
|
|
3054
3144
|
return this.generateItemId(ownerTorrowId);
|
|
3055
3145
|
}
|
|
3056
|
-
toSdkServiceItem(service) {
|
|
3057
|
-
return {
|
|
3058
|
-
...service,
|
|
3059
|
-
behaviorSettings: parseServiceImplicitTagParams(service.tags)
|
|
3060
|
-
};
|
|
3061
|
-
}
|
|
3062
3146
|
toApiServiceItem(service) {
|
|
3063
3147
|
const { behaviorSettings, ...rest } = service;
|
|
3064
3148
|
const apiBase = rest;
|
|
@@ -3073,20 +3157,21 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3073
3157
|
const payload = applyItemCreateDefaults(body, "ServiceItem" /* ServiceItem */);
|
|
3074
3158
|
return this.http.requestJson({
|
|
3075
3159
|
method: "POST",
|
|
3076
|
-
path:
|
|
3160
|
+
path: BASE9,
|
|
3077
3161
|
query: {
|
|
3078
3162
|
parentId: options?.parentId,
|
|
3079
3163
|
profileId: options?.profileId
|
|
3080
3164
|
},
|
|
3081
3165
|
body: this.toApiServiceItem(payload),
|
|
3082
3166
|
signal: options?.signal
|
|
3083
|
-
}).then((item) =>
|
|
3167
|
+
}).then((item) => toSdkServiceItem(item));
|
|
3084
3168
|
}
|
|
3085
|
-
/** `PUT /api/v1/services/{
|
|
3086
|
-
update(body,
|
|
3169
|
+
/** `PUT /api/v1/services/{body.id}` */
|
|
3170
|
+
update(body, options) {
|
|
3171
|
+
const itemId = requireItemUpdateId(body, "Service");
|
|
3087
3172
|
return this.http.requestJson({
|
|
3088
3173
|
method: "PUT",
|
|
3089
|
-
path: `${
|
|
3174
|
+
path: `${BASE9}/${encodePathSegment(itemId)}`,
|
|
3090
3175
|
query: {
|
|
3091
3176
|
profileId: options?.profileId,
|
|
3092
3177
|
checkVersion: options?.checkVersion,
|
|
@@ -3094,13 +3179,13 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3094
3179
|
},
|
|
3095
3180
|
body: this.toApiServiceItem(body),
|
|
3096
3181
|
signal: options?.signal
|
|
3097
|
-
}).then((item) =>
|
|
3182
|
+
}).then((item) => toSdkServiceItem(item));
|
|
3098
3183
|
}
|
|
3099
3184
|
/** `DELETE /api/v1/services/{torrowId}` */
|
|
3100
3185
|
async delete(torrowId, options) {
|
|
3101
3186
|
const resp = await this.http.requestJson({
|
|
3102
3187
|
method: "DELETE",
|
|
3103
|
-
path: `${
|
|
3188
|
+
path: `${BASE9}/${encodePathSegment(torrowId)}`,
|
|
3104
3189
|
query: {
|
|
3105
3190
|
cascade: options.cascade,
|
|
3106
3191
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -3113,18 +3198,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3113
3198
|
}
|
|
3114
3199
|
/** `GET /api/v1/services/{torrowId}` */
|
|
3115
3200
|
getById(torrowId, options) {
|
|
3116
|
-
return this.http
|
|
3117
|
-
method: "GET",
|
|
3118
|
-
path: `${BASE7}/${encodePathSegment(torrowId)}`,
|
|
3119
|
-
query: {
|
|
3120
|
-
profileId: options?.profileId,
|
|
3121
|
-
versionToCheck: options?.versionToCheck,
|
|
3122
|
-
includeDeleted: options?.includeDeleted,
|
|
3123
|
-
includeChildTypes: options?.includeChildTypes,
|
|
3124
|
-
securityToken: options?.securityToken
|
|
3125
|
-
},
|
|
3126
|
-
signal: options?.signal
|
|
3127
|
-
}).then((item) => this.toSdkServiceItem(item));
|
|
3201
|
+
return getService(this.http, torrowId, options);
|
|
3128
3202
|
}
|
|
3129
3203
|
/** Внутренний helper: получить типизированные настройки поведения услуги из `service.tags`. */
|
|
3130
3204
|
getBehaviorSettingsFromService(service) {
|
|
@@ -3184,22 +3258,17 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3184
3258
|
* Типичные отказы: нет слота, услуга недоступна по времени, подписка/баланс — разбирай тело `TorrowHttpError` (`name` / `code`); эталон UX — `torrow-apps` `CreateOrderTask`.
|
|
3185
3259
|
*/
|
|
3186
3260
|
createOrder(serviceId, body, options) {
|
|
3187
|
-
return this.http
|
|
3188
|
-
method: "POST",
|
|
3189
|
-
path: `${BASE7}/${encodePathSegment(serviceId)}/order`,
|
|
3190
|
-
body,
|
|
3191
|
-
signal: options?.signal
|
|
3192
|
-
});
|
|
3261
|
+
return createOrder(this.http, serviceId, body, options);
|
|
3193
3262
|
}
|
|
3194
3263
|
/**
|
|
3195
|
-
*
|
|
3196
|
-
*
|
|
3264
|
+
* События/заказы и занятость услуги — `PUT /api/v1/services/{serviceId}/timetable`.
|
|
3265
|
+
* Не вычисляет свободные слоты записи: для них используй `getCheckInSchedule` с `type: "FreeTimeSlots"`.
|
|
3197
3266
|
*/
|
|
3198
3267
|
getTimetable(serviceId, body, options) {
|
|
3199
3268
|
const { signal, ...queryOpts } = options ?? {};
|
|
3200
3269
|
return this.http.requestJson({
|
|
3201
3270
|
method: "PUT",
|
|
3202
|
-
path: `${
|
|
3271
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/timetable`,
|
|
3203
3272
|
query: buildTimetableQuery(queryOpts),
|
|
3204
3273
|
body,
|
|
3205
3274
|
signal
|
|
@@ -3212,7 +3281,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3212
3281
|
getWorkloadInfo(body, options) {
|
|
3213
3282
|
return this.http.requestJson({
|
|
3214
3283
|
method: "PUT",
|
|
3215
|
-
path: `${
|
|
3284
|
+
path: `${BASE9}/workloadinfo`,
|
|
3216
3285
|
body,
|
|
3217
3286
|
signal: options?.signal
|
|
3218
3287
|
});
|
|
@@ -3221,38 +3290,31 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3221
3290
|
async getTimetableStatistics(body, options) {
|
|
3222
3291
|
const resp = await this.http.requestJson({
|
|
3223
3292
|
method: "POST",
|
|
3224
|
-
path: `${
|
|
3293
|
+
path: `${BASE9}/timetable/statistics`,
|
|
3225
3294
|
body,
|
|
3226
3295
|
signal: options?.signal
|
|
3227
3296
|
});
|
|
3228
3297
|
return unwrapTimetableStatisticsList(resp);
|
|
3229
3298
|
}
|
|
3230
|
-
/**
|
|
3299
|
+
/**
|
|
3300
|
+
* Расчёт доступности записи — `POST /api/v1/services/{id}/checkinschedule`.
|
|
3301
|
+
* `type: "FreeTimeSlots"` возвращает выбираемые свободные слоты; `AsIs` — исходные периоды нагрузки.
|
|
3302
|
+
*/
|
|
3231
3303
|
getCheckInSchedule(serviceId, body, options) {
|
|
3232
|
-
return this.http
|
|
3233
|
-
method: "POST",
|
|
3234
|
-
path: `${BASE7}/${encodePathSegment(serviceId)}/checkinschedule`,
|
|
3235
|
-
body,
|
|
3236
|
-
signal: options?.signal
|
|
3237
|
-
});
|
|
3304
|
+
return getCheckInSchedule(this.http, serviceId, body, options);
|
|
3238
3305
|
}
|
|
3239
3306
|
/** Пересчёт расписания чекина — `PUT /api/v1/services/{id}/recheckinschedule`. */
|
|
3240
3307
|
getReCheckInSchedule(serviceId, body, options) {
|
|
3241
3308
|
return this.http.requestJson({
|
|
3242
3309
|
method: "PUT",
|
|
3243
|
-
path: `${
|
|
3310
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/recheckinschedule`,
|
|
3244
3311
|
body,
|
|
3245
3312
|
signal: options?.signal
|
|
3246
3313
|
});
|
|
3247
3314
|
}
|
|
3248
3315
|
/** Доступные ресурсы группы для шага «Ресурс» — `POST /api/v1/services/{serviceId}/resources`. */
|
|
3249
3316
|
getServiceResources(serviceId, body, options) {
|
|
3250
|
-
return this.http
|
|
3251
|
-
method: "POST",
|
|
3252
|
-
path: `${BASE7}/${encodePathSegment(serviceId)}/resources`,
|
|
3253
|
-
body,
|
|
3254
|
-
signal: options?.signal
|
|
3255
|
-
});
|
|
3317
|
+
return getServiceResources(this.http, serviceId, body, options);
|
|
3256
3318
|
}
|
|
3257
3319
|
/**
|
|
3258
3320
|
* Ресурсы с детализацией (в т.ч. гарантированные количества) — `POST .../resourceswithdetalization`.
|
|
@@ -3261,7 +3323,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3261
3323
|
getServiceResourcesWithDetalization(serviceId, body, options) {
|
|
3262
3324
|
return this.http.requestJson({
|
|
3263
3325
|
method: "POST",
|
|
3264
|
-
path: `${
|
|
3326
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/resourceswithdetalization`,
|
|
3265
3327
|
body,
|
|
3266
3328
|
signal: options?.signal
|
|
3267
3329
|
});
|
|
@@ -3271,16 +3333,16 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3271
3333
|
const { signal, ...rest } = options ?? {};
|
|
3272
3334
|
return this.http.requestJson({
|
|
3273
3335
|
method: "GET",
|
|
3274
|
-
path: `${
|
|
3336
|
+
path: `${BASE9}/personallist`,
|
|
3275
3337
|
query: { ...rest },
|
|
3276
3338
|
signal
|
|
3277
|
-
}).then((items) => items.map((item) =>
|
|
3339
|
+
}).then((items) => items.map((item) => toSdkServiceItem(item)));
|
|
3278
3340
|
}
|
|
3279
3341
|
/** `POST /api/v1/services/{serviceId}/session` — создать сессию записи (тело `CaseItem`). */
|
|
3280
3342
|
createSession(serviceId, body, options) {
|
|
3281
3343
|
return this.http.requestJson({
|
|
3282
3344
|
method: "POST",
|
|
3283
|
-
path: `${
|
|
3345
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/session`,
|
|
3284
3346
|
query: { profileId: options?.profileId },
|
|
3285
3347
|
body,
|
|
3286
3348
|
signal: options?.signal
|
|
@@ -3290,7 +3352,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3290
3352
|
refreshSession(serviceId, options) {
|
|
3291
3353
|
return this.http.requestJson({
|
|
3292
3354
|
method: "PUT",
|
|
3293
|
-
path: `${
|
|
3355
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/session`,
|
|
3294
3356
|
query: { caseId: options?.caseId, profileId: options?.profileId },
|
|
3295
3357
|
signal: options?.signal
|
|
3296
3358
|
});
|
|
@@ -3299,7 +3361,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3299
3361
|
patchUpdateOrder(serviceId, body, options) {
|
|
3300
3362
|
return this.http.requestJson({
|
|
3301
3363
|
method: "PATCH",
|
|
3302
|
-
path: `${
|
|
3364
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/updateorder`,
|
|
3303
3365
|
body,
|
|
3304
3366
|
signal: options?.signal
|
|
3305
3367
|
});
|
|
@@ -3308,7 +3370,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3308
3370
|
patchUpdateOrder2(serviceId, body, options) {
|
|
3309
3371
|
return this.http.requestJson({
|
|
3310
3372
|
method: "PATCH",
|
|
3311
|
-
path: `${
|
|
3373
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/updateorder2`,
|
|
3312
3374
|
body,
|
|
3313
3375
|
signal: options?.signal
|
|
3314
3376
|
});
|
|
@@ -3317,7 +3379,7 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3317
3379
|
changeOrderService(serviceId, body, options) {
|
|
3318
3380
|
return this.http.requestJson({
|
|
3319
3381
|
method: "PUT",
|
|
3320
|
-
path: `${
|
|
3382
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/changeorderservice`,
|
|
3321
3383
|
body,
|
|
3322
3384
|
signal: options?.signal
|
|
3323
3385
|
});
|
|
@@ -3326,21 +3388,30 @@ var ServicesFacade = class extends TorrowItemFacade {
|
|
|
3326
3388
|
patchUpdateOrderInfo(serviceId, body, options) {
|
|
3327
3389
|
return this.http.requestJson({
|
|
3328
3390
|
method: "PATCH",
|
|
3329
|
-
path: `${
|
|
3391
|
+
path: `${BASE9}/${encodePathSegment(serviceId)}/updateorderinfo`,
|
|
3330
3392
|
body,
|
|
3331
3393
|
signal: options?.signal
|
|
3332
3394
|
});
|
|
3333
3395
|
}
|
|
3334
3396
|
};
|
|
3335
3397
|
|
|
3398
|
+
// ../../src/util/base64.ts
|
|
3399
|
+
function utf8ToBase64(value) {
|
|
3400
|
+
const bytes = new TextEncoder().encode(value);
|
|
3401
|
+
let binary = "";
|
|
3402
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
3403
|
+
binary += String.fromCharCode(bytes[i]);
|
|
3404
|
+
}
|
|
3405
|
+
return btoa(binary);
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3336
3408
|
// ../../src/resources/auth/AuthFacade.ts
|
|
3337
|
-
|
|
3338
|
-
var BASE8 = "/api/v1/auth";
|
|
3409
|
+
var BASE10 = "/api/v1/auth";
|
|
3339
3410
|
function authFacadeDefaultHeaders(config) {
|
|
3340
3411
|
const merged = { ...config.defaultHeaders ?? {} };
|
|
3341
3412
|
const basic = config.authIdentityBasic;
|
|
3342
3413
|
if (basic?.username && basic.password !== void 0 && basic.password !== "") {
|
|
3343
|
-
merged.Authorization = `Basic ${
|
|
3414
|
+
merged.Authorization = `Basic ${utf8ToBase64(`${basic.username}:${basic.password}`)}`;
|
|
3344
3415
|
}
|
|
3345
3416
|
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
3346
3417
|
}
|
|
@@ -3358,7 +3429,7 @@ var AuthFacade = class {
|
|
|
3358
3429
|
refresh(body, options) {
|
|
3359
3430
|
return this.anonHttp.requestJson({
|
|
3360
3431
|
method: "POST",
|
|
3361
|
-
path: `${
|
|
3432
|
+
path: `${BASE10}/refresh`,
|
|
3362
3433
|
body,
|
|
3363
3434
|
signal: options?.signal
|
|
3364
3435
|
});
|
|
@@ -3367,7 +3438,7 @@ var AuthFacade = class {
|
|
|
3367
3438
|
requestToken(body, options) {
|
|
3368
3439
|
return this.anonHttp.requestJson({
|
|
3369
3440
|
method: "POST",
|
|
3370
|
-
path: `${
|
|
3441
|
+
path: `${BASE10}/token`,
|
|
3371
3442
|
body,
|
|
3372
3443
|
signal: options?.signal
|
|
3373
3444
|
});
|
|
@@ -3376,7 +3447,7 @@ var AuthFacade = class {
|
|
|
3376
3447
|
revoke(body, options) {
|
|
3377
3448
|
return this.anonHttp.requestJson({
|
|
3378
3449
|
method: "POST",
|
|
3379
|
-
path: `${
|
|
3450
|
+
path: `${BASE10}/revoke`,
|
|
3380
3451
|
body,
|
|
3381
3452
|
signal: options?.signal
|
|
3382
3453
|
});
|
|
@@ -3385,7 +3456,7 @@ var AuthFacade = class {
|
|
|
3385
3456
|
sendCode(body, options) {
|
|
3386
3457
|
return this.anonHttp.requestJson({
|
|
3387
3458
|
method: "POST",
|
|
3388
|
-
path: `${
|
|
3459
|
+
path: `${BASE10}/sendcode`,
|
|
3389
3460
|
body,
|
|
3390
3461
|
signal: options?.signal
|
|
3391
3462
|
});
|
|
@@ -3394,7 +3465,7 @@ var AuthFacade = class {
|
|
|
3394
3465
|
createSession(body, options) {
|
|
3395
3466
|
return this.anonHttp.requestJson({
|
|
3396
3467
|
method: "POST",
|
|
3397
|
-
path: `${
|
|
3468
|
+
path: `${BASE10}/session`,
|
|
3398
3469
|
body,
|
|
3399
3470
|
signal: options?.signal
|
|
3400
3471
|
});
|
|
@@ -3427,7 +3498,7 @@ function prepareUserProfileItemForAdd(body) {
|
|
|
3427
3498
|
}
|
|
3428
3499
|
|
|
3429
3500
|
// ../../src/resources/user-profiles/ProfilesFacade.ts
|
|
3430
|
-
var
|
|
3501
|
+
var BASE11 = "/api/v1/user/profiles";
|
|
3431
3502
|
var ProfilesFacade = class {
|
|
3432
3503
|
constructor(http) {
|
|
3433
3504
|
this.http = http;
|
|
@@ -3439,7 +3510,7 @@ var ProfilesFacade = class {
|
|
|
3439
3510
|
* @throws Если тело ответа не объект или **`profileList`** не массив при наличии поля.
|
|
3440
3511
|
*/
|
|
3441
3512
|
async list(options) {
|
|
3442
|
-
const resp = await this.http.requestJson({ method: "GET", path:
|
|
3513
|
+
const resp = await this.http.requestJson({ method: "GET", path: BASE11, signal: options?.signal });
|
|
3443
3514
|
if (resp === null || typeof resp !== "object") {
|
|
3444
3515
|
throw new Error("GET /api/v1/user/profiles: expected a JSON object body");
|
|
3445
3516
|
}
|
|
@@ -3459,7 +3530,7 @@ var ProfilesFacade = class {
|
|
|
3459
3530
|
const payload = prepareUserProfileItemForAdd(body);
|
|
3460
3531
|
const resp = await this.http.requestJson({
|
|
3461
3532
|
method: "POST",
|
|
3462
|
-
path:
|
|
3533
|
+
path: BASE11,
|
|
3463
3534
|
body: payload,
|
|
3464
3535
|
signal: options?.signal
|
|
3465
3536
|
});
|
|
@@ -3472,7 +3543,7 @@ var ProfilesFacade = class {
|
|
|
3472
3543
|
async addByContactId(contactId, options) {
|
|
3473
3544
|
const resp = await this.http.requestJson({
|
|
3474
3545
|
method: "PUT",
|
|
3475
|
-
path:
|
|
3546
|
+
path: BASE11,
|
|
3476
3547
|
body: contactId,
|
|
3477
3548
|
signal: options?.signal
|
|
3478
3549
|
});
|
|
@@ -3486,7 +3557,7 @@ var ProfilesFacade = class {
|
|
|
3486
3557
|
async updateProfileProperties(profileId, body, options) {
|
|
3487
3558
|
const resp = await this.http.requestJson({
|
|
3488
3559
|
method: "PUT",
|
|
3489
|
-
path: `${
|
|
3560
|
+
path: `${BASE11}/${encodePathSegment(profileId)}/profileproperties`,
|
|
3490
3561
|
body,
|
|
3491
3562
|
signal: options?.signal
|
|
3492
3563
|
});
|
|
@@ -3496,7 +3567,7 @@ var ProfilesFacade = class {
|
|
|
3496
3567
|
async remove(profileId, options) {
|
|
3497
3568
|
const resp = await this.http.requestJson({
|
|
3498
3569
|
method: "DELETE",
|
|
3499
|
-
path: `${
|
|
3570
|
+
path: `${BASE11}/${encodePathSegment(profileId)}`,
|
|
3500
3571
|
signal: options?.signal
|
|
3501
3572
|
});
|
|
3502
3573
|
return unwrapRemoveProfileList(resp);
|
|
@@ -3745,7 +3816,7 @@ var ViewsFacade = class {
|
|
|
3745
3816
|
};
|
|
3746
3817
|
|
|
3747
3818
|
// ../../src/resources/search/SearchFacade.ts
|
|
3748
|
-
var
|
|
3819
|
+
var BASE12 = "/api/v1/search";
|
|
3749
3820
|
var SearchFacade = class {
|
|
3750
3821
|
constructor(http) {
|
|
3751
3822
|
this.http = http;
|
|
@@ -3755,7 +3826,7 @@ var SearchFacade = class {
|
|
|
3755
3826
|
advisedItems(query, options) {
|
|
3756
3827
|
return this.http.requestJson({
|
|
3757
3828
|
method: "GET",
|
|
3758
|
-
path: `${
|
|
3829
|
+
path: `${BASE12}/adviseditems`,
|
|
3759
3830
|
query: { ...query ?? {} },
|
|
3760
3831
|
signal: options?.signal
|
|
3761
3832
|
});
|
|
@@ -3767,7 +3838,7 @@ var SearchFacade = class {
|
|
|
3767
3838
|
orders(torrowId, body, query, options) {
|
|
3768
3839
|
return this.http.requestJson({
|
|
3769
3840
|
method: "PUT",
|
|
3770
|
-
path: `${
|
|
3841
|
+
path: `${BASE12}/${encodePathSegment(torrowId)}/orders`,
|
|
3771
3842
|
query: { ...query ?? {} },
|
|
3772
3843
|
body,
|
|
3773
3844
|
signal: options?.signal
|
|
@@ -3785,7 +3856,7 @@ var SearchFacade = class {
|
|
|
3785
3856
|
contacts(query, options) {
|
|
3786
3857
|
return this.http.requestJson({
|
|
3787
3858
|
method: "GET",
|
|
3788
|
-
path: `${
|
|
3859
|
+
path: `${BASE12}/contacts`,
|
|
3789
3860
|
query: { ...query ?? {} },
|
|
3790
3861
|
signal: options?.signal
|
|
3791
3862
|
});
|
|
@@ -3800,7 +3871,7 @@ var SearchFacade = class {
|
|
|
3800
3871
|
notes(query, options) {
|
|
3801
3872
|
return this.http.requestJson({
|
|
3802
3873
|
method: "GET",
|
|
3803
|
-
path: `${
|
|
3874
|
+
path: `${BASE12}/notes`,
|
|
3804
3875
|
query: { ...query ?? {} },
|
|
3805
3876
|
signal: options?.signal
|
|
3806
3877
|
});
|
|
@@ -3815,7 +3886,7 @@ var SearchFacade = class {
|
|
|
3815
3886
|
calendars(query, options) {
|
|
3816
3887
|
return this.http.requestJson({
|
|
3817
3888
|
method: "GET",
|
|
3818
|
-
path: `${
|
|
3889
|
+
path: `${BASE12}/calendars`,
|
|
3819
3890
|
query: { ...query ?? {} },
|
|
3820
3891
|
signal: options?.signal
|
|
3821
3892
|
});
|
|
@@ -3830,7 +3901,7 @@ var SearchFacade = class {
|
|
|
3830
3901
|
cases(query, options) {
|
|
3831
3902
|
return this.http.requestJson({
|
|
3832
3903
|
method: "GET",
|
|
3833
|
-
path: `${
|
|
3904
|
+
path: `${BASE12}/cases`,
|
|
3834
3905
|
query: { ...query ?? {} },
|
|
3835
3906
|
signal: options?.signal
|
|
3836
3907
|
});
|
|
@@ -3845,7 +3916,7 @@ var SearchFacade = class {
|
|
|
3845
3916
|
resources(query, options) {
|
|
3846
3917
|
return this.http.requestJson({
|
|
3847
3918
|
method: "GET",
|
|
3848
|
-
path: `${
|
|
3919
|
+
path: `${BASE12}/resources`,
|
|
3849
3920
|
query: { ...query ?? {} },
|
|
3850
3921
|
signal: options?.signal
|
|
3851
3922
|
});
|
|
@@ -3860,7 +3931,7 @@ var SearchFacade = class {
|
|
|
3860
3931
|
services(query, options) {
|
|
3861
3932
|
return this.http.requestJson({
|
|
3862
3933
|
method: "GET",
|
|
3863
|
-
path: `${
|
|
3934
|
+
path: `${BASE12}/services`,
|
|
3864
3935
|
query: { ...query ?? {} },
|
|
3865
3936
|
signal: options?.signal
|
|
3866
3937
|
});
|
|
@@ -3868,7 +3939,7 @@ var SearchFacade = class {
|
|
|
3868
3939
|
};
|
|
3869
3940
|
|
|
3870
3941
|
// ../../src/resources/action-history/ActionHistoryFacade.ts
|
|
3871
|
-
var
|
|
3942
|
+
var BASE13 = "/api/v1/actionhistory";
|
|
3872
3943
|
var ActionHistoryFacade = class {
|
|
3873
3944
|
constructor(http) {
|
|
3874
3945
|
this.http = http;
|
|
@@ -3882,7 +3953,7 @@ var ActionHistoryFacade = class {
|
|
|
3882
3953
|
list(query, options) {
|
|
3883
3954
|
return this.http.requestJson({
|
|
3884
3955
|
method: "GET",
|
|
3885
|
-
path:
|
|
3956
|
+
path: BASE13,
|
|
3886
3957
|
query: { ...query ?? {} },
|
|
3887
3958
|
signal: options?.signal
|
|
3888
3959
|
});
|
|
@@ -3890,7 +3961,7 @@ var ActionHistoryFacade = class {
|
|
|
3890
3961
|
};
|
|
3891
3962
|
|
|
3892
3963
|
// ../../src/resources/accounting-transactions/AccountingTransactionsFacade.ts
|
|
3893
|
-
var
|
|
3964
|
+
var BASE14 = "/api/v1/accountingtransactions";
|
|
3894
3965
|
var AccountingTransactionsFacade = class {
|
|
3895
3966
|
constructor(http) {
|
|
3896
3967
|
this.http = http;
|
|
@@ -3900,17 +3971,18 @@ var AccountingTransactionsFacade = class {
|
|
|
3900
3971
|
create(transaction, options) {
|
|
3901
3972
|
return this.http.requestJson({
|
|
3902
3973
|
method: "POST",
|
|
3903
|
-
path:
|
|
3974
|
+
path: BASE14,
|
|
3904
3975
|
query: { securityToken: options?.securityToken },
|
|
3905
3976
|
body: transaction,
|
|
3906
3977
|
signal: options?.signal
|
|
3907
3978
|
});
|
|
3908
3979
|
}
|
|
3909
|
-
/** `PUT /api/v1/accountingtransactions/{
|
|
3910
|
-
update(transaction,
|
|
3980
|
+
/** `PUT /api/v1/accountingtransactions/{transaction.id}` */
|
|
3981
|
+
update(transaction, options) {
|
|
3982
|
+
const transactionId = requireItemUpdateId(transaction, "Accounting transaction");
|
|
3911
3983
|
return this.http.requestJson({
|
|
3912
3984
|
method: "PUT",
|
|
3913
|
-
path: `${
|
|
3985
|
+
path: `${BASE14}/${encodePathSegment(transactionId)}`,
|
|
3914
3986
|
query: {
|
|
3915
3987
|
checkVersion: options?.checkVersion,
|
|
3916
3988
|
isNeedAnnouncement: options?.isNeedAnnouncement,
|
|
@@ -3924,7 +3996,7 @@ var AccountingTransactionsFacade = class {
|
|
|
3924
3996
|
async delete(torrowId, options) {
|
|
3925
3997
|
const resp = await this.http.requestJson({
|
|
3926
3998
|
method: "DELETE",
|
|
3927
|
-
path: `${
|
|
3999
|
+
path: `${BASE14}/${encodePathSegment(torrowId)}`,
|
|
3928
4000
|
query: {
|
|
3929
4001
|
versionToCheck: options?.versionToCheck,
|
|
3930
4002
|
isNeedAnnouncement: options?.isNeedAnnouncement,
|
|
@@ -3941,7 +4013,7 @@ var AccountingTransactionsFacade = class {
|
|
|
3941
4013
|
updateState(torrowId, state, options) {
|
|
3942
4014
|
return this.http.requestJson({
|
|
3943
4015
|
method: "PUT",
|
|
3944
|
-
path: `${
|
|
4016
|
+
path: `${BASE14}/${encodePathSegment(torrowId)}/state`,
|
|
3945
4017
|
query: {
|
|
3946
4018
|
state,
|
|
3947
4019
|
versionToCheck: options?.versionToCheck,
|
|
@@ -3955,7 +4027,7 @@ var AccountingTransactionsFacade = class {
|
|
|
3955
4027
|
getBalance(torrowId, options) {
|
|
3956
4028
|
return this.http.requestJson({
|
|
3957
4029
|
method: "GET",
|
|
3958
|
-
path: `${
|
|
4030
|
+
path: `${BASE14}/${encodePathSegment(torrowId)}/balance`,
|
|
3959
4031
|
query: {
|
|
3960
4032
|
balanceDate: options?.balanceDate,
|
|
3961
4033
|
securityToken: options?.securityToken
|
|
@@ -3967,7 +4039,7 @@ var AccountingTransactionsFacade = class {
|
|
|
3967
4039
|
listTransactions(torrowId, query, options) {
|
|
3968
4040
|
return this.http.requestJson({
|
|
3969
4041
|
method: "GET",
|
|
3970
|
-
path: `${
|
|
4042
|
+
path: `${BASE14}/${encodePathSegment(torrowId)}/transactions`,
|
|
3971
4043
|
query: { ...query ?? {} },
|
|
3972
4044
|
signal: options?.signal
|
|
3973
4045
|
});
|
|
@@ -3975,7 +4047,7 @@ var AccountingTransactionsFacade = class {
|
|
|
3975
4047
|
};
|
|
3976
4048
|
|
|
3977
4049
|
// ../../src/resources/announcements/AnnouncementsFacade.ts
|
|
3978
|
-
var
|
|
4050
|
+
var BASE15 = "/api/v1/announcements";
|
|
3979
4051
|
var AnnouncementsFacade = class {
|
|
3980
4052
|
constructor(http) {
|
|
3981
4053
|
this.http = http;
|
|
@@ -3989,7 +4061,7 @@ var AnnouncementsFacade = class {
|
|
|
3989
4061
|
list(query, options) {
|
|
3990
4062
|
return this.http.requestJson({
|
|
3991
4063
|
method: "GET",
|
|
3992
|
-
path:
|
|
4064
|
+
path: BASE15,
|
|
3993
4065
|
query: { ...query ?? {} },
|
|
3994
4066
|
signal: options?.signal
|
|
3995
4067
|
});
|
|
@@ -3998,7 +4070,7 @@ var AnnouncementsFacade = class {
|
|
|
3998
4070
|
updateState(body, options) {
|
|
3999
4071
|
return this.http.requestJson({
|
|
4000
4072
|
method: "POST",
|
|
4001
|
-
path: `${
|
|
4073
|
+
path: `${BASE15}/updatestate`,
|
|
4002
4074
|
body,
|
|
4003
4075
|
signal: options?.signal
|
|
4004
4076
|
});
|
|
@@ -4041,7 +4113,7 @@ var ExportImportFacade = class {
|
|
|
4041
4113
|
};
|
|
4042
4114
|
|
|
4043
4115
|
// ../../src/resources/reports/ReportsFacade.ts
|
|
4044
|
-
var
|
|
4116
|
+
var BASE16 = "/api/v1/reports";
|
|
4045
4117
|
var ReportsFacade = class {
|
|
4046
4118
|
constructor(http) {
|
|
4047
4119
|
this.http = http;
|
|
@@ -4053,7 +4125,7 @@ var ReportsFacade = class {
|
|
|
4053
4125
|
generate(body, options) {
|
|
4054
4126
|
return this.http.requestJson({
|
|
4055
4127
|
method: "POST",
|
|
4056
|
-
path:
|
|
4128
|
+
path: BASE16,
|
|
4057
4129
|
query: { profileId: options?.profileId },
|
|
4058
4130
|
body,
|
|
4059
4131
|
signal: options?.signal
|
|
@@ -4063,7 +4135,7 @@ var ReportsFacade = class {
|
|
|
4063
4135
|
generateForProfile(profileId, body, options) {
|
|
4064
4136
|
return this.http.requestJson({
|
|
4065
4137
|
method: "POST",
|
|
4066
|
-
path: `${
|
|
4138
|
+
path: `${BASE16}/${encodePathSegment(profileId)}`,
|
|
4067
4139
|
body,
|
|
4068
4140
|
signal: options?.signal
|
|
4069
4141
|
});
|
|
@@ -4071,11 +4143,11 @@ var ReportsFacade = class {
|
|
|
4071
4143
|
};
|
|
4072
4144
|
|
|
4073
4145
|
// ../../src/resources/loyalty-systems/LoyaltySystemsFacade.ts
|
|
4074
|
-
var
|
|
4146
|
+
var BASE17 = "/api/v1/loyaltysystems";
|
|
4075
4147
|
var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
4076
4148
|
itemObjectTypeCode = TorrowObjectTypeCode.LoyaltySystem;
|
|
4077
4149
|
constructor(http) {
|
|
4078
|
-
super(http,
|
|
4150
|
+
super(http, BASE17);
|
|
4079
4151
|
}
|
|
4080
4152
|
/** Id программы лояльности до `create` / presigned upload. */
|
|
4081
4153
|
generateLoyaltySystemId(ownerTorrowId) {
|
|
@@ -4086,17 +4158,18 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4086
4158
|
const payload = applyItemCreateDefaults(body, "LoyaltySystemItem" /* LoyaltySystemItem */);
|
|
4087
4159
|
return this.http.requestJson({
|
|
4088
4160
|
method: "POST",
|
|
4089
|
-
path:
|
|
4161
|
+
path: BASE17,
|
|
4090
4162
|
query: { parentId: options?.parentId, profileId: options?.profileId },
|
|
4091
4163
|
body: payload,
|
|
4092
4164
|
signal: options?.signal
|
|
4093
4165
|
});
|
|
4094
4166
|
}
|
|
4095
|
-
/** `PUT /api/v1/loyaltysystems/{
|
|
4096
|
-
update(body,
|
|
4167
|
+
/** `PUT /api/v1/loyaltysystems/{body.id}` */
|
|
4168
|
+
update(body, options) {
|
|
4169
|
+
const itemId = requireItemUpdateId(body, "Loyalty system");
|
|
4097
4170
|
return this.http.requestJson({
|
|
4098
4171
|
method: "PUT",
|
|
4099
|
-
path: `${
|
|
4172
|
+
path: `${BASE17}/${encodePathSegment(itemId)}`,
|
|
4100
4173
|
query: {
|
|
4101
4174
|
checkVersion: options?.checkVersion,
|
|
4102
4175
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4109,7 +4182,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4109
4182
|
async delete(torrowId, options) {
|
|
4110
4183
|
const resp = await this.http.requestJson({
|
|
4111
4184
|
method: "DELETE",
|
|
4112
|
-
path: `${
|
|
4185
|
+
path: `${BASE17}/${encodePathSegment(torrowId)}`,
|
|
4113
4186
|
query: {
|
|
4114
4187
|
cascade: options.cascade,
|
|
4115
4188
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -4124,7 +4197,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4124
4197
|
getById(torrowId, options) {
|
|
4125
4198
|
return this.http.requestJson({
|
|
4126
4199
|
method: "GET",
|
|
4127
|
-
path: `${
|
|
4200
|
+
path: `${BASE17}/${encodePathSegment(torrowId)}`,
|
|
4128
4201
|
query: {
|
|
4129
4202
|
versionToCheck: options?.versionToCheck,
|
|
4130
4203
|
includeDeleted: options?.includeDeleted,
|
|
@@ -4139,7 +4212,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4139
4212
|
const { signal, ...rest } = options ?? {};
|
|
4140
4213
|
return this.http.requestJson({
|
|
4141
4214
|
method: "GET",
|
|
4142
|
-
path: `${
|
|
4215
|
+
path: `${BASE17}/personallist`,
|
|
4143
4216
|
query: { ...rest },
|
|
4144
4217
|
signal
|
|
4145
4218
|
});
|
|
@@ -4148,7 +4221,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4148
4221
|
deleteFromPersonalList(torrowId, options) {
|
|
4149
4222
|
return this.http.requestJson({
|
|
4150
4223
|
method: "DELETE",
|
|
4151
|
-
path: `${
|
|
4224
|
+
path: `${BASE17}/personallist/${encodePathSegment(torrowId)}`,
|
|
4152
4225
|
signal: options?.signal
|
|
4153
4226
|
});
|
|
4154
4227
|
}
|
|
@@ -4160,7 +4233,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4160
4233
|
createLoyaltyCard(loyaltySystemId, body, options) {
|
|
4161
4234
|
return this.http.requestJson({
|
|
4162
4235
|
method: "POST",
|
|
4163
|
-
path: `${
|
|
4236
|
+
path: `${BASE17}/${encodePathSegment(loyaltySystemId)}/loyaltycard`,
|
|
4164
4237
|
body,
|
|
4165
4238
|
signal: options?.signal
|
|
4166
4239
|
});
|
|
@@ -4173,7 +4246,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4173
4246
|
searchLoyaltyCards(torrowId, body, options) {
|
|
4174
4247
|
return this.http.requestJson({
|
|
4175
4248
|
method: "POST",
|
|
4176
|
-
path: `${
|
|
4249
|
+
path: `${BASE17}/${encodePathSegment(torrowId)}/loyaltycards`,
|
|
4177
4250
|
body,
|
|
4178
4251
|
signal: options?.signal
|
|
4179
4252
|
});
|
|
@@ -4182,7 +4255,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4182
4255
|
async postStatistics(body, options) {
|
|
4183
4256
|
const resp = await this.http.requestJson({
|
|
4184
4257
|
method: "POST",
|
|
4185
|
-
path: `${
|
|
4258
|
+
path: `${BASE17}/statistics`,
|
|
4186
4259
|
query: { securityToken: options?.securityToken },
|
|
4187
4260
|
body,
|
|
4188
4261
|
signal: options?.signal
|
|
@@ -4193,7 +4266,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4193
4266
|
getParticipantsCount(torrowId, query, options) {
|
|
4194
4267
|
return this.http.requestJson({
|
|
4195
4268
|
method: "GET",
|
|
4196
|
-
path: `${
|
|
4269
|
+
path: `${BASE17}/${encodePathSegment(torrowId)}/participants/count`,
|
|
4197
4270
|
query: { ...query ?? {} },
|
|
4198
4271
|
signal: options?.signal
|
|
4199
4272
|
});
|
|
@@ -4201,12 +4274,12 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
|
|
|
4201
4274
|
};
|
|
4202
4275
|
|
|
4203
4276
|
// ../../src/resources/loyalty-cards/LoyaltyCardsFacade.ts
|
|
4204
|
-
var
|
|
4277
|
+
var BASE18 = "/api/v1/loyaltycards";
|
|
4205
4278
|
var LOYALTY_CARD_SOCIAL_OPTS = { withGroupListEndpoint: false };
|
|
4206
4279
|
var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
4207
4280
|
itemObjectTypeCode = TorrowObjectTypeCode.LoyaltyCard;
|
|
4208
4281
|
constructor(http) {
|
|
4209
|
-
super(http,
|
|
4282
|
+
super(http, BASE18, LOYALTY_CARD_SOCIAL_OPTS);
|
|
4210
4283
|
}
|
|
4211
4284
|
/** Id карты лояльности до `create` / presigned upload. */
|
|
4212
4285
|
generateLoyaltyCardId(ownerTorrowId) {
|
|
@@ -4216,7 +4289,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4216
4289
|
createSubscription(loyaltyCardId, body, options) {
|
|
4217
4290
|
return this.http.requestJson({
|
|
4218
4291
|
method: "POST",
|
|
4219
|
-
path: `${
|
|
4292
|
+
path: `${BASE18}/${encodePathSegment(loyaltyCardId)}/subscription`,
|
|
4220
4293
|
body,
|
|
4221
4294
|
signal: options?.signal
|
|
4222
4295
|
});
|
|
@@ -4225,7 +4298,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4225
4298
|
getParticipantsCount(torrowId, query, options) {
|
|
4226
4299
|
return this.http.requestJson({
|
|
4227
4300
|
method: "GET",
|
|
4228
|
-
path: `${
|
|
4301
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/participants/count`,
|
|
4229
4302
|
query: { ...query ?? {} },
|
|
4230
4303
|
signal: options?.signal
|
|
4231
4304
|
});
|
|
@@ -4234,7 +4307,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4234
4307
|
getBalance(torrowId, options) {
|
|
4235
4308
|
return this.http.requestJson({
|
|
4236
4309
|
method: "GET",
|
|
4237
|
-
path: `${
|
|
4310
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/balance`,
|
|
4238
4311
|
query: {
|
|
4239
4312
|
balanceDate: options?.balanceDate,
|
|
4240
4313
|
securityToken: options?.securityToken
|
|
@@ -4246,7 +4319,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4246
4319
|
listTransactions(torrowId, query, options) {
|
|
4247
4320
|
return this.http.requestJson({
|
|
4248
4321
|
method: "GET",
|
|
4249
|
-
path: `${
|
|
4322
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/transactions`,
|
|
4250
4323
|
query: { ...query ?? {} },
|
|
4251
4324
|
signal: options?.signal
|
|
4252
4325
|
});
|
|
@@ -4255,7 +4328,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4255
4328
|
getSubscriptionBalance(torrowId, subscriptionId, options) {
|
|
4256
4329
|
return this.http.requestJson({
|
|
4257
4330
|
method: "GET",
|
|
4258
|
-
path: `${
|
|
4331
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/subscriptions/${encodePathSegment(subscriptionId)}/balance`,
|
|
4259
4332
|
query: {
|
|
4260
4333
|
balanceDate: options?.balanceDate,
|
|
4261
4334
|
securityToken: options?.securityToken
|
|
@@ -4267,16 +4340,17 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4267
4340
|
getSubscriptionTransactions(torrowId, subscriptionId, query, options) {
|
|
4268
4341
|
return this.http.requestJson({
|
|
4269
4342
|
method: "GET",
|
|
4270
|
-
path: `${
|
|
4343
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/subscriptions/${encodePathSegment(subscriptionId)}/transactions`,
|
|
4271
4344
|
query: { ...query ?? {} },
|
|
4272
4345
|
signal: options?.signal
|
|
4273
4346
|
});
|
|
4274
4347
|
}
|
|
4275
|
-
/** `PUT /api/v1/loyaltycards/{
|
|
4276
|
-
update(body,
|
|
4348
|
+
/** `PUT /api/v1/loyaltycards/{body.id}` */
|
|
4349
|
+
update(body, options) {
|
|
4350
|
+
const itemId = requireItemUpdateId(body, "Loyalty card");
|
|
4277
4351
|
return this.http.requestJson({
|
|
4278
4352
|
method: "PUT",
|
|
4279
|
-
path: `${
|
|
4353
|
+
path: `${BASE18}/${encodePathSegment(itemId)}`,
|
|
4280
4354
|
query: {
|
|
4281
4355
|
checkVersion: options?.checkVersion,
|
|
4282
4356
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4289,7 +4363,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4289
4363
|
async delete(torrowId, options) {
|
|
4290
4364
|
const resp = await this.http.requestJson({
|
|
4291
4365
|
method: "DELETE",
|
|
4292
|
-
path: `${
|
|
4366
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}`,
|
|
4293
4367
|
query: {
|
|
4294
4368
|
cascade: options.cascade,
|
|
4295
4369
|
withPinnedItems: options.withPinnedItems,
|
|
@@ -4304,7 +4378,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4304
4378
|
getById(torrowId, options) {
|
|
4305
4379
|
return this.http.requestJson({
|
|
4306
4380
|
method: "GET",
|
|
4307
|
-
path: `${
|
|
4381
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}`,
|
|
4308
4382
|
query: {
|
|
4309
4383
|
versionToCheck: options?.versionToCheck,
|
|
4310
4384
|
includeDeleted: options?.includeDeleted,
|
|
@@ -4320,7 +4394,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4320
4394
|
const { signal, ...rest } = options ?? {};
|
|
4321
4395
|
return this.http.requestJson({
|
|
4322
4396
|
method: "GET",
|
|
4323
|
-
path: `${
|
|
4397
|
+
path: `${BASE18}/personallist`,
|
|
4324
4398
|
query: { ...rest },
|
|
4325
4399
|
signal
|
|
4326
4400
|
});
|
|
@@ -4329,7 +4403,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4329
4403
|
deleteFromPersonalList(torrowId, options) {
|
|
4330
4404
|
return this.http.requestJson({
|
|
4331
4405
|
method: "DELETE",
|
|
4332
|
-
path: `${
|
|
4406
|
+
path: `${BASE18}/personallist/${encodePathSegment(torrowId)}`,
|
|
4333
4407
|
signal: options?.signal
|
|
4334
4408
|
});
|
|
4335
4409
|
}
|
|
@@ -4341,7 +4415,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4341
4415
|
const { signal, ...queryOpts } = options ?? {};
|
|
4342
4416
|
return this.http.requestJson({
|
|
4343
4417
|
method: "PUT",
|
|
4344
|
-
path: `${
|
|
4418
|
+
path: `${BASE18}/${encodePathSegment(torrowId)}/timetable`,
|
|
4345
4419
|
query: buildTimetableQuery(queryOpts),
|
|
4346
4420
|
body,
|
|
4347
4421
|
signal
|
|
@@ -4351,7 +4425,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4351
4425
|
async getTimetableStatistics(body, options) {
|
|
4352
4426
|
const resp = await this.http.requestJson({
|
|
4353
4427
|
method: "POST",
|
|
4354
|
-
path: `${
|
|
4428
|
+
path: `${BASE18}/timetable/statistics`,
|
|
4355
4429
|
body,
|
|
4356
4430
|
signal: options?.signal
|
|
4357
4431
|
});
|
|
@@ -4364,7 +4438,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
|
|
|
4364
4438
|
updateNotificationWayList(itemId, ways, options) {
|
|
4365
4439
|
return this.http.requestJson({
|
|
4366
4440
|
method: "PUT",
|
|
4367
|
-
path: `${
|
|
4441
|
+
path: `${BASE18}/${encodePathSegment(itemId)}/notificationwaylist`,
|
|
4368
4442
|
query: {
|
|
4369
4443
|
versionToCheck: options?.versionToCheck,
|
|
4370
4444
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4392,7 +4466,7 @@ function stringifyOpaqueJsonSettings(value) {
|
|
|
4392
4466
|
}
|
|
4393
4467
|
|
|
4394
4468
|
// ../../src/resources/user-settings/UserSettingsFacade.ts
|
|
4395
|
-
var
|
|
4469
|
+
var BASE19 = "/api/v1/user/settings";
|
|
4396
4470
|
var UserSettingsFacade = class {
|
|
4397
4471
|
constructor(http) {
|
|
4398
4472
|
this.http = http;
|
|
@@ -4402,7 +4476,7 @@ var UserSettingsFacade = class {
|
|
|
4402
4476
|
async get(options) {
|
|
4403
4477
|
const dto = await this.http.requestJson({
|
|
4404
4478
|
method: "GET",
|
|
4405
|
-
path:
|
|
4479
|
+
path: BASE19,
|
|
4406
4480
|
signal: options?.signal
|
|
4407
4481
|
});
|
|
4408
4482
|
return { settings: parseOpaqueJsonSettings(dto.settings) };
|
|
@@ -4417,7 +4491,7 @@ var UserSettingsFacade = class {
|
|
|
4417
4491
|
};
|
|
4418
4492
|
return this.http.requestJson({
|
|
4419
4493
|
method: "PUT",
|
|
4420
|
-
path: `${
|
|
4494
|
+
path: `${BASE19}/update`,
|
|
4421
4495
|
body: wire,
|
|
4422
4496
|
signal: options?.signal
|
|
4423
4497
|
});
|
|
@@ -4425,7 +4499,7 @@ var UserSettingsFacade = class {
|
|
|
4425
4499
|
};
|
|
4426
4500
|
|
|
4427
4501
|
// ../../src/resources/user/UserFacade.ts
|
|
4428
|
-
var
|
|
4502
|
+
var BASE20 = "/api/v1/user";
|
|
4429
4503
|
var UserFacade = class {
|
|
4430
4504
|
constructor(http) {
|
|
4431
4505
|
this.http = http;
|
|
@@ -4433,13 +4507,13 @@ var UserFacade = class {
|
|
|
4433
4507
|
http;
|
|
4434
4508
|
/** `GET /api/v1/user/loyaltycard` */
|
|
4435
4509
|
getLoyaltyCard(options) {
|
|
4436
|
-
return this.http.requestJson({ method: "GET", path: `${
|
|
4510
|
+
return this.http.requestJson({ method: "GET", path: `${BASE20}/loyaltycard`, signal: options?.signal });
|
|
4437
4511
|
}
|
|
4438
4512
|
/** `GET /api/v1/user/accounts` */
|
|
4439
4513
|
listAccounts(query, options) {
|
|
4440
4514
|
return this.http.requestJson({
|
|
4441
4515
|
method: "GET",
|
|
4442
|
-
path: `${
|
|
4516
|
+
path: `${BASE20}/accounts`,
|
|
4443
4517
|
query: { ...query ?? {} },
|
|
4444
4518
|
signal: options?.signal
|
|
4445
4519
|
});
|
|
@@ -4448,7 +4522,7 @@ var UserFacade = class {
|
|
|
4448
4522
|
initAddAccount(body, options) {
|
|
4449
4523
|
return this.http.requestJson({
|
|
4450
4524
|
method: "POST",
|
|
4451
|
-
path: `${
|
|
4525
|
+
path: `${BASE20}/accounts/add/init`,
|
|
4452
4526
|
body,
|
|
4453
4527
|
signal: options?.signal
|
|
4454
4528
|
});
|
|
@@ -4457,7 +4531,7 @@ var UserFacade = class {
|
|
|
4457
4531
|
completeAddAccount(body, options) {
|
|
4458
4532
|
return this.http.requestJson({
|
|
4459
4533
|
method: "POST",
|
|
4460
|
-
path: `${
|
|
4534
|
+
path: `${BASE20}/accounts/add/complete`,
|
|
4461
4535
|
body,
|
|
4462
4536
|
signal: options?.signal
|
|
4463
4537
|
});
|
|
@@ -4466,7 +4540,7 @@ var UserFacade = class {
|
|
|
4466
4540
|
async deleteAccount(body, options) {
|
|
4467
4541
|
const resp = await this.http.requestJson({
|
|
4468
4542
|
method: "DELETE",
|
|
4469
|
-
path: `${
|
|
4543
|
+
path: `${BASE20}/accounts/delete`,
|
|
4470
4544
|
body,
|
|
4471
4545
|
signal: options?.signal
|
|
4472
4546
|
});
|
|
@@ -4476,7 +4550,7 @@ var UserFacade = class {
|
|
|
4476
4550
|
listDevices(query, options) {
|
|
4477
4551
|
return this.http.requestJson({
|
|
4478
4552
|
method: "GET",
|
|
4479
|
-
path: `${
|
|
4553
|
+
path: `${BASE20}/devices`,
|
|
4480
4554
|
query: { ...query ?? {} },
|
|
4481
4555
|
signal: options?.signal
|
|
4482
4556
|
});
|
|
@@ -4485,7 +4559,7 @@ var UserFacade = class {
|
|
|
4485
4559
|
async deleteDevice(deviceId, options) {
|
|
4486
4560
|
const resp = await this.http.requestJson({
|
|
4487
4561
|
method: "DELETE",
|
|
4488
|
-
path: `${
|
|
4562
|
+
path: `${BASE20}/devices/${encodePathSegment(deviceId)}`,
|
|
4489
4563
|
signal: options?.signal
|
|
4490
4564
|
});
|
|
4491
4565
|
return unwrapDeleteCount(resp);
|
|
@@ -4494,7 +4568,7 @@ var UserFacade = class {
|
|
|
4494
4568
|
async getDeviceSettings(deviceId, options) {
|
|
4495
4569
|
const dto = await this.http.requestJson({
|
|
4496
4570
|
method: "GET",
|
|
4497
|
-
path: `${
|
|
4571
|
+
path: `${BASE20}/devices/${encodePathSegment(deviceId)}/settings`,
|
|
4498
4572
|
signal: options?.signal
|
|
4499
4573
|
});
|
|
4500
4574
|
return {
|
|
@@ -4510,20 +4584,20 @@ var UserFacade = class {
|
|
|
4510
4584
|
const wire = settings === null || settings === void 0 ? "{}" : stringifyOpaqueJsonSettings(settings);
|
|
4511
4585
|
return this.http.requestJson({
|
|
4512
4586
|
method: "PUT",
|
|
4513
|
-
path: `${
|
|
4587
|
+
path: `${BASE20}/devices/${encodePathSegment(deviceId)}/settings`,
|
|
4514
4588
|
query: { settings: wire },
|
|
4515
4589
|
signal: options?.signal
|
|
4516
4590
|
});
|
|
4517
4591
|
}
|
|
4518
4592
|
/** `GET /api/v1/user/defaultprofile` */
|
|
4519
4593
|
getDefaultProfile(options) {
|
|
4520
|
-
return this.http.requestJson({ method: "GET", path: `${
|
|
4594
|
+
return this.http.requestJson({ method: "GET", path: `${BASE20}/defaultprofile`, signal: options?.signal });
|
|
4521
4595
|
}
|
|
4522
4596
|
/** `PUT /api/v1/user/defaultprofile` */
|
|
4523
4597
|
async setDefaultProfileByContactId(contactId, options) {
|
|
4524
4598
|
const resp = await this.http.requestJson({
|
|
4525
4599
|
method: "PUT",
|
|
4526
|
-
path: `${
|
|
4600
|
+
path: `${BASE20}/defaultprofile`,
|
|
4527
4601
|
body: contactId,
|
|
4528
4602
|
signal: options?.signal
|
|
4529
4603
|
});
|
|
@@ -4537,7 +4611,7 @@ var UserFacade = class {
|
|
|
4537
4611
|
const payload = prepareUserProfileItemForAdd(body);
|
|
4538
4612
|
const resp = await this.http.requestJson({
|
|
4539
4613
|
method: "POST",
|
|
4540
|
-
path: `${
|
|
4614
|
+
path: `${BASE20}/defaultprofile`,
|
|
4541
4615
|
body: payload,
|
|
4542
4616
|
signal: options?.signal
|
|
4543
4617
|
});
|
|
@@ -4547,7 +4621,7 @@ var UserFacade = class {
|
|
|
4547
4621
|
listDeliveryWays(query, options) {
|
|
4548
4622
|
return this.http.requestJson({
|
|
4549
4623
|
method: "GET",
|
|
4550
|
-
path: `${
|
|
4624
|
+
path: `${BASE20}/deliveryways`,
|
|
4551
4625
|
query: { ...query ?? {} },
|
|
4552
4626
|
signal: options?.signal
|
|
4553
4627
|
});
|
|
@@ -4556,7 +4630,7 @@ var UserFacade = class {
|
|
|
4556
4630
|
listDefaultNotificationWays(options) {
|
|
4557
4631
|
return this.http.requestJson({
|
|
4558
4632
|
method: "GET",
|
|
4559
|
-
path: `${
|
|
4633
|
+
path: `${BASE20}/defaultnotificationways`,
|
|
4560
4634
|
signal: options?.signal
|
|
4561
4635
|
});
|
|
4562
4636
|
}
|
|
@@ -4564,7 +4638,7 @@ var UserFacade = class {
|
|
|
4564
4638
|
updateDefaultNotificationWays(body, options) {
|
|
4565
4639
|
return this.http.requestJson({
|
|
4566
4640
|
method: "PUT",
|
|
4567
|
-
path: `${
|
|
4641
|
+
path: `${BASE20}/defaultnotificationways`,
|
|
4568
4642
|
query: {
|
|
4569
4643
|
versionToCheck: options?.versionToCheck,
|
|
4570
4644
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4577,7 +4651,7 @@ var UserFacade = class {
|
|
|
4577
4651
|
updatePlace(query, options) {
|
|
4578
4652
|
return this.http.requestJson({
|
|
4579
4653
|
method: "PUT",
|
|
4580
|
-
path: `${
|
|
4654
|
+
path: `${BASE20}/place`,
|
|
4581
4655
|
query,
|
|
4582
4656
|
signal: options?.signal
|
|
4583
4657
|
});
|
|
@@ -4586,7 +4660,7 @@ var UserFacade = class {
|
|
|
4586
4660
|
register(body, options) {
|
|
4587
4661
|
return this.http.requestJson({
|
|
4588
4662
|
method: "POST",
|
|
4589
|
-
path: `${
|
|
4663
|
+
path: `${BASE20}/register`,
|
|
4590
4664
|
body,
|
|
4591
4665
|
signal: options?.signal
|
|
4592
4666
|
});
|
|
@@ -4595,7 +4669,7 @@ var UserFacade = class {
|
|
|
4595
4669
|
getTimetable(body, query, options) {
|
|
4596
4670
|
return this.http.requestJson({
|
|
4597
4671
|
method: "PUT",
|
|
4598
|
-
path: `${
|
|
4672
|
+
path: `${BASE20}/timetable`,
|
|
4599
4673
|
query: { ...query ?? {} },
|
|
4600
4674
|
body,
|
|
4601
4675
|
signal: options?.signal
|
|
@@ -4605,7 +4679,7 @@ var UserFacade = class {
|
|
|
4605
4679
|
listCalendars(options) {
|
|
4606
4680
|
return this.http.requestJson({
|
|
4607
4681
|
method: "GET",
|
|
4608
|
-
path: `${
|
|
4682
|
+
path: `${BASE20}/calendars`,
|
|
4609
4683
|
signal: options?.signal
|
|
4610
4684
|
});
|
|
4611
4685
|
}
|
|
@@ -4613,7 +4687,7 @@ var UserFacade = class {
|
|
|
4613
4687
|
updateCalendars(body, options) {
|
|
4614
4688
|
return this.http.requestJson({
|
|
4615
4689
|
method: "PUT",
|
|
4616
|
-
path: `${
|
|
4690
|
+
path: `${BASE20}/calendars/update`,
|
|
4617
4691
|
body,
|
|
4618
4692
|
signal: options?.signal
|
|
4619
4693
|
});
|
|
@@ -4622,7 +4696,7 @@ var UserFacade = class {
|
|
|
4622
4696
|
initDelete(options) {
|
|
4623
4697
|
return this.http.requestJson({
|
|
4624
4698
|
method: "DELETE",
|
|
4625
|
-
path: `${
|
|
4699
|
+
path: `${BASE20}/delete/init`,
|
|
4626
4700
|
signal: options?.signal
|
|
4627
4701
|
});
|
|
4628
4702
|
}
|
|
@@ -4630,19 +4704,19 @@ var UserFacade = class {
|
|
|
4630
4704
|
completeDelete(body, options) {
|
|
4631
4705
|
return this.http.requestJson({
|
|
4632
4706
|
method: "DELETE",
|
|
4633
|
-
path: `${
|
|
4707
|
+
path: `${BASE20}/delete/complete`,
|
|
4634
4708
|
body,
|
|
4635
4709
|
signal: options?.signal
|
|
4636
4710
|
});
|
|
4637
4711
|
}
|
|
4638
4712
|
/** `GET /api/v1/user/count` — публичный счётчик пользователей (без Bearer ок). */
|
|
4639
4713
|
count(options) {
|
|
4640
|
-
return this.http.requestJson({ method: "GET", path: `${
|
|
4714
|
+
return this.http.requestJson({ method: "GET", path: `${BASE20}/count`, signal: options?.signal });
|
|
4641
4715
|
}
|
|
4642
4716
|
};
|
|
4643
4717
|
|
|
4644
4718
|
// ../../src/resources/api-keys/ApiKeysFacade.ts
|
|
4645
|
-
var
|
|
4719
|
+
var BASE21 = "/api/v1/apikeys";
|
|
4646
4720
|
var ApiKeysFacade = class {
|
|
4647
4721
|
constructor(http) {
|
|
4648
4722
|
this.http = http;
|
|
@@ -4652,7 +4726,7 @@ var ApiKeysFacade = class {
|
|
|
4652
4726
|
list(options) {
|
|
4653
4727
|
return this.http.requestJson({
|
|
4654
4728
|
method: "GET",
|
|
4655
|
-
path:
|
|
4729
|
+
path: BASE21,
|
|
4656
4730
|
signal: options?.signal
|
|
4657
4731
|
});
|
|
4658
4732
|
}
|
|
@@ -4660,7 +4734,7 @@ var ApiKeysFacade = class {
|
|
|
4660
4734
|
create(body, options) {
|
|
4661
4735
|
return this.http.requestJson({
|
|
4662
4736
|
method: "POST",
|
|
4663
|
-
path:
|
|
4737
|
+
path: BASE21,
|
|
4664
4738
|
body,
|
|
4665
4739
|
signal: options?.signal
|
|
4666
4740
|
});
|
|
@@ -4669,14 +4743,14 @@ var ApiKeysFacade = class {
|
|
|
4669
4743
|
delete(keyId, options) {
|
|
4670
4744
|
return this.http.requestJson({
|
|
4671
4745
|
method: "DELETE",
|
|
4672
|
-
path: `${
|
|
4746
|
+
path: `${BASE21}/${encodePathSegment(keyId)}`,
|
|
4673
4747
|
signal: options?.signal
|
|
4674
4748
|
});
|
|
4675
4749
|
}
|
|
4676
4750
|
};
|
|
4677
4751
|
|
|
4678
4752
|
// ../../src/resources/block-reason/BlockReasonsFacade.ts
|
|
4679
|
-
var
|
|
4753
|
+
var BASE22 = "/api/v1/blockreason";
|
|
4680
4754
|
var BlockReasonsFacade = class {
|
|
4681
4755
|
constructor(http) {
|
|
4682
4756
|
this.http = http;
|
|
@@ -4686,7 +4760,7 @@ var BlockReasonsFacade = class {
|
|
|
4686
4760
|
create(body, options) {
|
|
4687
4761
|
return this.http.requestJson({
|
|
4688
4762
|
method: "POST",
|
|
4689
|
-
path:
|
|
4763
|
+
path: BASE22,
|
|
4690
4764
|
body,
|
|
4691
4765
|
signal: options?.signal
|
|
4692
4766
|
});
|
|
@@ -4695,7 +4769,7 @@ var BlockReasonsFacade = class {
|
|
|
4695
4769
|
getById(id, options) {
|
|
4696
4770
|
return this.http.requestJson({
|
|
4697
4771
|
method: "GET",
|
|
4698
|
-
path: `${
|
|
4772
|
+
path: `${BASE22}/${encodePathSegment(String(id))}`,
|
|
4699
4773
|
query: { lng: options?.lng },
|
|
4700
4774
|
signal: options?.signal
|
|
4701
4775
|
});
|
|
@@ -4705,7 +4779,7 @@ var BlockReasonsFacade = class {
|
|
|
4705
4779
|
const { signal } = options ?? {};
|
|
4706
4780
|
return this.http.requestJson({
|
|
4707
4781
|
method: "GET",
|
|
4708
|
-
path: `${
|
|
4782
|
+
path: `${BASE22}/all`,
|
|
4709
4783
|
query: { ...query ?? {} },
|
|
4710
4784
|
signal
|
|
4711
4785
|
});
|
|
@@ -4714,14 +4788,14 @@ var BlockReasonsFacade = class {
|
|
|
4714
4788
|
delete(id, options) {
|
|
4715
4789
|
return this.http.requestJson({
|
|
4716
4790
|
method: "DELETE",
|
|
4717
|
-
path: `${
|
|
4791
|
+
path: `${BASE22}/${encodePathSegment(String(id))}`,
|
|
4718
4792
|
signal: options?.signal
|
|
4719
4793
|
});
|
|
4720
4794
|
}
|
|
4721
4795
|
};
|
|
4722
4796
|
|
|
4723
4797
|
// ../../src/resources/external-auths/ExternalAuthsFacade.ts
|
|
4724
|
-
var
|
|
4798
|
+
var BASE23 = "/api/v1/externalauths";
|
|
4725
4799
|
var ExternalAuthsFacade = class {
|
|
4726
4800
|
constructor(http) {
|
|
4727
4801
|
this.http = http;
|
|
@@ -4731,7 +4805,7 @@ var ExternalAuthsFacade = class {
|
|
|
4731
4805
|
add(body, options) {
|
|
4732
4806
|
return this.http.requestJson({
|
|
4733
4807
|
method: "POST",
|
|
4734
|
-
path:
|
|
4808
|
+
path: BASE23,
|
|
4735
4809
|
body,
|
|
4736
4810
|
signal: options?.signal
|
|
4737
4811
|
});
|
|
@@ -4740,7 +4814,7 @@ var ExternalAuthsFacade = class {
|
|
|
4740
4814
|
getById(torrowId, options) {
|
|
4741
4815
|
return this.http.requestJson({
|
|
4742
4816
|
method: "GET",
|
|
4743
|
-
path: `${
|
|
4817
|
+
path: `${BASE23}/${encodePathSegment(torrowId)}`,
|
|
4744
4818
|
query: { includeDeleted: options?.includeDeleted },
|
|
4745
4819
|
signal: options?.signal
|
|
4746
4820
|
});
|
|
@@ -4750,7 +4824,7 @@ var ExternalAuthsFacade = class {
|
|
|
4750
4824
|
const { signal, ...rest } = options ?? {};
|
|
4751
4825
|
return this.http.requestJson({
|
|
4752
4826
|
method: "GET",
|
|
4753
|
-
path: `${
|
|
4827
|
+
path: `${BASE23}/all`,
|
|
4754
4828
|
query: { ...rest },
|
|
4755
4829
|
signal
|
|
4756
4830
|
});
|
|
@@ -4759,7 +4833,7 @@ var ExternalAuthsFacade = class {
|
|
|
4759
4833
|
async delete(externalAuthId, options) {
|
|
4760
4834
|
const resp = await this.http.requestJson({
|
|
4761
4835
|
method: "DELETE",
|
|
4762
|
-
path: `${
|
|
4836
|
+
path: `${BASE23}/${encodePathSegment(externalAuthId)}`,
|
|
4763
4837
|
query: {
|
|
4764
4838
|
versionToCheck: options?.versionToCheck,
|
|
4765
4839
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4771,7 +4845,7 @@ var ExternalAuthsFacade = class {
|
|
|
4771
4845
|
};
|
|
4772
4846
|
|
|
4773
4847
|
// ../../src/resources/id-generator/IdGeneratorFacade.ts
|
|
4774
|
-
var
|
|
4848
|
+
var BASE24 = "/api/v1/idgenerator";
|
|
4775
4849
|
var IdGeneratorFacade = class {
|
|
4776
4850
|
constructor(http) {
|
|
4777
4851
|
this.http = http;
|
|
@@ -4780,7 +4854,7 @@ var IdGeneratorFacade = class {
|
|
|
4780
4854
|
async getNextId(objectType, options) {
|
|
4781
4855
|
const resp = await this.http.requestJson({
|
|
4782
4856
|
method: "GET",
|
|
4783
|
-
path: `${
|
|
4857
|
+
path: `${BASE24}/${encodePathSegment(String(objectType))}`,
|
|
4784
4858
|
signal: options?.signal
|
|
4785
4859
|
});
|
|
4786
4860
|
return unwrapTorrowId(resp);
|
|
@@ -4788,7 +4862,7 @@ var IdGeneratorFacade = class {
|
|
|
4788
4862
|
};
|
|
4789
4863
|
|
|
4790
4864
|
// ../../src/resources/integrations/IntegrationsFacade.ts
|
|
4791
|
-
var
|
|
4865
|
+
var BASE25 = "/api/v1/integrations";
|
|
4792
4866
|
var IntegrationsFacade = class {
|
|
4793
4867
|
constructor(http) {
|
|
4794
4868
|
this.http = http;
|
|
@@ -4798,16 +4872,17 @@ var IntegrationsFacade = class {
|
|
|
4798
4872
|
create(body, options) {
|
|
4799
4873
|
return this.http.requestJson({
|
|
4800
4874
|
method: "POST",
|
|
4801
|
-
path:
|
|
4875
|
+
path: BASE25,
|
|
4802
4876
|
body,
|
|
4803
4877
|
signal: options?.signal
|
|
4804
4878
|
});
|
|
4805
4879
|
}
|
|
4806
|
-
/** `PUT /api/v1/integrations/{
|
|
4807
|
-
update(body,
|
|
4880
|
+
/** `PUT /api/v1/integrations/{body.id}` */
|
|
4881
|
+
update(body, options) {
|
|
4882
|
+
const itemId = requireItemUpdateId(body, "Integration");
|
|
4808
4883
|
return this.http.requestJson({
|
|
4809
4884
|
method: "PUT",
|
|
4810
|
-
path: `${
|
|
4885
|
+
path: `${BASE25}/${encodePathSegment(itemId)}`,
|
|
4811
4886
|
query: { checkVersion: options?.checkVersion },
|
|
4812
4887
|
body,
|
|
4813
4888
|
signal: options?.signal
|
|
@@ -4817,7 +4892,7 @@ var IntegrationsFacade = class {
|
|
|
4817
4892
|
list(options) {
|
|
4818
4893
|
return this.http.requestJson({
|
|
4819
4894
|
method: "GET",
|
|
4820
|
-
path: `${
|
|
4895
|
+
path: `${BASE25}/list`,
|
|
4821
4896
|
query: {
|
|
4822
4897
|
integrationIds: options?.integrationIds,
|
|
4823
4898
|
includeDeleted: options?.includeDeleted
|
|
@@ -4829,7 +4904,7 @@ var IntegrationsFacade = class {
|
|
|
4829
4904
|
async delete(integrationId, options) {
|
|
4830
4905
|
const resp = await this.http.requestJson({
|
|
4831
4906
|
method: "DELETE",
|
|
4832
|
-
path: `${
|
|
4907
|
+
path: `${BASE25}/${encodePathSegment(integrationId)}`,
|
|
4833
4908
|
query: {
|
|
4834
4909
|
versionToCheck: options?.versionToCheck,
|
|
4835
4910
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4841,7 +4916,7 @@ var IntegrationsFacade = class {
|
|
|
4841
4916
|
};
|
|
4842
4917
|
|
|
4843
4918
|
// ../../src/resources/item/ItemFacade.ts
|
|
4844
|
-
var
|
|
4919
|
+
var BASE26 = "/api/v1/item";
|
|
4845
4920
|
var ItemFacade = class {
|
|
4846
4921
|
constructor(http) {
|
|
4847
4922
|
this.http = http;
|
|
@@ -4855,7 +4930,7 @@ var ItemFacade = class {
|
|
|
4855
4930
|
activateShareItemSession(shareItemSessionId, options) {
|
|
4856
4931
|
return this.http.requestJson({
|
|
4857
4932
|
method: "PUT",
|
|
4858
|
-
path: `${
|
|
4933
|
+
path: `${BASE26}/activateshareitemsession/${encodePathSegment(shareItemSessionId)}`,
|
|
4859
4934
|
query: { userProfileId: options?.userProfileId, code: options?.code },
|
|
4860
4935
|
signal: options?.signal
|
|
4861
4936
|
});
|
|
@@ -4864,7 +4939,7 @@ var ItemFacade = class {
|
|
|
4864
4939
|
getByUniqueName(uniqueName, options) {
|
|
4865
4940
|
return this.http.requestJson({
|
|
4866
4941
|
method: "GET",
|
|
4867
|
-
path: `${
|
|
4942
|
+
path: `${BASE26}/uniquename/${encodePathSegment(uniqueName)}`,
|
|
4868
4943
|
signal: options?.signal
|
|
4869
4944
|
});
|
|
4870
4945
|
}
|
|
@@ -4872,7 +4947,7 @@ var ItemFacade = class {
|
|
|
4872
4947
|
getUserFeedback(torrowId, options) {
|
|
4873
4948
|
return this.http.requestJson({
|
|
4874
4949
|
method: "GET",
|
|
4875
|
-
path: `${
|
|
4950
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/userfeedback`,
|
|
4876
4951
|
query: {
|
|
4877
4952
|
throwExceptionIfNotFound: options?.throwExceptionIfNotFound,
|
|
4878
4953
|
versionToCheck: options?.versionToCheck,
|
|
@@ -4886,7 +4961,7 @@ var ItemFacade = class {
|
|
|
4886
4961
|
const { signal, ...query } = options ?? {};
|
|
4887
4962
|
return this.http.requestJson({
|
|
4888
4963
|
method: "PUT",
|
|
4889
|
-
path: `${
|
|
4964
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/userfeedback`,
|
|
4890
4965
|
query: { ...query },
|
|
4891
4966
|
signal
|
|
4892
4967
|
});
|
|
@@ -4896,7 +4971,7 @@ var ItemFacade = class {
|
|
|
4896
4971
|
const { signal, ...query } = options ?? {};
|
|
4897
4972
|
const resp = await this.http.requestJson({
|
|
4898
4973
|
method: "DELETE",
|
|
4899
|
-
path: `${
|
|
4974
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/userfeedback`,
|
|
4900
4975
|
query: { ...query },
|
|
4901
4976
|
signal
|
|
4902
4977
|
});
|
|
@@ -4907,7 +4982,7 @@ var ItemFacade = class {
|
|
|
4907
4982
|
const { signal, ...query } = options ?? {};
|
|
4908
4983
|
return this.http.requestJson({
|
|
4909
4984
|
method: "GET",
|
|
4910
|
-
path: `${
|
|
4985
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks`,
|
|
4911
4986
|
query: { ...query },
|
|
4912
4987
|
signal
|
|
4913
4988
|
});
|
|
@@ -4917,7 +4992,7 @@ var ItemFacade = class {
|
|
|
4917
4992
|
const { signal, ...query } = options ?? {};
|
|
4918
4993
|
return this.http.requestJson({
|
|
4919
4994
|
method: "POST",
|
|
4920
|
-
path: `${
|
|
4995
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/newmessage`,
|
|
4921
4996
|
query: { ...query },
|
|
4922
4997
|
signal
|
|
4923
4998
|
});
|
|
@@ -4926,7 +5001,7 @@ var ItemFacade = class {
|
|
|
4926
5001
|
getFeedback(torrowId, messageId, options) {
|
|
4927
5002
|
return this.http.requestJson({
|
|
4928
5003
|
method: "GET",
|
|
4929
|
-
path: `${
|
|
5004
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
|
|
4930
5005
|
query: {
|
|
4931
5006
|
versionToCheck: options?.versionToCheck,
|
|
4932
5007
|
includeDeleted: options?.includeDeleted
|
|
@@ -4939,7 +5014,7 @@ var ItemFacade = class {
|
|
|
4939
5014
|
const { signal, ...query } = options ?? {};
|
|
4940
5015
|
return this.http.requestJson({
|
|
4941
5016
|
method: "PUT",
|
|
4942
|
-
path: `${
|
|
5017
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
|
|
4943
5018
|
query: { ...query },
|
|
4944
5019
|
signal
|
|
4945
5020
|
});
|
|
@@ -4948,7 +5023,7 @@ var ItemFacade = class {
|
|
|
4948
5023
|
async deleteFeedback(torrowId, messageId, options) {
|
|
4949
5024
|
const resp = await this.http.requestJson({
|
|
4950
5025
|
method: "DELETE",
|
|
4951
|
-
path: `${
|
|
5026
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
|
|
4952
5027
|
query: {
|
|
4953
5028
|
versionToCheck: options?.versionToCheck,
|
|
4954
5029
|
isNeedAnnouncement: options?.isNeedAnnouncement
|
|
@@ -4962,17 +5037,17 @@ var ItemFacade = class {
|
|
|
4962
5037
|
const { signal, ...query } = options ?? {};
|
|
4963
5038
|
return this.http.requestJson({
|
|
4964
5039
|
method: "POST",
|
|
4965
|
-
path: `${
|
|
5040
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/reply`,
|
|
4966
5041
|
query: { ...query },
|
|
4967
5042
|
signal
|
|
4968
5043
|
});
|
|
4969
5044
|
}
|
|
4970
|
-
/** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}/replies` */
|
|
5045
|
+
/** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}/replies` — массив **`Feedback`** (не `ItemFeedback`). */
|
|
4971
5046
|
listFeedbackReplies(torrowId, messageId, options) {
|
|
4972
5047
|
const { signal, ...query } = options ?? {};
|
|
4973
5048
|
return this.http.requestJson({
|
|
4974
5049
|
method: "GET",
|
|
4975
|
-
path: `${
|
|
5050
|
+
path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/replies`,
|
|
4976
5051
|
query: { ...query },
|
|
4977
5052
|
signal
|
|
4978
5053
|
});
|
|
@@ -4980,7 +5055,7 @@ var ItemFacade = class {
|
|
|
4980
5055
|
};
|
|
4981
5056
|
|
|
4982
5057
|
// ../../src/resources/short-url/ShortUrlFacade.ts
|
|
4983
|
-
var
|
|
5058
|
+
var BASE27 = "/api/v1/u";
|
|
4984
5059
|
var ShortUrlFacade = class {
|
|
4985
5060
|
constructor(http, config) {
|
|
4986
5061
|
this.http = http;
|
|
@@ -4992,7 +5067,7 @@ var ShortUrlFacade = class {
|
|
|
4992
5067
|
getFull(shortUrl, options) {
|
|
4993
5068
|
return this.http.requestJson({
|
|
4994
5069
|
method: "GET",
|
|
4995
|
-
path: `${
|
|
5070
|
+
path: `${BASE27}/${encodePathSegment(shortUrl)}/full`,
|
|
4996
5071
|
signal: options?.signal
|
|
4997
5072
|
});
|
|
4998
5073
|
}
|
|
@@ -5003,7 +5078,7 @@ var ShortUrlFacade = class {
|
|
|
5003
5078
|
async getRedirectLocation(shortUrl, options) {
|
|
5004
5079
|
const fetchFn = this.config.fetch ?? globalThis.fetch;
|
|
5005
5080
|
const origin = this.config.baseUrl ?? DEFAULT_TORROW_API_BASE_URL;
|
|
5006
|
-
const url = joinBaseUrlAndPath(origin, `${
|
|
5081
|
+
const url = joinBaseUrlAndPath(origin, `${BASE27}/${encodePathSegment(shortUrl)}`);
|
|
5007
5082
|
const authHeaders = await buildAuthHeaders(this.config);
|
|
5008
5083
|
const res = await fetchFn(url, {
|
|
5009
5084
|
method: "GET",
|
|
@@ -5020,7 +5095,7 @@ var ShortUrlFacade = class {
|
|
|
5020
5095
|
};
|
|
5021
5096
|
|
|
5022
5097
|
// ../../src/resources/thesaurus/ThesaurusFacade.ts
|
|
5023
|
-
var
|
|
5098
|
+
var BASE28 = "/api/v1/thesaurus";
|
|
5024
5099
|
var ThesaurusFacade = class {
|
|
5025
5100
|
constructor(http) {
|
|
5026
5101
|
this.http = http;
|
|
@@ -5031,7 +5106,7 @@ var ThesaurusFacade = class {
|
|
|
5031
5106
|
const { signal, ...query } = options ?? {};
|
|
5032
5107
|
return this.http.requestJson({
|
|
5033
5108
|
method: "GET",
|
|
5034
|
-
path: `${
|
|
5109
|
+
path: `${BASE28}/places`,
|
|
5035
5110
|
query: { ...query },
|
|
5036
5111
|
signal
|
|
5037
5112
|
});
|
|
@@ -5041,7 +5116,7 @@ var ThesaurusFacade = class {
|
|
|
5041
5116
|
const { signal, ...query } = options ?? {};
|
|
5042
5117
|
return this.http.requestJson({
|
|
5043
5118
|
method: "GET",
|
|
5044
|
-
path: `${
|
|
5119
|
+
path: `${BASE28}/hobbies`,
|
|
5045
5120
|
query: { ...query },
|
|
5046
5121
|
signal
|
|
5047
5122
|
});
|
|
@@ -5467,6 +5542,176 @@ var CommunicationTypeValues = {
|
|
|
5467
5542
|
Max: "Max",
|
|
5468
5543
|
Other: "Other"
|
|
5469
5544
|
};
|
|
5545
|
+
var ProfileTypeValues = {
|
|
5546
|
+
Unknown: "UnknownProfile",
|
|
5547
|
+
None: "None",
|
|
5548
|
+
MyProfile: "MyProfile",
|
|
5549
|
+
AnyProfile: "AnyProfile",
|
|
5550
|
+
CopyProfile: "CopyProfile"
|
|
5551
|
+
};
|
|
5552
|
+
|
|
5553
|
+
// ../../src/resources/contacts/communication-links.ts
|
|
5554
|
+
function digitsOnly(value) {
|
|
5555
|
+
return value.replace(/\D+/g, "");
|
|
5556
|
+
}
|
|
5557
|
+
function looksLikeUrl(value) {
|
|
5558
|
+
return /^https?:\/\//i.test(value) || value.includes(".");
|
|
5559
|
+
}
|
|
5560
|
+
function removeFirstAt(value) {
|
|
5561
|
+
return value.replace(/^@/, "");
|
|
5562
|
+
}
|
|
5563
|
+
function ensureHttpUrl(value) {
|
|
5564
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(value) ? value : `https://${value}`;
|
|
5565
|
+
}
|
|
5566
|
+
function getDomain(url) {
|
|
5567
|
+
if (!url?.trim()) {
|
|
5568
|
+
return void 0;
|
|
5569
|
+
}
|
|
5570
|
+
const withScheme = /^[a-z][a-z0-9+.-]*:/i.test(url) ? url : `https://${url}`;
|
|
5571
|
+
const match = withScheme.match(/:\/\/(www[0-9]?\.)?([^/:]+)/i);
|
|
5572
|
+
const hostName = match?.[2];
|
|
5573
|
+
if (!hostName) {
|
|
5574
|
+
return void 0;
|
|
5575
|
+
}
|
|
5576
|
+
const parts = hostName.split(".").reverse();
|
|
5577
|
+
if (parts.length > 1) {
|
|
5578
|
+
let domain = `${parts[1]}.${parts[0]}`;
|
|
5579
|
+
if (hostName.toLowerCase().includes(".co.uk") && parts.length > 2) {
|
|
5580
|
+
domain = `${parts[2]}.${domain}`;
|
|
5581
|
+
}
|
|
5582
|
+
return domain;
|
|
5583
|
+
}
|
|
5584
|
+
return hostName;
|
|
5585
|
+
}
|
|
5586
|
+
function websiteBrandFromDomain(domain) {
|
|
5587
|
+
switch ((domain ?? "").toLowerCase()) {
|
|
5588
|
+
case "youtube.com":
|
|
5589
|
+
case "youtu.be":
|
|
5590
|
+
return "youtube";
|
|
5591
|
+
case "vk.com":
|
|
5592
|
+
return "vkontakte";
|
|
5593
|
+
case "ok.ru":
|
|
5594
|
+
return "odnoklassniki";
|
|
5595
|
+
case "facebook.com":
|
|
5596
|
+
case "fb.com":
|
|
5597
|
+
case "fb.me":
|
|
5598
|
+
return "facebook";
|
|
5599
|
+
case "twitter.com":
|
|
5600
|
+
case "x.com":
|
|
5601
|
+
return "twitter";
|
|
5602
|
+
case "instagram.com":
|
|
5603
|
+
case "instagr.am":
|
|
5604
|
+
case "instagr.com":
|
|
5605
|
+
return "instagram";
|
|
5606
|
+
case "linkedin.com":
|
|
5607
|
+
case "linked.in":
|
|
5608
|
+
case "lnkd.in":
|
|
5609
|
+
return "linkedin";
|
|
5610
|
+
case "zoom.us":
|
|
5611
|
+
return "zoom";
|
|
5612
|
+
default:
|
|
5613
|
+
return null;
|
|
5614
|
+
}
|
|
5615
|
+
}
|
|
5616
|
+
function communicationHref(comm) {
|
|
5617
|
+
const value = comm.value?.trim() ?? "";
|
|
5618
|
+
if (!value) {
|
|
5619
|
+
return null;
|
|
5620
|
+
}
|
|
5621
|
+
const digits = digitsOnly(comm.valueForSearch?.trim() || value);
|
|
5622
|
+
switch (comm.type) {
|
|
5623
|
+
case "Phone":
|
|
5624
|
+
return digits ? `tel:${digits}` : `tel:${value}`;
|
|
5625
|
+
case "Sms":
|
|
5626
|
+
return digits ? `sms:${digits}` : `sms:${value}`;
|
|
5627
|
+
case "Email":
|
|
5628
|
+
return `mailto:${value}`;
|
|
5629
|
+
case "WebSite":
|
|
5630
|
+
return ensureHttpUrl(value);
|
|
5631
|
+
case "Telegram":
|
|
5632
|
+
if (/^https?:\/\//i.test(value) || /^tg:/i.test(value)) {
|
|
5633
|
+
return value;
|
|
5634
|
+
}
|
|
5635
|
+
return `https://telegram.me/${removeFirstAt(value)}`;
|
|
5636
|
+
case "WhatsApp":
|
|
5637
|
+
return digits ? `https://wa.me/${digits}` : null;
|
|
5638
|
+
case "Viber":
|
|
5639
|
+
return digits ? `viber://add?number=${digits}` : null;
|
|
5640
|
+
case "Skype":
|
|
5641
|
+
return `skype:${removeFirstAt(value)}?call`;
|
|
5642
|
+
case "Max":
|
|
5643
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5644
|
+
return value;
|
|
5645
|
+
}
|
|
5646
|
+
return `https://max.ru/${removeFirstAt(value)}`;
|
|
5647
|
+
case "Vkontakte":
|
|
5648
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5649
|
+
return value;
|
|
5650
|
+
}
|
|
5651
|
+
return `https://vk.com/${removeFirstAt(value)}`;
|
|
5652
|
+
case "Facebook":
|
|
5653
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5654
|
+
return value;
|
|
5655
|
+
}
|
|
5656
|
+
return `https://www.facebook.com/${removeFirstAt(value)}`;
|
|
5657
|
+
case "Instagram":
|
|
5658
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5659
|
+
return value;
|
|
5660
|
+
}
|
|
5661
|
+
return `https://www.instagram.com/${removeFirstAt(value)}`;
|
|
5662
|
+
case "Odnoklassniki":
|
|
5663
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5664
|
+
return value;
|
|
5665
|
+
}
|
|
5666
|
+
return `https://ok.ru/${removeFirstAt(value)}`;
|
|
5667
|
+
case "Twitter":
|
|
5668
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5669
|
+
return value;
|
|
5670
|
+
}
|
|
5671
|
+
return `https://twitter.com/${removeFirstAt(value)}`;
|
|
5672
|
+
case "LinkedIn":
|
|
5673
|
+
if (/^https?:\/\//i.test(value)) {
|
|
5674
|
+
return value;
|
|
5675
|
+
}
|
|
5676
|
+
return `https://www.linkedin.com/in/${removeFirstAt(value)}`;
|
|
5677
|
+
case "Youtube":
|
|
5678
|
+
return ensureHttpUrl(value);
|
|
5679
|
+
default:
|
|
5680
|
+
return looksLikeUrl(value) ? ensureHttpUrl(value) : null;
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
function resolveCommunicationBrand(comm) {
|
|
5684
|
+
switch (comm.type) {
|
|
5685
|
+
case "Telegram":
|
|
5686
|
+
return "telegram";
|
|
5687
|
+
case "WhatsApp":
|
|
5688
|
+
return "whatsapp";
|
|
5689
|
+
case "Viber":
|
|
5690
|
+
return "viber";
|
|
5691
|
+
case "Skype":
|
|
5692
|
+
return "skype";
|
|
5693
|
+
case "Max":
|
|
5694
|
+
return "max";
|
|
5695
|
+
case "Youtube":
|
|
5696
|
+
return "youtube";
|
|
5697
|
+
case "Vkontakte":
|
|
5698
|
+
return "vkontakte";
|
|
5699
|
+
case "Facebook":
|
|
5700
|
+
return "facebook";
|
|
5701
|
+
case "Odnoklassniki":
|
|
5702
|
+
return "odnoklassniki";
|
|
5703
|
+
case "Twitter":
|
|
5704
|
+
return "twitter";
|
|
5705
|
+
case "LinkedIn":
|
|
5706
|
+
return "linkedin";
|
|
5707
|
+
case "Instagram":
|
|
5708
|
+
return "instagram";
|
|
5709
|
+
case "WebSite":
|
|
5710
|
+
return websiteBrandFromDomain(getDomain(comm.value?.trim()));
|
|
5711
|
+
default:
|
|
5712
|
+
return websiteBrandFromDomain(getDomain(comm.value?.trim()));
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5470
5715
|
|
|
5471
5716
|
// ../../src/resources/reports/types.ts
|
|
5472
5717
|
var TimeSplitTypeValues = {
|
|
@@ -5521,6 +5766,101 @@ var LoyaltyCardSortConditionValues = {
|
|
|
5521
5766
|
LoyaltyCardStateDescSequenceCardNumberDesc: "LoyaltyCardStateDescSequenceCardNumberDesc"
|
|
5522
5767
|
};
|
|
5523
5768
|
|
|
5769
|
+
// ../../src/resources/services/types.ts
|
|
5770
|
+
var SessionDurationTypeValues = {
|
|
5771
|
+
Unknown: "UnknownSessionDurationType",
|
|
5772
|
+
None: "SessionDurationNone",
|
|
5773
|
+
Custom: "Custom",
|
|
5774
|
+
Constant: "Constant",
|
|
5775
|
+
Sum: "Sum"
|
|
5776
|
+
};
|
|
5777
|
+
var TimeSelectionTypeValues = {
|
|
5778
|
+
Unknown: "UnknownTimeSelectionType",
|
|
5779
|
+
None: "TimeSelectionNone",
|
|
5780
|
+
Consumer: "Consumer",
|
|
5781
|
+
Executor: "Executor"
|
|
5782
|
+
};
|
|
5783
|
+
var StateManagementTypeValues = {
|
|
5784
|
+
Unknown: "UnknownStateManagementType",
|
|
5785
|
+
Auto: "Auto",
|
|
5786
|
+
Manual: "Manual"
|
|
5787
|
+
};
|
|
5788
|
+
var SessionPrecisionTypeValues = {
|
|
5789
|
+
Unknown: "UnknownSessionPrecisionType",
|
|
5790
|
+
None: "SessionPrecisionNone",
|
|
5791
|
+
DateTime: "DateTime",
|
|
5792
|
+
Date: "Date"
|
|
5793
|
+
};
|
|
5794
|
+
|
|
5795
|
+
// ../../src/resources/services/service-type-preset.ts
|
|
5796
|
+
var ServiceType = {
|
|
5797
|
+
Appeal: "Appeal",
|
|
5798
|
+
RegisterOnTime: "RegisterOnTime",
|
|
5799
|
+
OrderOnTime: "OrderOnTime",
|
|
5800
|
+
Rent: "Rent",
|
|
5801
|
+
AutoRent: "AutoRent",
|
|
5802
|
+
Custom: "Custom"
|
|
5803
|
+
};
|
|
5804
|
+
var ServiceTypePresetValues = {
|
|
5805
|
+
Appeal: ServiceType.Appeal,
|
|
5806
|
+
RegisterOnTime: ServiceType.RegisterOnTime,
|
|
5807
|
+
OrderOnTime: ServiceType.OrderOnTime,
|
|
5808
|
+
Rent: ServiceType.Rent,
|
|
5809
|
+
AutoRent: ServiceType.AutoRent
|
|
5810
|
+
};
|
|
5811
|
+
var serviceSessionDurationPresets = {
|
|
5812
|
+
[ServiceType.Appeal]: {
|
|
5813
|
+
sessionDurationType: SessionDurationTypeValues.None,
|
|
5814
|
+
timeSelectionType: TimeSelectionTypeValues.None,
|
|
5815
|
+
stateManagementType: StateManagementTypeValues.Manual
|
|
5816
|
+
},
|
|
5817
|
+
[ServiceType.RegisterOnTime]: {
|
|
5818
|
+
sessionDurationType: SessionDurationTypeValues.Sum,
|
|
5819
|
+
timeSelectionType: TimeSelectionTypeValues.Consumer,
|
|
5820
|
+
stateManagementType: StateManagementTypeValues.Auto
|
|
5821
|
+
},
|
|
5822
|
+
[ServiceType.OrderOnTime]: {
|
|
5823
|
+
sessionDurationType: SessionDurationTypeValues.Sum,
|
|
5824
|
+
timeSelectionType: TimeSelectionTypeValues.Consumer,
|
|
5825
|
+
stateManagementType: StateManagementTypeValues.Manual
|
|
5826
|
+
},
|
|
5827
|
+
[ServiceType.Rent]: {
|
|
5828
|
+
sessionDurationType: SessionDurationTypeValues.Custom,
|
|
5829
|
+
timeSelectionType: TimeSelectionTypeValues.Consumer,
|
|
5830
|
+
stateManagementType: StateManagementTypeValues.Manual
|
|
5831
|
+
},
|
|
5832
|
+
[ServiceType.AutoRent]: {
|
|
5833
|
+
sessionDurationType: SessionDurationTypeValues.Custom,
|
|
5834
|
+
timeSelectionType: TimeSelectionTypeValues.Consumer,
|
|
5835
|
+
stateManagementType: StateManagementTypeValues.Auto
|
|
5836
|
+
}
|
|
5837
|
+
};
|
|
5838
|
+
function createServiceSessionDurationProperties(type, options) {
|
|
5839
|
+
const preset = serviceSessionDurationPresets[type];
|
|
5840
|
+
if (!preset) {
|
|
5841
|
+
throw new TypeError(`Unknown service type: ${String(type)}`);
|
|
5842
|
+
}
|
|
5843
|
+
return {
|
|
5844
|
+
...options,
|
|
5845
|
+
sessionPrecisionType: options?.sessionPrecisionType ?? SessionPrecisionTypeValues.DateTime,
|
|
5846
|
+
...preset
|
|
5847
|
+
};
|
|
5848
|
+
}
|
|
5849
|
+
function getServiceTypeFromSessionDurationProperties(properties) {
|
|
5850
|
+
if (!properties) {
|
|
5851
|
+
return ServiceType.Custom;
|
|
5852
|
+
}
|
|
5853
|
+
for (const [type, preset] of Object.entries(serviceSessionDurationPresets)) {
|
|
5854
|
+
if (properties.sessionDurationType === preset.sessionDurationType && properties.timeSelectionType === preset.timeSelectionType && properties.stateManagementType === preset.stateManagementType) {
|
|
5855
|
+
return type;
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
return ServiceType.Custom;
|
|
5859
|
+
}
|
|
5860
|
+
function getServiceType(service) {
|
|
5861
|
+
return getServiceTypeFromSessionDurationProperties(service.sessionDurationProperties);
|
|
5862
|
+
}
|
|
5863
|
+
|
|
5524
5864
|
// ../../src/resources/services/booking-wizard-hints.ts
|
|
5525
5865
|
var ServiceCheckInWizardStepType = {
|
|
5526
5866
|
Unknown: 0,
|
|
@@ -5534,6 +5874,12 @@ var ServiceCheckInWizardStepParameterName = {
|
|
|
5534
5874
|
ResourceGroupId: "ResourceGroupId",
|
|
5535
5875
|
AutoChoiceResource: "AutoChoiceResource"
|
|
5536
5876
|
};
|
|
5877
|
+
var TimeStepUiModeValues = {
|
|
5878
|
+
SelectDate: "selectDate",
|
|
5879
|
+
SelectDateRange: "selectDateRange",
|
|
5880
|
+
SelectTimeBegin: "selectTimeBegin",
|
|
5881
|
+
SelectTime: "selectTime"
|
|
5882
|
+
};
|
|
5537
5883
|
function sortStepDescriptionsByOrder(list) {
|
|
5538
5884
|
if (!list?.length) {
|
|
5539
5885
|
return [];
|
|
@@ -5558,16 +5904,279 @@ function getTimeStepUiMode(session) {
|
|
|
5558
5904
|
const isSelectDateAndTimeBegin = sessionPrecisionType === "DateTime" && sessionDurationType !== "SessionDurationNone" && sessionDurationType !== "Custom";
|
|
5559
5905
|
const isSelectDateRangeAndTimeBeginAndTimeEnd = sessionPrecisionType === "DateTime" && sessionDurationType === "Custom";
|
|
5560
5906
|
if (isSelectDate) {
|
|
5561
|
-
return
|
|
5907
|
+
return TimeStepUiModeValues.SelectDate;
|
|
5562
5908
|
}
|
|
5563
5909
|
if (isSelectDateRange) {
|
|
5564
|
-
return
|
|
5910
|
+
return TimeStepUiModeValues.SelectDateRange;
|
|
5565
5911
|
}
|
|
5566
5912
|
if (isSelectDateAndTimeBegin || isSelectDateRangeAndTimeBeginAndTimeEnd) {
|
|
5567
|
-
return
|
|
5913
|
+
return TimeStepUiModeValues.SelectTimeBegin;
|
|
5914
|
+
}
|
|
5915
|
+
return TimeStepUiModeValues.SelectTime;
|
|
5916
|
+
}
|
|
5917
|
+
|
|
5918
|
+
// ../../src/resources/services/service-builder.ts
|
|
5919
|
+
var RESOURCE_USAGE_TYPES = /* @__PURE__ */ new Set(["Specification", "Rent", "Sale"]);
|
|
5920
|
+
var GROUP_ID_PATTERN = /^[0-9a-f]{24}$/i;
|
|
5921
|
+
var SESSION_DURATION_TYPES = new Set(Object.values(SessionDurationTypeValues));
|
|
5922
|
+
var TIME_SELECTION_TYPES = new Set(Object.values(TimeSelectionTypeValues));
|
|
5923
|
+
var STATE_MANAGEMENT_TYPES = new Set(Object.values(StateManagementTypeValues));
|
|
5924
|
+
function cloneValue(value) {
|
|
5925
|
+
if (value instanceof Date) {
|
|
5926
|
+
return new Date(value.getTime());
|
|
5927
|
+
}
|
|
5928
|
+
if (Array.isArray(value)) {
|
|
5929
|
+
return value.map((item) => cloneValue(item));
|
|
5930
|
+
}
|
|
5931
|
+
if (value && typeof value === "object") {
|
|
5932
|
+
const result = {};
|
|
5933
|
+
for (const [key, item] of Object.entries(value)) {
|
|
5934
|
+
result[key] = cloneValue(item);
|
|
5935
|
+
}
|
|
5936
|
+
return result;
|
|
5937
|
+
}
|
|
5938
|
+
return value;
|
|
5939
|
+
}
|
|
5940
|
+
function generateServiceResourceGroupId() {
|
|
5941
|
+
const bytes = new Uint8Array(12);
|
|
5942
|
+
const cryptoObject = globalThis.crypto;
|
|
5943
|
+
if (cryptoObject?.getRandomValues) {
|
|
5944
|
+
cryptoObject.getRandomValues(bytes);
|
|
5945
|
+
} else {
|
|
5946
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
5947
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
5951
|
+
}
|
|
5952
|
+
function normalizeSteps(steps) {
|
|
5953
|
+
return steps.map((step, index) => ({ step, index })).sort((a, b) => {
|
|
5954
|
+
const aOrder = a.step.stepOrder;
|
|
5955
|
+
const bOrder = b.step.stepOrder;
|
|
5956
|
+
if (aOrder == null && bOrder == null) return a.index - b.index;
|
|
5957
|
+
if (aOrder == null) return 1;
|
|
5958
|
+
if (bOrder == null) return -1;
|
|
5959
|
+
return aOrder - bOrder || a.index - b.index;
|
|
5960
|
+
}).map(({ step }, index) => ({ ...step, stepOrder: index + 1 }));
|
|
5961
|
+
}
|
|
5962
|
+
function assertStepPosition(position, length) {
|
|
5963
|
+
if (position === void 0) return length + 1;
|
|
5964
|
+
if (!Number.isInteger(position) || position < 1 || position > length + 1) {
|
|
5965
|
+
throw new RangeError(`stepOrder must be an integer from 1 to ${length + 1}`);
|
|
5568
5966
|
}
|
|
5569
|
-
return
|
|
5967
|
+
return position;
|
|
5570
5968
|
}
|
|
5969
|
+
var ServiceBuilder = class _ServiceBuilder {
|
|
5970
|
+
draft;
|
|
5971
|
+
addedGroups = /* @__PURE__ */ new Map();
|
|
5972
|
+
constructor(body) {
|
|
5973
|
+
this.draft = cloneValue(body);
|
|
5974
|
+
this.normalizeAndSyncOrders();
|
|
5975
|
+
}
|
|
5976
|
+
static create(body) {
|
|
5977
|
+
return new _ServiceBuilder(body);
|
|
5978
|
+
}
|
|
5979
|
+
static from(service) {
|
|
5980
|
+
return new _ServiceBuilder(service);
|
|
5981
|
+
}
|
|
5982
|
+
withType(type, options) {
|
|
5983
|
+
if (type === ServiceType.Custom) {
|
|
5984
|
+
throw new TypeError("ServiceType.Custom requires explicit sessionDurationProperties");
|
|
5985
|
+
}
|
|
5986
|
+
this.draft.sessionDurationProperties = createServiceSessionDurationProperties(type, options);
|
|
5987
|
+
return this;
|
|
5988
|
+
}
|
|
5989
|
+
withSessionDurationProperties(properties) {
|
|
5990
|
+
if (!properties.sessionDurationType || !SESSION_DURATION_TYPES.has(properties.sessionDurationType) || !properties.timeSelectionType || !TIME_SELECTION_TYPES.has(properties.timeSelectionType) || !properties.stateManagementType || !STATE_MANAGEMENT_TYPES.has(properties.stateManagementType)) {
|
|
5991
|
+
throw new TypeError(
|
|
5992
|
+
"sessionDurationProperties must include sessionDurationType, timeSelectionType, and stateManagementType"
|
|
5993
|
+
);
|
|
5994
|
+
}
|
|
5995
|
+
this.draft.sessionDurationProperties = cloneValue(properties);
|
|
5996
|
+
return this;
|
|
5997
|
+
}
|
|
5998
|
+
addResourceStep(input) {
|
|
5999
|
+
if (!RESOURCE_USAGE_TYPES.has(input.usageType)) {
|
|
6000
|
+
throw new TypeError(`Unsupported resource group usageType: ${String(input.usageType)}`);
|
|
6001
|
+
}
|
|
6002
|
+
const minResources = input.minResources ?? 1;
|
|
6003
|
+
const maxResources = input.maxResources ?? 1;
|
|
6004
|
+
if (input.autoChoiceResource === true && (minResources !== 1 || maxResources !== 1)) {
|
|
6005
|
+
throw new RangeError("autoChoiceResource requires exactly one resource");
|
|
6006
|
+
}
|
|
6007
|
+
const group = this.addResourceGroup(input, input.usageType);
|
|
6008
|
+
const groupId = group.groupId;
|
|
6009
|
+
const step = {
|
|
6010
|
+
stepType: ServiceCheckInWizardStepType.Resource,
|
|
6011
|
+
description: input.description,
|
|
6012
|
+
stepParameterList: [
|
|
6013
|
+
{
|
|
6014
|
+
parameterName: ServiceCheckInWizardStepParameterName.ResourceGroupId,
|
|
6015
|
+
parameterValue: groupId
|
|
6016
|
+
},
|
|
6017
|
+
{
|
|
6018
|
+
parameterName: ServiceCheckInWizardStepParameterName.AutoChoiceResource,
|
|
6019
|
+
parameterValue: String(input.autoChoiceResource ?? false)
|
|
6020
|
+
},
|
|
6021
|
+
{
|
|
6022
|
+
parameterName: ServiceCheckInWizardStepParameterName.HiddenStep,
|
|
6023
|
+
parameterValue: String(input.hiddenStep ?? false)
|
|
6024
|
+
},
|
|
6025
|
+
{
|
|
6026
|
+
parameterName: ServiceCheckInWizardStepParameterName.HideResourceDetail,
|
|
6027
|
+
parameterValue: String(input.hideResourceDetail ?? false)
|
|
6028
|
+
}
|
|
6029
|
+
]
|
|
6030
|
+
};
|
|
6031
|
+
this.insertStep(step, input.stepOrder);
|
|
6032
|
+
return this;
|
|
6033
|
+
}
|
|
6034
|
+
/** Добавляет платёжную группу без ресурсного шага; шаг оплаты добавляется отдельно. */
|
|
6035
|
+
addPaymentGroup(input) {
|
|
6036
|
+
this.addResourceGroup(input, "Payment");
|
|
6037
|
+
return this;
|
|
6038
|
+
}
|
|
6039
|
+
/** Заменяет список ресурсов существующей группы, например после создания платёжного ресурса. */
|
|
6040
|
+
setResourceGroupResourceIds(resourceGroupId, resourceIds) {
|
|
6041
|
+
const normalizedGroupId = resourceGroupId.trim();
|
|
6042
|
+
if (!normalizedGroupId) throw new TypeError("resourceGroupId must not be empty");
|
|
6043
|
+
const normalizedResourceIds = resourceIds.map((resourceId) => resourceId.trim());
|
|
6044
|
+
if (normalizedResourceIds.some((resourceId) => !resourceId)) {
|
|
6045
|
+
throw new TypeError("resourceIds must not contain empty ids");
|
|
6046
|
+
}
|
|
6047
|
+
if (new Set(normalizedResourceIds).size !== normalizedResourceIds.length) {
|
|
6048
|
+
throw new TypeError("resourceIds must not contain duplicates");
|
|
6049
|
+
}
|
|
6050
|
+
const groups = this.draft.resourceGroupList ?? [];
|
|
6051
|
+
if (!groups.some((group) => group.groupId === normalizedGroupId)) {
|
|
6052
|
+
throw new TypeError(`Service resource group not found: ${normalizedGroupId}`);
|
|
6053
|
+
}
|
|
6054
|
+
this.draft.resourceGroupList = groups.map(
|
|
6055
|
+
(group) => group.groupId === normalizedGroupId ? { ...group, resourceIdList: [...normalizedResourceIds] } : group
|
|
6056
|
+
);
|
|
6057
|
+
return this;
|
|
6058
|
+
}
|
|
6059
|
+
addTimeStep(options) {
|
|
6060
|
+
return this.addSingletonStep(ServiceCheckInWizardStepType.Time, options?.stepOrder);
|
|
6061
|
+
}
|
|
6062
|
+
addPaymentStep(options) {
|
|
6063
|
+
return this.addSingletonStep(ServiceCheckInWizardStepType.Payment, options?.stepOrder);
|
|
6064
|
+
}
|
|
6065
|
+
build() {
|
|
6066
|
+
this.normalizeAndSyncOrders();
|
|
6067
|
+
this.validateConfiguration();
|
|
6068
|
+
const resourceGroupIds = /* @__PURE__ */ Object.create(null);
|
|
6069
|
+
for (const [key, group] of this.addedGroups) {
|
|
6070
|
+
const current = this.draft.resourceGroupList?.find((item) => item.groupId === group.groupId);
|
|
6071
|
+
Object.defineProperty(resourceGroupIds, key, {
|
|
6072
|
+
value: current?.groupId ?? group.groupId,
|
|
6073
|
+
enumerable: true,
|
|
6074
|
+
configurable: true
|
|
6075
|
+
});
|
|
6076
|
+
}
|
|
6077
|
+
return { body: cloneValue(this.draft), resourceGroupIds };
|
|
6078
|
+
}
|
|
6079
|
+
addSingletonStep(stepType, stepOrder) {
|
|
6080
|
+
if (this.draft.stepDescriptionList?.some((step) => step.stepType === stepType)) {
|
|
6081
|
+
throw new TypeError(`Service already contains step type ${stepType}`);
|
|
6082
|
+
}
|
|
6083
|
+
this.insertStep({ stepType }, stepOrder);
|
|
6084
|
+
return this;
|
|
6085
|
+
}
|
|
6086
|
+
addResourceGroup(input, usageType) {
|
|
6087
|
+
const key = input.key.trim();
|
|
6088
|
+
const groupName = input.groupName.trim();
|
|
6089
|
+
if (!key) throw new TypeError("Resource group key must not be empty");
|
|
6090
|
+
if (!groupName) throw new TypeError("Resource group name must not be empty");
|
|
6091
|
+
if (this.addedGroups.has(key)) throw new TypeError(`Duplicate resource group key: ${key}`);
|
|
6092
|
+
const groupId = input.groupId ?? generateServiceResourceGroupId();
|
|
6093
|
+
if (!GROUP_ID_PATTERN.test(groupId)) {
|
|
6094
|
+
throw new TypeError("Resource group id must be a 24-character hexadecimal string");
|
|
6095
|
+
}
|
|
6096
|
+
const groups = [...this.draft.resourceGroupList ?? []];
|
|
6097
|
+
if (groups.some((group2) => group2.groupId === groupId)) {
|
|
6098
|
+
throw new TypeError(`Duplicate resource group id: ${groupId}`);
|
|
6099
|
+
}
|
|
6100
|
+
const minResources = input.minResources ?? 1;
|
|
6101
|
+
const maxResources = input.maxResources ?? 1;
|
|
6102
|
+
for (const [name, value] of [
|
|
6103
|
+
["minResources", minResources],
|
|
6104
|
+
["maxResources", maxResources],
|
|
6105
|
+
["maxTotalAmount", input.maxTotalAmount]
|
|
6106
|
+
]) {
|
|
6107
|
+
if (value != null && (!Number.isInteger(value) || value < 0)) {
|
|
6108
|
+
throw new RangeError(`${name} must be a non-negative integer`);
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
if (minResources > maxResources) {
|
|
6112
|
+
throw new RangeError("minResources must not exceed maxResources");
|
|
6113
|
+
}
|
|
6114
|
+
const group = {
|
|
6115
|
+
groupId,
|
|
6116
|
+
groupName,
|
|
6117
|
+
usageType,
|
|
6118
|
+
minResources,
|
|
6119
|
+
maxResources,
|
|
6120
|
+
maxTotalAmount: input.maxTotalAmount,
|
|
6121
|
+
quickFilterTags: cloneValue(input.quickFilterTags),
|
|
6122
|
+
bookingProperties: cloneValue(input.bookingProperties ?? void 0)
|
|
6123
|
+
};
|
|
6124
|
+
this.draft.resourceGroupList = [...groups, group];
|
|
6125
|
+
this.addedGroups.set(key, cloneValue(group));
|
|
6126
|
+
return group;
|
|
6127
|
+
}
|
|
6128
|
+
insertStep(step, stepOrder) {
|
|
6129
|
+
const steps = normalizeSteps([...this.draft.stepDescriptionList ?? []]);
|
|
6130
|
+
const position = assertStepPosition(stepOrder, steps.length);
|
|
6131
|
+
steps.splice(position - 1, 0, step);
|
|
6132
|
+
this.draft.stepDescriptionList = steps.map((item, index) => ({
|
|
6133
|
+
...item,
|
|
6134
|
+
stepOrder: index + 1
|
|
6135
|
+
}));
|
|
6136
|
+
this.normalizeAndSyncOrders();
|
|
6137
|
+
}
|
|
6138
|
+
normalizeAndSyncOrders() {
|
|
6139
|
+
const hasSteps = this.draft.stepDescriptionList != null;
|
|
6140
|
+
const steps = normalizeSteps([...this.draft.stepDescriptionList ?? []]);
|
|
6141
|
+
if (hasSteps) this.draft.stepDescriptionList = steps;
|
|
6142
|
+
const orders = /* @__PURE__ */ new Map();
|
|
6143
|
+
for (const step of steps) {
|
|
6144
|
+
if (step.stepType === ServiceCheckInWizardStepType.Resource) {
|
|
6145
|
+
const groupId = getResourceGroupIdFromStep(step);
|
|
6146
|
+
if (groupId && step.stepOrder != null) orders.set(groupId, step.stepOrder);
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
if (this.draft.resourceGroupList != null) {
|
|
6150
|
+
this.draft.resourceGroupList = this.draft.resourceGroupList.map((group) => ({
|
|
6151
|
+
...group,
|
|
6152
|
+
order: group.groupId ? orders.get(group.groupId) ?? group.order : group.order
|
|
6153
|
+
}));
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
validateConfiguration() {
|
|
6157
|
+
const groups = this.draft.resourceGroupList ?? [];
|
|
6158
|
+
const ids = /* @__PURE__ */ new Set();
|
|
6159
|
+
for (const group of groups) {
|
|
6160
|
+
if (!group.groupId || !GROUP_ID_PATTERN.test(group.groupId)) {
|
|
6161
|
+
throw new TypeError("Every resource group must have a valid 24-character hexadecimal id");
|
|
6162
|
+
}
|
|
6163
|
+
if (ids.has(group.groupId)) throw new TypeError(`Duplicate resource group id: ${group.groupId}`);
|
|
6164
|
+
ids.add(group.groupId);
|
|
6165
|
+
}
|
|
6166
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
6167
|
+
for (const step of this.draft.stepDescriptionList ?? []) {
|
|
6168
|
+
if (step.stepType !== ServiceCheckInWizardStepType.Resource) continue;
|
|
6169
|
+
const groupId = getResourceGroupIdFromStep(step);
|
|
6170
|
+
if (!groupId || !ids.has(groupId)) {
|
|
6171
|
+
throw new TypeError(`Resource step references an unknown resource group: ${groupId ?? ""}`);
|
|
6172
|
+
}
|
|
6173
|
+
if (usedIds.has(groupId)) {
|
|
6174
|
+
throw new TypeError(`Resource group is used by more than one step: ${groupId}`);
|
|
6175
|
+
}
|
|
6176
|
+
usedIds.add(groupId);
|
|
6177
|
+
}
|
|
6178
|
+
}
|
|
6179
|
+
};
|
|
5571
6180
|
|
|
5572
6181
|
// ../../src/resources/services/booking-wizard-expand.ts
|
|
5573
6182
|
function isExistsStrict(n) {
|
|
@@ -5622,31 +6231,36 @@ function expandBookingWizardSteps(service) {
|
|
|
5622
6231
|
return out;
|
|
5623
6232
|
}
|
|
5624
6233
|
|
|
5625
|
-
// ../../src/resources/services/
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
};
|
|
5639
|
-
var StateManagementTypeValues = {
|
|
5640
|
-
Unknown: "UnknownStateManagementType",
|
|
5641
|
-
Auto: "Auto",
|
|
5642
|
-
Manual: "Manual"
|
|
5643
|
-
};
|
|
5644
|
-
var SessionPrecisionTypeValues = {
|
|
5645
|
-
Unknown: "UnknownSessionPrecisionType",
|
|
5646
|
-
None: "SessionPrecisionNone",
|
|
5647
|
-
DateTime: "DateTime",
|
|
5648
|
-
Date: "Date"
|
|
6234
|
+
// ../../src/resources/services/check-in-schedule-hints.ts
|
|
6235
|
+
function isFreeCheckInSlot(period) {
|
|
6236
|
+
return period.from != null && period.to != null && (period.status == null || period.status === "FreeTime");
|
|
6237
|
+
}
|
|
6238
|
+
function getFreeCheckInSlots(response) {
|
|
6239
|
+
return (response?.checkInSchedule ?? []).filter(isFreeCheckInSlot);
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
// ../../src/resources/services/service-order-errors.ts
|
|
6243
|
+
var ServiceOrderConflictErrorNameValues = {
|
|
6244
|
+
ResourceUnavailable: "REQUESTED_RESOURCE_IS_NOT_AVAILABLE",
|
|
6245
|
+
QuantityUnavailable: "REQUESTED_RESOURCE_QUANTITY_IS_NOT_AVAILABLE",
|
|
6246
|
+
ServiceUnavailableAtTime: "SERVICE_IS_NOT_AVAILABLE_AT_TIME"
|
|
5649
6247
|
};
|
|
6248
|
+
function getServiceOrderConflictReason(error) {
|
|
6249
|
+
if (!(error instanceof TorrowHttpError)) return void 0;
|
|
6250
|
+
switch (error.apiErrorName) {
|
|
6251
|
+
case ServiceOrderConflictErrorNameValues.ResourceUnavailable:
|
|
6252
|
+
return "resource-unavailable";
|
|
6253
|
+
case ServiceOrderConflictErrorNameValues.QuantityUnavailable:
|
|
6254
|
+
return "quantity-unavailable";
|
|
6255
|
+
case ServiceOrderConflictErrorNameValues.ServiceUnavailableAtTime:
|
|
6256
|
+
return "service-unavailable-at-time";
|
|
6257
|
+
default:
|
|
6258
|
+
return void 0;
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
function isServiceOrderConflictError(error) {
|
|
6262
|
+
return getServiceOrderConflictReason(error) !== void 0;
|
|
6263
|
+
}
|
|
5650
6264
|
|
|
5651
6265
|
// ../../src/resources/cases/payment-hints.ts
|
|
5652
6266
|
function normalizePaymentUrl(url) {
|
|
@@ -5663,6 +6277,124 @@ function getTicketPaymentUrl(caseItem) {
|
|
|
5663
6277
|
return normalizePaymentUrl(getTicketPaymentUrlRaw(caseItem));
|
|
5664
6278
|
}
|
|
5665
6279
|
|
|
6280
|
+
// ../../src/resources/resources/resource-builder.ts
|
|
6281
|
+
function cloneValue2(value) {
|
|
6282
|
+
if (value instanceof Date) return new Date(value.getTime());
|
|
6283
|
+
if (Array.isArray(value)) return value.map((item) => cloneValue2(item));
|
|
6284
|
+
if (value && typeof value === "object") {
|
|
6285
|
+
const result = {};
|
|
6286
|
+
for (const [key, item] of Object.entries(value)) result[key] = cloneValue2(item);
|
|
6287
|
+
return result;
|
|
6288
|
+
}
|
|
6289
|
+
return value;
|
|
6290
|
+
}
|
|
6291
|
+
function isSameBinding(description, serviceId, resourceGroupId) {
|
|
6292
|
+
return description.id === serviceId && description.resourceGroupId === resourceGroupId;
|
|
6293
|
+
}
|
|
6294
|
+
var ResourceBuilder = class _ResourceBuilder {
|
|
6295
|
+
draft;
|
|
6296
|
+
constructor(body) {
|
|
6297
|
+
this.draft = cloneValue2(body);
|
|
6298
|
+
}
|
|
6299
|
+
static create(body) {
|
|
6300
|
+
return new _ResourceBuilder(body);
|
|
6301
|
+
}
|
|
6302
|
+
static from(resource) {
|
|
6303
|
+
return new _ResourceBuilder(resource);
|
|
6304
|
+
}
|
|
6305
|
+
attachToService(service, resourceGroupId, options) {
|
|
6306
|
+
const serviceId = service.id?.trim();
|
|
6307
|
+
if (!serviceId) throw new TypeError("Service must have a non-empty id");
|
|
6308
|
+
const normalizedGroupId = resourceGroupId.trim();
|
|
6309
|
+
if (!normalizedGroupId) throw new TypeError("resourceGroupId must not be empty");
|
|
6310
|
+
const group = service.resourceGroupList?.find((item) => item.groupId === normalizedGroupId);
|
|
6311
|
+
if (!group) throw new TypeError(`Service resource group not found: ${normalizedGroupId}`);
|
|
6312
|
+
if (!group.usageType) throw new TypeError("Service resource group has no usageType");
|
|
6313
|
+
if (this.draft.usageType != null && this.draft.usageType !== group.usageType) {
|
|
6314
|
+
throw new TypeError("Resource usageType does not match the service resource group");
|
|
6315
|
+
}
|
|
6316
|
+
const descriptions = [...this.draft.serviceDescriptions ?? []];
|
|
6317
|
+
const matching = descriptions.filter(
|
|
6318
|
+
(item) => isSameBinding(item, serviceId, normalizedGroupId)
|
|
6319
|
+
);
|
|
6320
|
+
const current = matching[0];
|
|
6321
|
+
const next = {
|
|
6322
|
+
...current,
|
|
6323
|
+
id: serviceId,
|
|
6324
|
+
serviceName: service.name,
|
|
6325
|
+
resourceGroupId: normalizedGroupId,
|
|
6326
|
+
resourceGroupName: group.groupName,
|
|
6327
|
+
usageAmount: options?.usageAmount === void 0 ? current?.usageAmount : options.usageAmount,
|
|
6328
|
+
sortIndex: options?.sortIndex === void 0 ? current?.sortIndex : options.sortIndex,
|
|
6329
|
+
laterBinding: group.bookingProperties != null
|
|
6330
|
+
};
|
|
6331
|
+
const firstIndex = descriptions.findIndex(
|
|
6332
|
+
(item) => isSameBinding(item, serviceId, normalizedGroupId)
|
|
6333
|
+
);
|
|
6334
|
+
const withoutBinding = descriptions.filter(
|
|
6335
|
+
(item) => !isSameBinding(item, serviceId, normalizedGroupId)
|
|
6336
|
+
);
|
|
6337
|
+
if (firstIndex < 0) withoutBinding.push(next);
|
|
6338
|
+
else withoutBinding.splice(firstIndex, 0, next);
|
|
6339
|
+
this.draft = {
|
|
6340
|
+
...this.draft,
|
|
6341
|
+
usageType: this.draft.usageType ?? group.usageType,
|
|
6342
|
+
serviceDescriptions: withoutBinding
|
|
6343
|
+
};
|
|
6344
|
+
return this;
|
|
6345
|
+
}
|
|
6346
|
+
detachFromService(serviceId, resourceGroupId) {
|
|
6347
|
+
const normalizedServiceId = serviceId.trim();
|
|
6348
|
+
const normalizedGroupId = resourceGroupId.trim();
|
|
6349
|
+
if (!normalizedServiceId) throw new TypeError("serviceId must not be empty");
|
|
6350
|
+
if (!normalizedGroupId) throw new TypeError("resourceGroupId must not be empty");
|
|
6351
|
+
this.draft = {
|
|
6352
|
+
...this.draft,
|
|
6353
|
+
serviceDescriptions: (this.draft.serviceDescriptions ?? []).filter(
|
|
6354
|
+
(item) => !isSameBinding(item, normalizedServiceId, normalizedGroupId)
|
|
6355
|
+
)
|
|
6356
|
+
};
|
|
6357
|
+
return this;
|
|
6358
|
+
}
|
|
6359
|
+
/** Задаёт зависимость или исключение ресурса по id ранее выбранных ресурсов. */
|
|
6360
|
+
setUsageCondition(type, conditionIds) {
|
|
6361
|
+
if (type !== UsageConditionTypeValues.Additional && type !== UsageConditionTypeValues.Exclusion) {
|
|
6362
|
+
throw new TypeError(`Unsupported usage condition type: ${String(type)}`);
|
|
6363
|
+
}
|
|
6364
|
+
const normalizedIds = conditionIds.map((conditionId) => conditionId.trim());
|
|
6365
|
+
if (normalizedIds.length === 0) {
|
|
6366
|
+
throw new TypeError("conditionIds must not be empty");
|
|
6367
|
+
}
|
|
6368
|
+
if (normalizedIds.some((conditionId) => !conditionId)) {
|
|
6369
|
+
throw new TypeError("conditionIds must not contain empty ids");
|
|
6370
|
+
}
|
|
6371
|
+
if (new Set(normalizedIds).size !== normalizedIds.length) {
|
|
6372
|
+
throw new TypeError("conditionIds must not contain duplicates");
|
|
6373
|
+
}
|
|
6374
|
+
this.draft = {
|
|
6375
|
+
...this.draft,
|
|
6376
|
+
usageCondition: {
|
|
6377
|
+
usageConditionType: type,
|
|
6378
|
+
conditionIdList: normalizedIds
|
|
6379
|
+
}
|
|
6380
|
+
};
|
|
6381
|
+
return this;
|
|
6382
|
+
}
|
|
6383
|
+
clearUsageCondition() {
|
|
6384
|
+
this.draft = {
|
|
6385
|
+
...this.draft,
|
|
6386
|
+
usageCondition: {
|
|
6387
|
+
usageConditionType: UsageConditionTypeValues.None,
|
|
6388
|
+
conditionIdList: []
|
|
6389
|
+
}
|
|
6390
|
+
};
|
|
6391
|
+
return this;
|
|
6392
|
+
}
|
|
6393
|
+
build() {
|
|
6394
|
+
return { body: cloneValue2(this.draft) };
|
|
6395
|
+
}
|
|
6396
|
+
};
|
|
6397
|
+
|
|
5666
6398
|
// ../../src/resources/common/device-type.ts
|
|
5667
6399
|
var DeviceTypeValues = {
|
|
5668
6400
|
Unknown: "Unknown",
|
|
@@ -5757,16 +6489,22 @@ export {
|
|
|
5757
6489
|
ParticipationFieldRequirementTypeValues,
|
|
5758
6490
|
ParticipationFieldTypeValues,
|
|
5759
6491
|
PinnedViewsFacade,
|
|
6492
|
+
ProfileTypeValues,
|
|
5760
6493
|
ProfilesFacade,
|
|
5761
6494
|
RawClient,
|
|
5762
6495
|
RelationsFacade,
|
|
5763
6496
|
ReportsFacade,
|
|
6497
|
+
ResourceBuilder,
|
|
5764
6498
|
ResourcesFacade,
|
|
5765
6499
|
SearchFacade,
|
|
5766
6500
|
SendCodeAccountTypeValueList,
|
|
5767
6501
|
SendCodeAccountTypeValues,
|
|
6502
|
+
ServiceBuilder,
|
|
5768
6503
|
ServiceCheckInWizardStepParameterName,
|
|
5769
6504
|
ServiceCheckInWizardStepType,
|
|
6505
|
+
ServiceOrderConflictErrorNameValues,
|
|
6506
|
+
ServiceType,
|
|
6507
|
+
ServiceTypePresetValues,
|
|
5770
6508
|
ServicesFacade,
|
|
5771
6509
|
SessionDurationTypeValues,
|
|
5772
6510
|
SessionPrecisionTypeValues,
|
|
@@ -5775,6 +6513,7 @@ export {
|
|
|
5775
6513
|
ThesaurusFacade,
|
|
5776
6514
|
TimeSelectionTypeValues,
|
|
5777
6515
|
TimeSplitTypeValues,
|
|
6516
|
+
TimeStepUiModeValues,
|
|
5778
6517
|
TimetableViewTypeValues,
|
|
5779
6518
|
TokenStatusValueList,
|
|
5780
6519
|
TokenStatusValues,
|
|
@@ -5784,6 +6523,7 @@ export {
|
|
|
5784
6523
|
TorrowItemTypeValueList,
|
|
5785
6524
|
TorrowItemTypeValues,
|
|
5786
6525
|
TorrowObjectTypeCode,
|
|
6526
|
+
UsageConditionTypeValues,
|
|
5787
6527
|
UsageTypeValues,
|
|
5788
6528
|
UserAccessLevelValues,
|
|
5789
6529
|
UserFacade,
|
|
@@ -5794,11 +6534,24 @@ export {
|
|
|
5794
6534
|
ViewsFacade,
|
|
5795
6535
|
buildContextIconSvg,
|
|
5796
6536
|
buildContextIconSvgBytes,
|
|
6537
|
+
cancelCaseParticipation,
|
|
6538
|
+
communicationHref,
|
|
6539
|
+
createOrder,
|
|
6540
|
+
createServiceSessionDurationProperties,
|
|
5797
6541
|
expandBookingWizardSteps,
|
|
6542
|
+
generateServiceResourceGroupId,
|
|
5798
6543
|
generateTorrowId,
|
|
5799
6544
|
generateTorrowIdForOwner,
|
|
6545
|
+
getCase,
|
|
6546
|
+
getCheckInSchedule,
|
|
5800
6547
|
getContextIconPresetFileName,
|
|
6548
|
+
getFreeCheckInSlots,
|
|
5801
6549
|
getResourceGroupIdFromStep,
|
|
6550
|
+
getService,
|
|
6551
|
+
getServiceOrderConflictReason,
|
|
6552
|
+
getServiceResources,
|
|
6553
|
+
getServiceType,
|
|
6554
|
+
getServiceTypeFromSessionDurationProperties,
|
|
5802
6555
|
getShardFromTorrowId,
|
|
5803
6556
|
getStepParameter,
|
|
5804
6557
|
getTicketPaymentUrl,
|
|
@@ -5812,8 +6565,10 @@ export {
|
|
|
5812
6565
|
isAuthScope,
|
|
5813
6566
|
isContextIconPreset,
|
|
5814
6567
|
isDeviceType,
|
|
6568
|
+
isFreeCheckInSlot,
|
|
5815
6569
|
isItemViewSortCondition,
|
|
5816
6570
|
isSendCodeAccountType,
|
|
6571
|
+
isServiceOrderConflictError,
|
|
5817
6572
|
isStepFlag,
|
|
5818
6573
|
isTokenRespReadyStatus,
|
|
5819
6574
|
isTokenStatus,
|
|
@@ -5829,6 +6584,7 @@ export {
|
|
|
5829
6584
|
parseSendCodeAccountType,
|
|
5830
6585
|
parseTokenStatus,
|
|
5831
6586
|
parseVerificationMethod,
|
|
6587
|
+
resolveCommunicationBrand,
|
|
5832
6588
|
shouldSkipResourceStep,
|
|
5833
6589
|
sortStepDescriptionsByOrder,
|
|
5834
6590
|
torrowObjectTypeToCode,
|