@torrow/sdk-client 0.24.0 → 0.25.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
@@ -126,6 +126,10 @@ var ItemPatchEffectStep = /* @__PURE__ */ ((ItemPatchEffectStep2) => {
126
126
  ItemPatchEffectStep2["Write"] = "Write";
127
127
  return ItemPatchEffectStep2;
128
128
  })(ItemPatchEffectStep || {});
129
+ var PlacementEffectStep = /* @__PURE__ */ ((PlacementEffectStep2) => {
130
+ PlacementEffectStep2["Write"] = "Write";
131
+ return PlacementEffectStep2;
132
+ })(PlacementEffectStep || {});
129
133
  var AuthSessionEffectStep = /* @__PURE__ */ ((AuthSessionEffectStep2) => {
130
134
  AuthSessionEffectStep2["CreateAuthSession"] = "CreateAuthSession";
131
135
  AuthSessionEffectStep2["CloseSession"] = "CloseSession";
@@ -9988,10 +9992,10 @@ function validateOperationNoteTypes(body, method, path) {
9988
9992
  if (Array.isArray(current) && node.items !== void 0) {
9989
9993
  current.forEach((entry, i) => merge(invalidPaths(entry, node.items, `${path2}/${i}`, /* @__PURE__ */ new Set())));
9990
9994
  } else if (typeof current === "object" && !Array.isArray(current)) {
9991
- const record8 = current;
9995
+ const record9 = current;
9992
9996
  for (const [key, child] of Object.entries(node.properties ?? {})) {
9993
- if (Object.hasOwn(record8, key)) {
9994
- merge(invalidPaths(record8[key], child, `${path2}/${key}`, /* @__PURE__ */ new Set()));
9997
+ if (Object.hasOwn(record9, key)) {
9998
+ merge(invalidPaths(record9[key], child, `${path2}/${key}`, /* @__PURE__ */ new Set()));
9995
9999
  }
9996
10000
  }
9997
10001
  }
@@ -11885,7 +11889,7 @@ function copyValue(value, active = /* @__PURE__ */ new Set(), path = [], ridPath
11885
11889
  if (Array.isArray(value)) {
11886
11890
  result = Array.from(value, (child, index) => copyValue(child, active, [...path, index], ridPaths));
11887
11891
  } else {
11888
- const record8 = {};
11892
+ const record9 = {};
11889
11893
  for (const key of Reflect.ownKeys(value)) {
11890
11894
  if (typeof key !== "string") {
11891
11895
  throw itemPatchError("InvalidInput" /* InvalidInput */);
@@ -11898,14 +11902,14 @@ function copyValue(value, active = /* @__PURE__ */ new Set(), path = [], ridPath
11898
11902
  if (descriptor.value === void 0 && isPatchRidPath(childPath, ridPaths)) {
11899
11903
  continue;
11900
11904
  }
11901
- Object.defineProperty(record8, key, {
11905
+ Object.defineProperty(record9, key, {
11902
11906
  value: copyValue(descriptor.value, active, childPath, ridPaths),
11903
11907
  enumerable: true,
11904
11908
  writable: true,
11905
11909
  configurable: true
11906
11910
  });
11907
11911
  }
11908
- result = record8;
11912
+ result = record9;
11909
11913
  }
11910
11914
  active.delete(value);
11911
11915
  return result;
@@ -13918,12 +13922,228 @@ var NotesFacade = class extends TorrowItemFacade {
13918
13922
  }
13919
13923
  };
13920
13924
 
13925
+ // ../../src/resources/views/view-domain-resolver.ts
13926
+ function getCreateViewDomain(childIds) {
13927
+ return getTorrowItemDomainFromTorrowIds(childIds);
13928
+ }
13929
+ function getUpdateViewOrderDomain(orderedViews) {
13930
+ const childIds = orderedViews.flatMap(({ childId }) => childId ? [childId] : []);
13931
+ return getTorrowItemDomainFromTorrowIds(childIds);
13932
+ }
13933
+
13934
+ // ../../src/resources/views/view-paths.ts
13935
+ function viewDomainPath(domain) {
13936
+ return `/api/v1/${domain}`;
13937
+ }
13938
+ function viewParentPath(domain, parentId) {
13939
+ return `${viewDomainPath(domain)}/${encodePathSegment(parentId)}`;
13940
+ }
13941
+ function viewChildPath(domain, parentId, kind, childId) {
13942
+ return `${viewParentPath(domain, parentId)}/views/${kind}/${encodePathSegment(childId)}`;
13943
+ }
13944
+
13945
+ // ../../src/resources/relations/placement-types.ts
13946
+ var PlacementKindValues = /* @__PURE__ */ ((PlacementKindValues2) => {
13947
+ PlacementKindValues2["User"] = "User";
13948
+ PlacementKindValues2["Pinned"] = "Pinned";
13949
+ return PlacementKindValues2;
13950
+ })(PlacementKindValues || {});
13951
+ var PlacementWriteStatusValues = /* @__PURE__ */ ((PlacementWriteStatusValues2) => {
13952
+ PlacementWriteStatusValues2["Applied"] = "Applied";
13953
+ PlacementWriteStatusValues2["NoOp"] = "NoOp";
13954
+ PlacementWriteStatusValues2["Unknown"] = "Unknown";
13955
+ return PlacementWriteStatusValues2;
13956
+ })(PlacementWriteStatusValues || {});
13957
+
13958
+ // ../../src/resources/relations/PlacementFacade.ts
13959
+ function record5(value) {
13960
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
13961
+ }
13962
+ function matchesKey(key, parentId, childId) {
13963
+ return key?.parentId === parentId && key.itemId === childId;
13964
+ }
13965
+ function invalidResponse(body) {
13966
+ return new TorrowSdkError({ category: "InvalidResponse" /* InvalidResponse */, sensitive: { body } });
13967
+ }
13968
+ function writeError(cause, dispatched, operation) {
13969
+ const error = cause instanceof TorrowSdkError ? cause : new TorrowSdkError({ category: "Unknown" /* Unknown */, sensitive: { cause } });
13970
+ return error.withContext({
13971
+ operation,
13972
+ request: dispatched ? "Started" /* Started */ : "NotStarted" /* NotStarted */,
13973
+ effects: [
13974
+ {
13975
+ area: "Remote" /* Remote */,
13976
+ step: "Write" /* Write */,
13977
+ state: dispatched ? "Unknown" /* Unknown */ : "NotApplied" /* NotApplied */
13978
+ }
13979
+ ]
13980
+ });
13981
+ }
13982
+ var PlacementFacade = class {
13983
+ constructor(http) {
13984
+ this.http = http;
13985
+ }
13986
+ http;
13987
+ /** Читает ровно одну пару; HTTP-отказ, включая 404, не доказывает отсутствие связи. */
13988
+ async get(parentId, childId, kind, options) {
13989
+ const domain = getTorrowItemDomainFromTorrowId(childId);
13990
+ const path = viewChildPath(domain, parentId, kind === "User" /* User */ ? "user" : "pinned", childId);
13991
+ const view = await this.http.requestJson({ method: "GET", path, signal: options?.signal });
13992
+ const link = record5(view?.itemLink);
13993
+ if (!link || link.parentId !== parentId || link.itemId !== childId || link.linkType !== kind) {
13994
+ throw invalidResponse(view);
13995
+ }
13996
+ const order = link.order;
13997
+ if (order !== void 0 && order !== null && (!Number.isInteger(order) || typeof order !== "number")) {
13998
+ throw invalidResponse(view);
13999
+ }
14000
+ const base = {
14001
+ parentId,
14002
+ childId,
14003
+ ...order !== void 0 ? { order } : {}
14004
+ };
14005
+ if (kind === "User" /* User */) {
14006
+ return { ...base, kind };
14007
+ }
14008
+ const alias = link.alias;
14009
+ const tags = link.tags;
14010
+ if (alias !== void 0 && alias !== null && typeof alias !== "string" || tags !== void 0 && tags !== null && (!Array.isArray(tags) || tags.some((tag) => typeof tag !== "string"))) {
14011
+ throw invalidResponse(view);
14012
+ }
14013
+ return {
14014
+ ...base,
14015
+ kind,
14016
+ ...alias !== void 0 ? { alias } : {},
14017
+ ...tags !== void 0 ? { tags } : {}
14018
+ };
14019
+ }
14020
+ /** Создаёт одну пару. Backend может сначала снять противоположный вид без общей транзакции. */
14021
+ async attach(input, options) {
14022
+ const domain = getTorrowItemDomainFromTorrowId(input.parentId);
14023
+ let dispatched = false;
14024
+ try {
14025
+ const itemProperties = {
14026
+ itemId: input.childId,
14027
+ ...input.order !== void 0 ? { order: input.order } : {},
14028
+ ...input.kind === "Pinned" /* Pinned */ && input.alias !== void 0 ? { alias: input.alias } : {},
14029
+ ...input.kind === "Pinned" /* Pinned */ && input.tags !== void 0 ? { tags: input.tags } : {}
14030
+ };
14031
+ const resp = await this.http.requestJson(
14032
+ {
14033
+ method: "PUT",
14034
+ path: `/api/v1/${domain}/${encodePathSegment(input.parentId)}/include/${input.kind === "User" /* User */ ? "foruser" : "items"}`,
14035
+ body: { itemPropertiesList: [itemProperties] },
14036
+ signal: options?.signal
14037
+ },
14038
+ () => {
14039
+ dispatched = true;
14040
+ }
14041
+ );
14042
+ const included = resp?.includeResp;
14043
+ const excluded = resp?.excludeResp;
14044
+ if (included?.success !== true || !Array.isArray(included.linkMetaList)) {
14045
+ throw invalidResponse(resp);
14046
+ }
14047
+ if (included.linkMetaList.some(
14048
+ (entry) => !matchesKey(entry.key, input.parentId, input.childId) || record5(entry.info) === null
14049
+ )) {
14050
+ throw invalidResponse(resp);
14051
+ }
14052
+ const status = included.linkMetaList.length > 0 ? "Applied" /* Applied */ : "NoOp" /* NoOp */;
14053
+ let oppositeStatus = "Unknown" /* Unknown */;
14054
+ if (excluded?.success === true && Array.isArray(excluded.linkMetaList)) {
14055
+ if (excluded.linkMetaList.some(
14056
+ (entry) => !matchesKey(entry.key, input.parentId, input.childId) || !Number.isInteger(entry.count) || (entry.count ?? 0) <= 0
14057
+ )) {
14058
+ throw invalidResponse(resp);
14059
+ }
14060
+ oppositeStatus = excluded.linkMetaList.length > 0 ? "Applied" /* Applied */ : "NoOp" /* NoOp */;
14061
+ }
14062
+ return { parentId: input.parentId, childId: input.childId, kind: input.kind, status, oppositeStatus };
14063
+ } catch (cause) {
14064
+ throw writeError(cause, dispatched, "Placement.attach");
14065
+ }
14066
+ }
14067
+ /** Снимает только запрошенную пару и вид, без readback или повтора. */
14068
+ async detach(parentId, childId, kind, options) {
14069
+ const domain = getTorrowItemDomainFromTorrowId(parentId);
14070
+ let dispatched = false;
14071
+ try {
14072
+ const resp = await this.http.requestJson(
14073
+ {
14074
+ method: "PUT",
14075
+ path: `/api/v1/${domain}/${encodePathSegment(parentId)}/exclude/${kind === "User" /* User */ ? "fromuser" : "items"}`,
14076
+ body: { itemIds: [childId] },
14077
+ signal: options?.signal
14078
+ },
14079
+ () => {
14080
+ dispatched = true;
14081
+ }
14082
+ );
14083
+ if (resp?.success !== true || !Array.isArray(resp.linkMetaList)) {
14084
+ throw invalidResponse(resp);
14085
+ }
14086
+ if (resp.linkMetaList.some((entry) => !matchesKey(entry.key, parentId, childId))) {
14087
+ throw invalidResponse(resp);
14088
+ }
14089
+ const count = resp.linkMetaList.reduce((total, entry) => total + (entry.count ?? 0), 0);
14090
+ if (!Number.isInteger(count) || resp.linkMetaList.some((entry) => !Number.isInteger(entry.count) || (entry.count ?? 0) <= 0)) {
14091
+ throw invalidResponse(resp);
14092
+ }
14093
+ return {
14094
+ parentId,
14095
+ childId,
14096
+ kind,
14097
+ status: count > 0 ? "Applied" /* Applied */ : "NoOp" /* NoOp */
14098
+ };
14099
+ } catch (cause) {
14100
+ throw writeError(cause, dispatched, "Placement.detach");
14101
+ }
14102
+ }
14103
+ /** Изменяет явные веса одним серверным вызовом; результат каждого ребёнка проверяется отдельно. */
14104
+ async reorder(parentId, kind, items, options) {
14105
+ const domain = getUpdateViewOrderDomain(items);
14106
+ let dispatched = false;
14107
+ try {
14108
+ const resp = await this.http.requestJson(
14109
+ {
14110
+ method: "POST",
14111
+ path: `${viewParentPath(domain, parentId)}/views/${kind === "User" /* User */ ? "user" : "pinned"}/updateorder`,
14112
+ body: { orderedViewList: items },
14113
+ signal: options?.signal
14114
+ },
14115
+ () => {
14116
+ dispatched = true;
14117
+ }
14118
+ );
14119
+ if (!Array.isArray(resp?.updatedViewInfoList)) {
14120
+ throw invalidResponse(resp);
14121
+ }
14122
+ return items.map((item) => {
14123
+ const matches = resp.updatedViewInfoList?.filter((entry) => matchesKey(entry.itemLinkKey, parentId, item.childId)) ?? [];
14124
+ const applied = matches.length === 1 && !matches[0].torrowError && record5(matches[0].itemLinkInfo) !== null;
14125
+ return {
14126
+ parentId,
14127
+ childId: item.childId,
14128
+ kind,
14129
+ status: applied ? "Applied" /* Applied */ : "Unknown" /* Unknown */
14130
+ };
14131
+ });
14132
+ } catch (cause) {
14133
+ throw writeError(cause, dispatched, "Placement.reorder");
14134
+ }
14135
+ }
14136
+ };
14137
+
13921
14138
  // ../../src/resources/relations/RelationsFacade.ts
13922
14139
  var RelationsFacade = class {
13923
14140
  constructor(http) {
13924
14141
  this.http = http;
14142
+ this.placements = new PlacementFacade(http);
13925
14143
  }
13926
14144
  http;
14145
+ /** Точные User/Pinned связи с проверенным ACK отдельного вызова. */
14146
+ placements;
13927
14147
  base(domain) {
13928
14148
  return `/api/v1/${domain}`;
13929
14149
  }
@@ -13946,7 +14166,8 @@ var RelationsFacade = class {
13946
14166
  * в личную структуру пользователя под указанным родителем (`LinkType.User`).
13947
14167
  * Это batch-операция: `parentId` задаётся в path, а дочерние item'ы передаются
13948
14168
  * первым аргументом как `itemPropertiesList` (`itemId`, опционально `order`).
13949
- * Канон torrow-apps для сохранения одного item — {@link saveToMindMap}, не этот метод.
14169
+ * Канон torrow-apps для участия и сохранения одного item — {@link saveToMindMap}.
14170
+ * Для placement-only одной существующей пары используйте {@link placements}.
13950
14171
  */
13951
14172
  includeForUser(parentId, itemPropertiesList, options) {
13952
14173
  const domain = getTorrowItemDomainFromTorrowId(parentId);
@@ -14498,11 +14719,11 @@ var providers = {
14498
14719
  strings: ["redirectBaseUrl"]
14499
14720
  }
14500
14721
  };
14501
- function record5(value) {
14722
+ function record6(value) {
14502
14723
  return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
14503
14724
  }
14504
14725
  function isResourcePaymentPatch(value) {
14505
- if (!record5(value) || Object.keys(value).some(
14726
+ if (!record6(value) || Object.keys(value).some(
14506
14727
  (key) => !["paymentProviderType", "parameters", "numeratorId", "waitForConfirmation"].includes(key)
14507
14728
  )) {
14508
14729
  return false;
@@ -14522,7 +14743,7 @@ function isResourcePaymentPatch(value) {
14522
14743
  if (value.parameters == null) {
14523
14744
  return guarded;
14524
14745
  }
14525
- if (!record5(value.parameters)) {
14746
+ if (!record6(value.parameters)) {
14526
14747
  return false;
14527
14748
  }
14528
14749
  const parameters = value.parameters;
@@ -14551,7 +14772,7 @@ function isResourcePaymentPatch(value) {
14551
14772
  });
14552
14773
  }
14553
14774
  function paymentPatchToWire(value) {
14554
- if (!record5(value) || !record5(value.parameters)) {
14775
+ if (!record6(value) || !record6(value.parameters)) {
14555
14776
  return value;
14556
14777
  }
14557
14778
  const shape2 = providers[value.paymentProviderType];
@@ -14568,7 +14789,7 @@ function equalResourcePaymentPatchField(key, before, after) {
14568
14789
  return void 0;
14569
14790
  }
14570
14791
  const expected = paymentPatchToWire(after);
14571
- if (record5(before) && record5(expected) && before.paymentProviderType === "MockPaymentProvider" /* Mock */ && expected.paymentProviderType === "MockPaymentProvider" /* Mock */ && record5(before.parameters) && record5(expected.parameters) && expected.parameters.createAfter instanceof Date && typeof before.parameters.createAfter === "string") {
14792
+ if (record6(before) && record6(expected) && before.paymentProviderType === "MockPaymentProvider" /* Mock */ && expected.paymentProviderType === "MockPaymentProvider" /* Mock */ && record6(before.parameters) && record6(expected.parameters) && expected.parameters.createAfter instanceof Date && typeof before.parameters.createAfter === "string") {
14572
14793
  const date2 = new Date(before.parameters.createAfter);
14573
14794
  if (!Number.isFinite(date2.getTime())) {
14574
14795
  return false;
@@ -14687,7 +14908,7 @@ function invalidInput() {
14687
14908
  function insufficientData() {
14688
14909
  throw itemPatchError("InsufficientData" /* InsufficientData */);
14689
14910
  }
14690
- function invalidResponse() {
14911
+ function invalidResponse2() {
14691
14912
  throw itemPatchError("InvalidResponse" /* InvalidResponse */);
14692
14913
  }
14693
14914
  function validateSelector(selector) {
@@ -14733,26 +14954,26 @@ function checkedDescriptions(dto) {
14733
14954
  insufficientData();
14734
14955
  }
14735
14956
  if (!Array.isArray(list)) {
14736
- invalidResponse();
14957
+ invalidResponse2();
14737
14958
  }
14738
14959
  const seen = /* @__PURE__ */ new Set();
14739
14960
  for (const binding of list) {
14740
14961
  if (binding === null || typeof binding !== "object" || Array.isArray(binding) || typeof binding.id !== "string" || typeof binding.resourceGroupId !== "string" || binding.resourceGroupId.length === 0) {
14741
- invalidResponse();
14962
+ invalidResponse2();
14742
14963
  }
14743
14964
  try {
14744
14965
  if (getTorrowObjectTypeFromTorrowId(binding.id) !== "Service") {
14745
- invalidResponse();
14966
+ invalidResponse2();
14746
14967
  }
14747
14968
  } catch {
14748
- invalidResponse();
14969
+ invalidResponse2();
14749
14970
  }
14750
14971
  if (binding.serviceName != null && typeof binding.serviceName !== "string" || binding.resourceGroupName != null && typeof binding.resourceGroupName !== "string" || binding.laterBinding != null && typeof binding.laterBinding !== "boolean" || binding.usageAmount != null && (typeof binding.usageAmount !== "number" || !Number.isFinite(binding.usageAmount)) || binding.sortIndex != null && (typeof binding.sortIndex !== "number" || !Number.isInteger(binding.sortIndex) || binding.sortIndex < -2147483648 || binding.sortIndex > 2147483647)) {
14751
- invalidResponse();
14972
+ invalidResponse2();
14752
14973
  }
14753
14974
  const pair = `${binding.id.length}:${binding.id}${binding.resourceGroupId}`;
14754
14975
  if (seen.has(pair)) {
14755
- invalidResponse();
14976
+ invalidResponse2();
14756
14977
  }
14757
14978
  seen.add(pair);
14758
14979
  }
@@ -14794,7 +15015,7 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
14794
15015
  signal
14795
15016
  });
14796
15017
  if (service === null || typeof service !== "object" || Array.isArray(service) || service.id !== selected.serviceId) {
14797
- invalidResponse();
15018
+ invalidResponse2();
14798
15019
  }
14799
15020
  const groups = service.resourceGroupList;
14800
15021
  if (!Array.isArray(groups)) {
@@ -14802,14 +15023,14 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
14802
15023
  }
14803
15024
  const matchingGroups = groups.filter((item) => item?.groupId === selected.resourceGroupId);
14804
15025
  if (matchingGroups.length > 1) {
14805
- invalidResponse();
15026
+ invalidResponse2();
14806
15027
  }
14807
15028
  const group = matchingGroups[0];
14808
15029
  if (!group || typeof group.usageType !== "string" || group.usageType.length === 0 || typeof group.groupName !== "string" || typeof service.name !== "string") {
14809
15030
  insufficientData();
14810
15031
  }
14811
15032
  if (group.usageType === UsageTypeValues.Unknown || !Object.values(UsageTypeValues).some((value) => value === group.usageType)) {
14812
- invalidResponse();
15033
+ invalidResponse2();
14813
15034
  }
14814
15035
  if (dto.usageType !== group.usageType) {
14815
15036
  invalidInput();
@@ -14832,13 +15053,13 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
14832
15053
  },
14833
15054
  assertAck(ack, written) {
14834
15055
  if (!before || !expected || !Array.isArray(ack.serviceDescriptions) || !equalItemPatchValue(ack.serviceDescriptions, expected) || !Number.isInteger(ack.meta?.version) || (ack.meta?.version ?? 0) <= 0) {
14835
- invalidResponse();
15056
+ invalidResponse2();
14836
15057
  }
14837
15058
  const rawAck = ack;
14838
15059
  const rawWritten = written;
14839
15060
  for (const key of preservedRootFields) {
14840
15061
  if (Object.hasOwn(before, key) && !equalItemPatchValue(rawAck[key], rawWritten[key])) {
14841
- invalidResponse();
15062
+ invalidResponse2();
14842
15063
  }
14843
15064
  }
14844
15065
  acknowledged = ack.serviceDescriptions;
@@ -15364,18 +15585,18 @@ var configs = Object.values(SERVICE_IMPLICIT_TAG_REGISTRY);
15364
15585
  function isBehaviorVersion(value) {
15365
15586
  return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 2147483647;
15366
15587
  }
15367
- function record6(value) {
15588
+ function record7(value) {
15368
15589
  return value !== null && typeof value === "object" && !Array.isArray(value);
15369
15590
  }
15370
15591
  function validateBehaviorResponse(value, serviceId) {
15371
- if (!record6(value) || value.id !== serviceId) {
15592
+ if (!record7(value) || value.id !== serviceId) {
15372
15593
  throw behaviorSettingsError("InvalidResponse" /* InvalidResponse */);
15373
15594
  }
15374
15595
  const personal = value.personalInfo;
15375
- if (record6(personal) && (personal.itemContentType === "NoRights" /* NoRights */ || personal.itemContentType === "SubscriptionIsNotValid" /* SubscriptionIsNotValid */)) {
15596
+ if (record7(personal) && (personal.itemContentType === "NoRights" /* NoRights */ || personal.itemContentType === "SubscriptionIsNotValid" /* SubscriptionIsNotValid */)) {
15376
15597
  throw behaviorSettingsError("AccessDenied" /* AccessDenied */);
15377
15598
  }
15378
- if (!record6(personal) || personal.itemContentType !== "Full" /* Full */ || value.tags == null || !record6(value.meta) || !isBehaviorVersion(value.meta.version)) {
15599
+ if (!record7(personal) || personal.itemContentType !== "Full" /* Full */ || value.tags == null || !record7(value.meta) || !isBehaviorVersion(value.meta.version)) {
15379
15600
  throw behaviorSettingsError("InsufficientData" /* InsufficientData */);
15380
15601
  }
15381
15602
  if (!Array.isArray(value.tags) || !value.tags.every((tag) => typeof tag === "string")) {
@@ -15504,7 +15725,7 @@ function normalizeBehaviorInput(input) {
15504
15725
  function fail() {
15505
15726
  throw behaviorSettingsError("InvalidInput" /* InvalidInput */);
15506
15727
  }
15507
- if (!record6(input) || Object.keys(input).some((key) => !Object.hasOwn(SERVICE_IMPLICIT_TAG_REGISTRY, key))) {
15728
+ if (!record7(input) || Object.keys(input).some((key) => !Object.hasOwn(SERVICE_IMPLICIT_TAG_REGISTRY, key))) {
15508
15729
  fail();
15509
15730
  }
15510
15731
  const output = {};
@@ -15534,7 +15755,7 @@ function normalizeBehaviorInput(input) {
15534
15755
  }
15535
15756
  const seen = /* @__PURE__ */ new Set();
15536
15757
  output[config.field] = value.map((entry) => {
15537
- if (!record6(entry) || Object.keys(entry).some((key) => !["index", "text", "link"].includes(key)) || typeof entry.index !== "number" || !Number.isSafeInteger(entry.index) || entry.index <= 0 || seen.has(entry.index)) {
15758
+ if (!record7(entry) || Object.keys(entry).some((key) => !["index", "text", "link"].includes(key)) || typeof entry.index !== "number" || !Number.isSafeInteger(entry.index) || entry.index <= 0 || seen.has(entry.index)) {
15538
15759
  fail();
15539
15760
  }
15540
15761
  seen.add(entry.index);
@@ -16271,26 +16492,6 @@ var ProfilesFacade = class {
16271
16492
  }
16272
16493
  };
16273
16494
 
16274
- // ../../src/resources/views/view-domain-resolver.ts
16275
- function getCreateViewDomain(childIds) {
16276
- return getTorrowItemDomainFromTorrowIds(childIds);
16277
- }
16278
- function getUpdateViewOrderDomain(orderedViews) {
16279
- const childIds = orderedViews.flatMap(({ childId }) => childId ? [childId] : []);
16280
- return getTorrowItemDomainFromTorrowIds(childIds);
16281
- }
16282
-
16283
- // ../../src/resources/views/view-paths.ts
16284
- function viewDomainPath(domain) {
16285
- return `/api/v1/${domain}`;
16286
- }
16287
- function viewParentPath(domain, parentId) {
16288
- return `${viewDomainPath(domain)}/${encodePathSegment(parentId)}`;
16289
- }
16290
- function viewChildPath(domain, parentId, kind, childId) {
16291
- return `${viewParentPath(domain, parentId)}/views/${kind}/${encodePathSegment(childId)}`;
16292
- }
16293
-
16294
16495
  // ../../src/resources/views/PinnedViewsFacade.ts
16295
16496
  var PinnedViewsFacade = class {
16296
16497
  constructor(http) {
@@ -16483,7 +16684,9 @@ var ViewsFacade = class {
16483
16684
  pinned;
16484
16685
  /**
16485
16686
  * `POST /api/v1/{domain}/{parentId}/views/user/{childId}/pin` — переход **User → Pinned**.
16486
- * Создание исходной User view: `client.views.user.create` или `client.relations.saveToMindMap`.
16687
+ * Внутри backend сначала снимается User-связь, затем создаётся Pinned; общей транзакции нет.
16688
+ * Query `alias` принимается маршрутом, но текущий ViewLayer его не применяет.
16689
+ * Создание исходной User view: `client.views.user.create` или `client.relations.placements.attach`.
16487
16690
  */
16488
16691
  pin(parentId, childId, options) {
16489
16692
  const { signal, alias } = options ?? {};
@@ -16497,6 +16700,8 @@ var ViewsFacade = class {
16497
16700
  }
16498
16701
  /**
16499
16702
  * Переход **Pinned → User**. Для `contacts` API использует сегмент `pinned`, для остальных доменов — `user`.
16703
+ * Внутри backend сначала снимается Pinned-связь, затем создаётся User; общей транзакции нет.
16704
+ * Query `alias` принимается маршрутом, но текущий ViewLayer его не применяет.
16500
16705
  */
16501
16706
  unpin(parentId, childId, options) {
16502
16707
  const { signal, alias } = options ?? {};
@@ -18009,12 +18214,12 @@ var IntegrationEventTypeValues = /* @__PURE__ */ ((IntegrationEventTypeValues2)
18009
18214
  IntegrationEventTypeValues2["UpdateOrder"] = "UpdateOrder";
18010
18215
  return IntegrationEventTypeValues2;
18011
18216
  })(IntegrationEventTypeValues || {});
18012
- function record7(value) {
18217
+ function record8(value) {
18013
18218
  return typeof value === "object" && value !== null && !Array.isArray(value);
18014
18219
  }
18015
18220
  function hasReadEnvelope(value, type, discriminator) {
18016
- return record7(value) && typeof value.name === "string" && value.integrationType === type && value.discriminator === discriminator && record7(value.integrationParameters) && Array.isArray(value.integrationEvents) && Array.from(value.integrationEvents).every(
18017
- (event) => record7(event) && typeof event.rid === "string" && typeof event.eventType === "string" && Object.values(IntegrationEventTypeValues).some((known) => known === event.eventType)
18221
+ return record8(value) && typeof value.name === "string" && value.integrationType === type && value.discriminator === discriminator && record8(value.integrationParameters) && Array.isArray(value.integrationEvents) && Array.from(value.integrationEvents).every(
18222
+ (event) => record8(event) && typeof event.rid === "string" && typeof event.eventType === "string" && Object.values(IntegrationEventTypeValues).some((known) => known === event.eventType)
18018
18223
  );
18019
18224
  }
18020
18225
  function isExternalCalendarIntegration(value) {
@@ -18022,8 +18227,8 @@ function isExternalCalendarIntegration(value) {
18022
18227
  return false;
18023
18228
  }
18024
18229
  const parameters = value.integrationParameters;
18025
- return record7(parameters) && Array.isArray(parameters.externalCalendars) && Array.from(parameters.externalCalendars).every(
18026
- (calendar) => record7(calendar) && typeof calendar.externalAuthId === "string"
18230
+ return record8(parameters) && Array.isArray(parameters.externalCalendars) && Array.from(parameters.externalCalendars).every(
18231
+ (calendar) => record8(calendar) && typeof calendar.externalAuthId === "string"
18027
18232
  );
18028
18233
  }
18029
18234
  function isVideoTelephonyIntegration(value) {
@@ -18031,7 +18236,7 @@ function isVideoTelephonyIntegration(value) {
18031
18236
  return false;
18032
18237
  }
18033
18238
  const parameters = value.integrationParameters;
18034
- return record7(parameters) && record7(parameters.videoTelephony) && typeof parameters.videoTelephony.externalAuthId === "string";
18239
+ return record8(parameters) && record8(parameters.videoTelephony) && typeof parameters.videoTelephony.externalAuthId === "string";
18035
18240
  }
18036
18241
  function isWebHookIntegration(integration) {
18037
18242
  return typeof integration === "object" && integration !== null && "name" in integration && typeof integration.name === "string" && "integrationType" in integration && integration.integrationType === "WebHook" /* WebHook */ && "discriminator" in integration && integration.discriminator === "WebHookIntegration" /* WebHookIntegration */ && "integrationParameters" in integration && typeof integration.integrationParameters === "object" && integration.integrationParameters !== null && "url" in integration.integrationParameters && typeof integration.integrationParameters.url === "string" && "integrationEvents" in integration && Array.isArray(integration.integrationEvents) && Array.from(integration.integrationEvents).every(
@@ -20385,6 +20590,10 @@ export {
20385
20590
  ParticipationFieldTypeValues,
20386
20591
  PaymentProviderTypeValues,
20387
20592
  PinnedViewsFacade,
20593
+ PlacementEffectStep,
20594
+ PlacementFacade,
20595
+ PlacementKindValues,
20596
+ PlacementWriteStatusValues,
20388
20597
  ProfileEffectStep,
20389
20598
  ProfileErrorReason,
20390
20599
  ProfileFailureAt,