@torrow/sdk-client 0.13.0 → 0.14.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/dist/index.js CHANGED
@@ -9313,6 +9313,611 @@ var RawClient = class {
9313
9313
  }
9314
9314
  };
9315
9315
 
9316
+ // ../../src/resources/common/tags-projection.ts
9317
+ function projectTags(value) {
9318
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
9319
+ return value;
9320
+ }
9321
+ if (!("tags" in value) || value.tags !== null) {
9322
+ return value;
9323
+ }
9324
+ const result = { ...value };
9325
+ Reflect.deleteProperty(result, "tags");
9326
+ return result;
9327
+ }
9328
+
9329
+ // ../../src/resources/common/item-social-projection.ts
9330
+ function projectPersonalInfo(info) {
9331
+ if (info === null || typeof info !== "object" || Array.isArray(info)) {
9332
+ return info;
9333
+ }
9334
+ let result = info;
9335
+ if ("personalReminders" in result && result.personalReminders === null) {
9336
+ result = { ...result };
9337
+ Reflect.deleteProperty(result, "personalReminders");
9338
+ }
9339
+ if ("notificationWayList" in result && result.notificationWayList === null) {
9340
+ result = { ...result };
9341
+ Reflect.deleteProperty(result, "notificationWayList");
9342
+ }
9343
+ return result;
9344
+ }
9345
+ function projectItemSocial(item) {
9346
+ const tagged = projectTags(item);
9347
+ if (tagged === null || typeof tagged !== "object" || Array.isArray(tagged)) {
9348
+ return tagged;
9349
+ }
9350
+ let result = tagged;
9351
+ if ("integrationIds" in result && result.integrationIds === null) {
9352
+ result = { ...result };
9353
+ Reflect.deleteProperty(result, "integrationIds");
9354
+ }
9355
+ if ("personalInfo" in result && result.personalInfo != null) {
9356
+ const personalInfo = projectPersonalInfo(result.personalInfo);
9357
+ if (personalInfo !== result.personalInfo) {
9358
+ return { ...result, personalInfo };
9359
+ }
9360
+ }
9361
+ return result;
9362
+ }
9363
+
9364
+ // ../../src/resources/calendars/read-projection.ts
9365
+ function projectCalendarItem(item) {
9366
+ return projectItemSocial(item);
9367
+ }
9368
+
9369
+ // ../../src/resources/notes/read-projection.ts
9370
+ function projectNoteItem(item) {
9371
+ const result = projectItemSocial(item);
9372
+ if (result === null || typeof result !== "object" || Array.isArray(result) || !("files" in result) || result.files !== null) {
9373
+ return result;
9374
+ }
9375
+ const copy = { ...result };
9376
+ Reflect.deleteProperty(copy, "files");
9377
+ return copy;
9378
+ }
9379
+
9380
+ // ../../src/resources/contacts/read-projection.ts
9381
+ function projectContactItem(item) {
9382
+ return projectReadChild(projectItemSocial(item), "loyaltyCard", projectTorrowItem);
9383
+ }
9384
+
9385
+ // ../../src/resources/contexts/read-projection.ts
9386
+ function projectContextItem(item) {
9387
+ return projectItemSocial(item);
9388
+ }
9389
+
9390
+ // ../../src/resources/common/price-read-projection.ts
9391
+ function projectItemPrice(item) {
9392
+ if (item === null || typeof item !== "object" || Array.isArray(item) || !("priceInfo" in item)) {
9393
+ return item;
9394
+ }
9395
+ const info = item.priceInfo;
9396
+ if (info === null || typeof info !== "object" || Array.isArray(info) || !("settings" in info) || info.settings !== null) {
9397
+ return item;
9398
+ }
9399
+ const priceInfo = { ...info };
9400
+ Reflect.deleteProperty(priceInfo, "settings");
9401
+ return { ...item, priceInfo };
9402
+ }
9403
+
9404
+ // ../../src/resources/cases/read-projection.ts
9405
+ function projectCaseItem(item) {
9406
+ return projectReadChild(projectItemPrice(projectItemSocial(item)), "personalInfo", projectCasePersonalInfo);
9407
+ }
9408
+
9409
+ // ../../src/resources/loyalty-cards/read-projection.ts
9410
+ function projectLoyaltyCardItem(item) {
9411
+ return projectItemSocial(item);
9412
+ }
9413
+
9414
+ // ../../src/resources/loyalty-systems/read-projection.ts
9415
+ var LoyaltySystemReadArrayField = /* @__PURE__ */ ((LoyaltySystemReadArrayField2) => {
9416
+ LoyaltySystemReadArrayField2["ReferralProgramIds"] = "referralProgramIds";
9417
+ LoyaltySystemReadArrayField2["BeginTransactionValues"] = "beginTransactionValues";
9418
+ LoyaltySystemReadArrayField2["AccountingProductNames"] = "accountingProductNames";
9419
+ return LoyaltySystemReadArrayField2;
9420
+ })(LoyaltySystemReadArrayField || {});
9421
+ function projectLoyaltySystemItem(item) {
9422
+ const result = projectItemSocial(item);
9423
+ if (result === null || typeof result !== "object" || Array.isArray(result)) {
9424
+ return result;
9425
+ }
9426
+ let copy;
9427
+ for (const key of Object.values(LoyaltySystemReadArrayField)) {
9428
+ if (Object.hasOwn(result, key) && Reflect.get(result, key) === null) {
9429
+ copy ??= { ...result };
9430
+ Reflect.deleteProperty(copy, key);
9431
+ }
9432
+ }
9433
+ return copy ?? result;
9434
+ }
9435
+
9436
+ // ../../src/resources/services/read-projection.ts
9437
+ var ServiceReadArrayField = /* @__PURE__ */ ((ServiceReadArrayField2) => {
9438
+ ServiceReadArrayField2["ExecutorIdList"] = "executorIdList";
9439
+ ServiceReadArrayField2["ResourceGroupList"] = "resourceGroupList";
9440
+ ServiceReadArrayField2["AppendixList"] = "appendixList";
9441
+ ServiceReadArrayField2["StepDescriptionList"] = "stepDescriptionList";
9442
+ ServiceReadArrayField2["CaseActionList"] = "caseActionList";
9443
+ ServiceReadArrayField2["LoyaltyTransactionPropertiesList"] = "loyaltyTransactionPropertiesList";
9444
+ return ServiceReadArrayField2;
9445
+ })(ServiceReadArrayField || {});
9446
+ function projectServiceItem(item) {
9447
+ const result = projectItemPrice(projectItemSocial(item));
9448
+ if (result === null || typeof result !== "object" || Array.isArray(result)) {
9449
+ return result;
9450
+ }
9451
+ const copy = { ...result };
9452
+ for (const field of Object.values(ServiceReadArrayField)) {
9453
+ if (field in result && result[field] === null) {
9454
+ Reflect.deleteProperty(copy, field);
9455
+ }
9456
+ }
9457
+ return copy;
9458
+ }
9459
+
9460
+ // ../../src/resources/resources/read-projection.ts
9461
+ function projectResourceItem(item) {
9462
+ const result = projectItemPrice(projectItemSocial(item));
9463
+ if (result === null || typeof result !== "object" || Array.isArray(result)) {
9464
+ return result;
9465
+ }
9466
+ let projected = result;
9467
+ for (const key of ["serviceDescriptions", "appendixList", "loyaltyTransactionPropertiesList"]) {
9468
+ if (key in projected && projected[key] === null) {
9469
+ projected = { ...projected };
9470
+ Reflect.deleteProperty(projected, key);
9471
+ }
9472
+ }
9473
+ projected = projectReadChild(projected, "item", projectTorrowItem);
9474
+ projected = projectReadChild(projected, "parentResource", projectTorrowItem);
9475
+ return projected;
9476
+ }
9477
+
9478
+ // ../../src/util/torrow-id.ts
9479
+ var TORROW_OBJECT_ID_HEX_LENGTH = 24;
9480
+ var OBJECT_ID_HEX_LENGTH = TORROW_OBJECT_ID_HEX_LENGTH;
9481
+ var RID_HEX_PATTERN = /^[0-9a-fA-F]{24}$/;
9482
+ var TORROW_ID_HEX_PATTERN = /^[0-9a-fA-F]+$/;
9483
+ function generateRid() {
9484
+ const bytes = new Uint8Array(12);
9485
+ globalThis.crypto.getRandomValues(bytes);
9486
+ let hex = "";
9487
+ for (let i = 0; i < bytes.length; i++) {
9488
+ hex += bytes[i].toString(16).padStart(2, "0");
9489
+ }
9490
+ return hex;
9491
+ }
9492
+ function isValidRid(value) {
9493
+ return typeof value === "string" && RID_HEX_PATTERN.test(value);
9494
+ }
9495
+ var OBJECT_TYPE_HEX_LENGTH = 4;
9496
+ var HEX_RADIX = 16;
9497
+ function unpackTorrowId(torrowId) {
9498
+ const objectId = torrowId.substring(torrowId.length - OBJECT_ID_HEX_LENGTH);
9499
+ const objectTypeString = torrowId.substring(
9500
+ torrowId.length - (OBJECT_ID_HEX_LENGTH + OBJECT_TYPE_HEX_LENGTH),
9501
+ torrowId.length - OBJECT_ID_HEX_LENGTH
9502
+ );
9503
+ const objectType = Number.parseInt(objectTypeString, HEX_RADIX);
9504
+ const shardStartIndex = torrowId.length - (OBJECT_ID_HEX_LENGTH + objectTypeString.length);
9505
+ const shard = shardStartIndex === 0 ? 0 : Number.parseInt(torrowId.substring(0, shardStartIndex), HEX_RADIX);
9506
+ return { shard, objectType, objectId };
9507
+ }
9508
+ function packTorrowId(parts) {
9509
+ const objectType = parts.objectType.toString(HEX_RADIX).padStart(OBJECT_TYPE_HEX_LENGTH, "0");
9510
+ const shard = parts.shard.toString(HEX_RADIX);
9511
+ return `${shard}${objectType}${parts.objectId}`.replace(/^0+/, "");
9512
+ }
9513
+ function getShardFromTorrowId(torrowId) {
9514
+ return unpackTorrowId(torrowId).shard;
9515
+ }
9516
+ var TorrowObjectTypeCode = {
9517
+ User: 2,
9518
+ File: 10,
9519
+ Context: 1001,
9520
+ Contact: 1002,
9521
+ Note: 1003,
9522
+ Case: 1004,
9523
+ Service: 1005,
9524
+ Resource: 1009,
9525
+ Calendar: 1010,
9526
+ LoyaltySystem: 1019,
9527
+ LoyaltyCard: 1020
9528
+ };
9529
+ var STRING_TYPE_TO_CODE = {
9530
+ User: TorrowObjectTypeCode.User,
9531
+ File: TorrowObjectTypeCode.File,
9532
+ Context: TorrowObjectTypeCode.Context,
9533
+ Contact: TorrowObjectTypeCode.Contact,
9534
+ Note: TorrowObjectTypeCode.Note,
9535
+ Case: TorrowObjectTypeCode.Case,
9536
+ Service: TorrowObjectTypeCode.Service,
9537
+ Resource: TorrowObjectTypeCode.Resource,
9538
+ Calendar: TorrowObjectTypeCode.Calendar,
9539
+ LoyaltySystem: TorrowObjectTypeCode.LoyaltySystem,
9540
+ LoyaltyCard: TorrowObjectTypeCode.LoyaltyCard
9541
+ };
9542
+ var CODE_TO_STRING_TYPE = /* @__PURE__ */ new Map();
9543
+ for (const [objectType, code] of Object.entries(STRING_TYPE_TO_CODE)) {
9544
+ if (CODE_TO_STRING_TYPE.has(code)) {
9545
+ throw new Error(`Duplicate Torrow object type code: ${code}`);
9546
+ }
9547
+ CODE_TO_STRING_TYPE.set(code, objectType);
9548
+ }
9549
+ var TorrowIdError = class extends TypeError {
9550
+ reason;
9551
+ objectTypeCode;
9552
+ constructor(reason, message, objectTypeCode) {
9553
+ super(message);
9554
+ this.name = "TorrowIdError";
9555
+ this.reason = reason;
9556
+ this.objectTypeCode = objectTypeCode;
9557
+ }
9558
+ };
9559
+ function unpackCanonicalTorrowId(torrowId) {
9560
+ if (typeof torrowId !== "string" || torrowId.length <= OBJECT_ID_HEX_LENGTH || !TORROW_ID_HEX_PATTERN.test(torrowId) || !RID_HEX_PATTERN.test(torrowId.slice(-OBJECT_ID_HEX_LENGTH))) {
9561
+ throw new TorrowIdError("invalid-id", "Invalid Torrow ID format");
9562
+ }
9563
+ const unpacked = unpackTorrowId(torrowId);
9564
+ if (!Number.isSafeInteger(unpacked.shard) || unpacked.shard < 0 || !Number.isSafeInteger(unpacked.objectType) || unpacked.objectType < 0 || packTorrowId(unpacked).toLowerCase() !== torrowId.toLowerCase()) {
9565
+ throw new TorrowIdError("invalid-id", "Non-canonical Torrow ID");
9566
+ }
9567
+ return unpacked;
9568
+ }
9569
+ function getTorrowObjectTypeFromTorrowId(torrowId) {
9570
+ const { objectType } = unpackCanonicalTorrowId(torrowId);
9571
+ const result = CODE_TO_STRING_TYPE.get(objectType);
9572
+ if (result === void 0) {
9573
+ throw new TorrowIdError("unknown-object-type-code", `Unknown Torrow object type code: ${objectType}`, objectType);
9574
+ }
9575
+ return result;
9576
+ }
9577
+ function torrowObjectTypeToCode(objectType) {
9578
+ const code = STRING_TYPE_TO_CODE[objectType];
9579
+ if (code === void 0) {
9580
+ throw new Error(`torrowObjectTypeToCode: unsupported object type "${objectType}"`);
9581
+ }
9582
+ return code;
9583
+ }
9584
+ function generateTorrowId(objectTypeCode, shard) {
9585
+ return packTorrowId({
9586
+ shard,
9587
+ objectType: objectTypeCode,
9588
+ objectId: generateRid()
9589
+ });
9590
+ }
9591
+ function generateTorrowIdForOwner(objectTypeCode, ownerTorrowId) {
9592
+ return generateTorrowId(objectTypeCode, getShardFromTorrowId(ownerTorrowId));
9593
+ }
9594
+
9595
+ // ../../src/resources/common/item-type.ts
9596
+ var TorrowItemDefinitions = {
9597
+ Contact: { domain: "contacts", objectTypeCode: TorrowObjectTypeCode.Contact },
9598
+ Note: { domain: "notes", objectTypeCode: TorrowObjectTypeCode.Note },
9599
+ Context: { domain: "contexts", objectTypeCode: TorrowObjectTypeCode.Context },
9600
+ Resource: { domain: "resources", objectTypeCode: TorrowObjectTypeCode.Resource },
9601
+ Service: { domain: "services", objectTypeCode: TorrowObjectTypeCode.Service },
9602
+ Case: { domain: "cases", objectTypeCode: TorrowObjectTypeCode.Case },
9603
+ Calendar: { domain: "calendars", objectTypeCode: TorrowObjectTypeCode.Calendar },
9604
+ LoyaltyCard: {
9605
+ domain: "loyaltycards",
9606
+ objectTypeCode: TorrowObjectTypeCode.LoyaltyCard
9607
+ },
9608
+ LoyaltySystem: {
9609
+ domain: "loyaltysystems",
9610
+ objectTypeCode: TorrowObjectTypeCode.LoyaltySystem
9611
+ }
9612
+ };
9613
+ var TorrowItemTypeValues = {
9614
+ Contact: "Contact",
9615
+ Note: "Note",
9616
+ Context: "Context",
9617
+ Resource: "Resource",
9618
+ Service: "Service",
9619
+ Case: "Case",
9620
+ Calendar: "Calendar",
9621
+ LoyaltyCard: "LoyaltyCard",
9622
+ LoyaltySystem: "LoyaltySystem"
9623
+ };
9624
+ var TorrowItemTypeValueList = Object.values(TorrowItemTypeValues);
9625
+ function isTorrowItemType(value) {
9626
+ return TorrowItemTypeValueList.includes(value);
9627
+ }
9628
+ function getTorrowItemDomain(itemType) {
9629
+ return TorrowItemDefinitions[itemType].domain;
9630
+ }
9631
+
9632
+ // ../../src/resources/common/item-type-resolver.ts
9633
+ function getTorrowItemTypeFromTorrowId(torrowId) {
9634
+ const objectType = getTorrowObjectTypeFromTorrowId(torrowId);
9635
+ if (!isTorrowItemType(objectType)) {
9636
+ throw new TorrowIdError("unsupported-item-type", `Torrow object type ${objectType} is not an item type`);
9637
+ }
9638
+ return objectType;
9639
+ }
9640
+ function getTorrowItemTypeFromTorrowIds(torrowIds) {
9641
+ const firstId = torrowIds[0];
9642
+ if (firstId === void 0) {
9643
+ throw new TorrowIdError("empty-id-list", "Torrow ID list must not be empty");
9644
+ }
9645
+ const itemType = getTorrowItemTypeFromTorrowId(firstId);
9646
+ for (const torrowId of torrowIds.slice(1)) {
9647
+ if (getTorrowItemTypeFromTorrowId(torrowId) !== itemType) {
9648
+ throw new TorrowIdError("mixed-item-types", "All Torrow IDs must have the same item type");
9649
+ }
9650
+ }
9651
+ return itemType;
9652
+ }
9653
+ function getTorrowItemDomainFromTorrowId(torrowId) {
9654
+ return getTorrowItemDomain(getTorrowItemTypeFromTorrowId(torrowId));
9655
+ }
9656
+ function getTorrowItemDomainFromTorrowIds(torrowIds) {
9657
+ return getTorrowItemDomain(getTorrowItemTypeFromTorrowIds(torrowIds));
9658
+ }
9659
+
9660
+ // ../../src/resources/common/read-projection.ts
9661
+ function projectReadChild(value, key, project) {
9662
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
9663
+ return value;
9664
+ }
9665
+ const child = value[key];
9666
+ if (child === null || child === void 0) {
9667
+ return value;
9668
+ }
9669
+ return { ...value, [key]: project(child) };
9670
+ }
9671
+ function projectReadList(values, project) {
9672
+ return Array.isArray(values) ? values.map((item) => item == null ? item : project(item)) : values;
9673
+ }
9674
+ function projectTorrowItem(value) {
9675
+ if (value === null || typeof value !== "object" || !("id" in value) || typeof value.id !== "string") {
9676
+ return projectItemSocial(value);
9677
+ }
9678
+ let itemType;
9679
+ try {
9680
+ itemType = getTorrowItemTypeFromTorrowId(value.id);
9681
+ } catch {
9682
+ return projectItemSocial(value);
9683
+ }
9684
+ switch (itemType) {
9685
+ case "Note" /* Note */:
9686
+ return projectNoteItem(value);
9687
+ case "Contact" /* Contact */:
9688
+ return projectContactItem(value);
9689
+ case "Context" /* Context */:
9690
+ return projectContextItem(value);
9691
+ case "Calendar" /* Calendar */:
9692
+ return projectCalendarItem(value);
9693
+ case "Case" /* Case */:
9694
+ return projectCaseItem(value);
9695
+ case "LoyaltyCard" /* LoyaltyCard */:
9696
+ return projectLoyaltyCardItem(value);
9697
+ case "LoyaltySystem" /* LoyaltySystem */:
9698
+ return projectLoyaltySystemItem(value);
9699
+ case "Service" /* Service */:
9700
+ return projectServiceItem(value);
9701
+ case "Resource" /* Resource */:
9702
+ return projectResourceItem(value);
9703
+ }
9704
+ return projectItemSocial(value);
9705
+ }
9706
+ var projectItemLink = projectTags;
9707
+ function projectNoteView(value) {
9708
+ let result = value;
9709
+ result = projectReadChild(result, "itemLink", projectItemLink);
9710
+ result = projectReadChild(result, "itemObject", projectNoteItem);
9711
+ return result;
9712
+ }
9713
+ function projectContactView(value) {
9714
+ let result = value;
9715
+ result = projectReadChild(result, "itemLink", projectItemLink);
9716
+ result = projectReadChild(result, "itemObject", projectContactItem);
9717
+ return result;
9718
+ }
9719
+ function projectContextView(value) {
9720
+ let result = value;
9721
+ result = projectReadChild(result, "itemLink", projectItemLink);
9722
+ result = projectReadChild(result, "itemObject", projectContextItem);
9723
+ return result;
9724
+ }
9725
+ function projectCalendarView(value) {
9726
+ let result = value;
9727
+ result = projectReadChild(result, "itemLink", projectItemLink);
9728
+ result = projectReadChild(result, "itemObject", projectCalendarItem);
9729
+ return result;
9730
+ }
9731
+ function projectCaseView(value) {
9732
+ let result = value;
9733
+ result = projectReadChild(result, "itemLink", projectItemLink);
9734
+ result = projectReadChild(result, "itemObject", projectCaseItem);
9735
+ return result;
9736
+ }
9737
+ function projectLoyaltyCardView(value) {
9738
+ let result = value;
9739
+ result = projectReadChild(result, "itemLink", projectItemLink);
9740
+ result = projectReadChild(result, "itemObject", projectLoyaltyCardItem);
9741
+ return result;
9742
+ }
9743
+ function projectLoyaltySystemView(value) {
9744
+ let result = value;
9745
+ result = projectReadChild(result, "itemLink", projectItemLink);
9746
+ result = projectReadChild(result, "itemObject", projectLoyaltySystemItem);
9747
+ return result;
9748
+ }
9749
+ function projectServiceView(value) {
9750
+ let result = projectTags(value);
9751
+ result = projectReadChild(result, "itemLink", projectItemLink);
9752
+ result = projectReadChild(result, "itemObject", projectServiceItem);
9753
+ return result;
9754
+ }
9755
+ function projectResourceView(value) {
9756
+ let result = projectTags(value);
9757
+ result = projectReadChild(result, "itemLink", projectItemLink);
9758
+ result = projectReadChild(result, "itemObject", projectResourceItem);
9759
+ return result;
9760
+ }
9761
+ function projectCasePersonalInfo(value) {
9762
+ let result = projectPersonalInfo(value);
9763
+ result = projectReadChild(result, "ticketResource", projectResourceItem);
9764
+ result = projectReadChild(result, "paymentResource", projectResourceItem);
9765
+ return result;
9766
+ }
9767
+ function projectParticipantView(value) {
9768
+ let result = value;
9769
+ result = projectReadChild(result, "itemLink", projectItemLink);
9770
+ result = projectReadChild(result, "itemObject", projectContactItem);
9771
+ return result;
9772
+ }
9773
+ function projectCaseParticipantView(value) {
9774
+ let result = value;
9775
+ result = projectReadChild(result, "itemLink", projectItemLink);
9776
+ result = projectReadChild(result, "itemObject", projectContactItem);
9777
+ result = projectReadChild(result, "ticketResource", projectResourceItem);
9778
+ result = projectReadChild(result, "paymentResource", projectResourceItem);
9779
+ return result;
9780
+ }
9781
+ function projectTimetableCase(value) {
9782
+ let result = value;
9783
+ result = projectReadChild(result, "itemLink", projectItemLink);
9784
+ result = projectReadChild(result, "itemObject", projectCaseItem);
9785
+ return result;
9786
+ }
9787
+ function projectItemView(value) {
9788
+ let result = value;
9789
+ result = projectReadChild(result, "itemLink", projectItemLink);
9790
+ result = projectReadChild(result, "itemObject", projectTorrowItem);
9791
+ return result;
9792
+ }
9793
+ function projectFeedback(value) {
9794
+ let result = value;
9795
+ result = projectReadChild(result, "author", projectTorrowItem);
9796
+ return result;
9797
+ }
9798
+ function projectItemFeedback(value) {
9799
+ let result = value;
9800
+ result = projectReadChild(result, "feedback", projectFeedback);
9801
+ return result;
9802
+ }
9803
+ function projectUserFeedback(value) {
9804
+ let result = value;
9805
+ result = projectReadChild(result, "itemFeedback", projectItemFeedback);
9806
+ return result;
9807
+ }
9808
+ function projectGroupStatus(value) {
9809
+ let result = value;
9810
+ result = projectReadChild(result, "group", projectTorrowItem);
9811
+ return result;
9812
+ }
9813
+ function projectOrderResp(value) {
9814
+ let result = projectTags(value);
9815
+ result = projectReadChild(result, "order", projectCaseItem);
9816
+ result = projectReadChild(result, "personalInfo", projectCasePersonalInfo);
9817
+ return result;
9818
+ }
9819
+ function projectPickOrderResp(value) {
9820
+ let result = value;
9821
+ result = projectReadChild(result, "orderCase", projectCaseItem);
9822
+ return result;
9823
+ }
9824
+ function projectReturnOrderResp(value) {
9825
+ let result = value;
9826
+ result = projectReadChild(result, "orderCase", projectCaseItem);
9827
+ return result;
9828
+ }
9829
+ function projectExportGraph(value) {
9830
+ let result = value;
9831
+ result = projectReadChild(
9832
+ result,
9833
+ "items",
9834
+ (items) => projectReadList(items, (dto) => projectTorrowItem(dto))
9835
+ );
9836
+ result = projectReadChild(
9837
+ result,
9838
+ "views",
9839
+ (items) => projectReadList(items, (dto) => projectItemView(dto))
9840
+ );
9841
+ result = projectReadChild(
9842
+ result,
9843
+ "timetableCases",
9844
+ (items) => projectReadList(items, (dto) => projectTimetableCase(dto))
9845
+ );
9846
+ return result;
9847
+ }
9848
+ function projectSearchServiceResourcesResp(value) {
9849
+ let result = value;
9850
+ result = projectReadChild(
9851
+ result,
9852
+ "serviceResources",
9853
+ (items) => projectReadList(items, (dto) => projectResourceView(dto))
9854
+ );
9855
+ return result;
9856
+ }
9857
+ function projectWorkloadInfo(value) {
9858
+ let result = value;
9859
+ result = projectReadChild(result, "item", projectTorrowItem);
9860
+ result = projectReadChild(
9861
+ result,
9862
+ "timetable",
9863
+ (items) => projectReadList(items, (dto) => projectTimetableCase(dto))
9864
+ );
9865
+ return result;
9866
+ }
9867
+ function projectGetServiceWorkloadInfoResp(value) {
9868
+ let result = value;
9869
+ result = projectReadChild(
9870
+ result,
9871
+ "workloadInfoList",
9872
+ (items) => projectReadList(items, (dto) => projectWorkloadInfo(dto))
9873
+ );
9874
+ return result;
9875
+ }
9876
+ function projectTransactionInfo(value) {
9877
+ let result = value;
9878
+ result = projectReadChild(result, "basisItem", projectTorrowItem);
9879
+ return result;
9880
+ }
9881
+ function projectAccountingTransaction(value) {
9882
+ let result = value;
9883
+ result = projectReadChild(result, "transactionInfo", projectTransactionInfo);
9884
+ return result;
9885
+ }
9886
+ function projectAnnouncementInfo(value) {
9887
+ let result = value;
9888
+ result = projectReadChild(result, "itemNoteView", projectNoteView);
9889
+ result = projectReadChild(result, "itemContactView", projectContactView);
9890
+ result = projectReadChild(result, "itemContextView", projectContextView);
9891
+ result = projectReadChild(result, "itemCalendarView", projectCalendarView);
9892
+ result = projectReadChild(result, "itemCaseView", projectCaseView);
9893
+ result = projectReadChild(result, "itemLoyaltyCardView", projectLoyaltyCardView);
9894
+ result = projectReadChild(result, "itemLoyaltySystemView", projectLoyaltySystemView);
9895
+ result = projectReadChild(result, "itemServiceView", projectServiceView);
9896
+ result = projectReadChild(result, "itemResourceView", projectResourceView);
9897
+ result = projectReadChild(result, "senderProfileView", projectContactView);
9898
+ result = projectReadChild(result, "recipientProfileView", projectContactView);
9899
+ return result;
9900
+ }
9901
+ function projectActionHistoryInfo(value) {
9902
+ let result = value;
9903
+ result = projectReadChild(result, "itemNoteView", projectNoteView);
9904
+ result = projectReadChild(result, "itemContactView", projectContactView);
9905
+ result = projectReadChild(result, "itemContextView", projectContextView);
9906
+ result = projectReadChild(result, "itemCalendarView", projectCalendarView);
9907
+ result = projectReadChild(result, "itemCaseView", projectCaseView);
9908
+ result = projectReadChild(result, "itemLoyaltyCardView", projectLoyaltyCardView);
9909
+ result = projectReadChild(result, "itemLoyaltySystemView", projectLoyaltySystemView);
9910
+ result = projectReadChild(result, "itemServiceView", projectServiceView);
9911
+ result = projectReadChild(result, "itemResourceView", projectResourceView);
9912
+ result = projectReadChild(result, "userProfileView", projectContactView);
9913
+ result = projectReadChild(
9914
+ result,
9915
+ "correspondentProfileViewList",
9916
+ (items) => projectReadList(items, (dto) => projectContactView(dto))
9917
+ );
9918
+ return result;
9919
+ }
9920
+
9316
9921
  // ../../src/resources/common/facade-response-unwrap.ts
9317
9922
  function unwrapDeleteCount(resp) {
9318
9923
  if (resp == null || typeof resp !== "object") {
@@ -9569,183 +10174,66 @@ function validateFullItem(value, itemId) {
9569
10174
  throw fileMetadataError("InvalidResponse" /* InvalidResponse */);
9570
10175
  }
9571
10176
  if (content === "NoRights" /* NoRights */) {
9572
- throw fileMetadataError("AccessDenied" /* AccessDenied */);
9573
- }
9574
- if (content !== "Full" /* Full */) {
9575
- throw fileMetadataError(
9576
- "InsufficientData" /* InsufficientData */,
9577
- content === "SubscriptionIsNotValid" /* SubscriptionIsNotValid */ ? "SubscriptionIsNotValid" /* SubscriptionIsNotValid */ : "ContentTypeUnavailable" /* ContentTypeUnavailable */
9578
- );
9579
- }
9580
- }
9581
- async function readSelectedFileMetadata(options) {
9582
- let failureAt = "ValidateInput" /* ValidateInput */;
9583
- try {
9584
- validateFileMetadataId(options.itemId);
9585
- options.validateInput?.();
9586
- failureAt = "ReadItem" /* ReadItem */;
9587
- const item = await options.readItem(options.itemId, options.signal);
9588
- failureAt = "ValidateItem" /* ValidateItem */;
9589
- validateFullItem(item, options.itemId);
9590
- const file2 = options.selectFile(item);
9591
- if (file2 == null) {
9592
- return null;
9593
- }
9594
- validateFileReference(file2);
9595
- return file2;
9596
- } catch (cause) {
9597
- const error = cause instanceof TorrowSdkError ? cause : new TorrowSdkError({ category: "Unknown" /* Unknown */, sensitive: { cause } });
9598
- throw error.withContext({ operation: options.operation, failureAt });
9599
- }
9600
- }
9601
- async function readOptionalFileMetadata(options) {
9602
- let failureAt = "ValidateInput" /* ValidateInput */;
9603
- try {
9604
- validateFileMetadataId(options.itemId);
9605
- failureAt = "ReadItem" /* ReadItem */;
9606
- const item = await options.readItem(options.itemId, options.signal);
9607
- failureAt = "ValidateItem" /* ValidateItem */;
9608
- validateFullItem(item, options.itemId);
9609
- if (!options.hasFile(item)) {
9610
- return null;
9611
- }
9612
- failureAt = "ReadMetadata" /* ReadMetadata */;
9613
- if (options.signal?.aborted) {
9614
- throw new TorrowSdkError({
9615
- category: "Cancelled" /* Cancelled */,
9616
- request: "NotStarted" /* NotStarted */
9617
- });
9618
- }
9619
- const metadata = await options.readMetadata();
9620
- failureAt = "ValidateMetadata" /* ValidateMetadata */;
9621
- if (!record2(metadata)) {
9622
- throw fileMetadataError("InvalidResponse" /* InvalidResponse */);
9623
- }
9624
- if (metadata.id != null && (typeof metadata.id !== "string" || !metadata.id.trim() || options.expectedFileId !== void 0 && metadata.id !== options.expectedFileId)) {
9625
- throw fileMetadataError("InvalidResponse" /* InvalidResponse */);
9626
- }
9627
- return metadata;
9628
- } catch (cause) {
9629
- const error = cause instanceof TorrowSdkError ? cause : new TorrowSdkError({ category: "Unknown" /* Unknown */, sensitive: { cause } });
9630
- throw error.withContext({ operation: options.operation, failureAt });
9631
- }
9632
- }
9633
-
9634
- // ../../src/util/torrow-id.ts
9635
- var TORROW_OBJECT_ID_HEX_LENGTH = 24;
9636
- var OBJECT_ID_HEX_LENGTH = TORROW_OBJECT_ID_HEX_LENGTH;
9637
- var RID_HEX_PATTERN = /^[0-9a-fA-F]{24}$/;
9638
- var TORROW_ID_HEX_PATTERN = /^[0-9a-fA-F]+$/;
9639
- function generateRid() {
9640
- const bytes = new Uint8Array(12);
9641
- globalThis.crypto.getRandomValues(bytes);
9642
- let hex = "";
9643
- for (let i = 0; i < bytes.length; i++) {
9644
- hex += bytes[i].toString(16).padStart(2, "0");
9645
- }
9646
- return hex;
9647
- }
9648
- function isValidRid(value) {
9649
- return typeof value === "string" && RID_HEX_PATTERN.test(value);
9650
- }
9651
- var OBJECT_TYPE_HEX_LENGTH = 4;
9652
- var HEX_RADIX = 16;
9653
- function unpackTorrowId(torrowId) {
9654
- const objectId = torrowId.substring(torrowId.length - OBJECT_ID_HEX_LENGTH);
9655
- const objectTypeString = torrowId.substring(
9656
- torrowId.length - (OBJECT_ID_HEX_LENGTH + OBJECT_TYPE_HEX_LENGTH),
9657
- torrowId.length - OBJECT_ID_HEX_LENGTH
9658
- );
9659
- const objectType = Number.parseInt(objectTypeString, HEX_RADIX);
9660
- const shardStartIndex = torrowId.length - (OBJECT_ID_HEX_LENGTH + objectTypeString.length);
9661
- const shard = shardStartIndex === 0 ? 0 : Number.parseInt(torrowId.substring(0, shardStartIndex), HEX_RADIX);
9662
- return { shard, objectType, objectId };
9663
- }
9664
- function packTorrowId(parts) {
9665
- const objectType = parts.objectType.toString(HEX_RADIX).padStart(OBJECT_TYPE_HEX_LENGTH, "0");
9666
- const shard = parts.shard.toString(HEX_RADIX);
9667
- return `${shard}${objectType}${parts.objectId}`.replace(/^0+/, "");
9668
- }
9669
- function getShardFromTorrowId(torrowId) {
9670
- return unpackTorrowId(torrowId).shard;
9671
- }
9672
- var TorrowObjectTypeCode = {
9673
- User: 2,
9674
- File: 10,
9675
- Context: 1001,
9676
- Contact: 1002,
9677
- Note: 1003,
9678
- Case: 1004,
9679
- Service: 1005,
9680
- Resource: 1009,
9681
- Calendar: 1010,
9682
- LoyaltySystem: 1019,
9683
- LoyaltyCard: 1020
9684
- };
9685
- var STRING_TYPE_TO_CODE = {
9686
- User: TorrowObjectTypeCode.User,
9687
- File: TorrowObjectTypeCode.File,
9688
- Context: TorrowObjectTypeCode.Context,
9689
- Contact: TorrowObjectTypeCode.Contact,
9690
- Note: TorrowObjectTypeCode.Note,
9691
- Case: TorrowObjectTypeCode.Case,
9692
- Service: TorrowObjectTypeCode.Service,
9693
- Resource: TorrowObjectTypeCode.Resource,
9694
- Calendar: TorrowObjectTypeCode.Calendar,
9695
- LoyaltySystem: TorrowObjectTypeCode.LoyaltySystem,
9696
- LoyaltyCard: TorrowObjectTypeCode.LoyaltyCard
9697
- };
9698
- var CODE_TO_STRING_TYPE = /* @__PURE__ */ new Map();
9699
- for (const [objectType, code] of Object.entries(STRING_TYPE_TO_CODE)) {
9700
- if (CODE_TO_STRING_TYPE.has(code)) {
9701
- throw new Error(`Duplicate Torrow object type code: ${code}`);
9702
- }
9703
- CODE_TO_STRING_TYPE.set(code, objectType);
9704
- }
9705
- var TorrowIdError = class extends TypeError {
9706
- reason;
9707
- objectTypeCode;
9708
- constructor(reason, message, objectTypeCode) {
9709
- super(message);
9710
- this.name = "TorrowIdError";
9711
- this.reason = reason;
9712
- this.objectTypeCode = objectTypeCode;
9713
- }
9714
- };
9715
- function unpackCanonicalTorrowId(torrowId) {
9716
- if (typeof torrowId !== "string" || torrowId.length <= OBJECT_ID_HEX_LENGTH || !TORROW_ID_HEX_PATTERN.test(torrowId) || !RID_HEX_PATTERN.test(torrowId.slice(-OBJECT_ID_HEX_LENGTH))) {
9717
- throw new TorrowIdError("invalid-id", "Invalid Torrow ID format");
9718
- }
9719
- const unpacked = unpackTorrowId(torrowId);
9720
- if (!Number.isSafeInteger(unpacked.shard) || unpacked.shard < 0 || !Number.isSafeInteger(unpacked.objectType) || unpacked.objectType < 0 || packTorrowId(unpacked).toLowerCase() !== torrowId.toLowerCase()) {
9721
- throw new TorrowIdError("invalid-id", "Non-canonical Torrow ID");
10177
+ throw fileMetadataError("AccessDenied" /* AccessDenied */);
9722
10178
  }
9723
- return unpacked;
9724
- }
9725
- function getTorrowObjectTypeFromTorrowId(torrowId) {
9726
- const { objectType } = unpackCanonicalTorrowId(torrowId);
9727
- const result = CODE_TO_STRING_TYPE.get(objectType);
9728
- if (result === void 0) {
9729
- throw new TorrowIdError("unknown-object-type-code", `Unknown Torrow object type code: ${objectType}`, objectType);
10179
+ if (content !== "Full" /* Full */) {
10180
+ throw fileMetadataError(
10181
+ "InsufficientData" /* InsufficientData */,
10182
+ content === "SubscriptionIsNotValid" /* SubscriptionIsNotValid */ ? "SubscriptionIsNotValid" /* SubscriptionIsNotValid */ : "ContentTypeUnavailable" /* ContentTypeUnavailable */
10183
+ );
9730
10184
  }
9731
- return result;
9732
10185
  }
9733
- function torrowObjectTypeToCode(objectType) {
9734
- const code = STRING_TYPE_TO_CODE[objectType];
9735
- if (code === void 0) {
9736
- throw new Error(`torrowObjectTypeToCode: unsupported object type "${objectType}"`);
10186
+ async function readSelectedFileMetadata(options) {
10187
+ let failureAt = "ValidateInput" /* ValidateInput */;
10188
+ try {
10189
+ validateFileMetadataId(options.itemId);
10190
+ options.validateInput?.();
10191
+ failureAt = "ReadItem" /* ReadItem */;
10192
+ const item = await options.readItem(options.itemId, options.signal);
10193
+ failureAt = "ValidateItem" /* ValidateItem */;
10194
+ validateFullItem(item, options.itemId);
10195
+ const file2 = options.selectFile(item);
10196
+ if (file2 == null) {
10197
+ return null;
10198
+ }
10199
+ validateFileReference(file2);
10200
+ return file2;
10201
+ } catch (cause) {
10202
+ const error = cause instanceof TorrowSdkError ? cause : new TorrowSdkError({ category: "Unknown" /* Unknown */, sensitive: { cause } });
10203
+ throw error.withContext({ operation: options.operation, failureAt });
9737
10204
  }
9738
- return code;
9739
- }
9740
- function generateTorrowId(objectTypeCode, shard) {
9741
- return packTorrowId({
9742
- shard,
9743
- objectType: objectTypeCode,
9744
- objectId: generateRid()
9745
- });
9746
10205
  }
9747
- function generateTorrowIdForOwner(objectTypeCode, ownerTorrowId) {
9748
- return generateTorrowId(objectTypeCode, getShardFromTorrowId(ownerTorrowId));
10206
+ async function readOptionalFileMetadata(options) {
10207
+ let failureAt = "ValidateInput" /* ValidateInput */;
10208
+ try {
10209
+ validateFileMetadataId(options.itemId);
10210
+ failureAt = "ReadItem" /* ReadItem */;
10211
+ const item = await options.readItem(options.itemId, options.signal);
10212
+ failureAt = "ValidateItem" /* ValidateItem */;
10213
+ validateFullItem(item, options.itemId);
10214
+ if (!options.hasFile(item)) {
10215
+ return null;
10216
+ }
10217
+ failureAt = "ReadMetadata" /* ReadMetadata */;
10218
+ if (options.signal?.aborted) {
10219
+ throw new TorrowSdkError({
10220
+ category: "Cancelled" /* Cancelled */,
10221
+ request: "NotStarted" /* NotStarted */
10222
+ });
10223
+ }
10224
+ const metadata = await options.readMetadata();
10225
+ failureAt = "ValidateMetadata" /* ValidateMetadata */;
10226
+ if (!record2(metadata)) {
10227
+ throw fileMetadataError("InvalidResponse" /* InvalidResponse */);
10228
+ }
10229
+ if (metadata.id != null && (typeof metadata.id !== "string" || !metadata.id.trim() || options.expectedFileId !== void 0 && metadata.id !== options.expectedFileId)) {
10230
+ throw fileMetadataError("InvalidResponse" /* InvalidResponse */);
10231
+ }
10232
+ return metadata;
10233
+ } catch (cause) {
10234
+ const error = cause instanceof TorrowSdkError ? cause : new TorrowSdkError({ category: "Unknown" /* Unknown */, sensitive: { cause } });
10235
+ throw error.withContext({ operation: options.operation, failureAt });
10236
+ }
9749
10237
  }
9750
10238
 
9751
10239
  // ../../src/resources/common/item-social-facet-base.ts
@@ -9758,6 +10246,30 @@ var TorrowItemCoreFacade = class {
9758
10246
  http;
9759
10247
  basePath;
9760
10248
  socialOpts;
10249
+ projectReadItem(item) {
10250
+ switch (this.itemObjectTypeCode) {
10251
+ case TorrowObjectTypeCode.Contact:
10252
+ return projectContactItem(item);
10253
+ case TorrowObjectTypeCode.Note:
10254
+ return projectNoteItem(item);
10255
+ case TorrowObjectTypeCode.Context:
10256
+ return projectContextItem(item);
10257
+ case TorrowObjectTypeCode.Calendar:
10258
+ return projectCalendarItem(item);
10259
+ case TorrowObjectTypeCode.Case:
10260
+ return projectCaseItem(item);
10261
+ case TorrowObjectTypeCode.LoyaltyCard:
10262
+ return projectLoyaltyCardItem(item);
10263
+ case TorrowObjectTypeCode.LoyaltySystem:
10264
+ return projectLoyaltySystemItem(item);
10265
+ case TorrowObjectTypeCode.Service:
10266
+ return projectServiceItem(item);
10267
+ case TorrowObjectTypeCode.Resource:
10268
+ return projectResourceItem(item);
10269
+ default:
10270
+ return projectTorrowItem(item);
10271
+ }
10272
+ }
9761
10273
  /**
9762
10274
  * Id вложения (presigned image/file) — тип **File**.
9763
10275
  * `ownerTorrowId`: profileId, userId или id item того же пользователя (shard).
@@ -9845,7 +10357,7 @@ var TorrowItemCoreFacade = class {
9845
10357
  path: `${this.basePath}/${encodePathSegment(torrowId)}/participants`,
9846
10358
  query: { ...query ?? {} },
9847
10359
  signal: options?.signal
9848
- });
10360
+ }).then((items) => projectReadList(items, (dto) => projectParticipantView(dto)));
9849
10361
  }
9850
10362
  /**
9851
10363
  * `POST /api/v1/{domain}/{torrowId}/generatesecuritytoken` — токен для внешней ссылки.
@@ -9906,7 +10418,7 @@ var TorrowItemCoreFacade = class {
9906
10418
  path: `${this.basePath}/${encodePathSegment(torrowId)}/group/set`,
9907
10419
  body,
9908
10420
  signal: options?.signal
9909
- });
10421
+ }).then((dto) => projectTorrowItem(dto));
9910
10422
  }
9911
10423
  /** `PUT /api/v1/{domain}/{torrowId}/group/unset` */
9912
10424
  unsetGroup(torrowId, body, options) {
@@ -9915,7 +10427,7 @@ var TorrowItemCoreFacade = class {
9915
10427
  path: `${this.basePath}/${encodePathSegment(torrowId)}/group/unset`,
9916
10428
  body,
9917
10429
  signal: options?.signal
9918
- });
10430
+ }).then((dto) => projectTorrowItem(dto));
9919
10431
  }
9920
10432
  /** `PUT /api/v1/{domain}/{torrowId}/tags` */
9921
10433
  updateTags(torrowId, tags, options) {
@@ -9958,7 +10470,7 @@ var TorrowItemCoreFacade = class {
9958
10470
  path: `${this.basePath}/${encodePathSegment(parentId)}/group/list`,
9959
10471
  query: { ...query ?? {} },
9960
10472
  signal: options?.signal
9961
- });
10473
+ }).then((items) => projectReadList(items, (dto) => projectTorrowItem(dto)));
9962
10474
  }
9963
10475
  /**
9964
10476
  * `PUT /api/v1/{domain}/{itemId}/updategroups` — включить/исключить **этот** item из групп
@@ -10206,6 +10718,10 @@ var TorrowItemCoreFacade = class {
10206
10718
  }
10207
10719
  /** `GET /api/v1/{domain}/uniquename/{uniqueName}` */
10208
10720
  getByUniqueName(uniqueName, options) {
10721
+ return this.readByUniqueName(uniqueName, options).then((item) => this.projectReadItem(item));
10722
+ }
10723
+ /** Читает исходную карточку; доменный фасад применяет полную read-проекцию один раз. */
10724
+ readByUniqueName(uniqueName, options) {
10209
10725
  return this.http.requestJson({
10210
10726
  method: "GET",
10211
10727
  path: `${this.basePath}/uniquename/${encodePathSegment(uniqueName)}`,
@@ -10397,7 +10913,7 @@ var TorrowItemFacade = class extends TorrowItemCoreFacade {
10397
10913
  path: `${this.basePath}/${encodePathSegment(torrowId)}/tags`,
10398
10914
  query: { ...query ?? {} },
10399
10915
  signal: options?.signal
10400
- });
10916
+ }).then((tags) => tags ?? []);
10401
10917
  }
10402
10918
  /**
10403
10919
  * `GET /api/v1/{domain}/{itemId}/groups` — **`GroupStatus[]`**: в каких группах состоит
@@ -10422,7 +10938,7 @@ var TorrowItemFacade = class extends TorrowItemCoreFacade {
10422
10938
  path: `${this.basePath}/${encodePathSegment(itemId)}/groups`,
10423
10939
  query: { ...query ?? {} },
10424
10940
  signal: options?.signal
10425
- });
10941
+ }).then((items) => projectReadList(items, (dto) => projectGroupStatus(dto)));
10426
10942
  }
10427
10943
  /** `PUT /api/v1/{domain}/{torrowId}/updateaccounts` */
10428
10944
  updateAccounts(torrowId, body, options) {
@@ -10505,7 +11021,7 @@ var TorrowItemFacade = class extends TorrowItemCoreFacade {
10505
11021
  isNeedAnnouncement: options?.isNeedAnnouncement
10506
11022
  },
10507
11023
  signal: options?.signal
10508
- });
11024
+ }).then((dto) => projectTorrowItem(dto));
10509
11025
  }
10510
11026
  /** `POST /api/v1/{domain}/{itemId}/unblock` */
10511
11027
  unblock(itemId, options) {
@@ -10517,7 +11033,7 @@ var TorrowItemFacade = class extends TorrowItemCoreFacade {
10517
11033
  isNeedAnnouncement: options?.isNeedAnnouncement
10518
11034
  },
10519
11035
  signal: options?.signal
10520
- });
11036
+ }).then((dto) => projectTorrowItem(dto));
10521
11037
  }
10522
11038
  };
10523
11039
 
@@ -10897,7 +11413,7 @@ function createCalendarPatchAdapter() {
10897
11413
  }
10898
11414
  },
10899
11415
  assertSnapshot: assertCalendarPatchSnapshot,
10900
- project: projectCalendarPatchItem,
11416
+ project: (item) => projectCalendarItem(projectCalendarPatchItem(item)),
10901
11417
  casRefusal: isItemPatchCasRefusal
10902
11418
  };
10903
11419
  }
@@ -10933,7 +11449,7 @@ var CalendarsFacade = class extends TorrowItemFacade {
10933
11449
  },
10934
11450
  body: payload,
10935
11451
  signal: options?.signal
10936
- });
11452
+ }).then((dto) => projectCalendarItem(dto));
10937
11453
  }
10938
11454
  /** `PUT /api/v1/calendars/{body.id}` */
10939
11455
  update(body, options) {
@@ -10948,7 +11464,7 @@ var CalendarsFacade = class extends TorrowItemFacade {
10948
11464
  },
10949
11465
  body,
10950
11466
  signal: options?.signal
10951
- });
11467
+ }).then((dto) => projectCalendarItem(dto));
10952
11468
  }
10953
11469
  /** `DELETE /api/v1/calendars/{torrowId}` */
10954
11470
  async delete(torrowId, options) {
@@ -10977,7 +11493,7 @@ var CalendarsFacade = class extends TorrowItemFacade {
10977
11493
  securityToken: options?.securityToken
10978
11494
  },
10979
11495
  signal: options?.signal
10980
- });
11496
+ }).then((dto) => projectCalendarItem(dto));
10981
11497
  }
10982
11498
  /** `GET /api/v1/calendars/personallist` */
10983
11499
  listPersonal(options) {
@@ -10987,7 +11503,7 @@ var CalendarsFacade = class extends TorrowItemFacade {
10987
11503
  path: `${BASE}/personallist`,
10988
11504
  query: { ...rest },
10989
11505
  signal
10990
- });
11506
+ }).then((items) => projectReadList(items, (dto) => projectCalendarItem(dto)));
10991
11507
  }
10992
11508
  /** Расписание кейсов календаря — `PUT /api/v1/calendars/{id}/timetable`. */
10993
11509
  getTimetable(calendarId, body, options) {
@@ -10998,7 +11514,7 @@ var CalendarsFacade = class extends TorrowItemFacade {
10998
11514
  query: buildTimetableQuery(queryOpts),
10999
11515
  body,
11000
11516
  signal
11001
- });
11517
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
11002
11518
  }
11003
11519
  /** `POST /api/v1/calendars/timetable/statistics` */
11004
11520
  async getTimetableStatistics(body, options) {
@@ -11242,7 +11758,7 @@ function createCasePatchAdapter() {
11242
11758
  priceInfo: { kind: "Object" /* Object */, nullable: true }
11243
11759
  },
11244
11760
  validateFields: validateItemPricePatch,
11245
- project: (item) => item,
11761
+ project: (item) => projectCaseItem(item),
11246
11762
  casRefusal: isItemPatchCasRefusal
11247
11763
  };
11248
11764
  }
@@ -11263,7 +11779,7 @@ function getCase(http, torrowId, options) {
11263
11779
  caseParticipantId: options?.caseParticipantId
11264
11780
  },
11265
11781
  signal: options?.signal
11266
- });
11782
+ }).then((item) => projectCaseItem(item));
11267
11783
  }
11268
11784
  function cancelCaseParticipation(http, torrowId, body, options) {
11269
11785
  return http.requestJson({
@@ -11312,7 +11828,7 @@ var CasesFacade = class extends TorrowItemFacade {
11312
11828
  },
11313
11829
  body: payload,
11314
11830
  signal: options?.signal
11315
- });
11831
+ }).then((dto) => projectCaseItem(dto));
11316
11832
  }
11317
11833
  /**
11318
11834
  * `POST /api/v1/cases` — create из тела **`CaseItem`** (query: calendar / check-in / road / participant).
@@ -11334,7 +11850,7 @@ var CasesFacade = class extends TorrowItemFacade {
11334
11850
  },
11335
11851
  body: payload,
11336
11852
  signal: options?.signal
11337
- });
11853
+ }).then((dto) => projectCaseItem(dto));
11338
11854
  }
11339
11855
  /** `PUT /api/v1/cases/{body.id}` */
11340
11856
  update(body, options) {
@@ -11350,7 +11866,7 @@ var CasesFacade = class extends TorrowItemFacade {
11350
11866
  },
11351
11867
  body,
11352
11868
  signal: options?.signal
11353
- });
11869
+ }).then((dto) => projectCaseItem(dto));
11354
11870
  }
11355
11871
  withCreateDefaults(body) {
11356
11872
  const payload = applyItemCreateDefaults(body, "CaseItem" /* CaseItem */);
@@ -11395,7 +11911,7 @@ var CasesFacade = class extends TorrowItemFacade {
11395
11911
  path: `${BASE3}/personallist`,
11396
11912
  query: { ...rest },
11397
11913
  signal
11398
- });
11914
+ }).then((items) => projectReadList(items, (dto) => projectCaseItem(dto)));
11399
11915
  }
11400
11916
  /** `PUT /api/v1/cases/include/togroups` */
11401
11917
  includeToGroups(body, options) {
@@ -11422,7 +11938,7 @@ var CasesFacade = class extends TorrowItemFacade {
11422
11938
  path: `${BASE3}/uniquename/${encodePathSegment(uniqueName)}`,
11423
11939
  query: { profileId: options?.profileId },
11424
11940
  signal: options?.signal
11425
- });
11941
+ }).then((dto) => projectCaseItem(dto));
11426
11942
  }
11427
11943
  /** `GET /api/v1/cases/{torrowId}/resources` */
11428
11944
  listResources(torrowId, query, options) {
@@ -11431,7 +11947,7 @@ var CasesFacade = class extends TorrowItemFacade {
11431
11947
  path: `${BASE3}/${encodePathSegment(torrowId)}/resources`,
11432
11948
  query: { ...query ?? {} },
11433
11949
  signal: options?.signal
11434
- });
11950
+ }).then((items) => projectReadList(items, (dto) => projectResourceView(dto)));
11435
11951
  }
11436
11952
  /** `GET /api/v1/cases/{torrowId}/caseparticipants` */
11437
11953
  listCaseParticipants(torrowId, query, options) {
@@ -11440,7 +11956,7 @@ var CasesFacade = class extends TorrowItemFacade {
11440
11956
  path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants`,
11441
11957
  query: { ...query ?? {} },
11442
11958
  signal: options?.signal
11443
- });
11959
+ }).then((items) => projectReadList(items, (dto) => projectCaseParticipantView(dto)));
11444
11960
  }
11445
11961
  /** `GET /api/v1/cases/{torrowId}/caseparticipants/{caseParticipantId}` */
11446
11962
  getCaseParticipantById(torrowId, caseParticipantId, options) {
@@ -11449,7 +11965,7 @@ var CasesFacade = class extends TorrowItemFacade {
11449
11965
  path: `${BASE3}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}`,
11450
11966
  query: { securityToken: options?.securityToken },
11451
11967
  signal: options?.signal
11452
- });
11968
+ }).then((dto) => projectCaseParticipantView(dto));
11453
11969
  }
11454
11970
  /** `GET /api/v1/cases/{torrowId}/caseparticipants/count` */
11455
11971
  getCaseParticipantsCount(torrowId, query, options) {
@@ -11564,7 +12080,7 @@ var CasesFacade = class extends TorrowItemFacade {
11564
12080
  path: `${BASE3}/${encodePathSegment(torrowId)}/reject`,
11565
12081
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11566
12082
  signal: options?.signal
11567
- });
12083
+ }).then((dto) => projectCaseItem(dto));
11568
12084
  }
11569
12085
  /** `POST /api/v1/cases/{torrowId}/declinework` */
11570
12086
  declineWork(torrowId, options) {
@@ -11573,7 +12089,7 @@ var CasesFacade = class extends TorrowItemFacade {
11573
12089
  path: `${BASE3}/${encodePathSegment(torrowId)}/declinework`,
11574
12090
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11575
12091
  signal: options?.signal
11576
- });
12092
+ }).then((dto) => projectCaseItem(dto));
11577
12093
  }
11578
12094
  /** `POST /api/v1/cases/{torrowId}/plan` */
11579
12095
  planCase(torrowId, options) {
@@ -11582,7 +12098,7 @@ var CasesFacade = class extends TorrowItemFacade {
11582
12098
  path: `${BASE3}/${encodePathSegment(torrowId)}/plan`,
11583
12099
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11584
12100
  signal: options?.signal
11585
- });
12101
+ }).then((dto) => projectCaseItem(dto));
11586
12102
  }
11587
12103
  /** `POST /api/v1/cases/{torrowId}/takeinwork` */
11588
12104
  takeInWork(torrowId, options) {
@@ -11591,7 +12107,7 @@ var CasesFacade = class extends TorrowItemFacade {
11591
12107
  path: `${BASE3}/${encodePathSegment(torrowId)}/takeinwork`,
11592
12108
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11593
12109
  signal: options?.signal
11594
- });
12110
+ }).then((dto) => projectCaseItem(dto));
11595
12111
  }
11596
12112
  /** `POST /api/v1/cases/{torrowId}/complete` */
11597
12113
  completeCase(torrowId, options) {
@@ -11600,7 +12116,7 @@ var CasesFacade = class extends TorrowItemFacade {
11600
12116
  path: `${BASE3}/${encodePathSegment(torrowId)}/complete`,
11601
12117
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11602
12118
  signal: options?.signal
11603
- });
12119
+ }).then((dto) => projectCaseItem(dto));
11604
12120
  }
11605
12121
  /** `POST /api/v1/cases/{torrowId}/accept` */
11606
12122
  acceptCase(torrowId, options) {
@@ -11609,7 +12125,7 @@ var CasesFacade = class extends TorrowItemFacade {
11609
12125
  path: `${BASE3}/${encodePathSegment(torrowId)}/accept`,
11610
12126
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11611
12127
  signal: options?.signal
11612
- });
12128
+ }).then((dto) => projectCaseItem(dto));
11613
12129
  }
11614
12130
  /** `POST /api/v1/cases/{torrowId}/returntoverification` */
11615
12131
  returnToVerification(torrowId, options) {
@@ -11618,7 +12134,7 @@ var CasesFacade = class extends TorrowItemFacade {
11618
12134
  path: `${BASE3}/${encodePathSegment(torrowId)}/returntoverification`,
11619
12135
  query: { profileId: options?.profileId, userMessage: options?.userMessage },
11620
12136
  signal: options?.signal
11621
- });
12137
+ }).then((dto) => projectCaseItem(dto));
11622
12138
  }
11623
12139
  /** `POST /api/v1/cases/{torrowId}/cancel` */
11624
12140
  cancelCase(torrowId, options) {
@@ -11631,7 +12147,7 @@ var CasesFacade = class extends TorrowItemFacade {
11631
12147
  securityToken: options?.securityToken
11632
12148
  },
11633
12149
  signal: options?.signal
11634
- });
12150
+ }).then((dto) => projectCaseItem(dto));
11635
12151
  }
11636
12152
  /** `POST /api/v1/cases/{torrowId}/patch` */
11637
12153
  patchCase(torrowId, body, options) {
@@ -11640,7 +12156,7 @@ var CasesFacade = class extends TorrowItemFacade {
11640
12156
  path: `${BASE3}/${encodePathSegment(torrowId)}/patch`,
11641
12157
  body,
11642
12158
  signal: options?.signal
11643
- });
12159
+ }).then((dto) => projectCaseItem(dto));
11644
12160
  }
11645
12161
  };
11646
12162
 
@@ -11946,7 +12462,7 @@ function createContactPatchAdapter() {
11946
12462
  prepare(body) {
11947
12463
  return Object.assign(body, normalizedFields(original ?? body));
11948
12464
  },
11949
- project: (value) => value,
12465
+ project: projectContactItem,
11950
12466
  casRefusal: isItemPatchCasRefusal
11951
12467
  };
11952
12468
  }
@@ -11986,7 +12502,7 @@ var ContactsFacade = class extends TorrowItemFacade {
11986
12502
  },
11987
12503
  body: payload,
11988
12504
  signal: options?.signal
11989
- });
12505
+ }).then((dto) => projectContactItem(dto));
11990
12506
  }
11991
12507
  withCreateDefaults(body) {
11992
12508
  const payload = applyItemCreateDefaults(
@@ -12015,7 +12531,7 @@ var ContactsFacade = class extends TorrowItemFacade {
12015
12531
  },
12016
12532
  body: payload,
12017
12533
  signal: options?.signal
12018
- });
12534
+ }).then((dto) => projectContactItem(dto));
12019
12535
  }
12020
12536
  /** `GET /api/v1/contacts/{torrowId}` */
12021
12537
  getById(torrowId, options) {
@@ -12029,7 +12545,7 @@ var ContactsFacade = class extends TorrowItemFacade {
12029
12545
  securityToken: options?.securityToken
12030
12546
  },
12031
12547
  signal: options?.signal
12032
- });
12548
+ }).then((dto) => projectContactItem(dto));
12033
12549
  }
12034
12550
  /**
12035
12551
  * `DELETE /api/v1/contacts/{torrowId}`
@@ -12057,7 +12573,7 @@ var ContactsFacade = class extends TorrowItemFacade {
12057
12573
  path: `${BASE4}/personallist`,
12058
12574
  query: { ...rest, securityToken },
12059
12575
  signal
12060
- });
12576
+ }).then((items) => projectReadList(items, (dto) => projectContactItem(dto)));
12061
12577
  }
12062
12578
  /** Расписание по контакту (профиль/исполнитель) — `PUT /api/v1/contacts/{id}/timetable`. */
12063
12579
  getTimetable(contactId, body, options) {
@@ -12068,7 +12584,7 @@ var ContactsFacade = class extends TorrowItemFacade {
12068
12584
  query: buildTimetableQuery(queryOpts),
12069
12585
  body,
12070
12586
  signal
12071
- });
12587
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
12072
12588
  }
12073
12589
  /** `POST /api/v1/contacts/timetable/statistics` */
12074
12590
  async getTimetableStatistics(body, options) {
@@ -12145,7 +12661,7 @@ function createContextPatchAdapter() {
12145
12661
  },
12146
12662
  description: { kind: "String" /* String */, nullable: true }
12147
12663
  },
12148
- project: (value) => value,
12664
+ project: projectContextItem,
12149
12665
  casRefusal: isItemPatchCasRefusal
12150
12666
  };
12151
12667
  }
@@ -12178,7 +12694,7 @@ var ContextsFacade = class extends TorrowItemFacade {
12178
12694
  query: { profileId: options?.profileId },
12179
12695
  body: payload,
12180
12696
  signal: options?.signal
12181
- });
12697
+ }).then((dto) => projectContextItem(dto));
12182
12698
  }
12183
12699
  /** `PUT /api/v1/contexts/{body.id}` */
12184
12700
  update(body, options) {
@@ -12192,7 +12708,7 @@ var ContextsFacade = class extends TorrowItemFacade {
12192
12708
  },
12193
12709
  body,
12194
12710
  signal: options?.signal
12195
- });
12711
+ }).then((dto) => projectContextItem(dto));
12196
12712
  }
12197
12713
  /** `DELETE /api/v1/contexts/{torrowId}` */
12198
12714
  async delete(torrowId, options) {
@@ -12221,7 +12737,7 @@ var ContextsFacade = class extends TorrowItemFacade {
12221
12737
  securityToken: options?.securityToken
12222
12738
  },
12223
12739
  signal: options?.signal
12224
- });
12740
+ }).then((dto) => projectContextItem(dto));
12225
12741
  }
12226
12742
  /** `GET /api/v1/contexts/personallist` */
12227
12743
  listPersonal(options) {
@@ -12231,7 +12747,7 @@ var ContextsFacade = class extends TorrowItemFacade {
12231
12747
  path: `${BASE5}/personallist`,
12232
12748
  query: { ...rest },
12233
12749
  signal
12234
- });
12750
+ }).then((items) => projectReadList(items, (dto) => projectContextItem(dto)));
12235
12751
  }
12236
12752
  };
12237
12753
 
@@ -12243,7 +12759,7 @@ function projectNotePatchItem(item) {
12243
12759
  if (item.data != null && typeof item.data !== "string" || item.files != null && (!Array.isArray(item.files) || !item.files.every(isFileReference)) || item.image != null && !isFileReference(item.image)) {
12244
12760
  throw itemPatchError("InvalidResponse" /* InvalidResponse */);
12245
12761
  }
12246
- return item;
12762
+ return projectNoteItem(item);
12247
12763
  }
12248
12764
  function assertNotePatchSnapshot(item) {
12249
12765
  projectNotePatchItem(item);
@@ -12318,7 +12834,7 @@ var NotesFacade = class extends TorrowItemFacade {
12318
12834
  },
12319
12835
  body: payload,
12320
12836
  signal: options?.signal
12321
- });
12837
+ }).then((dto) => projectNoteItem(dto));
12322
12838
  }
12323
12839
  /** `PUT /api/v1/notes/{body.id}` */
12324
12840
  update(body, options) {
@@ -12332,7 +12848,7 @@ var NotesFacade = class extends TorrowItemFacade {
12332
12848
  },
12333
12849
  body,
12334
12850
  signal: options?.signal
12335
- });
12851
+ }).then((dto) => projectNoteItem(dto));
12336
12852
  }
12337
12853
  /**
12338
12854
  * `DELETE /api/v1/notes/{torrowId}`
@@ -12365,7 +12881,7 @@ var NotesFacade = class extends TorrowItemFacade {
12365
12881
  securityToken: options?.securityToken
12366
12882
  },
12367
12883
  signal: options?.signal
12368
- });
12884
+ }).then((dto) => projectNoteItem(dto));
12369
12885
  }
12370
12886
  /** `GET /api/v1/notes/personallist` */
12371
12887
  listPersonal(options) {
@@ -12375,7 +12891,7 @@ var NotesFacade = class extends TorrowItemFacade {
12375
12891
  path: `${BASE6}/personallist`,
12376
12892
  query: { ...rest },
12377
12893
  signal
12378
- });
12894
+ }).then((items) => projectReadList(items, (dto) => projectNoteItem(dto)));
12379
12895
  }
12380
12896
  /**
12381
12897
  * Читает полную заметку и метаданные выбранного вложения: один GET при отсутствии связи, два при наличии.
@@ -12457,71 +12973,6 @@ var NotesFacade = class extends TorrowItemFacade {
12457
12973
  }
12458
12974
  };
12459
12975
 
12460
- // ../../src/resources/common/item-type.ts
12461
- var TorrowItemDefinitions = {
12462
- Contact: { domain: "contacts", objectTypeCode: TorrowObjectTypeCode.Contact },
12463
- Note: { domain: "notes", objectTypeCode: TorrowObjectTypeCode.Note },
12464
- Context: { domain: "contexts", objectTypeCode: TorrowObjectTypeCode.Context },
12465
- Resource: { domain: "resources", objectTypeCode: TorrowObjectTypeCode.Resource },
12466
- Service: { domain: "services", objectTypeCode: TorrowObjectTypeCode.Service },
12467
- Case: { domain: "cases", objectTypeCode: TorrowObjectTypeCode.Case },
12468
- Calendar: { domain: "calendars", objectTypeCode: TorrowObjectTypeCode.Calendar },
12469
- LoyaltyCard: {
12470
- domain: "loyaltycards",
12471
- objectTypeCode: TorrowObjectTypeCode.LoyaltyCard
12472
- },
12473
- LoyaltySystem: {
12474
- domain: "loyaltysystems",
12475
- objectTypeCode: TorrowObjectTypeCode.LoyaltySystem
12476
- }
12477
- };
12478
- var TorrowItemTypeValues = {
12479
- Contact: "Contact",
12480
- Note: "Note",
12481
- Context: "Context",
12482
- Resource: "Resource",
12483
- Service: "Service",
12484
- Case: "Case",
12485
- Calendar: "Calendar",
12486
- LoyaltyCard: "LoyaltyCard",
12487
- LoyaltySystem: "LoyaltySystem"
12488
- };
12489
- var TorrowItemTypeValueList = Object.values(TorrowItemTypeValues);
12490
- function isTorrowItemType(value) {
12491
- return TorrowItemTypeValueList.includes(value);
12492
- }
12493
- function getTorrowItemDomain(itemType) {
12494
- return TorrowItemDefinitions[itemType].domain;
12495
- }
12496
-
12497
- // ../../src/resources/common/item-type-resolver.ts
12498
- function getTorrowItemTypeFromTorrowId(torrowId) {
12499
- const objectType = getTorrowObjectTypeFromTorrowId(torrowId);
12500
- if (!isTorrowItemType(objectType)) {
12501
- throw new TorrowIdError("unsupported-item-type", `Torrow object type ${objectType} is not an item type`);
12502
- }
12503
- return objectType;
12504
- }
12505
- function getTorrowItemTypeFromTorrowIds(torrowIds) {
12506
- const firstId = torrowIds[0];
12507
- if (firstId === void 0) {
12508
- throw new TorrowIdError("empty-id-list", "Torrow ID list must not be empty");
12509
- }
12510
- const itemType = getTorrowItemTypeFromTorrowId(firstId);
12511
- for (const torrowId of torrowIds.slice(1)) {
12512
- if (getTorrowItemTypeFromTorrowId(torrowId) !== itemType) {
12513
- throw new TorrowIdError("mixed-item-types", "All Torrow IDs must have the same item type");
12514
- }
12515
- }
12516
- return itemType;
12517
- }
12518
- function getTorrowItemDomainFromTorrowId(torrowId) {
12519
- return getTorrowItemDomain(getTorrowItemTypeFromTorrowId(torrowId));
12520
- }
12521
- function getTorrowItemDomainFromTorrowIds(torrowIds) {
12522
- return getTorrowItemDomain(getTorrowItemTypeFromTorrowIds(torrowIds));
12523
- }
12524
-
12525
12976
  // ../../src/resources/relations/RelationsFacade.ts
12526
12977
  var RelationsFacade = class {
12527
12978
  constructor(http) {
@@ -13272,14 +13723,14 @@ var ResourcesFacade = class extends TorrowItemFacade {
13272
13723
  }
13273
13724
  /** Поиск по уникальному имени возвращает ту же модель ресурса, что и getById. */
13274
13725
  getByUniqueName(uniqueName, options) {
13275
- return super.getByUniqueName(uniqueName, options).then((item) => this.toSdkResourceItem(item));
13726
+ return this.readByUniqueName(uniqueName, options).then((item) => this.toSdkResourceItem(item));
13276
13727
  }
13277
13728
  toSdkResourceItem(item) {
13278
13729
  if (item === null || typeof item !== "object" || Array.isArray(item)) {
13279
13730
  throw new TorrowSdkError({ category: "InvalidResponse" /* InvalidResponse */ });
13280
13731
  }
13281
13732
  return {
13282
- ...item,
13733
+ ...projectResourceItem(item),
13283
13734
  behaviorSettings: parseResourceBehaviorSettings(item.tags)
13284
13735
  };
13285
13736
  }
@@ -13468,7 +13919,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
13468
13919
  query: buildTimetableQuery(queryOpts),
13469
13920
  body,
13470
13921
  signal
13471
- });
13922
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
13472
13923
  }
13473
13924
  /**
13474
13925
  * Полосы занятости ресурса — `GET /api/v1/resources/{id}/workload`.
@@ -13493,7 +13944,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
13493
13944
  path: `${BASE7}/${encodePathSegment(resourceId)}/pickorder`,
13494
13945
  body,
13495
13946
  signal: options?.signal
13496
- });
13947
+ }).then((dto) => projectPickOrderResp(dto));
13497
13948
  }
13498
13949
  /** `POST /api/v1/resources/{id}/returnorder`. */
13499
13950
  returnOrder(resourceId, body, options) {
@@ -13502,7 +13953,7 @@ var ResourcesFacade = class extends TorrowItemFacade {
13502
13953
  path: `${BASE7}/${encodePathSegment(resourceId)}/returnorder`,
13503
13954
  body,
13504
13955
  signal: options?.signal
13505
- });
13956
+ }).then((dto) => projectReturnOrderResp(dto));
13506
13957
  }
13507
13958
  /** `POST /api/v1/resources/timetable/statistics`. */
13508
13959
  async getTimetableStatistics(body, options) {
@@ -13522,7 +13973,7 @@ function omitUnusedServiceFields(service) {
13522
13973
  Reflect.deleteProperty(result, "packingStrategyProperties");
13523
13974
  return result;
13524
13975
  }
13525
- function projectServiceView(view) {
13976
+ function projectServiceView2(view) {
13526
13977
  if (!view || typeof view !== "object") {
13527
13978
  return view;
13528
13979
  }
@@ -13532,11 +13983,32 @@ function projectServiceView(view) {
13532
13983
  }
13533
13984
  return result;
13534
13985
  }
13535
- function projectItemView(domain, view) {
13536
- return domain === "services" ? projectServiceView(view) : view;
13986
+ function projectItemView2(domain, view) {
13987
+ switch (domain) {
13988
+ case "contacts" /* Contact */:
13989
+ return projectContactView(view);
13990
+ case "notes" /* Note */:
13991
+ return projectNoteView(view);
13992
+ case "contexts" /* Context */:
13993
+ return projectContextView(view);
13994
+ case "calendars" /* Calendar */:
13995
+ return projectCalendarView(view);
13996
+ case "cases" /* Case */:
13997
+ return projectCaseView(view);
13998
+ case "loyaltycards" /* LoyaltyCard */:
13999
+ return projectLoyaltyCardView(view);
14000
+ case "loyaltysystems" /* LoyaltySystem */:
14001
+ return projectLoyaltySystemView(view);
14002
+ case "services" /* Service */:
14003
+ return projectServiceView(projectServiceView2(view));
14004
+ case "resources" /* Resource */:
14005
+ return projectResourceView(view);
14006
+ default:
14007
+ return view;
14008
+ }
13537
14009
  }
13538
14010
  function projectItemViews(domain, views) {
13539
- return Array.isArray(views) ? views.map((view) => projectItemView(domain, view)) : views;
14011
+ return Array.isArray(views) ? views.map((view) => projectItemView2(domain, view)) : views;
13540
14012
  }
13541
14013
 
13542
14014
  // ../../src/resources/services/service-requests.ts
@@ -13546,7 +14018,7 @@ function toSdkServiceItem(service) {
13546
14018
  throw new TorrowSdkError({ category: "InvalidResponse" /* InvalidResponse */ });
13547
14019
  }
13548
14020
  return {
13549
- ...omitUnusedServiceFields(service),
14021
+ ...projectServiceItem(omitUnusedServiceFields(service)),
13550
14022
  behaviorSettings: parseServiceImplicitTagParams(service.tags)
13551
14023
  };
13552
14024
  }
@@ -13571,7 +14043,7 @@ function getServiceResources(http, serviceId, body, options) {
13571
14043
  path: `${BASE8}/${encodePathSegment(serviceId)}/resources`,
13572
14044
  body,
13573
14045
  signal: options?.signal
13574
- });
14046
+ }).then((items) => projectReadList(items, (dto) => projectResourceView(dto)));
13575
14047
  }
13576
14048
  function getCheckInSchedule(http, serviceId, body, options) {
13577
14049
  return http.requestJson({
@@ -13587,7 +14059,7 @@ function createOrder(http, serviceId, body, options) {
13587
14059
  path: `${BASE8}/${encodePathSegment(serviceId)}/order`,
13588
14060
  body,
13589
14061
  signal: options?.signal
13590
- });
14062
+ }).then((dto) => projectOrderResp(dto));
13591
14063
  }
13592
14064
 
13593
14065
  // ../../src/resources/services/service-patch.ts
@@ -13964,7 +14436,7 @@ var ServicesFacade = class extends TorrowItemFacade {
13964
14436
  }
13965
14437
  /** Чтение по uniqueName использует ту же доменную проекцию, что чтение по ID. */
13966
14438
  getByUniqueName(uniqueName, options) {
13967
- return super.getByUniqueName(uniqueName, options).then(toSdkServiceItem);
14439
+ return this.readByUniqueName(uniqueName, options).then(toSdkServiceItem);
13968
14440
  }
13969
14441
  /** Читает сырой OpenAPI DTO до проекции, чтобы malformed tags не маскировались парсером. */
13970
14442
  async readBehaviorState(serviceId, options) {
@@ -14121,7 +14593,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14121
14593
  query: buildTimetableQuery(queryOpts),
14122
14594
  body,
14123
14595
  signal
14124
- });
14596
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
14125
14597
  }
14126
14598
  /**
14127
14599
  * Нагрузка и расписание по ресурсам услуги — `PUT /api/v1/services/workloadinfo`.
@@ -14133,7 +14605,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14133
14605
  path: `${BASE9}/workloadinfo`,
14134
14606
  body,
14135
14607
  signal: options?.signal
14136
- });
14608
+ }).then((dto) => projectGetServiceWorkloadInfoResp(dto));
14137
14609
  }
14138
14610
  /** Агрегаты по расписанию услуги — `POST /api/v1/services/timetable/statistics`. */
14139
14611
  async getTimetableStatistics(body, options) {
@@ -14175,7 +14647,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14175
14647
  path: `${BASE9}/${encodePathSegment(serviceId)}/resourceswithdetalization`,
14176
14648
  body,
14177
14649
  signal: options?.signal
14178
- });
14650
+ }).then((dto) => projectSearchServiceResourcesResp(dto));
14179
14651
  }
14180
14652
  /** `GET /api/v1/services/personallist` */
14181
14653
  listPersonal(options) {
@@ -14195,7 +14667,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14195
14667
  query: { profileId: options?.profileId },
14196
14668
  body,
14197
14669
  signal: options?.signal
14198
- });
14670
+ }).then((dto) => projectCaseItem(dto));
14199
14671
  }
14200
14672
  /** `PUT /api/v1/services/{serviceId}/session` — получить/обновить сессию по `caseId`. */
14201
14673
  refreshSession(serviceId, options) {
@@ -14204,7 +14676,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14204
14676
  path: `${BASE9}/${encodePathSegment(serviceId)}/session`,
14205
14677
  query: { caseId: options?.caseId, profileId: options?.profileId },
14206
14678
  signal: options?.signal
14207
- });
14679
+ }).then((dto) => projectCaseItem(dto));
14208
14680
  }
14209
14681
  /** `PATCH /api/v1/services/{serviceId}/updateorder` */
14210
14682
  patchUpdateOrder(serviceId, body, options) {
@@ -14213,7 +14685,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14213
14685
  path: `${BASE9}/${encodePathSegment(serviceId)}/updateorder`,
14214
14686
  body,
14215
14687
  signal: options?.signal
14216
- });
14688
+ }).then((dto) => projectCaseItem(dto));
14217
14689
  }
14218
14690
  /** `PATCH /api/v1/services/{serviceId}/updateorder2` */
14219
14691
  patchUpdateOrder2(serviceId, body, options) {
@@ -14222,7 +14694,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14222
14694
  path: `${BASE9}/${encodePathSegment(serviceId)}/updateorder2`,
14223
14695
  body,
14224
14696
  signal: options?.signal
14225
- });
14697
+ }).then((dto) => projectCaseItem(dto));
14226
14698
  }
14227
14699
  /** `PUT /api/v1/services/{serviceId}/changeorderservice` */
14228
14700
  changeOrderService(serviceId, body, options) {
@@ -14231,7 +14703,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14231
14703
  path: `${BASE9}/${encodePathSegment(serviceId)}/changeorderservice`,
14232
14704
  body,
14233
14705
  signal: options?.signal
14234
- });
14706
+ }).then((dto) => projectCaseItem(dto));
14235
14707
  }
14236
14708
  /** `PATCH /api/v1/services/{serviceId}/updateorderinfo` */
14237
14709
  patchUpdateOrderInfo(serviceId, body, options) {
@@ -14240,7 +14712,7 @@ var ServicesFacade = class extends TorrowItemFacade {
14240
14712
  path: `${BASE9}/${encodePathSegment(serviceId)}/updateorderinfo`,
14241
14713
  body,
14242
14714
  signal: options?.signal
14243
- });
14715
+ }).then((dto) => projectCaseItem(dto));
14244
14716
  }
14245
14717
  };
14246
14718
 
@@ -14367,18 +14839,22 @@ var ProfilesFacade = class {
14367
14839
  * @throws Если тело ответа не объект или **`profileList`** не массив при наличии поля.
14368
14840
  */
14369
14841
  async list(options) {
14370
- const resp = await this.http.requestJson({ method: "GET", path: BASE11, signal: options?.signal });
14842
+ const resp = await this.http.requestJson({
14843
+ method: "GET",
14844
+ path: BASE11,
14845
+ signal: options?.signal
14846
+ });
14371
14847
  if (resp === null || typeof resp !== "object") {
14372
14848
  throw new Error("GET /api/v1/user/profiles: expected a JSON object body");
14373
14849
  }
14374
14850
  const pl = resp.profileList;
14375
14851
  if (pl === void 0 || pl === null) {
14376
- return [];
14852
+ return projectReadList([], (dto) => projectContactItem(dto));
14377
14853
  }
14378
14854
  if (!Array.isArray(pl)) {
14379
14855
  throw new Error("GET /api/v1/user/profiles: profileList must be an array when present");
14380
14856
  }
14381
- return pl;
14857
+ return projectReadList(pl, (dto) => projectContactItem(dto));
14382
14858
  }
14383
14859
  /**
14384
14860
  * `POST /api/v1/user/profiles` — создать Профиль по телу **`UserProfileItemForAdd`** (контакт для write + поля Профиля).
@@ -14393,7 +14869,7 @@ var ProfilesFacade = class {
14393
14869
  body: payload,
14394
14870
  signal: options?.signal
14395
14871
  });
14396
- return unwrapAddProfileContact(resp);
14872
+ return projectContactItem(unwrapAddProfileContact(resp));
14397
14873
  }
14398
14874
  /**
14399
14875
  * `PUT /api/v1/user/profiles` — в OpenAPI тело **JSON-строка** (id существующего контакта), не объект.
@@ -14406,7 +14882,7 @@ var ProfilesFacade = class {
14406
14882
  body: contactId,
14407
14883
  signal: options?.signal
14408
14884
  });
14409
- return unwrapAddProfileContact(resp);
14885
+ return projectContactItem(unwrapAddProfileContact(resp));
14410
14886
  }
14411
14887
  /**
14412
14888
  * `PUT /api/v1/user/profiles/{profileId}/profileproperties` — обновить расширенные свойства Профиля
@@ -14429,7 +14905,7 @@ var ProfilesFacade = class {
14429
14905
  path: `${BASE11}/${encodePathSegment(profileId)}`,
14430
14906
  signal: options?.signal
14431
14907
  });
14432
- return unwrapRemoveProfileList(resp);
14908
+ return projectReadList(unwrapRemoveProfileList(resp), (dto) => projectContactItem(dto));
14433
14909
  }
14434
14910
  };
14435
14911
 
@@ -14504,7 +14980,7 @@ var PinnedViewsFacade = class {
14504
14980
  method: "GET",
14505
14981
  path: viewChildPath(domain, parentId, "pinned", childId),
14506
14982
  signal: options?.signal
14507
- }).then((item) => projectItemView(domain, item));
14983
+ }).then((item) => projectItemView2(domain, item));
14508
14984
  }
14509
14985
  /**
14510
14986
  * Удаляет закреплённое представление дочернего элемента.
@@ -14601,7 +15077,7 @@ var UserViewsFacade = class {
14601
15077
  method: "GET",
14602
15078
  path: viewChildPath(domain, parentId, "user", childId),
14603
15079
  signal: options?.signal
14604
- }).then((item) => projectItemView(domain, item));
15080
+ }).then((item) => projectItemView2(domain, item));
14605
15081
  }
14606
15082
  /**
14607
15083
  * Удаляет персональное представление дочернего элемента.
@@ -14688,7 +15164,7 @@ var SearchFacade = class {
14688
15164
  path: `${BASE12}/adviseditems`,
14689
15165
  query: { ...query ?? {} },
14690
15166
  signal: options?.signal
14691
- });
15167
+ }).then((items) => projectReadList(items, (dto) => projectTorrowItem(dto)));
14692
15168
  }
14693
15169
  /**
14694
15170
  * `PUT /api/v1/search/{torrowId}/orders` — заказы (события-заказы) под элементом с фильтром.
@@ -14701,7 +15177,7 @@ var SearchFacade = class {
14701
15177
  query: { ...query ?? {} },
14702
15178
  body,
14703
15179
  signal: options?.signal
14704
- });
15180
+ }).then((items) => projectReadList(items, (dto) => projectCaseView(dto)));
14705
15181
  }
14706
15182
  /**
14707
15183
  * `GET /api/v1/search/contacts` — текстовый поиск контактов.
@@ -14718,7 +15194,7 @@ var SearchFacade = class {
14718
15194
  path: `${BASE12}/contacts`,
14719
15195
  query: { ...query ?? {} },
14720
15196
  signal: options?.signal
14721
- });
15197
+ }).then((items) => projectReadList(items, (dto) => projectContactView(dto)));
14722
15198
  }
14723
15199
  /**
14724
15200
  * `GET /api/v1/search/notes` — текстовый поиск заметок.
@@ -14733,7 +15209,7 @@ var SearchFacade = class {
14733
15209
  path: `${BASE12}/notes`,
14734
15210
  query: { ...query ?? {} },
14735
15211
  signal: options?.signal
14736
- });
15212
+ }).then((items) => projectReadList(items, (dto) => projectNoteView(dto)));
14737
15213
  }
14738
15214
  /**
14739
15215
  * `GET /api/v1/search/calendars` — текстовый поиск календарей.
@@ -14748,7 +15224,7 @@ var SearchFacade = class {
14748
15224
  path: `${BASE12}/calendars`,
14749
15225
  query: { ...query ?? {} },
14750
15226
  signal: options?.signal
14751
- });
15227
+ }).then((items) => projectReadList(items, (dto) => projectCalendarView(dto)));
14752
15228
  }
14753
15229
  /**
14754
15230
  * `GET /api/v1/search/cases` — текстовый поиск дел/событий.
@@ -14763,7 +15239,7 @@ var SearchFacade = class {
14763
15239
  path: `${BASE12}/cases`,
14764
15240
  query: { ...query ?? {} },
14765
15241
  signal: options?.signal
14766
- });
15242
+ }).then((items) => projectReadList(items, (dto) => projectCaseView(dto)));
14767
15243
  }
14768
15244
  /**
14769
15245
  * `GET /api/v1/search/resources` — текстовый поиск ресурсов.
@@ -14778,7 +15254,7 @@ var SearchFacade = class {
14778
15254
  path: `${BASE12}/resources`,
14779
15255
  query: { ...query ?? {} },
14780
15256
  signal: options?.signal
14781
- });
15257
+ }).then((items) => projectReadList(items, (dto) => projectResourceView(dto)));
14782
15258
  }
14783
15259
  /**
14784
15260
  * `GET /api/v1/search/services` — текстовый поиск услуг.
@@ -14815,7 +15291,7 @@ var ActionHistoryFacade = class {
14815
15291
  path: BASE13,
14816
15292
  query: { ...query ?? {} },
14817
15293
  signal: options?.signal
14818
- });
15294
+ }).then((items) => projectReadList(items, (dto) => projectActionHistoryInfo(dto)));
14819
15295
  }
14820
15296
  };
14821
15297
 
@@ -14834,7 +15310,7 @@ var AccountingTransactionsFacade = class {
14834
15310
  query: { securityToken: options?.securityToken },
14835
15311
  body: transaction,
14836
15312
  signal: options?.signal
14837
- });
15313
+ }).then((dto) => projectAccountingTransaction(dto));
14838
15314
  }
14839
15315
  /** `PUT /api/v1/accountingtransactions/{transaction.id}` */
14840
15316
  update(transaction, options) {
@@ -14849,7 +15325,7 @@ var AccountingTransactionsFacade = class {
14849
15325
  },
14850
15326
  body: transaction,
14851
15327
  signal: options?.signal
14852
- });
15328
+ }).then((dto) => projectAccountingTransaction(dto));
14853
15329
  }
14854
15330
  /** `DELETE /api/v1/accountingtransactions/{torrowId}` */
14855
15331
  async delete(torrowId, options) {
@@ -14880,7 +15356,7 @@ var AccountingTransactionsFacade = class {
14880
15356
  securityToken: options?.securityToken
14881
15357
  },
14882
15358
  signal: options?.signal
14883
- });
15359
+ }).then((dto) => projectAccountingTransaction(dto));
14884
15360
  }
14885
15361
  /** `GET /api/v1/accountingtransactions/{torrowId}/balance` */
14886
15362
  getBalance(torrowId, options) {
@@ -14901,7 +15377,7 @@ var AccountingTransactionsFacade = class {
14901
15377
  path: `${BASE14}/${encodePathSegment(torrowId)}/transactions`,
14902
15378
  query: { ...query ?? {} },
14903
15379
  signal: options?.signal
14904
- });
15380
+ }).then((items) => projectReadList(items, (dto) => projectAccountingTransaction(dto)));
14905
15381
  }
14906
15382
  };
14907
15383
 
@@ -14923,7 +15399,7 @@ var AnnouncementsFacade = class {
14923
15399
  path: BASE15,
14924
15400
  query: { ...query ?? {} },
14925
15401
  signal: options?.signal
14926
- });
15402
+ }).then((items) => projectReadList(items, (dto) => projectAnnouncementInfo(dto)));
14927
15403
  }
14928
15404
  /** `POST /api/v1/announcements/updatestate` */
14929
15405
  updateState(body, options) {
@@ -14949,7 +15425,7 @@ var ExportImportFacade = class {
14949
15425
  path: "/api/v1/export",
14950
15426
  body,
14951
15427
  signal: options?.signal
14952
- });
15428
+ }).then((dto) => projectExportGraph(dto));
14953
15429
  }
14954
15430
  /** `POST /api/v1/import` */
14955
15431
  importFromFile(body, options) {
@@ -14958,7 +15434,7 @@ var ExportImportFacade = class {
14958
15434
  path: "/api/v1/import",
14959
15435
  body,
14960
15436
  signal: options?.signal
14961
- });
15437
+ }).then((dto) => projectTorrowItem(dto));
14962
15438
  }
14963
15439
  /** `POST /api/v1/importbyuniquename` */
14964
15440
  importByUniqueName(body, options) {
@@ -14967,7 +15443,7 @@ var ExportImportFacade = class {
14967
15443
  path: "/api/v1/importbyuniquename",
14968
15444
  body,
14969
15445
  signal: options?.signal
14970
- });
15446
+ }).then((dto) => projectTorrowItem(dto));
14971
15447
  }
14972
15448
  };
14973
15449
 
@@ -15104,7 +15580,8 @@ function createLoyaltySystemPatchAdapter() {
15104
15580
  objectType: TorrowObjectTypeCode.LoyaltySystem,
15105
15581
  discriminator: "LoyaltySystemItem" /* LoyaltySystemItem */,
15106
15582
  fields: loyaltySystemPatchFields,
15107
- project: (value) => value,
15583
+ // Сужение допустимо только после подготовки публичной копии: исходный wire-снимок остаётся для PUT.
15584
+ project: (item) => projectLoyaltySystemItem(item),
15108
15585
  casRefusal: isItemPatchCasRefusal,
15109
15586
  prepare: (body) => omitLoyaltySystemNumerator(body)
15110
15587
  };
@@ -15146,13 +15623,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15146
15623
  }
15147
15624
  /** Изменяет выбранные настройки через полный GET и один CAS PUT; пропуск сохраняет поля. */
15148
15625
  patch(itemId, fields, options) {
15149
- return patchItem(
15150
- this.http,
15151
- itemId,
15152
- fields,
15153
- options,
15154
- createLoyaltySystemPatchAdapter()
15155
- );
15626
+ return patchItem(this.http, itemId, fields, options, createLoyaltySystemPatchAdapter());
15156
15627
  }
15157
15628
  /** Id программы лояльности до `create` / presigned upload. */
15158
15629
  generateLoyaltySystemId(ownerTorrowId) {
@@ -15167,7 +15638,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15167
15638
  query: { parentId: options?.parentId, profileId: options?.profileId },
15168
15639
  body: payload,
15169
15640
  signal: options?.signal
15170
- });
15641
+ }).then((dto) => projectLoyaltySystemItem(dto));
15171
15642
  }
15172
15643
  /** `PUT /api/v1/loyaltysystems/{body.id}`; numeratorInfo не обновляется и исключается из тела. */
15173
15644
  update(body, options) {
@@ -15181,7 +15652,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15181
15652
  },
15182
15653
  body: omitLoyaltySystemNumerator(body),
15183
15654
  signal: options?.signal
15184
- });
15655
+ }).then((dto) => projectLoyaltySystemItem(dto));
15185
15656
  }
15186
15657
  /** `DELETE /api/v1/loyaltysystems/{torrowId}` */
15187
15658
  async delete(torrowId, options) {
@@ -15210,7 +15681,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15210
15681
  securityToken: options?.securityToken
15211
15682
  },
15212
15683
  signal: options?.signal
15213
- });
15684
+ }).then((dto) => projectLoyaltySystemItem(dto));
15214
15685
  }
15215
15686
  /** `GET /api/v1/loyaltysystems/personallist` */
15216
15687
  listPersonal(options) {
@@ -15220,7 +15691,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15220
15691
  path: `${BASE17}/personallist`,
15221
15692
  query: { ...rest },
15222
15693
  signal
15223
- });
15694
+ }).then((items) => projectReadList(items, (dto) => projectLoyaltySystemItem(dto)));
15224
15695
  }
15225
15696
  /** `DELETE /api/v1/loyaltysystems/personallist/{torrowId}` */
15226
15697
  deleteFromPersonalList(torrowId, options) {
@@ -15241,7 +15712,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15241
15712
  path: `${BASE17}/${encodePathSegment(loyaltySystemId)}/loyaltycard`,
15242
15713
  body,
15243
15714
  signal: options?.signal
15244
- });
15715
+ }).then((dto) => projectLoyaltyCardItem(dto));
15245
15716
  }
15246
15717
  /**
15247
15718
  * `POST /api/v1/loyaltysystems/{torrowId}/loyaltycards` — поиск карт в программе
@@ -15254,7 +15725,7 @@ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
15254
15725
  path: `${BASE17}/${encodePathSegment(torrowId)}/loyaltycards`,
15255
15726
  body,
15256
15727
  signal: options?.signal
15257
- });
15728
+ }).then((items) => projectReadList(items, (dto) => projectLoyaltyCardItem(dto)));
15258
15729
  }
15259
15730
  /** `POST /api/v1/loyaltysystems/statistics` */
15260
15731
  async postStatistics(body, options) {
@@ -15390,7 +15861,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15390
15861
  path: `${BASE18}/${encodePathSegment(torrowId)}/transactions`,
15391
15862
  query: { ...query ?? {} },
15392
15863
  signal: options?.signal
15393
- });
15864
+ }).then((items) => projectReadList(items, (dto) => projectAccountingTransaction(dto)));
15394
15865
  }
15395
15866
  /** `GET /api/v1/loyaltycards/{torrowId}/subscriptions/{subscriptionId}/balance` */
15396
15867
  getSubscriptionBalance(torrowId, subscriptionId, options) {
@@ -15411,7 +15882,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15411
15882
  path: `${BASE18}/${encodePathSegment(torrowId)}/subscriptions/${encodePathSegment(subscriptionId)}/transactions`,
15412
15883
  query: { ...query ?? {} },
15413
15884
  signal: options?.signal
15414
- });
15885
+ }).then((items) => projectReadList(items, (dto) => projectAccountingTransaction(dto)));
15415
15886
  }
15416
15887
  /** `PUT /api/v1/loyaltycards/{body.id}` */
15417
15888
  update(body, options) {
@@ -15425,7 +15896,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15425
15896
  },
15426
15897
  body,
15427
15898
  signal: options?.signal
15428
- });
15899
+ }).then((dto) => projectLoyaltyCardItem(dto));
15429
15900
  }
15430
15901
  /** `DELETE /api/v1/loyaltycards/{torrowId}` */
15431
15902
  async delete(torrowId, options) {
@@ -15455,7 +15926,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15455
15926
  securityToken: options?.securityToken
15456
15927
  },
15457
15928
  signal: options?.signal
15458
- });
15929
+ }).then((dto) => projectLoyaltyCardItem(dto));
15459
15930
  }
15460
15931
  /** `GET /api/v1/loyaltycards/personallist` */
15461
15932
  listPersonal(options) {
@@ -15465,7 +15936,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15465
15936
  path: `${BASE18}/personallist`,
15466
15937
  query: { ...rest },
15467
15938
  signal
15468
- });
15939
+ }).then((items) => projectReadList(items, (dto) => projectLoyaltyCardItem(dto)));
15469
15940
  }
15470
15941
  /** `DELETE /api/v1/loyaltycards/personallist/{torrowId}` */
15471
15942
  deleteFromPersonalList(torrowId, options) {
@@ -15487,7 +15958,7 @@ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
15487
15958
  query: buildTimetableQuery(queryOpts),
15488
15959
  body,
15489
15960
  signal
15490
- });
15961
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
15491
15962
  }
15492
15963
  /** `POST /api/v1/loyaltycards/timetable/statistics` */
15493
15964
  async getTimetableStatistics(body, options) {
@@ -15581,7 +16052,7 @@ var UserFacade = class {
15581
16052
  http;
15582
16053
  /** `GET /api/v1/user/loyaltycard` */
15583
16054
  getLoyaltyCard(options) {
15584
- return this.http.requestJson({ method: "GET", path: `${BASE20}/loyaltycard`, signal: options?.signal });
16055
+ return this.http.requestJson({ method: "GET", path: `${BASE20}/loyaltycard`, signal: options?.signal }).then((dto) => projectLoyaltyCardItem(dto));
15585
16056
  }
15586
16057
  /** `GET /api/v1/user/accounts` */
15587
16058
  listAccounts(query, options) {
@@ -15669,7 +16140,7 @@ var UserFacade = class {
15669
16140
  method: "GET",
15670
16141
  path: `${BASE20}/defaultprofile`,
15671
16142
  signal: options?.signal
15672
- });
16143
+ }).then((dto) => projectContactItem(dto));
15673
16144
  }
15674
16145
  /** `PUT /api/v1/user/defaultprofile` */
15675
16146
  async setDefaultProfileByContactId(contactId, options) {
@@ -15679,7 +16150,7 @@ var UserFacade = class {
15679
16150
  body: contactId,
15680
16151
  signal: options?.signal
15681
16152
  });
15682
- return unwrapAddProfileContact(resp);
16153
+ return projectContactItem(unwrapAddProfileContact(resp));
15683
16154
  }
15684
16155
  /**
15685
16156
  * `POST /api/v1/user/defaultprofile` — создать и назначить дефолтный профиль.
@@ -15693,7 +16164,7 @@ var UserFacade = class {
15693
16164
  body: payload,
15694
16165
  signal: options?.signal
15695
16166
  });
15696
- return unwrapAddProfileContact(resp);
16167
+ return projectContactItem(unwrapAddProfileContact(resp));
15697
16168
  }
15698
16169
  /** `GET /api/v1/user/deliveryways` */
15699
16170
  listDeliveryWays(query, options) {
@@ -15751,7 +16222,7 @@ var UserFacade = class {
15751
16222
  query: { ...query ?? {} },
15752
16223
  body,
15753
16224
  signal: options?.signal
15754
- });
16225
+ }).then((items) => projectReadList(items, (dto) => projectTimetableCase(dto)));
15755
16226
  }
15756
16227
  /** `GET /api/v1/user/calendars` */
15757
16228
  listCalendars(options) {
@@ -16032,7 +16503,7 @@ var ItemFacade = class {
16032
16503
  includeDeleted: options?.includeDeleted
16033
16504
  },
16034
16505
  signal: options?.signal
16035
- });
16506
+ }).then((dto) => projectUserFeedback(dto));
16036
16507
  }
16037
16508
  /** `PUT /api/v1/item/{torrowId}/userfeedback` */
16038
16509
  putUserFeedback(torrowId, options) {
@@ -16042,7 +16513,7 @@ var ItemFacade = class {
16042
16513
  path: `${BASE26}/${encodePathSegment(torrowId)}/userfeedback`,
16043
16514
  query: { ...query },
16044
16515
  signal
16045
- });
16516
+ }).then((dto) => projectUserFeedback(dto));
16046
16517
  }
16047
16518
  /** `DELETE /api/v1/item/{torrowId}/userfeedback` */
16048
16519
  async deleteUserFeedback(torrowId, options) {
@@ -16063,7 +16534,7 @@ var ItemFacade = class {
16063
16534
  path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks`,
16064
16535
  query: { ...query },
16065
16536
  signal
16066
- });
16537
+ }).then((items) => projectReadList(items, (dto) => projectItemFeedback(dto)));
16067
16538
  }
16068
16539
  /** `POST /api/v1/item/{torrowId}/feedbacks/newmessage` */
16069
16540
  postFeedbackNewMessage(torrowId, options) {
@@ -16073,7 +16544,7 @@ var ItemFacade = class {
16073
16544
  path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/newmessage`,
16074
16545
  query: { ...query },
16075
16546
  signal
16076
- });
16547
+ }).then((dto) => projectFeedback(dto));
16077
16548
  }
16078
16549
  /** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}` */
16079
16550
  getFeedback(torrowId, messageId, options) {
@@ -16085,7 +16556,7 @@ var ItemFacade = class {
16085
16556
  includeDeleted: options?.includeDeleted
16086
16557
  },
16087
16558
  signal: options?.signal
16088
- });
16559
+ }).then((dto) => projectFeedback(dto));
16089
16560
  }
16090
16561
  /** `PUT /api/v1/item/{torrowId}/feedbacks/{messageId}` */
16091
16562
  updateFeedback(torrowId, messageId, options) {
@@ -16095,7 +16566,7 @@ var ItemFacade = class {
16095
16566
  path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
16096
16567
  query: { ...query },
16097
16568
  signal
16098
- });
16569
+ }).then((dto) => projectFeedback(dto));
16099
16570
  }
16100
16571
  /** `DELETE /api/v1/item/{torrowId}/feedbacks/{messageId}` */
16101
16572
  async deleteFeedback(torrowId, messageId, options) {
@@ -16118,7 +16589,7 @@ var ItemFacade = class {
16118
16589
  path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/reply`,
16119
16590
  query: { ...query },
16120
16591
  signal
16121
- });
16592
+ }).then((dto) => projectFeedback(dto));
16122
16593
  }
16123
16594
  /** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}/replies` — массив **`Feedback`** (не `ItemFeedback`). */
16124
16595
  listFeedbackReplies(torrowId, messageId, options) {
@@ -16128,7 +16599,7 @@ var ItemFacade = class {
16128
16599
  path: `${BASE26}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/replies`,
16129
16600
  query: { ...query },
16130
16601
  signal
16131
- });
16602
+ }).then((items) => projectReadList(items, (dto) => projectFeedback(dto)));
16132
16603
  }
16133
16604
  };
16134
16605
 
@@ -16993,6 +17464,7 @@ var ServiceBuilder = class _ServiceBuilder {
16993
17464
  static create(body) {
16994
17465
  return new _ServiceBuilder(body);
16995
17466
  }
17467
+ /** Принимает исходную конфигурацию, сохраняя nullable write-поля независимо от read-проекции. */
16996
17468
  static from(service) {
16997
17469
  return new _ServiceBuilder(service);
16998
17470
  }
@@ -17353,6 +17825,7 @@ var ResourceBuilder = class _ResourceBuilder {
17353
17825
  static create(body) {
17354
17826
  return new _ResourceBuilder(body);
17355
17827
  }
17828
+ /** Исходная конфигурация сохраняет допустимые nullable write-поля независимо от read-проекции. */
17356
17829
  static from(resource) {
17357
17830
  return new _ResourceBuilder(resource);
17358
17831
  }