@torrow/sdk-client 0.24.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/index.d.ts +106 -4
- package/dist/index.js +268 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
9995
|
+
const record9 = current;
|
|
9992
9996
|
for (const [key, child] of Object.entries(node.properties ?? {})) {
|
|
9993
|
-
if (Object.hasOwn(
|
|
9994
|
-
merge(invalidPaths(
|
|
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
|
|
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(
|
|
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 =
|
|
11912
|
+
result = record9;
|
|
11909
11913
|
}
|
|
11910
11914
|
active.delete(value);
|
|
11911
11915
|
return result;
|
|
@@ -13918,12 +13922,230 @@ 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 (input.kind === "Pinned" /* Pinned */ && excluded?.success === false && Array.isArray(excluded.linkMetaList) && excluded.linkMetaList.length === 0) {
|
|
14055
|
+
oppositeStatus = "NoOp" /* NoOp */;
|
|
14056
|
+
} else if (excluded?.success === true && Array.isArray(excluded.linkMetaList)) {
|
|
14057
|
+
if (excluded.linkMetaList.some(
|
|
14058
|
+
(entry) => !matchesKey(entry.key, input.parentId, input.childId) || !Number.isInteger(entry.count) || (entry.count ?? 0) <= 0
|
|
14059
|
+
)) {
|
|
14060
|
+
throw invalidResponse(resp);
|
|
14061
|
+
}
|
|
14062
|
+
oppositeStatus = excluded.linkMetaList.length > 0 ? "Applied" /* Applied */ : "NoOp" /* NoOp */;
|
|
14063
|
+
}
|
|
14064
|
+
return { parentId: input.parentId, childId: input.childId, kind: input.kind, status, oppositeStatus };
|
|
14065
|
+
} catch (cause) {
|
|
14066
|
+
throw writeError(cause, dispatched, "Placement.attach");
|
|
14067
|
+
}
|
|
14068
|
+
}
|
|
14069
|
+
/** Снимает только запрошенную пару и вид, без readback или повтора. */
|
|
14070
|
+
async detach(parentId, childId, kind, options) {
|
|
14071
|
+
const domain = getTorrowItemDomainFromTorrowId(parentId);
|
|
14072
|
+
let dispatched = false;
|
|
14073
|
+
try {
|
|
14074
|
+
const resp = await this.http.requestJson(
|
|
14075
|
+
{
|
|
14076
|
+
method: "PUT",
|
|
14077
|
+
path: `/api/v1/${domain}/${encodePathSegment(parentId)}/exclude/${kind === "User" /* User */ ? "fromuser" : "items"}`,
|
|
14078
|
+
body: { itemIds: [childId] },
|
|
14079
|
+
signal: options?.signal
|
|
14080
|
+
},
|
|
14081
|
+
() => {
|
|
14082
|
+
dispatched = true;
|
|
14083
|
+
}
|
|
14084
|
+
);
|
|
14085
|
+
if (resp?.success !== true || !Array.isArray(resp.linkMetaList)) {
|
|
14086
|
+
throw invalidResponse(resp);
|
|
14087
|
+
}
|
|
14088
|
+
if (resp.linkMetaList.some((entry) => !matchesKey(entry.key, parentId, childId))) {
|
|
14089
|
+
throw invalidResponse(resp);
|
|
14090
|
+
}
|
|
14091
|
+
const count = resp.linkMetaList.reduce((total, entry) => total + (entry.count ?? 0), 0);
|
|
14092
|
+
if (!Number.isInteger(count) || resp.linkMetaList.some((entry) => !Number.isInteger(entry.count) || (entry.count ?? 0) <= 0)) {
|
|
14093
|
+
throw invalidResponse(resp);
|
|
14094
|
+
}
|
|
14095
|
+
return {
|
|
14096
|
+
parentId,
|
|
14097
|
+
childId,
|
|
14098
|
+
kind,
|
|
14099
|
+
status: count > 0 ? "Applied" /* Applied */ : "NoOp" /* NoOp */
|
|
14100
|
+
};
|
|
14101
|
+
} catch (cause) {
|
|
14102
|
+
throw writeError(cause, dispatched, "Placement.detach");
|
|
14103
|
+
}
|
|
14104
|
+
}
|
|
14105
|
+
/** Изменяет явные веса одним серверным вызовом; результат каждого ребёнка проверяется отдельно. */
|
|
14106
|
+
async reorder(parentId, kind, items, options) {
|
|
14107
|
+
const domain = getUpdateViewOrderDomain(items);
|
|
14108
|
+
let dispatched = false;
|
|
14109
|
+
try {
|
|
14110
|
+
const resp = await this.http.requestJson(
|
|
14111
|
+
{
|
|
14112
|
+
method: "POST",
|
|
14113
|
+
path: `${viewParentPath(domain, parentId)}/views/${kind === "User" /* User */ ? "user" : "pinned"}/updateorder`,
|
|
14114
|
+
body: { orderedViewList: items },
|
|
14115
|
+
signal: options?.signal
|
|
14116
|
+
},
|
|
14117
|
+
() => {
|
|
14118
|
+
dispatched = true;
|
|
14119
|
+
}
|
|
14120
|
+
);
|
|
14121
|
+
if (!Array.isArray(resp?.updatedViewInfoList)) {
|
|
14122
|
+
throw invalidResponse(resp);
|
|
14123
|
+
}
|
|
14124
|
+
return items.map((item) => {
|
|
14125
|
+
const matches = resp.updatedViewInfoList?.filter((entry) => matchesKey(entry.itemLinkKey, parentId, item.childId)) ?? [];
|
|
14126
|
+
const applied = matches.length === 1 && !matches[0].torrowError && record5(matches[0].itemLinkInfo) !== null;
|
|
14127
|
+
return {
|
|
14128
|
+
parentId,
|
|
14129
|
+
childId: item.childId,
|
|
14130
|
+
kind,
|
|
14131
|
+
status: applied ? "Applied" /* Applied */ : "Unknown" /* Unknown */
|
|
14132
|
+
};
|
|
14133
|
+
});
|
|
14134
|
+
} catch (cause) {
|
|
14135
|
+
throw writeError(cause, dispatched, "Placement.reorder");
|
|
14136
|
+
}
|
|
14137
|
+
}
|
|
14138
|
+
};
|
|
14139
|
+
|
|
13921
14140
|
// ../../src/resources/relations/RelationsFacade.ts
|
|
13922
14141
|
var RelationsFacade = class {
|
|
13923
14142
|
constructor(http) {
|
|
13924
14143
|
this.http = http;
|
|
14144
|
+
this.placements = new PlacementFacade(http);
|
|
13925
14145
|
}
|
|
13926
14146
|
http;
|
|
14147
|
+
/** Точные User/Pinned связи с проверенным ACK отдельного вызова. */
|
|
14148
|
+
placements;
|
|
13927
14149
|
base(domain) {
|
|
13928
14150
|
return `/api/v1/${domain}`;
|
|
13929
14151
|
}
|
|
@@ -13946,7 +14168,8 @@ var RelationsFacade = class {
|
|
|
13946
14168
|
* в личную структуру пользователя под указанным родителем (`LinkType.User`).
|
|
13947
14169
|
* Это batch-операция: `parentId` задаётся в path, а дочерние item'ы передаются
|
|
13948
14170
|
* первым аргументом как `itemPropertiesList` (`itemId`, опционально `order`).
|
|
13949
|
-
* Канон torrow-apps для сохранения одного item — {@link saveToMindMap}
|
|
14171
|
+
* Канон torrow-apps для участия и сохранения одного item — {@link saveToMindMap}.
|
|
14172
|
+
* Для placement-only одной существующей пары используйте {@link placements}.
|
|
13950
14173
|
*/
|
|
13951
14174
|
includeForUser(parentId, itemPropertiesList, options) {
|
|
13952
14175
|
const domain = getTorrowItemDomainFromTorrowId(parentId);
|
|
@@ -14498,11 +14721,11 @@ var providers = {
|
|
|
14498
14721
|
strings: ["redirectBaseUrl"]
|
|
14499
14722
|
}
|
|
14500
14723
|
};
|
|
14501
|
-
function
|
|
14724
|
+
function record6(value) {
|
|
14502
14725
|
return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
|
|
14503
14726
|
}
|
|
14504
14727
|
function isResourcePaymentPatch(value) {
|
|
14505
|
-
if (!
|
|
14728
|
+
if (!record6(value) || Object.keys(value).some(
|
|
14506
14729
|
(key) => !["paymentProviderType", "parameters", "numeratorId", "waitForConfirmation"].includes(key)
|
|
14507
14730
|
)) {
|
|
14508
14731
|
return false;
|
|
@@ -14522,7 +14745,7 @@ function isResourcePaymentPatch(value) {
|
|
|
14522
14745
|
if (value.parameters == null) {
|
|
14523
14746
|
return guarded;
|
|
14524
14747
|
}
|
|
14525
|
-
if (!
|
|
14748
|
+
if (!record6(value.parameters)) {
|
|
14526
14749
|
return false;
|
|
14527
14750
|
}
|
|
14528
14751
|
const parameters = value.parameters;
|
|
@@ -14551,7 +14774,7 @@ function isResourcePaymentPatch(value) {
|
|
|
14551
14774
|
});
|
|
14552
14775
|
}
|
|
14553
14776
|
function paymentPatchToWire(value) {
|
|
14554
|
-
if (!
|
|
14777
|
+
if (!record6(value) || !record6(value.parameters)) {
|
|
14555
14778
|
return value;
|
|
14556
14779
|
}
|
|
14557
14780
|
const shape2 = providers[value.paymentProviderType];
|
|
@@ -14568,7 +14791,7 @@ function equalResourcePaymentPatchField(key, before, after) {
|
|
|
14568
14791
|
return void 0;
|
|
14569
14792
|
}
|
|
14570
14793
|
const expected = paymentPatchToWire(after);
|
|
14571
|
-
if (
|
|
14794
|
+
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
14795
|
const date2 = new Date(before.parameters.createAfter);
|
|
14573
14796
|
if (!Number.isFinite(date2.getTime())) {
|
|
14574
14797
|
return false;
|
|
@@ -14687,7 +14910,7 @@ function invalidInput() {
|
|
|
14687
14910
|
function insufficientData() {
|
|
14688
14911
|
throw itemPatchError("InsufficientData" /* InsufficientData */);
|
|
14689
14912
|
}
|
|
14690
|
-
function
|
|
14913
|
+
function invalidResponse2() {
|
|
14691
14914
|
throw itemPatchError("InvalidResponse" /* InvalidResponse */);
|
|
14692
14915
|
}
|
|
14693
14916
|
function validateSelector(selector) {
|
|
@@ -14733,26 +14956,26 @@ function checkedDescriptions(dto) {
|
|
|
14733
14956
|
insufficientData();
|
|
14734
14957
|
}
|
|
14735
14958
|
if (!Array.isArray(list)) {
|
|
14736
|
-
|
|
14959
|
+
invalidResponse2();
|
|
14737
14960
|
}
|
|
14738
14961
|
const seen = /* @__PURE__ */ new Set();
|
|
14739
14962
|
for (const binding of list) {
|
|
14740
14963
|
if (binding === null || typeof binding !== "object" || Array.isArray(binding) || typeof binding.id !== "string" || typeof binding.resourceGroupId !== "string" || binding.resourceGroupId.length === 0) {
|
|
14741
|
-
|
|
14964
|
+
invalidResponse2();
|
|
14742
14965
|
}
|
|
14743
14966
|
try {
|
|
14744
14967
|
if (getTorrowObjectTypeFromTorrowId(binding.id) !== "Service") {
|
|
14745
|
-
|
|
14968
|
+
invalidResponse2();
|
|
14746
14969
|
}
|
|
14747
14970
|
} catch {
|
|
14748
|
-
|
|
14971
|
+
invalidResponse2();
|
|
14749
14972
|
}
|
|
14750
14973
|
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
|
-
|
|
14974
|
+
invalidResponse2();
|
|
14752
14975
|
}
|
|
14753
14976
|
const pair = `${binding.id.length}:${binding.id}${binding.resourceGroupId}`;
|
|
14754
14977
|
if (seen.has(pair)) {
|
|
14755
|
-
|
|
14978
|
+
invalidResponse2();
|
|
14756
14979
|
}
|
|
14757
14980
|
seen.add(pair);
|
|
14758
14981
|
}
|
|
@@ -14794,7 +15017,7 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
|
|
|
14794
15017
|
signal
|
|
14795
15018
|
});
|
|
14796
15019
|
if (service === null || typeof service !== "object" || Array.isArray(service) || service.id !== selected.serviceId) {
|
|
14797
|
-
|
|
15020
|
+
invalidResponse2();
|
|
14798
15021
|
}
|
|
14799
15022
|
const groups = service.resourceGroupList;
|
|
14800
15023
|
if (!Array.isArray(groups)) {
|
|
@@ -14802,14 +15025,14 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
|
|
|
14802
15025
|
}
|
|
14803
15026
|
const matchingGroups = groups.filter((item) => item?.groupId === selected.resourceGroupId);
|
|
14804
15027
|
if (matchingGroups.length > 1) {
|
|
14805
|
-
|
|
15028
|
+
invalidResponse2();
|
|
14806
15029
|
}
|
|
14807
15030
|
const group = matchingGroups[0];
|
|
14808
15031
|
if (!group || typeof group.usageType !== "string" || group.usageType.length === 0 || typeof group.groupName !== "string" || typeof service.name !== "string") {
|
|
14809
15032
|
insufficientData();
|
|
14810
15033
|
}
|
|
14811
15034
|
if (group.usageType === UsageTypeValues.Unknown || !Object.values(UsageTypeValues).some((value) => value === group.usageType)) {
|
|
14812
|
-
|
|
15035
|
+
invalidResponse2();
|
|
14813
15036
|
}
|
|
14814
15037
|
if (dto.usageType !== group.usageType) {
|
|
14815
15038
|
invalidInput();
|
|
@@ -14832,13 +15055,13 @@ async function changeResourceServiceLink(http, project, resourceId, selector, op
|
|
|
14832
15055
|
},
|
|
14833
15056
|
assertAck(ack, written) {
|
|
14834
15057
|
if (!before || !expected || !Array.isArray(ack.serviceDescriptions) || !equalItemPatchValue(ack.serviceDescriptions, expected) || !Number.isInteger(ack.meta?.version) || (ack.meta?.version ?? 0) <= 0) {
|
|
14835
|
-
|
|
15058
|
+
invalidResponse2();
|
|
14836
15059
|
}
|
|
14837
15060
|
const rawAck = ack;
|
|
14838
15061
|
const rawWritten = written;
|
|
14839
15062
|
for (const key of preservedRootFields) {
|
|
14840
15063
|
if (Object.hasOwn(before, key) && !equalItemPatchValue(rawAck[key], rawWritten[key])) {
|
|
14841
|
-
|
|
15064
|
+
invalidResponse2();
|
|
14842
15065
|
}
|
|
14843
15066
|
}
|
|
14844
15067
|
acknowledged = ack.serviceDescriptions;
|
|
@@ -15364,18 +15587,18 @@ var configs = Object.values(SERVICE_IMPLICIT_TAG_REGISTRY);
|
|
|
15364
15587
|
function isBehaviorVersion(value) {
|
|
15365
15588
|
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 2147483647;
|
|
15366
15589
|
}
|
|
15367
|
-
function
|
|
15590
|
+
function record7(value) {
|
|
15368
15591
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15369
15592
|
}
|
|
15370
15593
|
function validateBehaviorResponse(value, serviceId) {
|
|
15371
|
-
if (!
|
|
15594
|
+
if (!record7(value) || value.id !== serviceId) {
|
|
15372
15595
|
throw behaviorSettingsError("InvalidResponse" /* InvalidResponse */);
|
|
15373
15596
|
}
|
|
15374
15597
|
const personal = value.personalInfo;
|
|
15375
|
-
if (
|
|
15598
|
+
if (record7(personal) && (personal.itemContentType === "NoRights" /* NoRights */ || personal.itemContentType === "SubscriptionIsNotValid" /* SubscriptionIsNotValid */)) {
|
|
15376
15599
|
throw behaviorSettingsError("AccessDenied" /* AccessDenied */);
|
|
15377
15600
|
}
|
|
15378
|
-
if (!
|
|
15601
|
+
if (!record7(personal) || personal.itemContentType !== "Full" /* Full */ || value.tags == null || !record7(value.meta) || !isBehaviorVersion(value.meta.version)) {
|
|
15379
15602
|
throw behaviorSettingsError("InsufficientData" /* InsufficientData */);
|
|
15380
15603
|
}
|
|
15381
15604
|
if (!Array.isArray(value.tags) || !value.tags.every((tag) => typeof tag === "string")) {
|
|
@@ -15504,7 +15727,7 @@ function normalizeBehaviorInput(input) {
|
|
|
15504
15727
|
function fail() {
|
|
15505
15728
|
throw behaviorSettingsError("InvalidInput" /* InvalidInput */);
|
|
15506
15729
|
}
|
|
15507
|
-
if (!
|
|
15730
|
+
if (!record7(input) || Object.keys(input).some((key) => !Object.hasOwn(SERVICE_IMPLICIT_TAG_REGISTRY, key))) {
|
|
15508
15731
|
fail();
|
|
15509
15732
|
}
|
|
15510
15733
|
const output = {};
|
|
@@ -15534,7 +15757,7 @@ function normalizeBehaviorInput(input) {
|
|
|
15534
15757
|
}
|
|
15535
15758
|
const seen = /* @__PURE__ */ new Set();
|
|
15536
15759
|
output[config.field] = value.map((entry) => {
|
|
15537
|
-
if (!
|
|
15760
|
+
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
15761
|
fail();
|
|
15539
15762
|
}
|
|
15540
15763
|
seen.add(entry.index);
|
|
@@ -16271,26 +16494,6 @@ var ProfilesFacade = class {
|
|
|
16271
16494
|
}
|
|
16272
16495
|
};
|
|
16273
16496
|
|
|
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
16497
|
// ../../src/resources/views/PinnedViewsFacade.ts
|
|
16295
16498
|
var PinnedViewsFacade = class {
|
|
16296
16499
|
constructor(http) {
|
|
@@ -16483,7 +16686,9 @@ var ViewsFacade = class {
|
|
|
16483
16686
|
pinned;
|
|
16484
16687
|
/**
|
|
16485
16688
|
* `POST /api/v1/{domain}/{parentId}/views/user/{childId}/pin` — переход **User → Pinned**.
|
|
16486
|
-
*
|
|
16689
|
+
* Внутри backend сначала снимается User-связь, затем создаётся Pinned; общей транзакции нет.
|
|
16690
|
+
* Query `alias` принимается маршрутом, но текущий ViewLayer его не применяет.
|
|
16691
|
+
* Создание исходной User view: `client.views.user.create` или `client.relations.placements.attach`.
|
|
16487
16692
|
*/
|
|
16488
16693
|
pin(parentId, childId, options) {
|
|
16489
16694
|
const { signal, alias } = options ?? {};
|
|
@@ -16497,6 +16702,8 @@ var ViewsFacade = class {
|
|
|
16497
16702
|
}
|
|
16498
16703
|
/**
|
|
16499
16704
|
* Переход **Pinned → User**. Для `contacts` API использует сегмент `pinned`, для остальных доменов — `user`.
|
|
16705
|
+
* Внутри backend сначала снимается Pinned-связь, затем создаётся User; общей транзакции нет.
|
|
16706
|
+
* Query `alias` принимается маршрутом, но текущий ViewLayer его не применяет.
|
|
16500
16707
|
*/
|
|
16501
16708
|
unpin(parentId, childId, options) {
|
|
16502
16709
|
const { signal, alias } = options ?? {};
|
|
@@ -18009,12 +18216,12 @@ var IntegrationEventTypeValues = /* @__PURE__ */ ((IntegrationEventTypeValues2)
|
|
|
18009
18216
|
IntegrationEventTypeValues2["UpdateOrder"] = "UpdateOrder";
|
|
18010
18217
|
return IntegrationEventTypeValues2;
|
|
18011
18218
|
})(IntegrationEventTypeValues || {});
|
|
18012
|
-
function
|
|
18219
|
+
function record8(value) {
|
|
18013
18220
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18014
18221
|
}
|
|
18015
18222
|
function hasReadEnvelope(value, type, discriminator) {
|
|
18016
|
-
return
|
|
18017
|
-
(event) =>
|
|
18223
|
+
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(
|
|
18224
|
+
(event) => record8(event) && typeof event.rid === "string" && typeof event.eventType === "string" && Object.values(IntegrationEventTypeValues).some((known) => known === event.eventType)
|
|
18018
18225
|
);
|
|
18019
18226
|
}
|
|
18020
18227
|
function isExternalCalendarIntegration(value) {
|
|
@@ -18022,8 +18229,8 @@ function isExternalCalendarIntegration(value) {
|
|
|
18022
18229
|
return false;
|
|
18023
18230
|
}
|
|
18024
18231
|
const parameters = value.integrationParameters;
|
|
18025
|
-
return
|
|
18026
|
-
(calendar) =>
|
|
18232
|
+
return record8(parameters) && Array.isArray(parameters.externalCalendars) && Array.from(parameters.externalCalendars).every(
|
|
18233
|
+
(calendar) => record8(calendar) && typeof calendar.externalAuthId === "string"
|
|
18027
18234
|
);
|
|
18028
18235
|
}
|
|
18029
18236
|
function isVideoTelephonyIntegration(value) {
|
|
@@ -18031,7 +18238,7 @@ function isVideoTelephonyIntegration(value) {
|
|
|
18031
18238
|
return false;
|
|
18032
18239
|
}
|
|
18033
18240
|
const parameters = value.integrationParameters;
|
|
18034
|
-
return
|
|
18241
|
+
return record8(parameters) && record8(parameters.videoTelephony) && typeof parameters.videoTelephony.externalAuthId === "string";
|
|
18035
18242
|
}
|
|
18036
18243
|
function isWebHookIntegration(integration) {
|
|
18037
18244
|
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 +20592,10 @@ export {
|
|
|
20385
20592
|
ParticipationFieldTypeValues,
|
|
20386
20593
|
PaymentProviderTypeValues,
|
|
20387
20594
|
PinnedViewsFacade,
|
|
20595
|
+
PlacementEffectStep,
|
|
20596
|
+
PlacementFacade,
|
|
20597
|
+
PlacementKindValues,
|
|
20598
|
+
PlacementWriteStatusValues,
|
|
20388
20599
|
ProfileEffectStep,
|
|
20389
20600
|
ProfileErrorReason,
|
|
20390
20601
|
ProfileFailureAt,
|