@torrow/sdk-client 0.1.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 ADDED
@@ -0,0 +1,4163 @@
1
+ // ../../src/TorrowClientConfig.ts
2
+ var DEFAULT_TORROW_API_BASE_URL = "https://torrow.net";
3
+
4
+ // ../../src/http/auth.ts
5
+ async function buildAuthHeaders(config) {
6
+ const headers = {};
7
+ const token = await config.getAccessToken?.();
8
+ if (token) {
9
+ headers.Authorization = `Bearer ${token}`;
10
+ }
11
+ return headers;
12
+ }
13
+
14
+ // ../../src/http/TorrowHttpError.ts
15
+ function pickApiErrorName(body) {
16
+ if (body === null || typeof body !== "object") {
17
+ return void 0;
18
+ }
19
+ const o = body;
20
+ if (typeof o.error === "string" && o.error.length > 0) {
21
+ return o.error;
22
+ }
23
+ if (typeof o.title === "string" && o.title.length > 0) {
24
+ return o.title;
25
+ }
26
+ if (typeof o.message === "string" && o.message.length > 0) {
27
+ return o.message;
28
+ }
29
+ return void 0;
30
+ }
31
+ function pickApiCode(body) {
32
+ if (body === null || typeof body !== "object") {
33
+ return void 0;
34
+ }
35
+ const c = body.code;
36
+ return typeof c === "string" ? c : void 0;
37
+ }
38
+ var TorrowHttpError = class _TorrowHttpError extends Error {
39
+ status;
40
+ body;
41
+ apiErrorName;
42
+ code;
43
+ requestId;
44
+ url;
45
+ constructor(init) {
46
+ const apiName = pickApiErrorName(init.body);
47
+ const code = pickApiCode(init.body);
48
+ const message = _TorrowHttpError.buildMessage(init.status, init.url, apiName, code);
49
+ super(message, { cause: init.cause });
50
+ this.name = "TorrowHttpError";
51
+ this.status = init.status;
52
+ this.body = init.body;
53
+ this.url = init.url;
54
+ this.requestId = init.requestId;
55
+ this.apiErrorName = apiName;
56
+ this.code = code;
57
+ }
58
+ static buildMessage(status, url, apiErrorName, code) {
59
+ const parts = [`HTTP ${status}`, url];
60
+ if (code) {
61
+ parts.push(`code=${code}`);
62
+ }
63
+ if (apiErrorName) {
64
+ parts.push(apiErrorName);
65
+ }
66
+ return parts.join(" \u2014 ");
67
+ }
68
+ };
69
+
70
+ // ../../src/util/json.ts
71
+ var ISO_DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(Z|([+-])(\d{2}):(\d{2}))$/;
72
+ function parseJsonWithIsoDates(json) {
73
+ if (json === "") {
74
+ return void 0;
75
+ }
76
+ return JSON.parse(json, (_key, value) => {
77
+ if (typeof value !== "string") {
78
+ return value;
79
+ }
80
+ return ISO_DATE_REGEX.exec(value) ? new Date(value) : value;
81
+ });
82
+ }
83
+ function stringifyJsonBody(body) {
84
+ return JSON.stringify(body, (_key, value) => {
85
+ if (value instanceof Date) {
86
+ return value.toISOString();
87
+ }
88
+ return value;
89
+ });
90
+ }
91
+
92
+ // ../../src/util/query-string.ts
93
+ function buildQueryString(queryStringParams) {
94
+ const queryString = [];
95
+ for (const prop of Object.keys(queryStringParams)) {
96
+ const value = queryStringParams[prop];
97
+ if (value === void 0) {
98
+ continue;
99
+ }
100
+ if (value === null) {
101
+ continue;
102
+ }
103
+ if (value instanceof Date) {
104
+ queryString.push(`${prop}=${encodeURIComponent(value.toISOString())}`);
105
+ } else if (Array.isArray(value)) {
106
+ for (const val of value) {
107
+ queryString.push(buildQueryString({ [prop]: val }));
108
+ }
109
+ } else {
110
+ queryString.push(`${prop}=${encodeURIComponent(String(value))}`);
111
+ }
112
+ }
113
+ return queryString.join("&");
114
+ }
115
+
116
+ // ../../src/util/url.ts
117
+ function joinBaseUrlAndPath(baseUrl, path) {
118
+ const base = baseUrl.replace(/\/+$/, "");
119
+ const p = path.startsWith("/") ? path : `/${path}`;
120
+ return `${base}${p}`;
121
+ }
122
+
123
+ // ../../src/http/HttpClient.ts
124
+ var JSON_MIME = "application/json";
125
+ var HttpClient = class {
126
+ constructor(config) {
127
+ this.config = config;
128
+ }
129
+ config;
130
+ async requestJson(init) {
131
+ const { fetch: fetchFn = globalThis.fetch } = this.config;
132
+ const url = this.buildUrl(init.path, init.query);
133
+ const authHeaders = await buildAuthHeaders(this.config);
134
+ const headers = {
135
+ Accept: JSON_MIME,
136
+ ...authHeaders,
137
+ ...this.config.defaultHeaders,
138
+ ...init.headers
139
+ };
140
+ if (this.config.userAgent) {
141
+ headers["User-Agent"] = this.config.userAgent;
142
+ }
143
+ const needsBody = init.body !== void 0 && init.method !== "GET" && init.method !== "DELETE";
144
+ if (needsBody) {
145
+ headers["Content-Type"] = JSON_MIME;
146
+ }
147
+ const res = await fetchFn(url, {
148
+ method: init.method,
149
+ headers,
150
+ body: needsBody ? stringifyJsonBody(init.body) : void 0,
151
+ signal: init.signal
152
+ });
153
+ const requestId = res.headers.get("x-request-id") ?? void 0;
154
+ const text = await res.text();
155
+ if (!res.ok) {
156
+ const errBody = tryParseErrorBody(text, res.headers.get("content-type"));
157
+ throw new TorrowHttpError({
158
+ status: res.status,
159
+ body: errBody,
160
+ url,
161
+ requestId
162
+ });
163
+ }
164
+ if (text === "") {
165
+ return void 0;
166
+ }
167
+ return parseJsonWithIsoDates(text);
168
+ }
169
+ buildUrl(path, query) {
170
+ const origin = this.config.baseUrl ?? DEFAULT_TORROW_API_BASE_URL;
171
+ const basePath = joinBaseUrlAndPath(origin, path);
172
+ const q = { ...query };
173
+ if (this.config.securityToken !== void 0 && this.config.securityToken !== "") {
174
+ q.securityToken = this.config.securityToken;
175
+ }
176
+ const qs = buildQueryString(q);
177
+ if (!qs) {
178
+ return basePath;
179
+ }
180
+ const joiner = basePath.includes("?") ? "&" : "?";
181
+ return `${basePath}${joiner}${qs}`;
182
+ }
183
+ };
184
+ function tryParseErrorBody(text, contentType) {
185
+ const ct = contentType ?? "";
186
+ if (ct.includes(JSON_MIME) || text.startsWith("{") && text.endsWith("}")) {
187
+ try {
188
+ return JSON.parse(text);
189
+ } catch {
190
+ return text;
191
+ }
192
+ }
193
+ return text;
194
+ }
195
+
196
+ // ../../src/raw/RawClient.ts
197
+ var RawClient = class {
198
+ constructor(http) {
199
+ this.http = http;
200
+ }
201
+ http;
202
+ request(method, path, options) {
203
+ return this.http.requestJson({ method, path, ...options });
204
+ }
205
+ get(path, options) {
206
+ return this.request("GET", path, options);
207
+ }
208
+ post(path, options) {
209
+ return this.request("POST", path, options);
210
+ }
211
+ put(path, options) {
212
+ return this.request("PUT", path, options);
213
+ }
214
+ patch(path, options) {
215
+ return this.request("PATCH", path, options);
216
+ }
217
+ delete(path, options) {
218
+ return this.request("DELETE", path, options);
219
+ }
220
+ };
221
+
222
+ // ../../src/util/path.ts
223
+ function encodePathSegment(id) {
224
+ return encodeURIComponent(id);
225
+ }
226
+
227
+ // ../../src/resources/common/item-social-facet-base.ts
228
+ var TorrowItemCoreFacade = class {
229
+ constructor(http, basePath, socialOpts = {}) {
230
+ this.http = http;
231
+ this.basePath = basePath;
232
+ this.socialOpts = socialOpts;
233
+ }
234
+ http;
235
+ basePath;
236
+ socialOpts;
237
+ /** `PUT /api/v1/{domain}/{torrowId}/publicity` */
238
+ updatePublicity(torrowId, body, options) {
239
+ return this.http.requestJson({
240
+ method: "PUT",
241
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/publicity`,
242
+ query: {
243
+ versionToCheck: options?.versionToCheck,
244
+ isNeedAnnouncement: options?.isNeedAnnouncement
245
+ },
246
+ body,
247
+ signal: options?.signal
248
+ });
249
+ }
250
+ /** `PUT /api/v1/{domain}/{torrowId}/image/id` — тело: JSON-string **`fileId`**. */
251
+ updateImageId(torrowId, fileId, options) {
252
+ return this.http.requestJson({
253
+ method: "PUT",
254
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/image/id`,
255
+ query: {
256
+ versionToCheck: options?.versionToCheck,
257
+ isNeedAnnouncement: options?.isNeedAnnouncement
258
+ },
259
+ body: fileId,
260
+ signal: options?.signal
261
+ });
262
+ }
263
+ /** `PUT /api/v1/{domain}/{torrowId}/torrowaccount/id` — тело: JSON-string account id. */
264
+ updateTorrowAccountId(torrowId, accountId, options) {
265
+ return this.http.requestJson({
266
+ method: "PUT",
267
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/torrowaccount/id`,
268
+ query: {
269
+ versionToCheck: options?.versionToCheck,
270
+ isNeedAnnouncement: options?.isNeedAnnouncement
271
+ },
272
+ body: accountId,
273
+ signal: options?.signal
274
+ });
275
+ }
276
+ /** `PUT /api/v1/{domain}/{torrowId}/masterinfo` */
277
+ updateMasterInfo(torrowId, body, options) {
278
+ return this.http.requestJson({
279
+ method: "PUT",
280
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/masterinfo`,
281
+ query: {
282
+ versionToCheck: options?.versionToCheck,
283
+ isNeedAnnouncement: options?.isNeedAnnouncement
284
+ },
285
+ body,
286
+ signal: options?.signal
287
+ });
288
+ }
289
+ /** `PUT /api/v1/{domain}/{torrowId}/integrations` */
290
+ updateIntegrations(torrowId, integrationIds, options) {
291
+ return this.http.requestJson({
292
+ method: "PUT",
293
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/integrations`,
294
+ query: {
295
+ versionToCheck: options?.versionToCheck,
296
+ isNeedAnnouncement: options?.isNeedAnnouncement
297
+ },
298
+ body: integrationIds,
299
+ signal: options?.signal
300
+ });
301
+ }
302
+ /** `GET /api/v1/{domain}/{torrowId}/participants` — см. {@link TorrowItemCoreFacade TParticipantsQuery}. */
303
+ listParticipants(torrowId, query, options) {
304
+ return this.http.requestJson({
305
+ method: "GET",
306
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participants`,
307
+ query: { ...query ?? {} },
308
+ signal: options?.signal
309
+ });
310
+ }
311
+ /** `POST /api/v1/{domain}/{torrowId}/generatesecuritytoken` */
312
+ generateSecurityToken(torrowId, body, options) {
313
+ return this.http.requestJson({
314
+ method: "POST",
315
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/generatesecuritytoken`,
316
+ body,
317
+ signal: options?.signal
318
+ });
319
+ }
320
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/{participantProfileId}/type` */
321
+ updateParticipationType(torrowId, participantProfileId, participantType, options) {
322
+ return this.http.requestJson({
323
+ method: "PUT",
324
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/${encodePathSegment(participantProfileId)}/type`,
325
+ query: {
326
+ versionToCheck: options?.versionToCheck,
327
+ isNeedAnnouncement: options?.isNeedAnnouncement
328
+ },
329
+ body: participantType,
330
+ signal: options?.signal
331
+ });
332
+ }
333
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/requestaccess` */
334
+ requestAccess(torrowId, profileId, options) {
335
+ return this.http.requestJson({
336
+ method: "PUT",
337
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/requestaccess`,
338
+ query: { userMessage: options?.userMessage },
339
+ body: profileId,
340
+ signal: options?.signal
341
+ });
342
+ }
343
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/revokerequest` */
344
+ revokeAccessRequest(torrowId, options) {
345
+ return this.http.requestJson({
346
+ method: "PUT",
347
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/revokerequest`,
348
+ signal: options?.signal
349
+ });
350
+ }
351
+ /** `PUT /api/v1/{domain}/{torrowId}/group/set` */
352
+ setGroup(torrowId, body, options) {
353
+ return this.http.requestJson({
354
+ method: "PUT",
355
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/group/set`,
356
+ body,
357
+ signal: options?.signal
358
+ });
359
+ }
360
+ /** `PUT /api/v1/{domain}/{torrowId}/group/unset` */
361
+ unsetGroup(torrowId, body, options) {
362
+ return this.http.requestJson({
363
+ method: "PUT",
364
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/group/unset`,
365
+ body,
366
+ signal: options?.signal
367
+ });
368
+ }
369
+ /** `PUT /api/v1/{domain}/{torrowId}/tags` */
370
+ updateTags(torrowId, tags, options) {
371
+ return this.http.requestJson({
372
+ method: "PUT",
373
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/tags`,
374
+ query: {
375
+ versionToCheck: options?.versionToCheck,
376
+ isNeedAnnouncement: options?.isNeedAnnouncement
377
+ },
378
+ body: tags,
379
+ signal: options?.signal
380
+ });
381
+ }
382
+ /** `GET /api/v1/{domain}/{torrowId}/group/list` */
383
+ listGroup(torrowId, query, options) {
384
+ if (this.socialOpts.withGroupListEndpoint === false) {
385
+ throw new Error("listGroup is not supported for this API domain (withGroupListEndpoint: false)");
386
+ }
387
+ return this.http.requestJson({
388
+ method: "GET",
389
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/group/list`,
390
+ query: { ...query ?? {} },
391
+ signal: options?.signal
392
+ });
393
+ }
394
+ /** `PUT /api/v1/{domain}/{torrowId}/updategroups` */
395
+ updateGroups(torrowId, body, options) {
396
+ return this.http.requestJson({
397
+ method: "PUT",
398
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/updategroups`,
399
+ query: {
400
+ parentId: options?.parentId,
401
+ tags: options?.tags,
402
+ alias: options?.alias,
403
+ versionToCheck: options?.versionToCheck,
404
+ isNeedAnnouncement: options?.isNeedAnnouncement
405
+ },
406
+ body,
407
+ signal: options?.signal
408
+ });
409
+ }
410
+ /** `PUT /api/v1/{domain}/include/togroups` */
411
+ includeToGroups(body, options) {
412
+ return this.http.requestJson({
413
+ method: "PUT",
414
+ path: `${this.basePath}/include/togroups`,
415
+ body,
416
+ signal: options?.signal
417
+ });
418
+ }
419
+ /** `PUT /api/v1/{domain}/exclude/fromgroups` */
420
+ excludeFromGroups(body, options) {
421
+ return this.http.requestJson({
422
+ method: "PUT",
423
+ path: `${this.basePath}/exclude/fromgroups`,
424
+ body,
425
+ signal: options?.signal
426
+ });
427
+ }
428
+ /** `PUT /api/v1/{domain}/{parentId}/include/items` */
429
+ includeToParent(parentId, body, options) {
430
+ return this.http.requestJson({
431
+ method: "PUT",
432
+ path: `${this.basePath}/${encodePathSegment(parentId)}/include/items`,
433
+ body,
434
+ signal: options?.signal
435
+ });
436
+ }
437
+ /** `PUT /api/v1/{domain}/{parentId}/exclude/items` */
438
+ excludeFromParent(parentId, body, options) {
439
+ return this.http.requestJson({
440
+ method: "PUT",
441
+ path: `${this.basePath}/${encodePathSegment(parentId)}/exclude/items`,
442
+ body,
443
+ signal: options?.signal
444
+ });
445
+ }
446
+ /** `PUT /api/v1/{domain}/{parentId}/include/foruser` */
447
+ includeForUser(parentId, body, options) {
448
+ return this.http.requestJson({
449
+ method: "PUT",
450
+ path: `${this.basePath}/${encodePathSegment(parentId)}/include/foruser`,
451
+ body,
452
+ signal: options?.signal
453
+ });
454
+ }
455
+ /** `PUT /api/v1/{domain}/{parentId}/exclude/fromuser` */
456
+ excludeFromUser(parentId, body, options) {
457
+ return this.http.requestJson({
458
+ method: "PUT",
459
+ path: `${this.basePath}/${encodePathSegment(parentId)}/exclude/fromuser`,
460
+ body,
461
+ signal: options?.signal
462
+ });
463
+ }
464
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/rejectoffer` */
465
+ rejectOffer(torrowId, profileId, options) {
466
+ return this.http.requestJson({
467
+ method: "PUT",
468
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/rejectoffer`,
469
+ query: { userMessage: options?.userMessage },
470
+ body: profileId,
471
+ signal: options?.signal
472
+ });
473
+ }
474
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/reject` */
475
+ reject(torrowId, profileId, options) {
476
+ return this.http.requestJson({
477
+ method: "PUT",
478
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/reject`,
479
+ body: profileId,
480
+ signal: options?.signal
481
+ });
482
+ }
483
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/share` */
484
+ share(torrowId, body, options) {
485
+ return this.http.requestJson({
486
+ method: "PUT",
487
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/share`,
488
+ body,
489
+ signal: options?.signal
490
+ });
491
+ }
492
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/revokeoffer` */
493
+ revokeOffer(torrowId, profileIds, options) {
494
+ return this.http.requestJson({
495
+ method: "PUT",
496
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/revokeoffer`,
497
+ body: profileIds,
498
+ signal: options?.signal
499
+ });
500
+ }
501
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/grantaccess` */
502
+ grantAccess(torrowId, profileIds, options) {
503
+ return this.http.requestJson({
504
+ method: "PUT",
505
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/grantaccess`,
506
+ body: profileIds,
507
+ signal: options?.signal
508
+ });
509
+ }
510
+ /** `PUT /api/v1/{domain}/{torrowId}/participation/declineaccess` */
511
+ declineAccess(torrowId, profileIds, options) {
512
+ return this.http.requestJson({
513
+ method: "PUT",
514
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/declineaccess`,
515
+ query: { userMessage: options?.userMessage },
516
+ body: profileIds,
517
+ signal: options?.signal
518
+ });
519
+ }
520
+ /** `POST /api/v1/{domain}/personallist/updateorder` */
521
+ updatePersonalListOrder(body, options) {
522
+ return this.http.requestJson({
523
+ method: "POST",
524
+ path: `${this.basePath}/personallist/updateorder`,
525
+ body,
526
+ signal: options?.signal
527
+ });
528
+ }
529
+ /** `PUT /api/v1/{domain}/{itemId}/alias` */
530
+ updateAlias(itemId, alias, options) {
531
+ return this.http.requestJson({
532
+ method: "PUT",
533
+ path: `${this.basePath}/${encodePathSegment(itemId)}/alias`,
534
+ query: {
535
+ versionToCheck: options?.versionToCheck,
536
+ isNeedAnnouncement: options?.isNeedAnnouncement
537
+ },
538
+ body: alias,
539
+ signal: options?.signal
540
+ });
541
+ }
542
+ /** `PUT /api/v1/{domain}/{itemId}/lastusagetime` — тело ISO date-time string. */
543
+ updateLastUsageTime(itemId, lastUsageTime, options) {
544
+ return this.http.requestJson({
545
+ method: "PUT",
546
+ path: `${this.basePath}/${encodePathSegment(itemId)}/lastusagetime`,
547
+ query: {
548
+ versionToCheck: options?.versionToCheck,
549
+ isNeedAnnouncement: options?.isNeedAnnouncement
550
+ },
551
+ body: lastUsageTime,
552
+ signal: options?.signal
553
+ });
554
+ }
555
+ /** `PUT /api/v1/{domain}/{itemId}/participation/profile` */
556
+ updateParticipationProfile(itemId, profileId, options) {
557
+ return this.http.requestJson({
558
+ method: "PUT",
559
+ path: `${this.basePath}/${encodePathSegment(itemId)}/participation/profile`,
560
+ query: {
561
+ versionToCheck: options?.versionToCheck,
562
+ isNeedAnnouncement: options?.isNeedAnnouncement
563
+ },
564
+ body: profileId,
565
+ signal: options?.signal
566
+ });
567
+ }
568
+ /** `PUT /api/v1/{domain}/{itemId}/sendlink` */
569
+ sendLink(itemId, body, options) {
570
+ return this.http.requestJson({
571
+ method: "PUT",
572
+ path: `${this.basePath}/${encodePathSegment(itemId)}/sendlink`,
573
+ body,
574
+ signal: options?.signal
575
+ });
576
+ }
577
+ /** `POST /api/v1/{domain}/{torrowId}/shorturl` */
578
+ getShortUrl(torrowId, options) {
579
+ return this.http.requestJson({
580
+ method: "POST",
581
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/shorturl`,
582
+ signal: options?.signal
583
+ });
584
+ }
585
+ /** `PUT /api/v1/{domain}/{itemId}/uniquename` */
586
+ updateUniqueName(itemId, uniqueName, options) {
587
+ return this.http.requestJson({
588
+ method: "PUT",
589
+ path: `${this.basePath}/${encodePathSegment(itemId)}/uniquename`,
590
+ body: uniqueName,
591
+ signal: options?.signal
592
+ });
593
+ }
594
+ /** `GET /api/v1/{domain}/uniquename/{uniqueName}` */
595
+ getByUniqueName(uniqueName, options) {
596
+ return this.http.requestJson({
597
+ method: "GET",
598
+ path: `${this.basePath}/uniquename/${encodePathSegment(uniqueName)}`,
599
+ signal: options?.signal
600
+ });
601
+ }
602
+ /** `GET /api/v1/{domain}/{torrowId}/image/info` */
603
+ getImageInfo(torrowId, options) {
604
+ return this.http.requestJson({
605
+ method: "GET",
606
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/image/info`,
607
+ signal: options?.signal
608
+ });
609
+ }
610
+ /** `GET /api/v1/{domain}/{torrowId}/image/puturl` */
611
+ getImagePutUrl(torrowId, options) {
612
+ const query = {
613
+ fileId: options?.fileId,
614
+ fileName: options?.fileName,
615
+ fileSize: options?.fileSize
616
+ };
617
+ if (this.socialOpts.imagePutUrlSecurityToken) {
618
+ query.securityToken = options?.securityToken;
619
+ }
620
+ return this.http.requestJson({
621
+ method: "GET",
622
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/image/puturl`,
623
+ query,
624
+ signal: options?.signal
625
+ });
626
+ }
627
+ /** `PUT /api/v1/{domain}/{torrowId}/savetomindmap` */
628
+ saveToMindMap(torrowId, body, options) {
629
+ return this.http.requestJson({
630
+ method: "PUT",
631
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/savetomindmap`,
632
+ body,
633
+ signal: options?.signal
634
+ });
635
+ }
636
+ /** `PUT /api/v1/{domain}/{torrowId}/solutiondata` */
637
+ updateSolutionData(torrowId, body, options) {
638
+ return this.http.requestJson({
639
+ method: "PUT",
640
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/solutiondata`,
641
+ query: {
642
+ versionToCheck: options?.versionToCheck,
643
+ isNeedAnnouncement: options?.isNeedAnnouncement
644
+ },
645
+ body,
646
+ signal: options?.signal
647
+ });
648
+ }
649
+ /** `PUT /api/v1/{domain}/{itemId}/personalsolutiondata` */
650
+ updatePersonalSolutionData(itemId, body, options) {
651
+ return this.http.requestJson({
652
+ method: "PUT",
653
+ path: `${this.basePath}/${encodePathSegment(itemId)}/personalsolutiondata`,
654
+ query: {
655
+ versionToCheck: options?.versionToCheck,
656
+ isNeedAnnouncement: options?.isNeedAnnouncement
657
+ },
658
+ body,
659
+ signal: options?.signal
660
+ });
661
+ }
662
+ /** `GET /api/v1/{domain}/{torrowId}/photo/info` — только при {@link TorrowItemFacadeOptions.withPhotoEndpoints}. */
663
+ getPhotoInfo(torrowId, options) {
664
+ if (!this.socialOpts.withPhotoEndpoints) {
665
+ throw new Error("getPhotoInfo is only supported when withPhotoEndpoints is true (contacts)");
666
+ }
667
+ return this.http.requestJson({
668
+ method: "GET",
669
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/photo/info`,
670
+ query: { photoId: options?.photoId },
671
+ signal: options?.signal
672
+ });
673
+ }
674
+ /** `GET /api/v1/{domain}/{torrowId}/photo/puturl` — только при {@link TorrowItemFacadeOptions.withPhotoEndpoints}. */
675
+ getPhotoPutUrl(torrowId, options) {
676
+ if (!this.socialOpts.withPhotoEndpoints) {
677
+ throw new Error("getPhotoPutUrl is only supported when withPhotoEndpoints is true (contacts)");
678
+ }
679
+ return this.http.requestJson({
680
+ method: "GET",
681
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/photo/puturl`,
682
+ query: {
683
+ fileId: options?.fileId,
684
+ fileName: options?.fileName,
685
+ fileSize: options?.fileSize,
686
+ securityToken: options?.securityToken
687
+ },
688
+ signal: options?.signal
689
+ });
690
+ }
691
+ };
692
+ var TorrowItemFacade = class extends TorrowItemCoreFacade {
693
+ constructor(http, basePath, socialOpts = {}) {
694
+ super(http, basePath, socialOpts);
695
+ }
696
+ /** `PUT /api/v1/{domain}/{torrowId}/feedbacks/options` */
697
+ updateFeedbackOptions(torrowId, body, options) {
698
+ return this.http.requestJson({
699
+ method: "PUT",
700
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/feedbacks/options`,
701
+ query: {
702
+ versionToCheck: options?.versionToCheck,
703
+ isNeedAnnouncement: options?.isNeedAnnouncement
704
+ },
705
+ body,
706
+ signal: options?.signal
707
+ });
708
+ }
709
+ /** `GET /api/v1/{domain}/{torrowId}/participants/anonymous` */
710
+ getParticipantsAnonymousCount(torrowId, options) {
711
+ return this.http.requestJson({
712
+ method: "GET",
713
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participants/anonymous`,
714
+ signal: options?.signal
715
+ });
716
+ }
717
+ /** `GET /api/v1/{domain}/{torrowId}/participants/nonanonymous` */
718
+ getParticipantsNonAnonymousCount(torrowId, query, options) {
719
+ return this.http.requestJson({
720
+ method: "GET",
721
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participants/nonanonymous`,
722
+ query: { ...query ?? {} },
723
+ signal: options?.signal
724
+ });
725
+ }
726
+ /** `GET /api/v1/{domain}/{torrowId}/tags` */
727
+ listTags(torrowId, query, options) {
728
+ return this.http.requestJson({
729
+ method: "GET",
730
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/tags`,
731
+ query: { ...query ?? {} },
732
+ signal: options?.signal
733
+ });
734
+ }
735
+ /** `GET /api/v1/{domain}/{torrowId}/groups` */
736
+ listGroups(torrowId, query, options) {
737
+ return this.http.requestJson({
738
+ method: "GET",
739
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/groups`,
740
+ query: { ...query ?? {} },
741
+ signal: options?.signal
742
+ });
743
+ }
744
+ /** `PUT /api/v1/{domain}/{torrowId}/updateaccounts` */
745
+ updateAccounts(torrowId, body, options) {
746
+ return this.http.requestJson({
747
+ method: "PUT",
748
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/updateaccounts`,
749
+ query: {
750
+ versionToCheck: options?.versionToCheck,
751
+ isNeedAnnouncement: options?.isNeedAnnouncement
752
+ },
753
+ body,
754
+ signal: options?.signal
755
+ });
756
+ }
757
+ /** `POST /api/v1/{domain}/{torrowId}/participation/shareitemlink` */
758
+ shareItemLink(torrowId, body, options) {
759
+ return this.http.requestJson({
760
+ method: "POST",
761
+ path: `${this.basePath}/${encodePathSegment(torrowId)}/participation/shareitemlink`,
762
+ body,
763
+ signal: options?.signal
764
+ });
765
+ }
766
+ /** `PUT /api/v1/{domain}/{itemId}/offlinable` */
767
+ updateOfflinable(itemId, offlinable, options) {
768
+ return this.http.requestJson({
769
+ method: "PUT",
770
+ path: `${this.basePath}/${encodePathSegment(itemId)}/offlinable`,
771
+ query: {
772
+ versionToCheck: options?.versionToCheck,
773
+ isNeedAnnouncement: options?.isNeedAnnouncement
774
+ },
775
+ body: offlinable,
776
+ signal: options?.signal
777
+ });
778
+ }
779
+ /** `PUT /api/v1/{domain}/{itemId}/reminders` */
780
+ updateReminders(itemId, reminders, options) {
781
+ return this.http.requestJson({
782
+ method: "PUT",
783
+ path: `${this.basePath}/${encodePathSegment(itemId)}/reminders`,
784
+ query: {
785
+ versionToCheck: options?.versionToCheck,
786
+ isNeedAnnouncement: options?.isNeedAnnouncement
787
+ },
788
+ body: reminders,
789
+ signal: options?.signal
790
+ });
791
+ }
792
+ /** `PUT /api/v1/{domain}/{itemId}/notificationwaylist` */
793
+ updateNotificationWayList(itemId, ways, options) {
794
+ return this.http.requestJson({
795
+ method: "PUT",
796
+ path: `${this.basePath}/${encodePathSegment(itemId)}/notificationwaylist`,
797
+ query: {
798
+ versionToCheck: options?.versionToCheck,
799
+ isNeedAnnouncement: options?.isNeedAnnouncement
800
+ },
801
+ body: ways,
802
+ signal: options?.signal
803
+ });
804
+ }
805
+ /** `POST /api/v1/{domain}/{itemId}/block` */
806
+ block(itemId, options) {
807
+ return this.http.requestJson({
808
+ method: "POST",
809
+ path: `${this.basePath}/${encodePathSegment(itemId)}/block`,
810
+ query: {
811
+ reasonId: options?.reasonId,
812
+ reasonNote: options?.reasonNote,
813
+ language: options?.language,
814
+ versionToCheck: options?.versionToCheck,
815
+ isNeedAnnouncement: options?.isNeedAnnouncement
816
+ },
817
+ signal: options?.signal
818
+ });
819
+ }
820
+ /** `POST /api/v1/{domain}/{itemId}/unblock` */
821
+ unblock(itemId, options) {
822
+ return this.http.requestJson({
823
+ method: "POST",
824
+ path: `${this.basePath}/${encodePathSegment(itemId)}/unblock`,
825
+ query: {
826
+ versionToCheck: options?.versionToCheck,
827
+ isNeedAnnouncement: options?.isNeedAnnouncement
828
+ },
829
+ signal: options?.signal
830
+ });
831
+ }
832
+ };
833
+
834
+ // ../../src/resources/common/timetable-query.ts
835
+ function buildTimetableQuery(options) {
836
+ const o = options ?? {};
837
+ return {
838
+ visibility: o.visibility,
839
+ take: o.take,
840
+ skip: o.skip,
841
+ lmfrom: o.lmfrom,
842
+ lmto: o.lmto,
843
+ includeDeleted: o.includeDeleted,
844
+ sort: o.sort,
845
+ createDateFrom: o.createDateFrom,
846
+ createDateTo: o.createDateTo
847
+ };
848
+ }
849
+
850
+ // ../../src/resources/calendars/CalendarsFacade.ts
851
+ var BASE = "/api/v1/calendars";
852
+ var CalendarsFacade = class extends TorrowItemFacade {
853
+ constructor(http) {
854
+ super(http, BASE, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
855
+ }
856
+ /** `POST /api/v1/calendars` */
857
+ create(body, options) {
858
+ return this.http.requestJson({
859
+ method: "POST",
860
+ path: BASE,
861
+ query: {
862
+ parentId: options?.parentId,
863
+ profileId: options?.profileId
864
+ },
865
+ body,
866
+ signal: options?.signal
867
+ });
868
+ }
869
+ /** `PUT /api/v1/calendars/{torrowId}` */
870
+ update(body, torrowId, options) {
871
+ return this.http.requestJson({
872
+ method: "PUT",
873
+ path: `${BASE}/${encodePathSegment(torrowId)}`,
874
+ query: {
875
+ checkVersion: options?.checkVersion,
876
+ isNeedAnnouncement: options?.isNeedAnnouncement,
877
+ securityToken: options?.securityToken
878
+ },
879
+ body,
880
+ signal: options?.signal
881
+ });
882
+ }
883
+ /** `DELETE /api/v1/calendars/{torrowId}` */
884
+ delete(torrowId, options) {
885
+ return this.http.requestJson({
886
+ method: "DELETE",
887
+ path: `${BASE}/${encodePathSegment(torrowId)}`,
888
+ query: {
889
+ cascade: options.cascade,
890
+ withPinnedItems: options.withPinnedItems,
891
+ versionToCheck: options.versionToCheck,
892
+ isNeedAnnouncement: options.isNeedAnnouncement
893
+ },
894
+ signal: options.signal
895
+ });
896
+ }
897
+ /** `GET /api/v1/calendars/{torrowId}` */
898
+ getById(torrowId, options) {
899
+ return this.http.requestJson({
900
+ method: "GET",
901
+ path: `${BASE}/${encodePathSegment(torrowId)}`,
902
+ query: {
903
+ versionToCheck: options?.versionToCheck,
904
+ includeDeleted: options?.includeDeleted,
905
+ includeChildItems: options?.includeChildItems,
906
+ securityToken: options?.securityToken
907
+ },
908
+ signal: options?.signal
909
+ });
910
+ }
911
+ /** `GET /api/v1/calendars/personallist` */
912
+ listPersonal(options) {
913
+ const { signal, ...rest } = options ?? {};
914
+ return this.http.requestJson({
915
+ method: "GET",
916
+ path: `${BASE}/personallist`,
917
+ query: { ...rest },
918
+ signal
919
+ });
920
+ }
921
+ /** Расписание кейсов календаря — `PUT /api/v1/calendars/{id}/timetable`. */
922
+ getTimetable(calendarId, body, options) {
923
+ const { signal, ...queryOpts } = options ?? {};
924
+ return this.http.requestJson({
925
+ method: "PUT",
926
+ path: `${BASE}/${encodePathSegment(calendarId)}/timetable`,
927
+ query: buildTimetableQuery(queryOpts),
928
+ body,
929
+ signal
930
+ });
931
+ }
932
+ /** `POST /api/v1/calendars/timetable/statistics` */
933
+ getTimetableStatistics(body, options) {
934
+ return this.http.requestJson({
935
+ method: "POST",
936
+ path: `${BASE}/timetable/statistics`,
937
+ body,
938
+ signal: options?.signal
939
+ });
940
+ }
941
+ /** `PUT /api/v1/calendars/{calendarId}/includecase` — тело: массив id кейсов. */
942
+ includeCase(calendarId, caseIds, options) {
943
+ return this.http.requestJson({
944
+ method: "PUT",
945
+ path: `${BASE}/${encodePathSegment(calendarId)}/includecase`,
946
+ query: { profileId: options?.profileId },
947
+ body: caseIds,
948
+ signal: options?.signal
949
+ });
950
+ }
951
+ /** `PUT /api/v1/calendars/{calendarId}/includecasetocustomcalendar` */
952
+ includeCaseToCustomCalendar(calendarId, caseIds, options) {
953
+ return this.http.requestJson({
954
+ method: "PUT",
955
+ path: `${BASE}/${encodePathSegment(calendarId)}/includecasetocustomcalendar`,
956
+ query: { profileId: options?.profileId },
957
+ body: caseIds,
958
+ signal: options?.signal
959
+ });
960
+ }
961
+ /** `PUT /api/v1/calendars/{calendarId}/excludecasefromcustomcalendar` */
962
+ excludeCaseFromCustomCalendar(calendarId, caseIds, options) {
963
+ return this.http.requestJson({
964
+ method: "PUT",
965
+ path: `${BASE}/${encodePathSegment(calendarId)}/excludecasefromcustomcalendar`,
966
+ query: { profileId: options?.profileId },
967
+ body: caseIds,
968
+ signal: options?.signal
969
+ });
970
+ }
971
+ /** `PUT /api/v1/calendars/{calendarId}/excludecase` */
972
+ excludeCase(calendarId, caseIds, options) {
973
+ return this.http.requestJson({
974
+ method: "PUT",
975
+ path: `${BASE}/${encodePathSegment(calendarId)}/excludecase`,
976
+ query: { profileId: options?.profileId },
977
+ body: caseIds,
978
+ signal: options?.signal
979
+ });
980
+ }
981
+ };
982
+
983
+ // ../../src/resources/cases/CasesFacade.ts
984
+ var BASE2 = "/api/v1/cases";
985
+ var CasesFacade = class extends TorrowItemFacade {
986
+ constructor(http) {
987
+ super(http, BASE2);
988
+ }
989
+ /** `POST /api/v1/cases` — create case from `CaseItem` body. */
990
+ create(body, options) {
991
+ return this.http.requestJson({
992
+ method: "POST",
993
+ path: BASE2,
994
+ query: {
995
+ parentId: options?.parentId,
996
+ profileId: options?.profileId,
997
+ isNeedToCheckInMySelf: options?.isNeedToCheckInMySelf,
998
+ availabilityTime: options?.availabilityTime,
999
+ roadTime: options?.roadTime,
1000
+ calendarId: options?.calendarId,
1001
+ caseParticipantType: options?.caseParticipantType
1002
+ },
1003
+ body,
1004
+ signal: options?.signal
1005
+ });
1006
+ }
1007
+ /**
1008
+ * `PUT /api/v1/cases` with `CreateCaseReq` body (reminder flow).
1009
+ * Distinct from **`create`** (`POST` + `CaseItem`).
1010
+ */
1011
+ createWithReminder(body, options) {
1012
+ return this.http.requestJson({
1013
+ method: "PUT",
1014
+ path: BASE2,
1015
+ query: {
1016
+ parentId: options?.parentId,
1017
+ profileId: options?.profileId
1018
+ },
1019
+ body,
1020
+ signal: options?.signal
1021
+ });
1022
+ }
1023
+ /** `PUT /api/v1/cases/{torrowId}` */
1024
+ update(body, torrowId, options) {
1025
+ return this.http.requestJson({
1026
+ method: "PUT",
1027
+ path: `${BASE2}/${encodePathSegment(torrowId)}`,
1028
+ query: {
1029
+ profileId: options?.profileId,
1030
+ checkVersion: options?.checkVersion,
1031
+ isNeedAnnouncement: options?.isNeedAnnouncement,
1032
+ securityToken: options?.securityToken
1033
+ },
1034
+ body,
1035
+ signal: options?.signal
1036
+ });
1037
+ }
1038
+ /** `DELETE /api/v1/cases/{torrowId}` */
1039
+ delete(torrowId, options) {
1040
+ return this.http.requestJson({
1041
+ method: "DELETE",
1042
+ path: `${BASE2}/${encodePathSegment(torrowId)}`,
1043
+ query: {
1044
+ cascade: options.cascade,
1045
+ withPinnedItems: options.withPinnedItems,
1046
+ versionToCheck: options.versionToCheck,
1047
+ isNeedAnnouncement: options.isNeedAnnouncement
1048
+ },
1049
+ signal: options.signal
1050
+ });
1051
+ }
1052
+ /** `GET /api/v1/cases/{torrowId}` */
1053
+ getById(torrowId, options) {
1054
+ return this.http.requestJson({
1055
+ method: "GET",
1056
+ path: `${BASE2}/${encodePathSegment(torrowId)}`,
1057
+ query: {
1058
+ profileId: options?.profileId,
1059
+ caseParticipantProfileId: options?.caseParticipantProfileId,
1060
+ versionToCheck: options?.versionToCheck,
1061
+ includeDeleted: options?.includeDeleted,
1062
+ includeChildTypes: options?.includeChildTypes,
1063
+ securityToken: options?.securityToken,
1064
+ caseParticipantId: options?.caseParticipantId
1065
+ },
1066
+ signal: options?.signal
1067
+ });
1068
+ }
1069
+ /** `GET /api/v1/cases/personallist` */
1070
+ listPersonal(options) {
1071
+ const { signal, ...rest } = options ?? {};
1072
+ return this.http.requestJson({
1073
+ method: "GET",
1074
+ path: `${BASE2}/personallist`,
1075
+ query: { ...rest },
1076
+ signal
1077
+ });
1078
+ }
1079
+ /** `PUT /api/v1/cases/include/togroups` */
1080
+ includeToGroups(body, options) {
1081
+ return this.http.requestJson({
1082
+ method: "PUT",
1083
+ path: `${BASE2}/include/togroups`,
1084
+ body,
1085
+ signal: options?.signal
1086
+ });
1087
+ }
1088
+ /** `PUT /api/v1/cases/exclude/fromgroups` */
1089
+ excludeFromGroups(body, options) {
1090
+ return this.http.requestJson({
1091
+ method: "PUT",
1092
+ path: `${BASE2}/exclude/fromgroups`,
1093
+ body,
1094
+ signal: options?.signal
1095
+ });
1096
+ }
1097
+ /** `GET /api/v1/cases/uniquename/{uniqueName}` — query **`profileId`** (в отличие от базового `GET .../uniquename/...`). */
1098
+ getByUniqueName(uniqueName, options) {
1099
+ return this.http.requestJson({
1100
+ method: "GET",
1101
+ path: `${BASE2}/uniquename/${encodePathSegment(uniqueName)}`,
1102
+ query: { profileId: options?.profileId },
1103
+ signal: options?.signal
1104
+ });
1105
+ }
1106
+ /** `GET /api/v1/cases/{torrowId}/resources` */
1107
+ listResources(torrowId, query, options) {
1108
+ return this.http.requestJson({
1109
+ method: "GET",
1110
+ path: `${BASE2}/${encodePathSegment(torrowId)}/resources`,
1111
+ query: { ...query ?? {} },
1112
+ signal: options?.signal
1113
+ });
1114
+ }
1115
+ /** `GET /api/v1/cases/{torrowId}/caseparticipants` */
1116
+ listCaseParticipants(torrowId, query, options) {
1117
+ return this.http.requestJson({
1118
+ method: "GET",
1119
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants`,
1120
+ query: { ...query ?? {} },
1121
+ signal: options?.signal
1122
+ });
1123
+ }
1124
+ /** `GET /api/v1/cases/{torrowId}/caseparticipants/{caseParticipantId}` */
1125
+ getCaseParticipantById(torrowId, caseParticipantId, options) {
1126
+ return this.http.requestJson({
1127
+ method: "GET",
1128
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}`,
1129
+ query: { securityToken: options?.securityToken },
1130
+ signal: options?.signal
1131
+ });
1132
+ }
1133
+ /** `GET /api/v1/cases/{torrowId}/caseparticipants/count` */
1134
+ getCaseParticipantsCount(torrowId, query, options) {
1135
+ return this.http.requestJson({
1136
+ method: "GET",
1137
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/count`,
1138
+ query: { ...query ?? {} },
1139
+ signal: options?.signal
1140
+ });
1141
+ }
1142
+ /** `GET /api/v1/cases/{torrowId}/caseparticipants/nonanonymous` */
1143
+ getCaseParticipantsNonAnonymousCount(torrowId, query, options) {
1144
+ return this.http.requestJson({
1145
+ method: "GET",
1146
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/nonanonymous`,
1147
+ query: { ...query ?? {} },
1148
+ signal: options?.signal
1149
+ });
1150
+ }
1151
+ /** `PATCH /api/v1/cases/{torrowId}/caseparticipants/{caseParticipantId}/fields` */
1152
+ patchCaseParticipantFields(torrowId, caseParticipantId, body, options) {
1153
+ return this.http.requestJson({
1154
+ method: "PATCH",
1155
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}/fields`,
1156
+ query: {
1157
+ userMessage: options?.userMessage,
1158
+ versionToCheck: options?.versionToCheck,
1159
+ isNeedAnnouncement: options?.isNeedAnnouncement
1160
+ },
1161
+ body,
1162
+ signal: options?.signal
1163
+ });
1164
+ }
1165
+ /** `PATCH /api/v1/cases/{torrowId}/caseparticipants/{caseParticipantId}/confirmparticipation` */
1166
+ confirmCaseParticipantParticipation(torrowId, caseParticipantId, options) {
1167
+ return this.http.requestJson({
1168
+ method: "PATCH",
1169
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/${encodePathSegment(caseParticipantId)}/confirmparticipation`,
1170
+ query: {
1171
+ userMessage: options?.userMessage,
1172
+ profileId: options?.profileId,
1173
+ isNeedAnnouncement: options?.isNeedAnnouncement,
1174
+ versionToCheck: options?.versionToCheck,
1175
+ securityToken: options?.securityToken
1176
+ },
1177
+ signal: options?.signal
1178
+ });
1179
+ }
1180
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/checkin` */
1181
+ caseParticipationCheckIn(torrowId, body, options) {
1182
+ return this.http.requestJson({
1183
+ method: "PUT",
1184
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/checkin`,
1185
+ body,
1186
+ signal: options?.signal
1187
+ });
1188
+ }
1189
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/checkinmyself` (deprecated в Swagger). */
1190
+ checkInMyself(torrowId, body, options) {
1191
+ return this.http.requestJson({
1192
+ method: "PUT",
1193
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/checkinmyself`,
1194
+ query: { message: options?.message },
1195
+ body,
1196
+ signal: options?.signal
1197
+ });
1198
+ }
1199
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/checkinother` (deprecated). */
1200
+ checkInOther(torrowId, body, options) {
1201
+ return this.http.requestJson({
1202
+ method: "PUT",
1203
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/checkinother`,
1204
+ body,
1205
+ signal: options?.signal
1206
+ });
1207
+ }
1208
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/bookresourcesforme` */
1209
+ bookResourcesForMe(torrowId, body, options) {
1210
+ return this.http.requestJson({
1211
+ method: "PUT",
1212
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/bookresourcesforme`,
1213
+ query: { profileId: options?.profileId },
1214
+ body,
1215
+ signal: options?.signal
1216
+ });
1217
+ }
1218
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/bookresourcesforother` */
1219
+ bookResourcesForOthers(torrowId, body, options) {
1220
+ return this.http.requestJson({
1221
+ method: "PUT",
1222
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/bookresourcesforother`,
1223
+ body,
1224
+ signal: options?.signal
1225
+ });
1226
+ }
1227
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/bookresources` (deprecated). */
1228
+ bookResources(torrowId, body, options) {
1229
+ return this.http.requestJson({
1230
+ method: "PUT",
1231
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/bookresources`,
1232
+ body,
1233
+ signal: options?.signal
1234
+ });
1235
+ }
1236
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipants/approvemoneyreceive` */
1237
+ approveMoneyReceive(torrowId, body, options) {
1238
+ return this.http.requestJson({
1239
+ method: "PUT",
1240
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/approvemoneyreceive`,
1241
+ body,
1242
+ signal: options?.signal
1243
+ });
1244
+ }
1245
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipants/rejectmoneyreceive` */
1246
+ rejectMoneyReceive(torrowId, body, options) {
1247
+ return this.http.requestJson({
1248
+ method: "PUT",
1249
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipants/rejectmoneyreceive`,
1250
+ body,
1251
+ signal: options?.signal
1252
+ });
1253
+ }
1254
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/cancelmycaseparticipation` (deprecated). */
1255
+ cancelMyCaseParticipation(torrowId, body, options) {
1256
+ return this.http.requestJson({
1257
+ method: "PUT",
1258
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/cancelmycaseparticipation`,
1259
+ query: { profileId: options?.profileId },
1260
+ body,
1261
+ signal: options?.signal
1262
+ });
1263
+ }
1264
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/cancelothercaseparticipation` (deprecated). */
1265
+ cancelOtherCaseParticipation(torrowId, body, options) {
1266
+ return this.http.requestJson({
1267
+ method: "PUT",
1268
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/cancelothercaseparticipation`,
1269
+ body,
1270
+ signal: options?.signal
1271
+ });
1272
+ }
1273
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/approvecaseparticipation` */
1274
+ approveCaseParticipation(torrowId, body, options) {
1275
+ return this.http.requestJson({
1276
+ method: "PUT",
1277
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/approvecaseparticipation`,
1278
+ body,
1279
+ signal: options?.signal
1280
+ });
1281
+ }
1282
+ /** `PUT /api/v1/cases/{torrowId}/caseparticipation/cancelcaseparticipation` */
1283
+ cancelCaseParticipation(torrowId, body, options) {
1284
+ return this.http.requestJson({
1285
+ method: "PUT",
1286
+ path: `${BASE2}/${encodePathSegment(torrowId)}/caseparticipation/cancelcaseparticipation`,
1287
+ body,
1288
+ signal: options?.signal
1289
+ });
1290
+ }
1291
+ /** `POST /api/v1/cases/{torrowId}/reject` */
1292
+ rejectCase(torrowId, options) {
1293
+ return this.http.requestJson({
1294
+ method: "POST",
1295
+ path: `${BASE2}/${encodePathSegment(torrowId)}/reject`,
1296
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1297
+ signal: options?.signal
1298
+ });
1299
+ }
1300
+ /** `POST /api/v1/cases/{torrowId}/declinework` */
1301
+ declineWork(torrowId, options) {
1302
+ return this.http.requestJson({
1303
+ method: "POST",
1304
+ path: `${BASE2}/${encodePathSegment(torrowId)}/declinework`,
1305
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1306
+ signal: options?.signal
1307
+ });
1308
+ }
1309
+ /** `POST /api/v1/cases/{torrowId}/plan` */
1310
+ planCase(torrowId, options) {
1311
+ return this.http.requestJson({
1312
+ method: "POST",
1313
+ path: `${BASE2}/${encodePathSegment(torrowId)}/plan`,
1314
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1315
+ signal: options?.signal
1316
+ });
1317
+ }
1318
+ /** `POST /api/v1/cases/{torrowId}/takeinwork` */
1319
+ takeInWork(torrowId, options) {
1320
+ return this.http.requestJson({
1321
+ method: "POST",
1322
+ path: `${BASE2}/${encodePathSegment(torrowId)}/takeinwork`,
1323
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1324
+ signal: options?.signal
1325
+ });
1326
+ }
1327
+ /** `POST /api/v1/cases/{torrowId}/complete` */
1328
+ completeCase(torrowId, options) {
1329
+ return this.http.requestJson({
1330
+ method: "POST",
1331
+ path: `${BASE2}/${encodePathSegment(torrowId)}/complete`,
1332
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1333
+ signal: options?.signal
1334
+ });
1335
+ }
1336
+ /** `POST /api/v1/cases/{torrowId}/accept` */
1337
+ acceptCase(torrowId, options) {
1338
+ return this.http.requestJson({
1339
+ method: "POST",
1340
+ path: `${BASE2}/${encodePathSegment(torrowId)}/accept`,
1341
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1342
+ signal: options?.signal
1343
+ });
1344
+ }
1345
+ /** `POST /api/v1/cases/{torrowId}/returntoverification` */
1346
+ returnToVerification(torrowId, options) {
1347
+ return this.http.requestJson({
1348
+ method: "POST",
1349
+ path: `${BASE2}/${encodePathSegment(torrowId)}/returntoverification`,
1350
+ query: { profileId: options?.profileId, userMessage: options?.userMessage },
1351
+ signal: options?.signal
1352
+ });
1353
+ }
1354
+ /** `POST /api/v1/cases/{torrowId}/cancel` */
1355
+ cancelCase(torrowId, options) {
1356
+ return this.http.requestJson({
1357
+ method: "POST",
1358
+ path: `${BASE2}/${encodePathSegment(torrowId)}/cancel`,
1359
+ query: {
1360
+ profileId: options?.profileId,
1361
+ userMessage: options?.userMessage,
1362
+ securityToken: options?.securityToken
1363
+ },
1364
+ signal: options?.signal
1365
+ });
1366
+ }
1367
+ /** `POST /api/v1/cases/{torrowId}/patch` */
1368
+ patchCase(torrowId, body, options) {
1369
+ return this.http.requestJson({
1370
+ method: "POST",
1371
+ path: `${BASE2}/${encodePathSegment(torrowId)}/patch`,
1372
+ body,
1373
+ signal: options?.signal
1374
+ });
1375
+ }
1376
+ };
1377
+
1378
+ // ../../src/resources/contacts/ContactsFacade.ts
1379
+ var BASE3 = "/api/v1/contacts";
1380
+ var CONTACT_SOCIAL_OPTS = {
1381
+ imagePutUrlSecurityToken: true,
1382
+ withPhotoEndpoints: true
1383
+ };
1384
+ var ContactsFacade = class extends TorrowItemFacade {
1385
+ constructor(http) {
1386
+ super(http, BASE3, CONTACT_SOCIAL_OPTS);
1387
+ }
1388
+ /** `POST /api/v1/contacts` */
1389
+ create(body, options) {
1390
+ return this.http.requestJson({
1391
+ method: "POST",
1392
+ path: BASE3,
1393
+ query: {
1394
+ parentId: options?.parentId,
1395
+ profileId: options?.profileId
1396
+ },
1397
+ body,
1398
+ signal: options?.signal
1399
+ });
1400
+ }
1401
+ /** `PUT /api/v1/contacts/{torrowId}` */
1402
+ update(body, torrowId, options) {
1403
+ return this.http.requestJson({
1404
+ method: "PUT",
1405
+ path: `${BASE3}/${encodePathSegment(torrowId)}`,
1406
+ query: {
1407
+ checkVersion: options?.checkVersion,
1408
+ isNeedAnnouncement: options?.isNeedAnnouncement,
1409
+ securityToken: options?.securityToken
1410
+ },
1411
+ body,
1412
+ signal: options?.signal
1413
+ });
1414
+ }
1415
+ /** `GET /api/v1/contacts/{torrowId}` */
1416
+ getById(torrowId, options) {
1417
+ return this.http.requestJson({
1418
+ method: "GET",
1419
+ path: `${BASE3}/${encodePathSegment(torrowId)}`,
1420
+ query: {
1421
+ versionToCheck: options?.versionToCheck,
1422
+ includeDeleted: options?.includeDeleted,
1423
+ includeChildTypes: options?.includeChildTypes,
1424
+ securityToken: options?.securityToken
1425
+ },
1426
+ signal: options?.signal
1427
+ });
1428
+ }
1429
+ /**
1430
+ * `DELETE /api/v1/contacts/{torrowId}`
1431
+ * @param options.cascade / withPinnedItems — required by API (see Swagger).
1432
+ */
1433
+ delete(torrowId, options) {
1434
+ return this.http.requestJson({
1435
+ method: "DELETE",
1436
+ path: `${BASE3}/${encodePathSegment(torrowId)}`,
1437
+ query: {
1438
+ cascade: options.cascade,
1439
+ withPinnedItems: options.withPinnedItems,
1440
+ versionToCheck: options.versionToCheck,
1441
+ isNeedAnnouncement: options.isNeedAnnouncement
1442
+ },
1443
+ signal: options.signal
1444
+ });
1445
+ }
1446
+ /** `GET /api/v1/contacts/personallist` */
1447
+ listPersonal(options) {
1448
+ const { signal, securityToken, ...rest } = options ?? {};
1449
+ return this.http.requestJson({
1450
+ method: "GET",
1451
+ path: `${BASE3}/personallist`,
1452
+ query: { ...rest, securityToken },
1453
+ signal
1454
+ });
1455
+ }
1456
+ /** Расписание по контакту (профиль/исполнитель) — `PUT /api/v1/contacts/{id}/timetable`. */
1457
+ getTimetable(contactId, body, options) {
1458
+ const { signal, ...queryOpts } = options ?? {};
1459
+ return this.http.requestJson({
1460
+ method: "PUT",
1461
+ path: `${BASE3}/${encodePathSegment(contactId)}/timetable`,
1462
+ query: buildTimetableQuery(queryOpts),
1463
+ body,
1464
+ signal
1465
+ });
1466
+ }
1467
+ /** `POST /api/v1/contacts/timetable/statistics` */
1468
+ getTimetableStatistics(body, options) {
1469
+ return this.http.requestJson({
1470
+ method: "POST",
1471
+ path: `${BASE3}/timetable/statistics`,
1472
+ body,
1473
+ signal: options?.signal
1474
+ });
1475
+ }
1476
+ /** `POST /api/v1/contacts/communication/sendcode` */
1477
+ sendCommunicationCode(body, options) {
1478
+ return this.http.requestJson({
1479
+ method: "POST",
1480
+ path: `${BASE3}/communication/sendcode`,
1481
+ body,
1482
+ signal: options?.signal
1483
+ });
1484
+ }
1485
+ /** `POST /api/v1/contacts/communication/verify` */
1486
+ verifyCommunicationCode(body, options) {
1487
+ return this.http.requestJson({
1488
+ method: "POST",
1489
+ path: `${BASE3}/communication/verify`,
1490
+ body,
1491
+ signal: options?.signal
1492
+ });
1493
+ }
1494
+ /** `POST /api/v1/contacts/{torrowId}/invite` — тело JSON-string (идентификатор приглашения / профиля по контракту API). */
1495
+ invite(torrowId, body, options) {
1496
+ return this.http.requestJson({
1497
+ method: "POST",
1498
+ path: `${BASE3}/${encodePathSegment(torrowId)}/invite`,
1499
+ query: { communicationId: options?.communicationId },
1500
+ body,
1501
+ signal: options?.signal
1502
+ });
1503
+ }
1504
+ /** `POST /api/v1/contacts/activitystatuslist` */
1505
+ listActivityStatuses(itemIds, options) {
1506
+ return this.http.requestJson({
1507
+ method: "POST",
1508
+ path: `${BASE3}/activitystatuslist`,
1509
+ body: itemIds,
1510
+ signal: options?.signal
1511
+ });
1512
+ }
1513
+ /** `PUT /api/v1/contacts/{contactId}/contactproperties` */
1514
+ updateContactProperties(contactId, body, options) {
1515
+ return this.http.requestJson({
1516
+ method: "PUT",
1517
+ path: `${BASE3}/${encodePathSegment(contactId)}/contactproperties`,
1518
+ body,
1519
+ signal: options?.signal
1520
+ });
1521
+ }
1522
+ };
1523
+
1524
+ // ../../src/resources/contexts/ContextsFacade.ts
1525
+ var BASE4 = "/api/v1/contexts";
1526
+ var ContextsFacade = class extends TorrowItemFacade {
1527
+ constructor(http) {
1528
+ super(http, BASE4, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
1529
+ }
1530
+ /** `POST /api/v1/contexts` */
1531
+ create(body, options) {
1532
+ return this.http.requestJson({
1533
+ method: "POST",
1534
+ path: BASE4,
1535
+ query: { profileId: options?.profileId },
1536
+ body,
1537
+ signal: options?.signal
1538
+ });
1539
+ }
1540
+ /** `PUT /api/v1/contexts/{torrowId}` */
1541
+ update(body, torrowId, options) {
1542
+ return this.http.requestJson({
1543
+ method: "PUT",
1544
+ path: `${BASE4}/${encodePathSegment(torrowId)}`,
1545
+ query: {
1546
+ checkVersion: options?.checkVersion,
1547
+ isNeedAnnouncement: options?.isNeedAnnouncement
1548
+ },
1549
+ body,
1550
+ signal: options?.signal
1551
+ });
1552
+ }
1553
+ /** `DELETE /api/v1/contexts/{torrowId}` */
1554
+ delete(torrowId, options) {
1555
+ return this.http.requestJson({
1556
+ method: "DELETE",
1557
+ path: `${BASE4}/${encodePathSegment(torrowId)}`,
1558
+ query: {
1559
+ cascade: options.cascade,
1560
+ withPinnedItems: options.withPinnedItems,
1561
+ versionToCheck: options.versionToCheck,
1562
+ isNeedAnnouncement: options.isNeedAnnouncement
1563
+ },
1564
+ signal: options.signal
1565
+ });
1566
+ }
1567
+ /** `GET /api/v1/contexts/{torrowId}` */
1568
+ getById(torrowId, options) {
1569
+ return this.http.requestJson({
1570
+ method: "GET",
1571
+ path: `${BASE4}/${encodePathSegment(torrowId)}`,
1572
+ query: {
1573
+ versionToCheck: options?.versionToCheck,
1574
+ includeDeleted: options?.includeDeleted,
1575
+ includeChildTypes: options?.includeChildTypes,
1576
+ securityToken: options?.securityToken
1577
+ },
1578
+ signal: options?.signal
1579
+ });
1580
+ }
1581
+ /** `GET /api/v1/contexts/personallist` */
1582
+ listPersonal(options) {
1583
+ const { signal, ...rest } = options ?? {};
1584
+ return this.http.requestJson({
1585
+ method: "GET",
1586
+ path: `${BASE4}/personallist`,
1587
+ query: { ...rest },
1588
+ signal
1589
+ });
1590
+ }
1591
+ };
1592
+
1593
+ // ../../src/resources/notes/NotesFacade.ts
1594
+ var BASE5 = "/api/v1/notes";
1595
+ var NotesFacade = class extends TorrowItemFacade {
1596
+ constructor(http) {
1597
+ super(http, BASE5, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
1598
+ }
1599
+ /** `POST /api/v1/notes` */
1600
+ create(body, options) {
1601
+ return this.http.requestJson({
1602
+ method: "POST",
1603
+ path: BASE5,
1604
+ query: {
1605
+ parentId: options?.parentId,
1606
+ profileId: options?.profileId
1607
+ },
1608
+ body,
1609
+ signal: options?.signal
1610
+ });
1611
+ }
1612
+ /** `PUT /api/v1/notes/{torrowId}` */
1613
+ update(body, torrowId, options) {
1614
+ return this.http.requestJson({
1615
+ method: "PUT",
1616
+ path: `${BASE5}/${encodePathSegment(torrowId)}`,
1617
+ query: {
1618
+ checkVersion: options?.checkVersion,
1619
+ isNeedAnnouncement: options?.isNeedAnnouncement
1620
+ },
1621
+ body,
1622
+ signal: options?.signal
1623
+ });
1624
+ }
1625
+ /** `DELETE /api/v1/notes/{torrowId}` */
1626
+ delete(torrowId, options) {
1627
+ return this.http.requestJson({
1628
+ method: "DELETE",
1629
+ path: `${BASE5}/${encodePathSegment(torrowId)}`,
1630
+ query: {
1631
+ cascade: options.cascade,
1632
+ withPinnedItems: options.withPinnedItems,
1633
+ versionToCheck: options.versionToCheck,
1634
+ isNeedAnnouncement: options.isNeedAnnouncement
1635
+ },
1636
+ signal: options.signal
1637
+ });
1638
+ }
1639
+ /** `GET /api/v1/notes/{torrowId}` */
1640
+ getById(torrowId, options) {
1641
+ return this.http.requestJson({
1642
+ method: "GET",
1643
+ path: `${BASE5}/${encodePathSegment(torrowId)}`,
1644
+ query: {
1645
+ versionToCheck: options?.versionToCheck,
1646
+ includeDeleted: options?.includeDeleted,
1647
+ includeChildTypes: options?.includeChildTypes,
1648
+ securityToken: options?.securityToken
1649
+ },
1650
+ signal: options?.signal
1651
+ });
1652
+ }
1653
+ /** `GET /api/v1/notes/personallist` */
1654
+ listPersonal(options) {
1655
+ const { signal, ...rest } = options ?? {};
1656
+ return this.http.requestJson({
1657
+ method: "GET",
1658
+ path: `${BASE5}/personallist`,
1659
+ query: { ...rest },
1660
+ signal
1661
+ });
1662
+ }
1663
+ /** `GET /api/v1/notes/{torrowId}/file/info` */
1664
+ getFileInfo(torrowId, options) {
1665
+ return this.http.requestJson({
1666
+ method: "GET",
1667
+ path: `${BASE5}/${encodePathSegment(torrowId)}/file/info`,
1668
+ query: { fileId: options?.fileId },
1669
+ signal: options?.signal
1670
+ });
1671
+ }
1672
+ /** `GET /api/v1/notes/{torrowId}/file/puturl` — URL для загрузки файла (presigned). */
1673
+ getFilePutUrl(torrowId, options) {
1674
+ return this.http.requestJson({
1675
+ method: "GET",
1676
+ path: `${BASE5}/${encodePathSegment(torrowId)}/file/puturl`,
1677
+ query: {
1678
+ fileId: options?.fileId,
1679
+ fileName: options?.fileName,
1680
+ fileSize: options?.fileSize
1681
+ },
1682
+ signal: options?.signal
1683
+ });
1684
+ }
1685
+ };
1686
+
1687
+ // ../../src/resources/relations/RelationsFacade.ts
1688
+ var DOMAIN_BASE = {
1689
+ contacts: "/api/v1/contacts",
1690
+ notes: "/api/v1/notes",
1691
+ contexts: "/api/v1/contexts",
1692
+ resources: "/api/v1/resources",
1693
+ services: "/api/v1/services",
1694
+ cases: "/api/v1/cases",
1695
+ calendars: "/api/v1/calendars"
1696
+ };
1697
+ var RelationsFacade = class {
1698
+ constructor(http) {
1699
+ this.http = http;
1700
+ }
1701
+ http;
1702
+ base(domain) {
1703
+ return DOMAIN_BASE[domain];
1704
+ }
1705
+ /** `PUT /api/v1/{domain}/{parentId}/include/items` — привязать дочерние элементы к родителю (иерархия). */
1706
+ includeToParent(domain, parentId, body, options) {
1707
+ return this.http.requestJson({
1708
+ method: "PUT",
1709
+ path: `${this.base(domain)}/${encodePathSegment(parentId)}/include/items`,
1710
+ body,
1711
+ signal: options?.signal
1712
+ });
1713
+ }
1714
+ /** `PUT /api/v1/{domain}/{parentId}/include/foruser` — добавить представления/элементы в mind map пользователя под родителем. */
1715
+ includeForUser(domain, parentId, body, options) {
1716
+ return this.http.requestJson({
1717
+ method: "PUT",
1718
+ path: `${this.base(domain)}/${encodePathSegment(parentId)}/include/foruser`,
1719
+ body,
1720
+ signal: options?.signal
1721
+ });
1722
+ }
1723
+ /** `PUT /api/v1/{domain}/{parentId}/exclude/items` — убрать элементы из родителя. */
1724
+ excludeFromParent(domain, parentId, body, options) {
1725
+ return this.http.requestJson({
1726
+ method: "PUT",
1727
+ path: `${this.base(domain)}/${encodePathSegment(parentId)}/exclude/items`,
1728
+ body,
1729
+ signal: options?.signal
1730
+ });
1731
+ }
1732
+ /** `PUT /api/v1/{domain}/{parentId}/exclude/fromuser` — убрать из персонального mind map пользователя. */
1733
+ excludeFromUser(domain, parentId, body, options) {
1734
+ return this.http.requestJson({
1735
+ method: "PUT",
1736
+ path: `${this.base(domain)}/${encodePathSegment(parentId)}/exclude/fromuser`,
1737
+ body,
1738
+ signal: options?.signal
1739
+ });
1740
+ }
1741
+ /** `PUT /api/v1/{domain}/include/togroups` — включить элементы в несколько групп. */
1742
+ includeToGroups(domain, body, options) {
1743
+ return this.http.requestJson({
1744
+ method: "PUT",
1745
+ path: `${this.base(domain)}/include/togroups`,
1746
+ body,
1747
+ signal: options?.signal
1748
+ });
1749
+ }
1750
+ /** `PUT /api/v1/{domain}/exclude/fromgroups` — исключить элементы из групп. */
1751
+ excludeFromGroups(domain, body, options) {
1752
+ return this.http.requestJson({
1753
+ method: "PUT",
1754
+ path: `${this.base(domain)}/exclude/fromgroups`,
1755
+ body,
1756
+ signal: options?.signal
1757
+ });
1758
+ }
1759
+ /** `PUT /api/v1/{domain}/{itemId}/savetomindmap` — позиция/alias элемента в mind map. */
1760
+ saveToMindMap(domain, itemId, body, options) {
1761
+ return this.http.requestJson({
1762
+ method: "PUT",
1763
+ path: `${this.base(domain)}/${encodePathSegment(itemId)}/savetomindmap`,
1764
+ body,
1765
+ signal: options?.signal
1766
+ });
1767
+ }
1768
+ };
1769
+
1770
+ // ../../src/resources/common/implicit-tag-params.ts
1771
+ var SERVICE_IMPLICIT_TAG_SUFFIX = {
1772
+ orderNameLegacy: ":ordername",
1773
+ orderName: ":OrderName",
1774
+ timeZoneLegacy: ":timeZone",
1775
+ timeZone: ":timezone",
1776
+ disableCancelMyParticipation: ":DisableCancelMyParticipation",
1777
+ disableUpdateOrderTime: ":DisableUpdateOrderTime",
1778
+ unavailableBookingMessage: ":UnavailableBookingMessage",
1779
+ discountPercentage: ":DiscountPercentage",
1780
+ agreementText: ":AgreementText",
1781
+ agreementLink: ":AgreementLink",
1782
+ marginTime: ":MarginTime",
1783
+ lockId: ":lockId",
1784
+ autoStartTelegramNotificationBot: "AutoStartTelegramNotificationBot",
1785
+ autoStartTelegramNotificationBotTypo: "AutoStartTelegramNotifcationBot",
1786
+ autoStartConnectNotifications: "AutoStartConnectNotifications",
1787
+ hideMessengerConnectUiLegacy: "HideTelegramNotificationBot",
1788
+ hideMessengerConnectUi: "HideMessengerNotifications",
1789
+ /**
1790
+ * Резерв под серверную договоренность. Формат в `tags`: `NNN:payment_redirect_timeout_sec`.
1791
+ * Непосредственно в текущем `torrow-apps` литерал пока не используется.
1792
+ */
1793
+ paymentRedirectTimeoutSec: ":payment_redirect_timeout_sec"
1794
+ };
1795
+ var SERVICE_IMPLICIT_TAG_REGISTRY = {
1796
+ orderName: {
1797
+ field: "orderName",
1798
+ kind: "string",
1799
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.orderName, SERVICE_IMPLICIT_TAG_SUFFIX.orderNameLegacy],
1800
+ caseInsensitive: true
1801
+ },
1802
+ timeZone: {
1803
+ field: "timeZone",
1804
+ kind: "string",
1805
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.timeZone, SERVICE_IMPLICIT_TAG_SUFFIX.timeZoneLegacy],
1806
+ caseInsensitive: true
1807
+ },
1808
+ disableCancelMyParticipationBeforeMinutes: {
1809
+ field: "disableCancelMyParticipationBeforeMinutes",
1810
+ kind: "positiveInt",
1811
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.disableCancelMyParticipation]
1812
+ },
1813
+ disableUpdateOrderTimeBeforeMinutes: {
1814
+ field: "disableUpdateOrderTimeBeforeMinutes",
1815
+ kind: "positiveInt",
1816
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.disableUpdateOrderTime]
1817
+ },
1818
+ unavailableBookingMessage: {
1819
+ field: "unavailableBookingMessage",
1820
+ kind: "string",
1821
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.unavailableBookingMessage]
1822
+ },
1823
+ discountPercentageFieldName: {
1824
+ field: "discountPercentageFieldName",
1825
+ kind: "string",
1826
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.discountPercentage]
1827
+ },
1828
+ marginTimeSec: {
1829
+ field: "marginTimeSec",
1830
+ kind: "positiveInt",
1831
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.marginTime]
1832
+ },
1833
+ paymentRedirectTimeoutSec: {
1834
+ field: "paymentRedirectTimeoutSec",
1835
+ kind: "positiveInt",
1836
+ suffixes: [SERVICE_IMPLICIT_TAG_SUFFIX.paymentRedirectTimeoutSec]
1837
+ },
1838
+ hideMessengerConnectUi: {
1839
+ field: "hideMessengerConnectUi",
1840
+ kind: "containsFlag",
1841
+ tokens: [SERVICE_IMPLICIT_TAG_SUFFIX.hideMessengerConnectUi, SERVICE_IMPLICIT_TAG_SUFFIX.hideMessengerConnectUiLegacy]
1842
+ },
1843
+ hideTelegramNotificationBot: {
1844
+ field: "hideTelegramNotificationBot",
1845
+ kind: "containsFlag",
1846
+ tokens: [SERVICE_IMPLICIT_TAG_SUFFIX.hideMessengerConnectUiLegacy]
1847
+ },
1848
+ autoStartNotificationDelaySeconds: {
1849
+ field: "autoStartNotificationDelaySeconds",
1850
+ kind: "autoStart",
1851
+ suffixes: [
1852
+ SERVICE_IMPLICIT_TAG_SUFFIX.autoStartConnectNotifications,
1853
+ SERVICE_IMPLICIT_TAG_SUFFIX.autoStartTelegramNotificationBot,
1854
+ SERVICE_IMPLICIT_TAG_SUFFIX.autoStartTelegramNotificationBotTypo
1855
+ ]
1856
+ },
1857
+ agreementItems: {
1858
+ field: "agreementItems",
1859
+ kind: "agreement",
1860
+ textSuffix: SERVICE_IMPLICIT_TAG_SUFFIX.agreementText,
1861
+ linkSuffix: SERVICE_IMPLICIT_TAG_SUFFIX.agreementLink
1862
+ }
1863
+ };
1864
+ function isPositiveInt(value) {
1865
+ return typeof value === "number" && Number.isFinite(value) && value > 0;
1866
+ }
1867
+ function splitBySuffix(tag, suffix, caseInsensitive = false) {
1868
+ if (caseInsensitive) {
1869
+ const lowerTag = tag.toLowerCase();
1870
+ const lowerSuffix = suffix.toLowerCase();
1871
+ if (!lowerTag.endsWith(lowerSuffix)) return void 0;
1872
+ return tag.slice(0, tag.length - suffix.length);
1873
+ }
1874
+ if (!tag.endsWith(suffix)) return void 0;
1875
+ return tag.slice(0, tag.length - suffix.length);
1876
+ }
1877
+ function firstPrefixBySuffix(tags, suffix, options) {
1878
+ for (const tag of tags) {
1879
+ const prefix = splitBySuffix(tag, suffix, options?.caseInsensitive ?? false);
1880
+ if (prefix !== void 0) return prefix;
1881
+ }
1882
+ return void 0;
1883
+ }
1884
+ function toPositiveInt(raw) {
1885
+ if (!raw) return void 0;
1886
+ const value = Number.parseInt(raw.trim(), 10);
1887
+ return Number.isFinite(value) && value > 0 ? value : void 0;
1888
+ }
1889
+ function parseAutoStartDelay(tag) {
1890
+ const suffixes = SERVICE_IMPLICIT_TAG_REGISTRY.autoStartNotificationDelaySeconds.suffixes;
1891
+ for (const suffix of suffixes) {
1892
+ const match = tag.match(new RegExp(`^(\\d+):${suffix}$`));
1893
+ if (match?.[1]) {
1894
+ const sec = Number.parseInt(match[1], 10);
1895
+ if (Number.isFinite(sec) && sec > 0) return sec;
1896
+ }
1897
+ }
1898
+ return void 0;
1899
+ }
1900
+ function parseAgreementIndexedTag(tag, baseSuffix) {
1901
+ const escaped = baseSuffix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1902
+ const match = tag.match(new RegExp(`^(.*)${escaped}(\\d+)$`));
1903
+ if (!match?.[1] || !match[2]) return void 0;
1904
+ const index = Number.parseInt(match[2], 10);
1905
+ if (!Number.isFinite(index) || index <= 0) return void 0;
1906
+ return { index, value: match[1] };
1907
+ }
1908
+ function decodeAgreementLink(linkRaw) {
1909
+ const trimmed = linkRaw.trim();
1910
+ if (trimmed.startsWith("https//")) return `https://${trimmed.slice("https//".length)}`;
1911
+ if (trimmed.startsWith("http//")) return `http://${trimmed.slice("http//".length)}`;
1912
+ return trimmed;
1913
+ }
1914
+ function encodeAgreementLink(linkRaw) {
1915
+ const trimmed = linkRaw.trim();
1916
+ if (trimmed.startsWith("https://")) return `https//${trimmed.slice("https://".length)}`;
1917
+ if (trimmed.startsWith("http://")) return `http//${trimmed.slice("http://".length)}`;
1918
+ return trimmed;
1919
+ }
1920
+ function parseServiceImplicitTagParams(tags) {
1921
+ const safeTags = tags ?? [];
1922
+ const result = {};
1923
+ const mutable = result;
1924
+ for (const config of Object.values(SERVICE_IMPLICIT_TAG_REGISTRY)) {
1925
+ if (config.kind === "string" || config.kind === "positiveInt") {
1926
+ const raw = config.suffixes.map((suffix) => firstPrefixBySuffix(safeTags, suffix, { caseInsensitive: config.caseInsensitive ?? false })).find((x) => x !== void 0);
1927
+ if (config.kind === "string") {
1928
+ if (raw?.trim()) mutable[config.field] = raw.trim();
1929
+ } else {
1930
+ const value = toPositiveInt(raw);
1931
+ if (value !== void 0) mutable[config.field] = value;
1932
+ }
1933
+ }
1934
+ if (config.kind === "containsFlag") {
1935
+ const hasAny = safeTags.some((tag) => config.tokens.some((token) => tag.includes(token)));
1936
+ if (hasAny) mutable[config.field] = true;
1937
+ }
1938
+ }
1939
+ let autoStartNotificationDelaySeconds = result.autoStartNotificationDelaySeconds;
1940
+ if (autoStartNotificationDelaySeconds === void 0) {
1941
+ for (const tag of safeTags) {
1942
+ autoStartNotificationDelaySeconds = parseAutoStartDelay(tag);
1943
+ if (autoStartNotificationDelaySeconds !== void 0) break;
1944
+ }
1945
+ }
1946
+ if (autoStartNotificationDelaySeconds !== void 0) {
1947
+ mutable.autoStartNotificationDelaySeconds = autoStartNotificationDelaySeconds;
1948
+ }
1949
+ const agreementsMap = /* @__PURE__ */ new Map();
1950
+ const agreementConfig = SERVICE_IMPLICIT_TAG_REGISTRY.agreementItems;
1951
+ for (const tag of safeTags) {
1952
+ const textTag = parseAgreementIndexedTag(tag, agreementConfig.textSuffix);
1953
+ if (textTag) {
1954
+ agreementsMap.set(textTag.index, {
1955
+ index: textTag.index,
1956
+ ...agreementsMap.get(textTag.index) ?? {},
1957
+ text: textTag.value.trim() || void 0
1958
+ });
1959
+ }
1960
+ const linkTag = parseAgreementIndexedTag(tag, agreementConfig.linkSuffix);
1961
+ if (linkTag) {
1962
+ agreementsMap.set(linkTag.index, {
1963
+ index: linkTag.index,
1964
+ ...agreementsMap.get(linkTag.index) ?? {},
1965
+ link: decodeAgreementLink(linkTag.value)
1966
+ });
1967
+ }
1968
+ }
1969
+ const agreementItems = [...agreementsMap.values()].sort((a, b) => a.index - b.index).filter((x) => x.text || x.link);
1970
+ if (agreementItems.length) mutable.agreementItems = agreementItems;
1971
+ return result;
1972
+ }
1973
+ function buildServiceImplicitTags(params, options) {
1974
+ const tags = [];
1975
+ const singleValueConfigs = Object.values(SERVICE_IMPLICIT_TAG_REGISTRY).filter(
1976
+ (x) => x.kind === "string" || x.kind === "positiveInt"
1977
+ );
1978
+ for (const config of singleValueConfigs) {
1979
+ const value = params[config.field];
1980
+ const writeSuffix = config.suffixes[0];
1981
+ if (config.kind === "string") {
1982
+ if (typeof value === "string" && value.trim()) {
1983
+ tags.push(`${value.trim()}${writeSuffix}`);
1984
+ }
1985
+ } else if (isPositiveInt(typeof value === "number" ? value : void 0)) {
1986
+ tags.push(`${value}${writeSuffix}`);
1987
+ }
1988
+ }
1989
+ for (const agreement of params.agreementItems ?? []) {
1990
+ if (!isPositiveInt(agreement.index)) continue;
1991
+ if (agreement.text?.trim()) {
1992
+ tags.push(
1993
+ `${agreement.text.trim()}${SERVICE_IMPLICIT_TAG_REGISTRY.agreementItems.textSuffix}${agreement.index}`
1994
+ );
1995
+ }
1996
+ if (agreement.link?.trim()) {
1997
+ tags.push(
1998
+ `${encodeAgreementLink(agreement.link)}${SERVICE_IMPLICIT_TAG_REGISTRY.agreementItems.linkSuffix}${agreement.index}`
1999
+ );
2000
+ }
2001
+ }
2002
+ if (isPositiveInt(params.autoStartNotificationDelaySeconds)) {
2003
+ tags.push(
2004
+ `${params.autoStartNotificationDelaySeconds}:${options?.autoStartNotificationSuffix ?? SERVICE_IMPLICIT_TAG_SUFFIX.autoStartConnectNotifications}`
2005
+ );
2006
+ }
2007
+ if (params.hideMessengerConnectUi) {
2008
+ tags.push(SERVICE_IMPLICIT_TAG_REGISTRY.hideMessengerConnectUi.tokens[0]);
2009
+ }
2010
+ if (params.hideTelegramNotificationBot) {
2011
+ tags.push(SERVICE_IMPLICIT_TAG_REGISTRY.hideTelegramNotificationBot.tokens[0]);
2012
+ }
2013
+ return tags;
2014
+ }
2015
+ function isImplicitServiceTag(tag) {
2016
+ for (const config of Object.values(SERVICE_IMPLICIT_TAG_REGISTRY)) {
2017
+ if (config.kind === "string" || config.kind === "positiveInt") {
2018
+ const matched = config.suffixes.some(
2019
+ (suffix) => splitBySuffix(tag, suffix, config.caseInsensitive ?? false) !== void 0
2020
+ );
2021
+ if (matched) return true;
2022
+ }
2023
+ if (config.kind === "containsFlag") {
2024
+ if (config.tokens.some((token) => tag.includes(token))) return true;
2025
+ }
2026
+ if (config.kind === "autoStart") {
2027
+ const isAutoStart = config.suffixes.some((suffix) => tag.match(new RegExp(`^\\d+:${suffix}$`)) !== null);
2028
+ if (isAutoStart) return true;
2029
+ }
2030
+ if (config.kind === "agreement") {
2031
+ if (parseAgreementIndexedTag(tag, config.textSuffix) !== void 0 || parseAgreementIndexedTag(tag, config.linkSuffix) !== void 0) {
2032
+ return true;
2033
+ }
2034
+ }
2035
+ }
2036
+ return false;
2037
+ }
2038
+ function mergeServiceImplicitTags(baseTags, params, options) {
2039
+ const safeBase = baseTags ?? [];
2040
+ const preservedNonImplicit = safeBase.filter((tag) => !isImplicitServiceTag(tag));
2041
+ const nextImplicit = buildServiceImplicitTags(params, options);
2042
+ return [...preservedNonImplicit, ...nextImplicit];
2043
+ }
2044
+ function parseResourceBehaviorSettings(tags) {
2045
+ const parsed = parseServiceImplicitTagParams(tags);
2046
+ const lockId = toPositiveInt(firstPrefixBySuffix(tags ?? [], SERVICE_IMPLICIT_TAG_SUFFIX.lockId));
2047
+ return {
2048
+ marginTimeSec: parsed.marginTimeSec,
2049
+ lockId
2050
+ };
2051
+ }
2052
+ function mergeResourceBehaviorTags(baseTags, settings) {
2053
+ const safeBase = baseTags ?? [];
2054
+ const nonManaged = safeBase.filter(
2055
+ (tag) => splitBySuffix(tag, SERVICE_IMPLICIT_TAG_SUFFIX.marginTime) === void 0 && splitBySuffix(tag, SERVICE_IMPLICIT_TAG_SUFFIX.lockId) === void 0
2056
+ );
2057
+ const managed = [];
2058
+ if (isPositiveInt(settings.marginTimeSec)) {
2059
+ managed.push(`${settings.marginTimeSec}${SERVICE_IMPLICIT_TAG_SUFFIX.marginTime}`);
2060
+ }
2061
+ if (isPositiveInt(settings.lockId)) {
2062
+ managed.push(`${settings.lockId}${SERVICE_IMPLICIT_TAG_SUFFIX.lockId}`);
2063
+ }
2064
+ return [...nonManaged, ...managed];
2065
+ }
2066
+
2067
+ // ../../src/resources/resources/ResourcesFacade.ts
2068
+ var BASE6 = "/api/v1/resources";
2069
+ var ResourcesFacade = class extends TorrowItemFacade {
2070
+ constructor(http) {
2071
+ super(http, BASE6, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
2072
+ }
2073
+ toSdkResourceItem(item) {
2074
+ return {
2075
+ ...item,
2076
+ behaviorSettings: parseResourceBehaviorSettings(item.tags)
2077
+ };
2078
+ }
2079
+ toApiResourceItem(item) {
2080
+ const { behaviorSettings, ...apiBase } = item;
2081
+ const nextTags = behaviorSettings ? mergeResourceBehaviorTags(apiBase.tags, behaviorSettings) : apiBase.tags;
2082
+ return {
2083
+ ...apiBase,
2084
+ tags: nextTags
2085
+ };
2086
+ }
2087
+ /** `POST /api/v1/resources` */
2088
+ create(body, options) {
2089
+ return this.http.requestJson({
2090
+ method: "POST",
2091
+ path: BASE6,
2092
+ query: {
2093
+ parentId: options?.parentId,
2094
+ profileId: options?.profileId
2095
+ },
2096
+ body: this.toApiResourceItem(body),
2097
+ signal: options?.signal
2098
+ }).then((item) => this.toSdkResourceItem(item));
2099
+ }
2100
+ /** `PUT /api/v1/resources/{torrowId}` */
2101
+ update(body, torrowId, options) {
2102
+ return this.http.requestJson({
2103
+ method: "PUT",
2104
+ path: `${BASE6}/${encodePathSegment(torrowId)}`,
2105
+ query: {
2106
+ profileId: options?.profileId,
2107
+ checkVersion: options?.checkVersion,
2108
+ isNeedAnnouncement: options?.isNeedAnnouncement
2109
+ },
2110
+ body: this.toApiResourceItem(body),
2111
+ signal: options?.signal
2112
+ }).then((item) => this.toSdkResourceItem(item));
2113
+ }
2114
+ /** `DELETE /api/v1/resources/{torrowId}` */
2115
+ delete(torrowId, options) {
2116
+ return this.http.requestJson({
2117
+ method: "DELETE",
2118
+ path: `${BASE6}/${encodePathSegment(torrowId)}`,
2119
+ query: {
2120
+ cascade: options.cascade,
2121
+ withPinnedItems: options.withPinnedItems,
2122
+ versionToCheck: options.versionToCheck,
2123
+ isNeedAnnouncement: options.isNeedAnnouncement
2124
+ },
2125
+ signal: options.signal
2126
+ });
2127
+ }
2128
+ /** `GET /api/v1/resources/{torrowId}` */
2129
+ getById(torrowId, options) {
2130
+ return this.http.requestJson({
2131
+ method: "GET",
2132
+ path: `${BASE6}/${encodePathSegment(torrowId)}`,
2133
+ query: {
2134
+ versionToCheck: options?.versionToCheck,
2135
+ includeDeleted: options?.includeDeleted,
2136
+ isNeedItem: options?.isNeedItem,
2137
+ isNeedParentResource: options?.isNeedParentResource,
2138
+ includeChildTypes: options?.includeChildTypes,
2139
+ securityToken: options?.securityToken
2140
+ },
2141
+ signal: options?.signal
2142
+ }).then((item) => this.toSdkResourceItem(item));
2143
+ }
2144
+ getBehaviorSettingsFromResource(resource) {
2145
+ return "behaviorSettings" in resource && resource.behaviorSettings ? resource.behaviorSettings : parseResourceBehaviorSettings(resource.tags);
2146
+ }
2147
+ async getBehaviorSettings(resourceId, options) {
2148
+ const resource = await this.getById(resourceId, options);
2149
+ return this.getBehaviorSettingsFromResource(resource);
2150
+ }
2151
+ async updateBehaviorSettings(resourceId, settingsPatch, options) {
2152
+ const resource = await this.getById(resourceId, {
2153
+ includeDeleted: options?.includeDeleted,
2154
+ isNeedItem: options?.isNeedItem,
2155
+ isNeedParentResource: options?.isNeedParentResource,
2156
+ includeChildTypes: options?.includeChildTypes,
2157
+ securityToken: options?.securityToken,
2158
+ signal: options?.signal
2159
+ });
2160
+ const mergeParameters = options?.mergeParameters ?? true;
2161
+ const nextSettings = mergeParameters ? {
2162
+ ...this.getBehaviorSettingsFromResource(resource),
2163
+ ...settingsPatch
2164
+ } : { ...settingsPatch };
2165
+ resource.behaviorSettings = nextSettings;
2166
+ resource.tags = mergeResourceBehaviorTags(resource.tags, nextSettings);
2167
+ return this.update(resource, resourceId, {
2168
+ profileId: options?.profileId,
2169
+ checkVersion: options?.checkVersion,
2170
+ isNeedAnnouncement: options?.isNeedAnnouncement,
2171
+ signal: options?.signal
2172
+ });
2173
+ }
2174
+ setBehaviorSettings(resourceId, settings, options) {
2175
+ return this.updateBehaviorSettings(resourceId, settings, {
2176
+ ...options,
2177
+ mergeParameters: false
2178
+ });
2179
+ }
2180
+ /** `GET /api/v1/resources/personallist` */
2181
+ listPersonal(options) {
2182
+ const { signal, ...rest } = options ?? {};
2183
+ return this.http.requestJson({
2184
+ method: "GET",
2185
+ path: `${BASE6}/personallist`,
2186
+ query: { ...rest },
2187
+ signal
2188
+ }).then((items) => items.map((item) => this.toSdkResourceItem(item)));
2189
+ }
2190
+ /**
2191
+ * Расписание заказов, привязанных к **ресурсу** — `PUT /api/v1/resources/{id}/timetable`.
2192
+ */
2193
+ getTimetable(resourceId, body, options) {
2194
+ const { signal, ...queryOpts } = options ?? {};
2195
+ return this.http.requestJson({
2196
+ method: "PUT",
2197
+ path: `${BASE6}/${encodePathSegment(resourceId)}/timetable`,
2198
+ query: buildTimetableQuery(queryOpts),
2199
+ body,
2200
+ signal
2201
+ });
2202
+ }
2203
+ /**
2204
+ * Полосы занятости ресурса — `GET /api/v1/resources/{id}/workload`.
2205
+ */
2206
+ getWorkload(resourceId, options) {
2207
+ const { signal, from, to, serviceId } = options;
2208
+ return this.http.requestJson({
2209
+ method: "GET",
2210
+ path: `${BASE6}/${encodePathSegment(resourceId)}/workload`,
2211
+ query: {
2212
+ From: from,
2213
+ To: to,
2214
+ serviceId
2215
+ },
2216
+ signal
2217
+ });
2218
+ }
2219
+ /** `POST /api/v1/resources/{id}/pickorder`. */
2220
+ pickOrder(resourceId, body, options) {
2221
+ return this.http.requestJson({
2222
+ method: "POST",
2223
+ path: `${BASE6}/${encodePathSegment(resourceId)}/pickorder`,
2224
+ body,
2225
+ signal: options?.signal
2226
+ });
2227
+ }
2228
+ /** `POST /api/v1/resources/{id}/returnorder`. */
2229
+ returnOrder(resourceId, body, options) {
2230
+ return this.http.requestJson({
2231
+ method: "POST",
2232
+ path: `${BASE6}/${encodePathSegment(resourceId)}/returnorder`,
2233
+ body,
2234
+ signal: options?.signal
2235
+ });
2236
+ }
2237
+ /** `POST /api/v1/resources/timetable/statistics`. */
2238
+ getTimetableStatistics(body, options) {
2239
+ return this.http.requestJson({
2240
+ method: "POST",
2241
+ path: `${BASE6}/timetable/statistics`,
2242
+ body,
2243
+ signal: options?.signal
2244
+ });
2245
+ }
2246
+ };
2247
+
2248
+ // ../../src/resources/services/ServicesFacade.ts
2249
+ var BASE7 = "/api/v1/services";
2250
+ var ServicesFacade = class extends TorrowItemFacade {
2251
+ constructor(http) {
2252
+ super(http, BASE7, { imagePutUrlSecurityToken: false, withPhotoEndpoints: false });
2253
+ }
2254
+ toSdkServiceItem(service) {
2255
+ return {
2256
+ ...service,
2257
+ behaviorSettings: parseServiceImplicitTagParams(service.tags)
2258
+ };
2259
+ }
2260
+ toApiServiceItem(service) {
2261
+ const { behaviorSettings, ...apiBase } = service;
2262
+ const nextTags = behaviorSettings ? mergeServiceImplicitTags(apiBase.tags, behaviorSettings) : apiBase.tags;
2263
+ return {
2264
+ ...apiBase,
2265
+ tags: nextTags
2266
+ };
2267
+ }
2268
+ /** `POST /api/v1/services` */
2269
+ create(body, options) {
2270
+ return this.http.requestJson({
2271
+ method: "POST",
2272
+ path: BASE7,
2273
+ query: {
2274
+ parentId: options?.parentId,
2275
+ profileId: options?.profileId
2276
+ },
2277
+ body: this.toApiServiceItem(body),
2278
+ signal: options?.signal
2279
+ }).then((item) => this.toSdkServiceItem(item));
2280
+ }
2281
+ /** `PUT /api/v1/services/{torrowId}` */
2282
+ update(body, torrowId, options) {
2283
+ return this.http.requestJson({
2284
+ method: "PUT",
2285
+ path: `${BASE7}/${encodePathSegment(torrowId)}`,
2286
+ query: {
2287
+ profileId: options?.profileId,
2288
+ checkVersion: options?.checkVersion,
2289
+ isNeedAnnouncement: options?.isNeedAnnouncement
2290
+ },
2291
+ body: this.toApiServiceItem(body),
2292
+ signal: options?.signal
2293
+ }).then((item) => this.toSdkServiceItem(item));
2294
+ }
2295
+ /** `DELETE /api/v1/services/{torrowId}` */
2296
+ delete(torrowId, options) {
2297
+ return this.http.requestJson({
2298
+ method: "DELETE",
2299
+ path: `${BASE7}/${encodePathSegment(torrowId)}`,
2300
+ query: {
2301
+ cascade: options.cascade,
2302
+ withPinnedItems: options.withPinnedItems,
2303
+ versionToCheck: options.versionToCheck,
2304
+ isNeedAnnouncement: options.isNeedAnnouncement
2305
+ },
2306
+ signal: options.signal
2307
+ });
2308
+ }
2309
+ /** `GET /api/v1/services/{torrowId}` */
2310
+ getById(torrowId, options) {
2311
+ return this.http.requestJson({
2312
+ method: "GET",
2313
+ path: `${BASE7}/${encodePathSegment(torrowId)}`,
2314
+ query: {
2315
+ profileId: options?.profileId,
2316
+ versionToCheck: options?.versionToCheck,
2317
+ includeDeleted: options?.includeDeleted,
2318
+ includeChildTypes: options?.includeChildTypes,
2319
+ securityToken: options?.securityToken
2320
+ },
2321
+ signal: options?.signal
2322
+ }).then((item) => this.toSdkServiceItem(item));
2323
+ }
2324
+ /** Внутренний helper: получить типизированные настройки поведения услуги из `service.tags`. */
2325
+ getBehaviorSettingsFromService(service) {
2326
+ const settings = "behaviorSettings" in service && service.behaviorSettings ? service.behaviorSettings : parseServiceImplicitTagParams(service.tags);
2327
+ return settings;
2328
+ }
2329
+ /** `GET + parse`: получить сервис и извлечь `ServiceBehaviorSettings`. */
2330
+ async getBehaviorSettings(serviceId, options) {
2331
+ const service = await this.getById(serviceId, options);
2332
+ return this.getBehaviorSettingsFromService(service);
2333
+ }
2334
+ /**
2335
+ * Обновляет настройки поведения услуги через типизированную структуру.
2336
+ * `mergeParameters=true` по умолчанию: patch поверх текущих settings.
2337
+ */
2338
+ async updateBehaviorSettings(serviceId, settingsPatch, options) {
2339
+ const service = await this.getById(serviceId, {
2340
+ profileId: options?.profileId,
2341
+ includeDeleted: options?.includeDeleted,
2342
+ includeChildTypes: options?.includeChildTypes,
2343
+ securityToken: options?.securityToken,
2344
+ signal: options?.signal
2345
+ });
2346
+ const mergeParameters = options?.mergeParameters ?? true;
2347
+ const nextSettings = mergeParameters ? {
2348
+ ...this.getBehaviorSettingsFromService(service),
2349
+ ...settingsPatch
2350
+ } : { ...settingsPatch };
2351
+ service.behaviorSettings = nextSettings;
2352
+ service.tags = mergeServiceImplicitTags(service.tags, nextSettings);
2353
+ return this.update(service, serviceId, {
2354
+ profileId: options?.profileId,
2355
+ checkVersion: options?.checkVersion,
2356
+ isNeedAnnouncement: options?.isNeedAnnouncement,
2357
+ signal: options?.signal
2358
+ });
2359
+ }
2360
+ /** Полная установка `ServiceBehaviorSettings` (без merge c текущими параметрами). */
2361
+ setBehaviorSettings(serviceId, settings, options) {
2362
+ return this.updateBehaviorSettings(serviceId, settings, {
2363
+ ...options,
2364
+ mergeParameters: false
2365
+ });
2366
+ }
2367
+ /**
2368
+ * Запись на услугу — `POST /api/v1/services/{serviceId}/order`.
2369
+ * Минимум в теле: непустой смысл в `checkInProperties` (слот, участник, контакты — по правилам услуги и OpenAPI).
2370
+ * Успех: `OrderResp` (часто интересен `order` как кейс и `consumerSecurityToken` для гостевого доступа).
2371
+ * Типичные отказы: нет слота, услуга недоступна по времени, подписка/баланс — разбирай тело `TorrowHttpError` (`name` / `code`); эталон UX — `torrow-apps` `CreateOrderTask`.
2372
+ */
2373
+ createOrder(serviceId, body, options) {
2374
+ return this.http.requestJson({
2375
+ method: "POST",
2376
+ path: `${BASE7}/${encodePathSegment(serviceId)}/order`,
2377
+ body,
2378
+ signal: options?.signal
2379
+ });
2380
+ }
2381
+ /**
2382
+ * Слоты расписания услуги — `PUT /api/v1/services/{serviceId}/timetable` с телом `TimetableFilter`.
2383
+ * Используется для выбора времени в мастере записи (после выбора ресурсов передай `bookingResourceFilter` в фильтре).
2384
+ */
2385
+ getTimetable(serviceId, body, options) {
2386
+ const { signal, ...queryOpts } = options ?? {};
2387
+ return this.http.requestJson({
2388
+ method: "PUT",
2389
+ path: `${BASE7}/${encodePathSegment(serviceId)}/timetable`,
2390
+ query: buildTimetableQuery(queryOpts),
2391
+ body,
2392
+ signal
2393
+ });
2394
+ }
2395
+ /**
2396
+ * Нагрузка и расписание по ресурсам услуги — `PUT /api/v1/services/workloadinfo`.
2397
+ * Эталон: torrow-apps `ServiceItemService.getWorkloadInfo`, экран заказов по ресурсам (`service-resource-orders`).
2398
+ */
2399
+ getWorkloadInfo(body, options) {
2400
+ return this.http.requestJson({
2401
+ method: "PUT",
2402
+ path: `${BASE7}/workloadinfo`,
2403
+ body,
2404
+ signal: options?.signal
2405
+ });
2406
+ }
2407
+ /** Агрегаты по расписанию услуги — `POST /api/v1/services/timetable/statistics`. */
2408
+ getTimetableStatistics(body, options) {
2409
+ return this.http.requestJson({
2410
+ method: "POST",
2411
+ path: `${BASE7}/timetable/statistics`,
2412
+ body,
2413
+ signal: options?.signal
2414
+ });
2415
+ }
2416
+ /** Доступные окна чекина — `POST /api/v1/services/{id}/checkinschedule`. */
2417
+ getCheckInSchedule(serviceId, body, options) {
2418
+ return this.http.requestJson({
2419
+ method: "POST",
2420
+ path: `${BASE7}/${encodePathSegment(serviceId)}/checkinschedule`,
2421
+ body,
2422
+ signal: options?.signal
2423
+ });
2424
+ }
2425
+ /** Пересчёт расписания чекина — `PUT /api/v1/services/{id}/recheckinschedule`. */
2426
+ getReCheckInSchedule(serviceId, body, options) {
2427
+ return this.http.requestJson({
2428
+ method: "PUT",
2429
+ path: `${BASE7}/${encodePathSegment(serviceId)}/recheckinschedule`,
2430
+ body,
2431
+ signal: options?.signal
2432
+ });
2433
+ }
2434
+ /** Доступные ресурсы группы для шага «Ресурс» — `POST /api/v1/services/{serviceId}/resources`. */
2435
+ getServiceResources(serviceId, body, options) {
2436
+ return this.http.requestJson({
2437
+ method: "POST",
2438
+ path: `${BASE7}/${encodePathSegment(serviceId)}/resources`,
2439
+ body,
2440
+ signal: options?.signal
2441
+ });
2442
+ }
2443
+ /**
2444
+ * Ресурсы с детализацией (в т.ч. гарантированные количества) — `POST .../resourceswithdetalization`.
2445
+ * Удобно для виджетов с лимитами мест / «осталось N».
2446
+ */
2447
+ getServiceResourcesWithDetalization(serviceId, body, options) {
2448
+ return this.http.requestJson({
2449
+ method: "POST",
2450
+ path: `${BASE7}/${encodePathSegment(serviceId)}/resourceswithdetalization`,
2451
+ body,
2452
+ signal: options?.signal
2453
+ });
2454
+ }
2455
+ /** `GET /api/v1/services/personallist` */
2456
+ listPersonal(options) {
2457
+ const { signal, ...rest } = options ?? {};
2458
+ return this.http.requestJson({
2459
+ method: "GET",
2460
+ path: `${BASE7}/personallist`,
2461
+ query: { ...rest },
2462
+ signal
2463
+ }).then((items) => items.map((item) => this.toSdkServiceItem(item)));
2464
+ }
2465
+ /** `POST /api/v1/services/{serviceId}/session` — создать сессию записи (тело `CaseItem`). */
2466
+ createSession(serviceId, body, options) {
2467
+ return this.http.requestJson({
2468
+ method: "POST",
2469
+ path: `${BASE7}/${encodePathSegment(serviceId)}/session`,
2470
+ query: { profileId: options?.profileId },
2471
+ body,
2472
+ signal: options?.signal
2473
+ });
2474
+ }
2475
+ /** `PUT /api/v1/services/{serviceId}/session` — получить/обновить сессию по `caseId`. */
2476
+ refreshSession(serviceId, options) {
2477
+ return this.http.requestJson({
2478
+ method: "PUT",
2479
+ path: `${BASE7}/${encodePathSegment(serviceId)}/session`,
2480
+ query: { caseId: options?.caseId, profileId: options?.profileId },
2481
+ signal: options?.signal
2482
+ });
2483
+ }
2484
+ /** `PATCH /api/v1/services/{serviceId}/updateorder` */
2485
+ patchUpdateOrder(serviceId, body, options) {
2486
+ return this.http.requestJson({
2487
+ method: "PATCH",
2488
+ path: `${BASE7}/${encodePathSegment(serviceId)}/updateorder`,
2489
+ body,
2490
+ signal: options?.signal
2491
+ });
2492
+ }
2493
+ /** `PATCH /api/v1/services/{serviceId}/updateorder2` */
2494
+ patchUpdateOrder2(serviceId, body, options) {
2495
+ return this.http.requestJson({
2496
+ method: "PATCH",
2497
+ path: `${BASE7}/${encodePathSegment(serviceId)}/updateorder2`,
2498
+ body,
2499
+ signal: options?.signal
2500
+ });
2501
+ }
2502
+ /** `PUT /api/v1/services/{serviceId}/changeorderservice` */
2503
+ changeOrderService(serviceId, body, options) {
2504
+ return this.http.requestJson({
2505
+ method: "PUT",
2506
+ path: `${BASE7}/${encodePathSegment(serviceId)}/changeorderservice`,
2507
+ body,
2508
+ signal: options?.signal
2509
+ });
2510
+ }
2511
+ /** `PATCH /api/v1/services/{serviceId}/updateorderinfo` */
2512
+ patchUpdateOrderInfo(serviceId, body, options) {
2513
+ return this.http.requestJson({
2514
+ method: "PATCH",
2515
+ path: `${BASE7}/${encodePathSegment(serviceId)}/updateorderinfo`,
2516
+ body,
2517
+ signal: options?.signal
2518
+ });
2519
+ }
2520
+ };
2521
+
2522
+ // ../../src/resources/auth/AuthFacade.ts
2523
+ var BASE8 = "/api/v1/auth";
2524
+ var AuthFacade = class {
2525
+ anonHttp;
2526
+ constructor(config) {
2527
+ this.anonHttp = new HttpClient({
2528
+ baseUrl: config.baseUrl,
2529
+ fetch: config.fetch,
2530
+ defaultHeaders: config.defaultHeaders,
2531
+ userAgent: config.userAgent
2532
+ });
2533
+ }
2534
+ /** `POST /api/v1/auth/refresh` — новая пара токенов по `refreshToken`. */
2535
+ refresh(body, options) {
2536
+ return this.anonHttp.requestJson({
2537
+ method: "POST",
2538
+ path: `${BASE8}/refresh`,
2539
+ body,
2540
+ signal: options?.signal
2541
+ });
2542
+ }
2543
+ /** `POST /api/v1/auth/token` — обмен `sessionId` / `code` (и др.) на `TokenResp`. */
2544
+ requestToken(body, options) {
2545
+ return this.anonHttp.requestJson({
2546
+ method: "POST",
2547
+ path: `${BASE8}/token`,
2548
+ body,
2549
+ signal: options?.signal
2550
+ });
2551
+ }
2552
+ /** `POST /api/v1/auth/revoke` — инвалидация refresh (тело `RevokeReq`). */
2553
+ revoke(body, options) {
2554
+ return this.anonHttp.requestJson({
2555
+ method: "POST",
2556
+ path: `${BASE8}/revoke`,
2557
+ body,
2558
+ signal: options?.signal
2559
+ });
2560
+ }
2561
+ /** `POST /api/v1/auth/sendcode` — отправка кода входа; ответ `SendCodeResp`. */
2562
+ sendCode(body, options) {
2563
+ return this.anonHttp.requestJson({
2564
+ method: "POST",
2565
+ path: `${BASE8}/sendcode`,
2566
+ body,
2567
+ signal: options?.signal
2568
+ });
2569
+ }
2570
+ /** `POST /api/v1/auth/session` — создание сессии аутентификации. */
2571
+ createSession(body, options) {
2572
+ return this.anonHttp.requestJson({
2573
+ method: "POST",
2574
+ path: `${BASE8}/session`,
2575
+ body,
2576
+ signal: options?.signal
2577
+ });
2578
+ }
2579
+ };
2580
+
2581
+ // ../../src/resources/user-profiles/ProfilesFacade.ts
2582
+ var BASE9 = "/api/v1/user/profiles";
2583
+ var ProfilesFacade = class {
2584
+ constructor(http) {
2585
+ this.http = http;
2586
+ }
2587
+ http;
2588
+ /** `GET /api/v1/user/profiles` — список Профилей текущего пользователя. */
2589
+ list(options) {
2590
+ return this.http.requestJson({ method: "GET", path: BASE9, signal: options?.signal });
2591
+ }
2592
+ /**
2593
+ * `POST /api/v1/user/profiles` — создать Профиль по телу контакта.
2594
+ * Ответ: `AddProfileResp` с полем `profile` (и устаревшим `personalContactList`).
2595
+ */
2596
+ add(body, options) {
2597
+ return this.http.requestJson({ method: "POST", path: BASE9, body, signal: options?.signal });
2598
+ }
2599
+ /**
2600
+ * `PUT /api/v1/user/profiles` — в OpenAPI тело **JSON-строка** (id существующего контакта), не объект.
2601
+ * Добавляет этот контакт как Профиль. Ответ: `AddProfileResp`.
2602
+ */
2603
+ addByContactId(contactId, options) {
2604
+ return this.http.requestJson({ method: "PUT", path: BASE9, body: contactId, signal: options?.signal });
2605
+ }
2606
+ /**
2607
+ * `PUT /api/v1/user/profiles/{profileId}/profileproperties` — обновить расширенные свойства Профиля
2608
+ * (цвет, доступность и т.д., см. тип `ProfileProperties`).
2609
+ */
2610
+ updateProfileProperties(profileId, body, options) {
2611
+ return this.http.requestJson({
2612
+ method: "PUT",
2613
+ path: `${BASE9}/${encodePathSegment(profileId)}/profileproperties`,
2614
+ body,
2615
+ signal: options?.signal
2616
+ });
2617
+ }
2618
+ /** `DELETE /api/v1/user/profiles/{profileId}` — удалить Профиль. Ответ: `RemoveProfileResp`. */
2619
+ remove(profileId, options) {
2620
+ return this.http.requestJson({
2621
+ method: "DELETE",
2622
+ path: `${BASE9}/${encodePathSegment(profileId)}`,
2623
+ signal: options?.signal
2624
+ });
2625
+ }
2626
+ };
2627
+
2628
+ // ../../src/resources/views/ViewsFacade.ts
2629
+ var DOMAIN_BASE2 = {
2630
+ contacts: "/api/v1/contacts",
2631
+ notes: "/api/v1/notes",
2632
+ contexts: "/api/v1/contexts",
2633
+ resources: "/api/v1/resources",
2634
+ services: "/api/v1/services",
2635
+ cases: "/api/v1/cases",
2636
+ calendars: "/api/v1/calendars",
2637
+ loyaltycards: "/api/v1/loyaltycards",
2638
+ loyaltysystems: "/api/v1/loyaltysystems"
2639
+ };
2640
+ var ViewsFacade = class {
2641
+ constructor(http) {
2642
+ this.http = http;
2643
+ }
2644
+ http;
2645
+ base(domain) {
2646
+ return DOMAIN_BASE2[domain];
2647
+ }
2648
+ parentPath(domain, parentId) {
2649
+ return `${this.base(domain)}/${encodePathSegment(parentId)}`;
2650
+ }
2651
+ /** У контактов снятие закрепления идёт через `.../pinned/{childId}/unpin`, у остальных доменов — `.../user/{childId}/unpin`. */
2652
+ unpinUserSegment(domain) {
2653
+ return domain === "contacts" ? "pinned" : "user";
2654
+ }
2655
+ /** `GET /api/v1/{domain}/{parentId}/views/user` */
2656
+ listUserForParent(domain, parentId, options) {
2657
+ const { signal, ...query } = options ?? {};
2658
+ return this.http.requestJson({
2659
+ method: "GET",
2660
+ path: `${this.parentPath(domain, parentId)}/views/user`,
2661
+ query: { ...query },
2662
+ signal
2663
+ });
2664
+ }
2665
+ /** `POST /api/v1/{domain}/{parentId}/views/user` */
2666
+ createUserViews(domain, parentId, body, options) {
2667
+ return this.http.requestJson({
2668
+ method: "POST",
2669
+ path: `${this.parentPath(domain, parentId)}/views/user`,
2670
+ body,
2671
+ signal: options?.signal
2672
+ });
2673
+ }
2674
+ /** `GET /api/v1/{domain}/views/user` — все пользовательские представления по домену без привязки к одному родителю. */
2675
+ listUserAll(domain, options) {
2676
+ const { signal, ...query } = options ?? {};
2677
+ return this.http.requestJson({
2678
+ method: "GET",
2679
+ path: `${this.base(domain)}/views/user`,
2680
+ query: { ...query },
2681
+ signal
2682
+ });
2683
+ }
2684
+ /** `GET /api/v1/{domain}/{parentId}/views/user/{childId}` */
2685
+ getUserView(domain, parentId, childId, options) {
2686
+ return this.http.requestJson({
2687
+ method: "GET",
2688
+ path: `${this.parentPath(domain, parentId)}/views/user/${encodePathSegment(childId)}`,
2689
+ signal: options?.signal
2690
+ });
2691
+ }
2692
+ /** `DELETE /api/v1/{domain}/{parentId}/views/user/{childId}` — убрать из mind map пользователя под родителем. */
2693
+ deleteUserView(domain, parentId, childId, options) {
2694
+ return this.http.requestJson({
2695
+ method: "DELETE",
2696
+ path: `${this.parentPath(domain, parentId)}/views/user/${encodePathSegment(childId)}`,
2697
+ signal: options?.signal
2698
+ });
2699
+ }
2700
+ /** `POST /api/v1/{domain}/{parentId}/views/pinned` */
2701
+ createPinnedViews(domain, parentId, body, options) {
2702
+ return this.http.requestJson({
2703
+ method: "POST",
2704
+ path: `${this.parentPath(domain, parentId)}/views/pinned`,
2705
+ body,
2706
+ signal: options?.signal
2707
+ });
2708
+ }
2709
+ /** `GET /api/v1/{domain}/{parentId}/views/pinned` */
2710
+ listPinnedForParent(domain, parentId, options) {
2711
+ const { signal, ...query } = options ?? {};
2712
+ return this.http.requestJson({
2713
+ method: "GET",
2714
+ path: `${this.parentPath(domain, parentId)}/views/pinned`,
2715
+ query: { ...query },
2716
+ signal
2717
+ });
2718
+ }
2719
+ /** `DELETE /api/v1/{domain}/{parentId}/views/pinned/{childId}` */
2720
+ deletePinnedView(domain, parentId, childId, options) {
2721
+ return this.http.requestJson({
2722
+ method: "DELETE",
2723
+ path: `${this.parentPath(domain, parentId)}/views/pinned/${encodePathSegment(childId)}`,
2724
+ signal: options?.signal
2725
+ });
2726
+ }
2727
+ /** `GET /api/v1/{domain}/{parentId}/views/pinned/{childId}` */
2728
+ getPinnedView(domain, parentId, childId, options) {
2729
+ return this.http.requestJson({
2730
+ method: "GET",
2731
+ path: `${this.parentPath(domain, parentId)}/views/pinned/${encodePathSegment(childId)}`,
2732
+ signal: options?.signal
2733
+ });
2734
+ }
2735
+ /** `POST /api/v1/{domain}/{parentId}/views/pinned/updateorder` */
2736
+ updatePinnedOrder(domain, parentId, body, options) {
2737
+ return this.http.requestJson({
2738
+ method: "POST",
2739
+ path: `${this.parentPath(domain, parentId)}/views/pinned/updateorder`,
2740
+ body,
2741
+ signal: options?.signal
2742
+ });
2743
+ }
2744
+ /** `POST /api/v1/{domain}/{parentId}/views/user/updateorder` */
2745
+ updateUserViewOrder(domain, parentId, body, options) {
2746
+ return this.http.requestJson({
2747
+ method: "POST",
2748
+ path: `${this.parentPath(domain, parentId)}/views/user/updateorder`,
2749
+ body,
2750
+ signal: options?.signal
2751
+ });
2752
+ }
2753
+ /** `POST /api/v1/{domain}/{parentId}/views/user/{childId}/pin` */
2754
+ pinUserView(domain, parentId, childId, options) {
2755
+ const { signal, alias } = options ?? {};
2756
+ return this.http.requestJson({
2757
+ method: "POST",
2758
+ path: `${this.parentPath(domain, parentId)}/views/user/${encodePathSegment(childId)}/pin`,
2759
+ query: { alias },
2760
+ signal
2761
+ });
2762
+ }
2763
+ /**
2764
+ * Снять закрепление пользовательского представления.
2765
+ * Для `contacts`: `POST .../views/pinned/{childId}/unpin`; иначе `POST .../views/user/{childId}/unpin`.
2766
+ */
2767
+ unpinUserView(domain, parentId, childId, options) {
2768
+ const { signal, alias } = options ?? {};
2769
+ const seg = this.unpinUserSegment(domain);
2770
+ return this.http.requestJson({
2771
+ method: "POST",
2772
+ path: `${this.parentPath(domain, parentId)}/views/${seg}/${encodePathSegment(childId)}/unpin`,
2773
+ query: { alias },
2774
+ signal
2775
+ });
2776
+ }
2777
+ };
2778
+
2779
+ // ../../src/resources/search/SearchFacade.ts
2780
+ var BASE10 = "/api/v1/search";
2781
+ var SearchFacade = class {
2782
+ constructor(http) {
2783
+ this.http = http;
2784
+ }
2785
+ http;
2786
+ /** `GET /api/v1/search/adviseditems` */
2787
+ advisedItems(query, options) {
2788
+ return this.http.requestJson({
2789
+ method: "GET",
2790
+ path: `${BASE10}/adviseditems`,
2791
+ query: { ...query ?? {} },
2792
+ signal: options?.signal
2793
+ });
2794
+ }
2795
+ /**
2796
+ * `PUT /api/v1/search/{torrowId}/orders` — заказы (события-заказы) под элементом с фильтром.
2797
+ * Тело **`OrderFilter`**; см. также **`examples/node/raw/24-search-orders-raw.ts`** (сырой `raw.put`).
2798
+ */
2799
+ orders(torrowId, body, query, options) {
2800
+ return this.http.requestJson({
2801
+ method: "PUT",
2802
+ path: `${BASE10}/${encodePathSegment(torrowId)}/orders`,
2803
+ query: { ...query ?? {} },
2804
+ body,
2805
+ signal: options?.signal
2806
+ });
2807
+ }
2808
+ /** `GET /api/v1/search/contacts` */
2809
+ contacts(query, options) {
2810
+ return this.http.requestJson({
2811
+ method: "GET",
2812
+ path: `${BASE10}/contacts`,
2813
+ query: { ...query ?? {} },
2814
+ signal: options?.signal
2815
+ });
2816
+ }
2817
+ /** `GET /api/v1/search/notes` */
2818
+ notes(query, options) {
2819
+ return this.http.requestJson({
2820
+ method: "GET",
2821
+ path: `${BASE10}/notes`,
2822
+ query: { ...query ?? {} },
2823
+ signal: options?.signal
2824
+ });
2825
+ }
2826
+ /** `GET /api/v1/search/calendars` */
2827
+ calendars(query, options) {
2828
+ return this.http.requestJson({
2829
+ method: "GET",
2830
+ path: `${BASE10}/calendars`,
2831
+ query: { ...query ?? {} },
2832
+ signal: options?.signal
2833
+ });
2834
+ }
2835
+ /** `GET /api/v1/search/cases` */
2836
+ cases(query, options) {
2837
+ return this.http.requestJson({
2838
+ method: "GET",
2839
+ path: `${BASE10}/cases`,
2840
+ query: { ...query ?? {} },
2841
+ signal: options?.signal
2842
+ });
2843
+ }
2844
+ /** `GET /api/v1/search/resources` */
2845
+ resources(query, options) {
2846
+ return this.http.requestJson({
2847
+ method: "GET",
2848
+ path: `${BASE10}/resources`,
2849
+ query: { ...query ?? {} },
2850
+ signal: options?.signal
2851
+ });
2852
+ }
2853
+ /** `GET /api/v1/search/services` */
2854
+ services(query, options) {
2855
+ return this.http.requestJson({
2856
+ method: "GET",
2857
+ path: `${BASE10}/services`,
2858
+ query: { ...query ?? {} },
2859
+ signal: options?.signal
2860
+ });
2861
+ }
2862
+ };
2863
+
2864
+ // ../../src/resources/action-history/ActionHistoryFacade.ts
2865
+ var BASE11 = "/api/v1/actionhistory";
2866
+ var ActionHistoryFacade = class {
2867
+ constructor(http) {
2868
+ this.http = http;
2869
+ }
2870
+ http;
2871
+ /** `GET /api/v1/actionhistory` */
2872
+ list(query, options) {
2873
+ return this.http.requestJson({
2874
+ method: "GET",
2875
+ path: BASE11,
2876
+ query: { ...query ?? {} },
2877
+ signal: options?.signal
2878
+ });
2879
+ }
2880
+ };
2881
+
2882
+ // ../../src/resources/accounting-transactions/AccountingTransactionsFacade.ts
2883
+ var BASE12 = "/api/v1/accountingtransactions";
2884
+ var AccountingTransactionsFacade = class {
2885
+ constructor(http) {
2886
+ this.http = http;
2887
+ }
2888
+ http;
2889
+ /** `POST /api/v1/accountingtransactions` */
2890
+ create(body, options) {
2891
+ return this.http.requestJson({
2892
+ method: "POST",
2893
+ path: BASE12,
2894
+ query: { securityToken: options?.securityToken },
2895
+ body,
2896
+ signal: options?.signal
2897
+ });
2898
+ }
2899
+ /** `PUT /api/v1/accountingtransactions/{torrowId}` */
2900
+ update(body, torrowId, options) {
2901
+ return this.http.requestJson({
2902
+ method: "PUT",
2903
+ path: `${BASE12}/${encodePathSegment(torrowId)}`,
2904
+ query: {
2905
+ checkVersion: options?.checkVersion,
2906
+ isNeedAnnouncement: options?.isNeedAnnouncement,
2907
+ securityToken: options?.securityToken
2908
+ },
2909
+ body,
2910
+ signal: options?.signal
2911
+ });
2912
+ }
2913
+ /** `DELETE /api/v1/accountingtransactions/{torrowId}` */
2914
+ delete(torrowId, options) {
2915
+ return this.http.requestJson({
2916
+ method: "DELETE",
2917
+ path: `${BASE12}/${encodePathSegment(torrowId)}`,
2918
+ query: {
2919
+ versionToCheck: options?.versionToCheck,
2920
+ isNeedAnnouncement: options?.isNeedAnnouncement,
2921
+ securityToken: options?.securityToken
2922
+ },
2923
+ signal: options?.signal
2924
+ });
2925
+ }
2926
+ /**
2927
+ * `PUT /api/v1/accountingtransactions/{torrowId}/state` — смена **`AccountingTransactionState`**
2928
+ * (в query **`state`**).
2929
+ */
2930
+ updateState(torrowId, state, options) {
2931
+ return this.http.requestJson({
2932
+ method: "PUT",
2933
+ path: `${BASE12}/${encodePathSegment(torrowId)}/state`,
2934
+ query: {
2935
+ state,
2936
+ versionToCheck: options?.versionToCheck,
2937
+ isNeedAnnouncement: options?.isNeedAnnouncement,
2938
+ securityToken: options?.securityToken
2939
+ },
2940
+ signal: options?.signal
2941
+ });
2942
+ }
2943
+ /** `GET /api/v1/accountingtransactions/{torrowId}/balance` */
2944
+ getBalance(torrowId, options) {
2945
+ return this.http.requestJson({
2946
+ method: "GET",
2947
+ path: `${BASE12}/${encodePathSegment(torrowId)}/balance`,
2948
+ query: {
2949
+ balanceDate: options?.balanceDate,
2950
+ securityToken: options?.securityToken
2951
+ },
2952
+ signal: options?.signal
2953
+ });
2954
+ }
2955
+ /** `GET /api/v1/accountingtransactions/{torrowId}/transactions` */
2956
+ listTransactions(torrowId, query, options) {
2957
+ return this.http.requestJson({
2958
+ method: "GET",
2959
+ path: `${BASE12}/${encodePathSegment(torrowId)}/transactions`,
2960
+ query: { ...query ?? {} },
2961
+ signal: options?.signal
2962
+ });
2963
+ }
2964
+ };
2965
+
2966
+ // ../../src/resources/announcements/AnnouncementsFacade.ts
2967
+ var BASE13 = "/api/v1/announcements";
2968
+ var AnnouncementsFacade = class {
2969
+ constructor(http) {
2970
+ this.http = http;
2971
+ }
2972
+ http;
2973
+ /** `GET /api/v1/announcements` */
2974
+ list(query, options) {
2975
+ return this.http.requestJson({
2976
+ method: "GET",
2977
+ path: BASE13,
2978
+ query: { ...query ?? {} },
2979
+ signal: options?.signal
2980
+ });
2981
+ }
2982
+ /** `POST /api/v1/announcements/updatestate` */
2983
+ updateState(body, options) {
2984
+ return this.http.requestJson({
2985
+ method: "POST",
2986
+ path: `${BASE13}/updatestate`,
2987
+ body,
2988
+ signal: options?.signal
2989
+ });
2990
+ }
2991
+ };
2992
+
2993
+ // ../../src/resources/export-import/ExportImportFacade.ts
2994
+ var ExportImportFacade = class {
2995
+ constructor(http) {
2996
+ this.http = http;
2997
+ }
2998
+ http;
2999
+ /** `POST /api/v1/export` */
3000
+ exportSubgraph(body, options) {
3001
+ return this.http.requestJson({
3002
+ method: "POST",
3003
+ path: "/api/v1/export",
3004
+ body,
3005
+ signal: options?.signal
3006
+ });
3007
+ }
3008
+ /** `POST /api/v1/import` */
3009
+ importFromFile(body, options) {
3010
+ return this.http.requestJson({
3011
+ method: "POST",
3012
+ path: "/api/v1/import",
3013
+ body,
3014
+ signal: options?.signal
3015
+ });
3016
+ }
3017
+ /** `POST /api/v1/importbyuniquename` */
3018
+ importByUniqueName(body, options) {
3019
+ return this.http.requestJson({
3020
+ method: "POST",
3021
+ path: "/api/v1/importbyuniquename",
3022
+ body,
3023
+ signal: options?.signal
3024
+ });
3025
+ }
3026
+ };
3027
+
3028
+ // ../../src/resources/reports/ReportsFacade.ts
3029
+ var BASE14 = "/api/v1/reports";
3030
+ var ReportsFacade = class {
3031
+ constructor(http) {
3032
+ this.http = http;
3033
+ }
3034
+ http;
3035
+ /**
3036
+ * `POST /api/v1/reports` — опционально **`profileId`** в query (как в Swagger).
3037
+ */
3038
+ generate(body, options) {
3039
+ return this.http.requestJson({
3040
+ method: "POST",
3041
+ path: BASE14,
3042
+ query: { profileId: options?.profileId },
3043
+ body,
3044
+ signal: options?.signal
3045
+ });
3046
+ }
3047
+ /** `POST /api/v1/reports/{profileId}` */
3048
+ generateForProfile(profileId, body, options) {
3049
+ return this.http.requestJson({
3050
+ method: "POST",
3051
+ path: `${BASE14}/${encodePathSegment(profileId)}`,
3052
+ body,
3053
+ signal: options?.signal
3054
+ });
3055
+ }
3056
+ };
3057
+
3058
+ // ../../src/resources/loyalty-systems/LoyaltySystemsFacade.ts
3059
+ var BASE15 = "/api/v1/loyaltysystems";
3060
+ var LoyaltySystemsFacade = class extends TorrowItemCoreFacade {
3061
+ constructor(http) {
3062
+ super(http, BASE15);
3063
+ }
3064
+ /** `POST /api/v1/loyaltysystems` */
3065
+ create(body, options) {
3066
+ return this.http.requestJson({
3067
+ method: "POST",
3068
+ path: BASE15,
3069
+ query: { parentId: options?.parentId, profileId: options?.profileId },
3070
+ body,
3071
+ signal: options?.signal
3072
+ });
3073
+ }
3074
+ /** `PUT /api/v1/loyaltysystems/{torrowId}` */
3075
+ update(body, torrowId, options) {
3076
+ return this.http.requestJson({
3077
+ method: "PUT",
3078
+ path: `${BASE15}/${encodePathSegment(torrowId)}`,
3079
+ query: {
3080
+ checkVersion: options?.checkVersion,
3081
+ isNeedAnnouncement: options?.isNeedAnnouncement
3082
+ },
3083
+ body,
3084
+ signal: options?.signal
3085
+ });
3086
+ }
3087
+ /** `DELETE /api/v1/loyaltysystems/{torrowId}` */
3088
+ delete(torrowId, options) {
3089
+ return this.http.requestJson({
3090
+ method: "DELETE",
3091
+ path: `${BASE15}/${encodePathSegment(torrowId)}`,
3092
+ query: {
3093
+ cascade: options.cascade,
3094
+ withPinnedItems: options.withPinnedItems,
3095
+ versionToCheck: options.versionToCheck,
3096
+ isNeedAnnouncement: options.isNeedAnnouncement
3097
+ },
3098
+ signal: options.signal
3099
+ });
3100
+ }
3101
+ /** `GET /api/v1/loyaltysystems/{torrowId}` */
3102
+ getById(torrowId, options) {
3103
+ return this.http.requestJson({
3104
+ method: "GET",
3105
+ path: `${BASE15}/${encodePathSegment(torrowId)}`,
3106
+ query: {
3107
+ versionToCheck: options?.versionToCheck,
3108
+ includeDeleted: options?.includeDeleted,
3109
+ includeChildItems: options?.includeChildItems,
3110
+ securityToken: options?.securityToken
3111
+ },
3112
+ signal: options?.signal
3113
+ });
3114
+ }
3115
+ /** `GET /api/v1/loyaltysystems/personallist` */
3116
+ listPersonal(options) {
3117
+ const { signal, ...rest } = options ?? {};
3118
+ return this.http.requestJson({
3119
+ method: "GET",
3120
+ path: `${BASE15}/personallist`,
3121
+ query: { ...rest },
3122
+ signal
3123
+ });
3124
+ }
3125
+ /** `DELETE /api/v1/loyaltysystems/personallist/{torrowId}` */
3126
+ deleteFromPersonalList(torrowId, options) {
3127
+ return this.http.requestJson({
3128
+ method: "DELETE",
3129
+ path: `${BASE15}/personallist/${encodePathSegment(torrowId)}`,
3130
+ signal: options?.signal
3131
+ });
3132
+ }
3133
+ /** `POST /api/v1/loyaltysystems/{loyaltySystemId}/loyaltycard` — выпуск **`LoyaltyCardItem`** под программой. */
3134
+ createLoyaltyCard(loyaltySystemId, body, options) {
3135
+ return this.http.requestJson({
3136
+ method: "POST",
3137
+ path: `${BASE15}/${encodePathSegment(loyaltySystemId)}/loyaltycard`,
3138
+ body,
3139
+ signal: options?.signal
3140
+ });
3141
+ }
3142
+ /** `POST /api/v1/loyaltysystems/statistics` */
3143
+ postStatistics(body, options) {
3144
+ return this.http.requestJson({
3145
+ method: "POST",
3146
+ path: `${BASE15}/statistics`,
3147
+ query: { securityToken: options?.securityToken },
3148
+ body,
3149
+ signal: options?.signal
3150
+ });
3151
+ }
3152
+ /** `GET /api/v1/loyaltysystems/{torrowId}/participants/count` */
3153
+ getParticipantsCount(torrowId, query, options) {
3154
+ return this.http.requestJson({
3155
+ method: "GET",
3156
+ path: `${BASE15}/${encodePathSegment(torrowId)}/participants/count`,
3157
+ query: { ...query ?? {} },
3158
+ signal: options?.signal
3159
+ });
3160
+ }
3161
+ };
3162
+
3163
+ // ../../src/resources/loyalty-cards/LoyaltyCardsFacade.ts
3164
+ var BASE16 = "/api/v1/loyaltycards";
3165
+ var LOYALTY_CARD_SOCIAL_OPTS = { withGroupListEndpoint: false };
3166
+ var LoyaltyCardsFacade = class extends TorrowItemCoreFacade {
3167
+ constructor(http) {
3168
+ super(http, BASE16, LOYALTY_CARD_SOCIAL_OPTS);
3169
+ }
3170
+ /** `POST /api/v1/loyaltycards/{loyaltyCardId}/subscription` */
3171
+ createSubscription(loyaltyCardId, body, options) {
3172
+ return this.http.requestJson({
3173
+ method: "POST",
3174
+ path: `${BASE16}/${encodePathSegment(loyaltyCardId)}/subscription`,
3175
+ body,
3176
+ signal: options?.signal
3177
+ });
3178
+ }
3179
+ /** `GET /api/v1/loyaltycards/{torrowId}/participants/count` */
3180
+ getParticipantsCount(torrowId, query, options) {
3181
+ return this.http.requestJson({
3182
+ method: "GET",
3183
+ path: `${BASE16}/${encodePathSegment(torrowId)}/participants/count`,
3184
+ query: { ...query ?? {} },
3185
+ signal: options?.signal
3186
+ });
3187
+ }
3188
+ /** `GET /api/v1/loyaltycards/{torrowId}/balance` */
3189
+ getBalance(torrowId, options) {
3190
+ return this.http.requestJson({
3191
+ method: "GET",
3192
+ path: `${BASE16}/${encodePathSegment(torrowId)}/balance`,
3193
+ query: {
3194
+ balanceDate: options?.balanceDate,
3195
+ securityToken: options?.securityToken
3196
+ },
3197
+ signal: options?.signal
3198
+ });
3199
+ }
3200
+ /** `GET /api/v1/loyaltycards/{torrowId}/transactions` */
3201
+ listTransactions(torrowId, query, options) {
3202
+ return this.http.requestJson({
3203
+ method: "GET",
3204
+ path: `${BASE16}/${encodePathSegment(torrowId)}/transactions`,
3205
+ query: { ...query ?? {} },
3206
+ signal: options?.signal
3207
+ });
3208
+ }
3209
+ /** `GET /api/v1/loyaltycards/{torrowId}/subscriptions/{subscriptionId}/balance` */
3210
+ getSubscriptionBalance(torrowId, subscriptionId, options) {
3211
+ return this.http.requestJson({
3212
+ method: "GET",
3213
+ path: `${BASE16}/${encodePathSegment(torrowId)}/subscriptions/${encodePathSegment(subscriptionId)}/balance`,
3214
+ query: {
3215
+ balanceDate: options?.balanceDate,
3216
+ securityToken: options?.securityToken
3217
+ },
3218
+ signal: options?.signal
3219
+ });
3220
+ }
3221
+ /** `GET /api/v1/loyaltycards/{torrowId}/subscriptions/{subscriptionId}/transactions` */
3222
+ getSubscriptionTransactions(torrowId, subscriptionId, query, options) {
3223
+ return this.http.requestJson({
3224
+ method: "GET",
3225
+ path: `${BASE16}/${encodePathSegment(torrowId)}/subscriptions/${encodePathSegment(subscriptionId)}/transactions`,
3226
+ query: { ...query ?? {} },
3227
+ signal: options?.signal
3228
+ });
3229
+ }
3230
+ /** `PUT /api/v1/loyaltycards/{torrowId}` */
3231
+ update(body, torrowId, options) {
3232
+ return this.http.requestJson({
3233
+ method: "PUT",
3234
+ path: `${BASE16}/${encodePathSegment(torrowId)}`,
3235
+ query: {
3236
+ checkVersion: options?.checkVersion,
3237
+ isNeedAnnouncement: options?.isNeedAnnouncement
3238
+ },
3239
+ body,
3240
+ signal: options?.signal
3241
+ });
3242
+ }
3243
+ /** `DELETE /api/v1/loyaltycards/{torrowId}` */
3244
+ delete(torrowId, options) {
3245
+ return this.http.requestJson({
3246
+ method: "DELETE",
3247
+ path: `${BASE16}/${encodePathSegment(torrowId)}`,
3248
+ query: {
3249
+ cascade: options.cascade,
3250
+ withPinnedItems: options.withPinnedItems,
3251
+ versionToCheck: options.versionToCheck,
3252
+ isNeedAnnouncement: options.isNeedAnnouncement
3253
+ },
3254
+ signal: options.signal
3255
+ });
3256
+ }
3257
+ /** `GET /api/v1/loyaltycards/{torrowId}` */
3258
+ getById(torrowId, options) {
3259
+ return this.http.requestJson({
3260
+ method: "GET",
3261
+ path: `${BASE16}/${encodePathSegment(torrowId)}`,
3262
+ query: {
3263
+ versionToCheck: options?.versionToCheck,
3264
+ includeDeleted: options?.includeDeleted,
3265
+ includeChildItems: options?.includeChildItems,
3266
+ includeBalance: options?.includeBalance,
3267
+ securityToken: options?.securityToken
3268
+ },
3269
+ signal: options?.signal
3270
+ });
3271
+ }
3272
+ /** `GET /api/v1/loyaltycards/personallist` */
3273
+ listPersonal(options) {
3274
+ const { signal, ...rest } = options ?? {};
3275
+ return this.http.requestJson({
3276
+ method: "GET",
3277
+ path: `${BASE16}/personallist`,
3278
+ query: { ...rest },
3279
+ signal
3280
+ });
3281
+ }
3282
+ /** `DELETE /api/v1/loyaltycards/personallist/{torrowId}` */
3283
+ deleteFromPersonalList(torrowId, options) {
3284
+ return this.http.requestJson({
3285
+ method: "DELETE",
3286
+ path: `${BASE16}/personallist/${encodePathSegment(torrowId)}`,
3287
+ signal: options?.signal
3288
+ });
3289
+ }
3290
+ /** `POST /api/v1/loyaltycards/timetable/statistics` */
3291
+ getTimetableStatistics(body, options) {
3292
+ return this.http.requestJson({
3293
+ method: "POST",
3294
+ path: `${BASE16}/timetable/statistics`,
3295
+ body,
3296
+ signal: options?.signal
3297
+ });
3298
+ }
3299
+ /**
3300
+ * `PUT /api/v1/loyaltycards/{itemId}/notificationwaylist` — в OpenAPI есть у **loyaltycards**, но не у **loyaltysystems**,
3301
+ * поэтому метод не вынесен в общий {@link TorrowItemCoreFacade}.
3302
+ */
3303
+ updateNotificationWayList(itemId, ways, options) {
3304
+ return this.http.requestJson({
3305
+ method: "PUT",
3306
+ path: `${BASE16}/${encodePathSegment(itemId)}/notificationwaylist`,
3307
+ query: {
3308
+ versionToCheck: options?.versionToCheck,
3309
+ isNeedAnnouncement: options?.isNeedAnnouncement
3310
+ },
3311
+ body: ways,
3312
+ signal: options?.signal
3313
+ });
3314
+ }
3315
+ };
3316
+
3317
+ // ../../src/resources/user-settings/UserSettingsFacade.ts
3318
+ var BASE17 = "/api/v1/user/settings";
3319
+ var UserSettingsFacade = class {
3320
+ constructor(http) {
3321
+ this.http = http;
3322
+ }
3323
+ http;
3324
+ /** `GET /api/v1/user/settings` — текущее значение `UserSettingsInfo`. */
3325
+ get(options) {
3326
+ return this.http.requestJson({
3327
+ method: "GET",
3328
+ path: BASE17,
3329
+ signal: options?.signal
3330
+ });
3331
+ }
3332
+ /** `PUT /api/v1/user/settings/update` — сохранить настройки. */
3333
+ update(body, options) {
3334
+ return this.http.requestJson({
3335
+ method: "PUT",
3336
+ path: `${BASE17}/update`,
3337
+ body,
3338
+ signal: options?.signal
3339
+ });
3340
+ }
3341
+ };
3342
+
3343
+ // ../../src/resources/user/UserFacade.ts
3344
+ var BASE18 = "/api/v1/user";
3345
+ var UserFacade = class {
3346
+ constructor(http) {
3347
+ this.http = http;
3348
+ }
3349
+ http;
3350
+ /** `GET /api/v1/user/loyaltycard` */
3351
+ getLoyaltyCard(options) {
3352
+ return this.http.requestJson({ method: "GET", path: `${BASE18}/loyaltycard`, signal: options?.signal });
3353
+ }
3354
+ /** `GET /api/v1/user/accounts` */
3355
+ listAccounts(query, options) {
3356
+ return this.http.requestJson({
3357
+ method: "GET",
3358
+ path: `${BASE18}/accounts`,
3359
+ query: { ...query ?? {} },
3360
+ signal: options?.signal
3361
+ });
3362
+ }
3363
+ /** `POST /api/v1/user/accounts/add/init` */
3364
+ initAddAccount(body, options) {
3365
+ return this.http.requestJson({
3366
+ method: "POST",
3367
+ path: `${BASE18}/accounts/add/init`,
3368
+ body,
3369
+ signal: options?.signal
3370
+ });
3371
+ }
3372
+ /** `POST /api/v1/user/accounts/add/complete` */
3373
+ completeAddAccount(body, options) {
3374
+ return this.http.requestJson({
3375
+ method: "POST",
3376
+ path: `${BASE18}/accounts/add/complete`,
3377
+ body,
3378
+ signal: options?.signal
3379
+ });
3380
+ }
3381
+ /** `DELETE /api/v1/user/accounts/delete` */
3382
+ deleteAccount(body, options) {
3383
+ return this.http.requestJson({
3384
+ method: "DELETE",
3385
+ path: `${BASE18}/accounts/delete`,
3386
+ body,
3387
+ signal: options?.signal
3388
+ });
3389
+ }
3390
+ /** `GET /api/v1/user/devices` */
3391
+ listDevices(query, options) {
3392
+ return this.http.requestJson({
3393
+ method: "GET",
3394
+ path: `${BASE18}/devices`,
3395
+ query: { ...query ?? {} },
3396
+ signal: options?.signal
3397
+ });
3398
+ }
3399
+ /** `DELETE /api/v1/user/devices/{deviceId}` */
3400
+ deleteDevice(deviceId, options) {
3401
+ return this.http.requestJson({
3402
+ method: "DELETE",
3403
+ path: `${BASE18}/devices/${encodePathSegment(deviceId)}`,
3404
+ signal: options?.signal
3405
+ });
3406
+ }
3407
+ /** `GET /api/v1/user/devices/{deviceId}/settings` */
3408
+ getDeviceSettings(deviceId, options) {
3409
+ return this.http.requestJson({
3410
+ method: "GET",
3411
+ path: `${BASE18}/devices/${encodePathSegment(deviceId)}/settings`,
3412
+ signal: options?.signal
3413
+ });
3414
+ }
3415
+ /** `PUT /api/v1/user/devices/{deviceId}/settings` */
3416
+ updateDeviceSettings(deviceId, settings, options) {
3417
+ return this.http.requestJson({
3418
+ method: "PUT",
3419
+ path: `${BASE18}/devices/${encodePathSegment(deviceId)}/settings`,
3420
+ query: { settings },
3421
+ signal: options?.signal
3422
+ });
3423
+ }
3424
+ /** `GET /api/v1/user/defaultprofile` */
3425
+ getDefaultProfile(options) {
3426
+ return this.http.requestJson({ method: "GET", path: `${BASE18}/defaultprofile`, signal: options?.signal });
3427
+ }
3428
+ /** `PUT /api/v1/user/defaultprofile` */
3429
+ setDefaultProfileByContactId(contactId, options) {
3430
+ return this.http.requestJson({
3431
+ method: "PUT",
3432
+ path: `${BASE18}/defaultprofile`,
3433
+ body: contactId,
3434
+ signal: options?.signal
3435
+ });
3436
+ }
3437
+ /** `POST /api/v1/user/defaultprofile` */
3438
+ createDefaultProfile(body, options) {
3439
+ return this.http.requestJson({
3440
+ method: "POST",
3441
+ path: `${BASE18}/defaultprofile`,
3442
+ body,
3443
+ signal: options?.signal
3444
+ });
3445
+ }
3446
+ /** `GET /api/v1/user/deliveryways` */
3447
+ listDeliveryWays(query, options) {
3448
+ return this.http.requestJson({
3449
+ method: "GET",
3450
+ path: `${BASE18}/deliveryways`,
3451
+ query: { ...query ?? {} },
3452
+ signal: options?.signal
3453
+ });
3454
+ }
3455
+ /** `GET /api/v1/user/defaultnotificationways` */
3456
+ listDefaultNotificationWays(options) {
3457
+ return this.http.requestJson({
3458
+ method: "GET",
3459
+ path: `${BASE18}/defaultnotificationways`,
3460
+ signal: options?.signal
3461
+ });
3462
+ }
3463
+ /** `PUT /api/v1/user/defaultnotificationways` */
3464
+ updateDefaultNotificationWays(body, options) {
3465
+ return this.http.requestJson({
3466
+ method: "PUT",
3467
+ path: `${BASE18}/defaultnotificationways`,
3468
+ query: {
3469
+ versionToCheck: options?.versionToCheck,
3470
+ isNeedAnnouncement: options?.isNeedAnnouncement
3471
+ },
3472
+ body,
3473
+ signal: options?.signal
3474
+ });
3475
+ }
3476
+ /** `PUT /api/v1/user/place` */
3477
+ updatePlace(query, options) {
3478
+ return this.http.requestJson({
3479
+ method: "PUT",
3480
+ path: `${BASE18}/place`,
3481
+ query,
3482
+ signal: options?.signal
3483
+ });
3484
+ }
3485
+ /** `POST /api/v1/user/register` */
3486
+ register(body, options) {
3487
+ return this.http.requestJson({
3488
+ method: "POST",
3489
+ path: `${BASE18}/register`,
3490
+ body,
3491
+ signal: options?.signal
3492
+ });
3493
+ }
3494
+ /** `PUT /api/v1/user/timetable` */
3495
+ getTimetable(body, query, options) {
3496
+ return this.http.requestJson({
3497
+ method: "PUT",
3498
+ path: `${BASE18}/timetable`,
3499
+ query: { ...query ?? {} },
3500
+ body,
3501
+ signal: options?.signal
3502
+ });
3503
+ }
3504
+ /** `GET /api/v1/user/calendars` */
3505
+ listCalendars(options) {
3506
+ return this.http.requestJson({
3507
+ method: "GET",
3508
+ path: `${BASE18}/calendars`,
3509
+ signal: options?.signal
3510
+ });
3511
+ }
3512
+ /** `PUT /api/v1/user/calendars/update` */
3513
+ updateCalendars(body, options) {
3514
+ return this.http.requestJson({
3515
+ method: "PUT",
3516
+ path: `${BASE18}/calendars/update`,
3517
+ body,
3518
+ signal: options?.signal
3519
+ });
3520
+ }
3521
+ /** `DELETE /api/v1/user/delete/init` */
3522
+ initDelete(options) {
3523
+ return this.http.requestJson({
3524
+ method: "DELETE",
3525
+ path: `${BASE18}/delete/init`,
3526
+ signal: options?.signal
3527
+ });
3528
+ }
3529
+ /** `DELETE /api/v1/user/delete/complete` */
3530
+ completeDelete(body, options) {
3531
+ return this.http.requestJson({
3532
+ method: "DELETE",
3533
+ path: `${BASE18}/delete/complete`,
3534
+ body,
3535
+ signal: options?.signal
3536
+ });
3537
+ }
3538
+ /** `GET /api/v1/user/count` */
3539
+ count(options) {
3540
+ return this.http.requestJson({ method: "GET", path: `${BASE18}/count`, signal: options?.signal });
3541
+ }
3542
+ };
3543
+
3544
+ // ../../src/resources/block-reason/BlockReasonsFacade.ts
3545
+ var BASE19 = "/api/v1/blockreason";
3546
+ var BlockReasonsFacade = class {
3547
+ constructor(http) {
3548
+ this.http = http;
3549
+ }
3550
+ http;
3551
+ /** `POST /api/v1/blockreason` — создать; ответ: числовой id. */
3552
+ create(body, options) {
3553
+ return this.http.requestJson({
3554
+ method: "POST",
3555
+ path: BASE19,
3556
+ body,
3557
+ signal: options?.signal
3558
+ });
3559
+ }
3560
+ /** `GET /api/v1/blockreason/{id}` */
3561
+ getById(id, options) {
3562
+ return this.http.requestJson({
3563
+ method: "GET",
3564
+ path: `${BASE19}/${encodePathSegment(String(id))}`,
3565
+ query: { lng: options?.lng },
3566
+ signal: options?.signal
3567
+ });
3568
+ }
3569
+ /** `GET /api/v1/blockreason/all` */
3570
+ listAll(query, options) {
3571
+ const { signal } = options ?? {};
3572
+ return this.http.requestJson({
3573
+ method: "GET",
3574
+ path: `${BASE19}/all`,
3575
+ query: { ...query ?? {} },
3576
+ signal
3577
+ });
3578
+ }
3579
+ /** `DELETE /api/v1/blockreason/{id}` — ответ: число (код/количество по контракту API). */
3580
+ delete(id, options) {
3581
+ return this.http.requestJson({
3582
+ method: "DELETE",
3583
+ path: `${BASE19}/${encodePathSegment(String(id))}`,
3584
+ signal: options?.signal
3585
+ });
3586
+ }
3587
+ };
3588
+
3589
+ // ../../src/resources/external-auths/ExternalAuthsFacade.ts
3590
+ var BASE20 = "/api/v1/externalauths";
3591
+ var ExternalAuthsFacade = class {
3592
+ constructor(http) {
3593
+ this.http = http;
3594
+ }
3595
+ http;
3596
+ /** `POST /api/v1/externalauths` */
3597
+ add(body, options) {
3598
+ return this.http.requestJson({
3599
+ method: "POST",
3600
+ path: BASE20,
3601
+ body,
3602
+ signal: options?.signal
3603
+ });
3604
+ }
3605
+ /** `GET /api/v1/externalauths/{torrowId}` */
3606
+ getById(torrowId, options) {
3607
+ return this.http.requestJson({
3608
+ method: "GET",
3609
+ path: `${BASE20}/${encodePathSegment(torrowId)}`,
3610
+ query: { includeDeleted: options?.includeDeleted },
3611
+ signal: options?.signal
3612
+ });
3613
+ }
3614
+ /** `GET /api/v1/externalauths/all` */
3615
+ listAll(options) {
3616
+ const { signal, ...rest } = options ?? {};
3617
+ return this.http.requestJson({
3618
+ method: "GET",
3619
+ path: `${BASE20}/all`,
3620
+ query: { ...rest },
3621
+ signal
3622
+ });
3623
+ }
3624
+ /** `DELETE /api/v1/externalauths/{externalAuthId}` */
3625
+ delete(externalAuthId, options) {
3626
+ return this.http.requestJson({
3627
+ method: "DELETE",
3628
+ path: `${BASE20}/${encodePathSegment(externalAuthId)}`,
3629
+ query: {
3630
+ versionToCheck: options?.versionToCheck,
3631
+ isNeedAnnouncement: options?.isNeedAnnouncement
3632
+ },
3633
+ signal: options?.signal
3634
+ });
3635
+ }
3636
+ };
3637
+
3638
+ // ../../src/resources/id-generator/IdGeneratorFacade.ts
3639
+ var BASE21 = "/api/v1/idgenerator";
3640
+ var IdGeneratorFacade = class {
3641
+ constructor(http) {
3642
+ this.http = http;
3643
+ }
3644
+ http;
3645
+ getNextId(objectType, options) {
3646
+ return this.http.requestJson({
3647
+ method: "GET",
3648
+ path: `${BASE21}/${encodePathSegment(String(objectType))}`,
3649
+ signal: options?.signal
3650
+ });
3651
+ }
3652
+ };
3653
+
3654
+ // ../../src/resources/integrations/IntegrationsFacade.ts
3655
+ var BASE22 = "/api/v1/integrations";
3656
+ var IntegrationsFacade = class {
3657
+ constructor(http) {
3658
+ this.http = http;
3659
+ }
3660
+ http;
3661
+ /** `POST /api/v1/integrations` */
3662
+ create(body, options) {
3663
+ return this.http.requestJson({
3664
+ method: "POST",
3665
+ path: BASE22,
3666
+ body,
3667
+ signal: options?.signal
3668
+ });
3669
+ }
3670
+ /** `PUT /api/v1/integrations/{torrowId}` */
3671
+ update(body, torrowId, options) {
3672
+ return this.http.requestJson({
3673
+ method: "PUT",
3674
+ path: `${BASE22}/${encodePathSegment(torrowId)}`,
3675
+ query: { checkVersion: options?.checkVersion },
3676
+ body,
3677
+ signal: options?.signal
3678
+ });
3679
+ }
3680
+ /** `GET /api/v1/integrations/list` */
3681
+ list(options) {
3682
+ return this.http.requestJson({
3683
+ method: "GET",
3684
+ path: `${BASE22}/list`,
3685
+ query: {
3686
+ integrationIds: options?.integrationIds,
3687
+ includeDeleted: options?.includeDeleted
3688
+ },
3689
+ signal: options?.signal
3690
+ });
3691
+ }
3692
+ /** `DELETE /api/v1/integrations/{integrationId}` */
3693
+ delete(integrationId, options) {
3694
+ return this.http.requestJson({
3695
+ method: "DELETE",
3696
+ path: `${BASE22}/${encodePathSegment(integrationId)}`,
3697
+ query: {
3698
+ versionToCheck: options?.versionToCheck,
3699
+ isNeedAnnouncement: options?.isNeedAnnouncement
3700
+ },
3701
+ signal: options?.signal
3702
+ });
3703
+ }
3704
+ };
3705
+
3706
+ // ../../src/resources/item/ItemFacade.ts
3707
+ var BASE23 = "/api/v1/item";
3708
+ var ItemFacade = class {
3709
+ constructor(http) {
3710
+ this.http = http;
3711
+ }
3712
+ http;
3713
+ /** `PUT /api/v1/item/activateshareitemsession/{shareItemSessionId}` */
3714
+ activateShareItemSession(shareItemSessionId, options) {
3715
+ return this.http.requestJson({
3716
+ method: "PUT",
3717
+ path: `${BASE23}/activateshareitemsession/${encodePathSegment(shareItemSessionId)}`,
3718
+ query: { userProfileId: options?.userProfileId, code: options?.code },
3719
+ signal: options?.signal
3720
+ });
3721
+ }
3722
+ /** `GET /api/v1/item/uniquename/{uniqueName}` — ответ: строка (часто id / url по контракту). */
3723
+ getByUniqueName(uniqueName, options) {
3724
+ return this.http.requestJson({
3725
+ method: "GET",
3726
+ path: `${BASE23}/uniquename/${encodePathSegment(uniqueName)}`,
3727
+ signal: options?.signal
3728
+ });
3729
+ }
3730
+ /** `GET /api/v1/item/{torrowId}/userfeedback` */
3731
+ getUserFeedback(torrowId, options) {
3732
+ return this.http.requestJson({
3733
+ method: "GET",
3734
+ path: `${BASE23}/${encodePathSegment(torrowId)}/userfeedback`,
3735
+ query: {
3736
+ throwExceptionIfNotFound: options?.throwExceptionIfNotFound,
3737
+ versionToCheck: options?.versionToCheck,
3738
+ includeDeleted: options?.includeDeleted
3739
+ },
3740
+ signal: options?.signal
3741
+ });
3742
+ }
3743
+ /** `PUT /api/v1/item/{torrowId}/userfeedback` */
3744
+ putUserFeedback(torrowId, options) {
3745
+ const { signal, ...query } = options ?? {};
3746
+ return this.http.requestJson({
3747
+ method: "PUT",
3748
+ path: `${BASE23}/${encodePathSegment(torrowId)}/userfeedback`,
3749
+ query: { ...query },
3750
+ signal
3751
+ });
3752
+ }
3753
+ /** `DELETE /api/v1/item/{torrowId}/userfeedback` */
3754
+ deleteUserFeedback(torrowId, options) {
3755
+ const { signal, ...query } = options ?? {};
3756
+ return this.http.requestJson({
3757
+ method: "DELETE",
3758
+ path: `${BASE23}/${encodePathSegment(torrowId)}/userfeedback`,
3759
+ query: { ...query },
3760
+ signal
3761
+ });
3762
+ }
3763
+ /** `GET /api/v1/item/{torrowId}/feedbacks` */
3764
+ listFeedbacks(torrowId, options) {
3765
+ const { signal, ...query } = options ?? {};
3766
+ return this.http.requestJson({
3767
+ method: "GET",
3768
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks`,
3769
+ query: { ...query },
3770
+ signal
3771
+ });
3772
+ }
3773
+ /** `POST /api/v1/item/{torrowId}/feedbacks/newmessage` */
3774
+ postFeedbackNewMessage(torrowId, options) {
3775
+ const { signal, ...query } = options ?? {};
3776
+ return this.http.requestJson({
3777
+ method: "POST",
3778
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/newmessage`,
3779
+ query: { ...query },
3780
+ signal
3781
+ });
3782
+ }
3783
+ /** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}` */
3784
+ getFeedback(torrowId, messageId, options) {
3785
+ return this.http.requestJson({
3786
+ method: "GET",
3787
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
3788
+ query: {
3789
+ versionToCheck: options?.versionToCheck,
3790
+ includeDeleted: options?.includeDeleted
3791
+ },
3792
+ signal: options?.signal
3793
+ });
3794
+ }
3795
+ /** `PUT /api/v1/item/{torrowId}/feedbacks/{messageId}` */
3796
+ updateFeedback(torrowId, messageId, options) {
3797
+ const { signal, ...query } = options ?? {};
3798
+ return this.http.requestJson({
3799
+ method: "PUT",
3800
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
3801
+ query: { ...query },
3802
+ signal
3803
+ });
3804
+ }
3805
+ /** `DELETE /api/v1/item/{torrowId}/feedbacks/{messageId}` */
3806
+ deleteFeedback(torrowId, messageId, options) {
3807
+ return this.http.requestJson({
3808
+ method: "DELETE",
3809
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}`,
3810
+ query: {
3811
+ versionToCheck: options?.versionToCheck,
3812
+ isNeedAnnouncement: options?.isNeedAnnouncement
3813
+ },
3814
+ signal: options?.signal
3815
+ });
3816
+ }
3817
+ /** `POST /api/v1/item/{torrowId}/feedbacks/{messageId}/reply` */
3818
+ replyToFeedback(torrowId, messageId, options) {
3819
+ const { signal, ...query } = options ?? {};
3820
+ return this.http.requestJson({
3821
+ method: "POST",
3822
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/reply`,
3823
+ query: { ...query },
3824
+ signal
3825
+ });
3826
+ }
3827
+ /** `GET /api/v1/item/{torrowId}/feedbacks/{messageId}/replies` */
3828
+ listFeedbackReplies(torrowId, messageId, options) {
3829
+ const { signal, ...query } = options ?? {};
3830
+ return this.http.requestJson({
3831
+ method: "GET",
3832
+ path: `${BASE23}/${encodePathSegment(torrowId)}/feedbacks/${encodePathSegment(messageId)}/replies`,
3833
+ query: { ...query },
3834
+ signal
3835
+ });
3836
+ }
3837
+ };
3838
+
3839
+ // ../../src/resources/short-url/ShortUrlFacade.ts
3840
+ var BASE24 = "/api/v1/u";
3841
+ var ShortUrlFacade = class {
3842
+ constructor(http, config) {
3843
+ this.http = http;
3844
+ this.config = config;
3845
+ }
3846
+ http;
3847
+ config;
3848
+ /** `GET /api/v1/u/{shortUrl}/full` */
3849
+ getFull(shortUrl, options) {
3850
+ return this.http.requestJson({
3851
+ method: "GET",
3852
+ path: `${BASE24}/${encodePathSegment(shortUrl)}/full`,
3853
+ signal: options?.signal
3854
+ });
3855
+ }
3856
+ /**
3857
+ * `GET /api/v1/u/{shortUrl}` — обычно **302 Redirect**.
3858
+ * Возвращает заголовок `Location` без следования редиректу.
3859
+ */
3860
+ async getRedirectLocation(shortUrl, options) {
3861
+ const fetchFn = this.config.fetch ?? globalThis.fetch;
3862
+ const origin = this.config.baseUrl ?? DEFAULT_TORROW_API_BASE_URL;
3863
+ const url = joinBaseUrlAndPath(origin, `${BASE24}/${encodePathSegment(shortUrl)}`);
3864
+ const authHeaders = await buildAuthHeaders(this.config);
3865
+ const res = await fetchFn(url, {
3866
+ method: "GET",
3867
+ redirect: "manual",
3868
+ headers: {
3869
+ Accept: "*/*",
3870
+ ...authHeaders,
3871
+ ...this.config.defaultHeaders
3872
+ },
3873
+ signal: options?.signal
3874
+ });
3875
+ return res.headers.get("Location");
3876
+ }
3877
+ };
3878
+
3879
+ // ../../src/resources/thesaurus/ThesaurusFacade.ts
3880
+ var BASE25 = "/api/v1/thesaurus";
3881
+ var ThesaurusFacade = class {
3882
+ constructor(http) {
3883
+ this.http = http;
3884
+ }
3885
+ http;
3886
+ /** `GET /api/v1/thesaurus/places` */
3887
+ listPlaces(options) {
3888
+ const { signal, ...query } = options ?? {};
3889
+ return this.http.requestJson({
3890
+ method: "GET",
3891
+ path: `${BASE25}/places`,
3892
+ query: { ...query },
3893
+ signal
3894
+ });
3895
+ }
3896
+ /** `GET /api/v1/thesaurus/hobbies` */
3897
+ listHobbies(options) {
3898
+ const { signal, ...query } = options ?? {};
3899
+ return this.http.requestJson({
3900
+ method: "GET",
3901
+ path: `${BASE25}/hobbies`,
3902
+ query: { ...query },
3903
+ signal
3904
+ });
3905
+ }
3906
+ };
3907
+
3908
+ // ../../src/TorrowClient.ts
3909
+ var TorrowClient = class {
3910
+ config;
3911
+ http;
3912
+ raw;
3913
+ contacts;
3914
+ notes;
3915
+ contexts;
3916
+ /** API domain `Resource` (`/api/v1/resources`), не каталог `src/resources/`. */
3917
+ resourceItems;
3918
+ services;
3919
+ cases;
3920
+ calendars;
3921
+ /** Поиск по API (тег OpenAPI **Search**): advised items, текстовый поиск по типам, заказы под родителем. */
3922
+ search;
3923
+ /** История действий (`/api/v1/actionhistory`). */
3924
+ actionHistory;
3925
+ /** Учётные транзакции (`/api/v1/accountingtransactions`). */
3926
+ accountingTransactions;
3927
+ /** Объявления (`/api/v1/announcements`). */
3928
+ announcements;
3929
+ /** Экспорт/импорт графа (`/api/v1/export`, `import`, `importbyuniquename`). */
3930
+ exportImport;
3931
+ /** Генерация отчётов (`/api/v1/reports`). */
3932
+ reports;
3933
+ /** Программы лояльности (`/api/v1/loyaltysystems`). */
3934
+ loyaltySystems;
3935
+ /** Карты лояльности (`/api/v1/loyaltycards`); создание карты — **`loyaltySystems.createLoyaltyCard`**. */
3936
+ loyaltyCards;
3937
+ /** Настройки пользователя (`/api/v1/user/settings`). */
3938
+ userSettings;
3939
+ /** User endpoints (`/api/v1/user/*`): accounts/devices/default profile/delivery/register/calendars/timetable. */
3940
+ user;
3941
+ /** Include/exclude в иерархии и группах, mind map (`includeToParent`, `saveToMindMap`, …). */
3942
+ relations;
3943
+ /** Пользовательские и закреплённые представления под родителем (`views/user`, `views/pinned`). */
3944
+ views;
3945
+ /** Профили пользователя Torrow (`/api/v1/user/profiles`), не CRUD `/api/v1/contacts`. */
3946
+ profiles;
3947
+ /** AuthIdentity: `refresh`, `requestToken`, `revoke`, `sendCode`, `createSession` — без Bearer основного клиента. */
3948
+ auth;
3949
+ /** Справочник причин блокировки (`/api/v1/blockreason`). */
3950
+ blockReasons;
3951
+ /** Внешняя авторизация (`/api/v1/externalauths`). */
3952
+ externalAuths;
3953
+ /** Интеграции (`/api/v1/integrations`). */
3954
+ integrations;
3955
+ /** Генерация id (`/api/v1/idgenerator`). */
3956
+ idGenerator;
3957
+ /** Отзывы и шаринг-сессии (`/api/v1/item/...`). */
3958
+ item;
3959
+ /** Тезаурус мест/хобби (`/api/v1/thesaurus`). */
3960
+ thesaurus;
3961
+ /** Короткие ссылки (`/api/v1/u`). */
3962
+ shortUrl;
3963
+ constructor(config) {
3964
+ this.config = {
3965
+ ...config,
3966
+ baseUrl: config.baseUrl ?? DEFAULT_TORROW_API_BASE_URL
3967
+ };
3968
+ this.http = new HttpClient(this.config);
3969
+ this.raw = new RawClient(this.http);
3970
+ this.contacts = new ContactsFacade(this.http);
3971
+ this.notes = new NotesFacade(this.http);
3972
+ this.contexts = new ContextsFacade(this.http);
3973
+ this.resourceItems = new ResourcesFacade(this.http);
3974
+ this.services = new ServicesFacade(this.http);
3975
+ this.cases = new CasesFacade(this.http);
3976
+ this.calendars = new CalendarsFacade(this.http);
3977
+ this.search = new SearchFacade(this.http);
3978
+ this.actionHistory = new ActionHistoryFacade(this.http);
3979
+ this.accountingTransactions = new AccountingTransactionsFacade(this.http);
3980
+ this.announcements = new AnnouncementsFacade(this.http);
3981
+ this.exportImport = new ExportImportFacade(this.http);
3982
+ this.reports = new ReportsFacade(this.http);
3983
+ this.loyaltySystems = new LoyaltySystemsFacade(this.http);
3984
+ this.loyaltyCards = new LoyaltyCardsFacade(this.http);
3985
+ this.userSettings = new UserSettingsFacade(this.http);
3986
+ this.user = new UserFacade(this.http);
3987
+ this.relations = new RelationsFacade(this.http);
3988
+ this.views = new ViewsFacade(this.http);
3989
+ this.profiles = new ProfilesFacade(this.http);
3990
+ this.auth = new AuthFacade(this.config);
3991
+ this.blockReasons = new BlockReasonsFacade(this.http);
3992
+ this.externalAuths = new ExternalAuthsFacade(this.http);
3993
+ this.integrations = new IntegrationsFacade(this.http);
3994
+ this.idGenerator = new IdGeneratorFacade(this.http);
3995
+ this.item = new ItemFacade(this.http);
3996
+ this.thesaurus = new ThesaurusFacade(this.http);
3997
+ this.shortUrl = new ShortUrlFacade(this.http, this.config);
3998
+ }
3999
+ };
4000
+
4001
+ // ../../src/resources/services/booking-wizard-hints.ts
4002
+ var ServiceCheckInWizardStepType = {
4003
+ Unknown: 0,
4004
+ Time: 1,
4005
+ Resource: 2,
4006
+ Payment: 3
4007
+ };
4008
+ var ServiceCheckInWizardStepParameterName = {
4009
+ HiddenStep: "HiddenStep",
4010
+ HideResourceDetail: "HideResourceDetail",
4011
+ ResourceGroupId: "ResourceGroupId",
4012
+ AutoChoiceResource: "AutoChoiceResource"
4013
+ };
4014
+ function sortStepDescriptionsByOrder(list) {
4015
+ if (!list?.length) {
4016
+ return [];
4017
+ }
4018
+ return [...list].sort((a, b) => (a.stepOrder ?? 0) - (b.stepOrder ?? 0));
4019
+ }
4020
+ function getStepParameter(step, parameterName) {
4021
+ const p = step.stepParameterList?.find((x) => x.parameterName === parameterName);
4022
+ return p?.parameterValue ?? void 0;
4023
+ }
4024
+ function getResourceGroupIdFromStep(step) {
4025
+ return getStepParameter(step, ServiceCheckInWizardStepParameterName.ResourceGroupId);
4026
+ }
4027
+ function isStepFlag(step, parameterName) {
4028
+ return getStepParameter(step, parameterName) === "true";
4029
+ }
4030
+ function getTimeStepUiMode(session) {
4031
+ const sessionDurationType = session?.sessionDurationType;
4032
+ const sessionPrecisionType = session?.sessionPrecisionType;
4033
+ const isSelectDate = sessionPrecisionType === "Date" && sessionDurationType !== "SessionDurationNone" && sessionDurationType !== "Custom";
4034
+ const isSelectDateRange = sessionPrecisionType === "Date" && sessionDurationType === "Custom";
4035
+ const isSelectDateAndTimeBegin = sessionPrecisionType === "DateTime" && sessionDurationType !== "SessionDurationNone" && sessionDurationType !== "Custom";
4036
+ const isSelectDateRangeAndTimeBeginAndTimeEnd = sessionPrecisionType === "DateTime" && sessionDurationType === "Custom";
4037
+ if (isSelectDate) {
4038
+ return "selectDate";
4039
+ }
4040
+ if (isSelectDateRange) {
4041
+ return "selectDateRange";
4042
+ }
4043
+ if (isSelectDateAndTimeBegin || isSelectDateRangeAndTimeBeginAndTimeEnd) {
4044
+ return "selectTimeBegin";
4045
+ }
4046
+ return "selectTime";
4047
+ }
4048
+
4049
+ // ../../src/resources/services/booking-wizard-expand.ts
4050
+ function isExistsStrict(n) {
4051
+ return n !== void 0 && n !== null;
4052
+ }
4053
+ function shouldSkipResourceStep(min, max) {
4054
+ const maxIsNull = max === 0;
4055
+ const maxIsOne = max === 1;
4056
+ const minMoreThenOne = isExistsStrict(min) && min > 1;
4057
+ const minIsNegative = isExistsStrict(min) && min < 0;
4058
+ const maxIsNegative = isExistsStrict(max) && max < 0;
4059
+ return maxIsNull || maxIsOne && minMoreThenOne || minIsNegative || maxIsNegative;
4060
+ }
4061
+ function expandBookingWizardSteps(service) {
4062
+ const ordered = sortStepDescriptionsByOrder(service.stepDescriptionList);
4063
+ const out = [];
4064
+ let seq = 0;
4065
+ for (const step of ordered) {
4066
+ const st = step.stepType ?? ServiceCheckInWizardStepType.Unknown;
4067
+ if (st === ServiceCheckInWizardStepType.Time) {
4068
+ const wizardStepType = getTimeStepUiMode(service.sessionDurationProperties);
4069
+ out.push({
4070
+ kind: "time",
4071
+ sequence: ++seq,
4072
+ stepOrder: step.stepOrder ?? seq,
4073
+ wizardStepType
4074
+ });
4075
+ continue;
4076
+ }
4077
+ if (st === ServiceCheckInWizardStepType.Resource) {
4078
+ const resourceGroupId = getResourceGroupIdFromStep(step);
4079
+ if (!resourceGroupId) continue;
4080
+ const rg = service.resourceGroupList?.find((g) => g.groupId === resourceGroupId);
4081
+ if (!rg) continue;
4082
+ if (shouldSkipResourceStep(rg.minResources ?? void 0, rg.maxResources ?? void 0)) continue;
4083
+ out.push({
4084
+ kind: "resource",
4085
+ sequence: ++seq,
4086
+ stepOrder: step.stepOrder ?? seq,
4087
+ resourceGroupId,
4088
+ resourceGroupName: rg.groupName,
4089
+ isStepHidden: isStepFlag(step, ServiceCheckInWizardStepParameterName.HiddenStep),
4090
+ isResourceDetailHidden: isStepFlag(step, ServiceCheckInWizardStepParameterName.HideResourceDetail),
4091
+ autoChoiceResource: isStepFlag(step, ServiceCheckInWizardStepParameterName.AutoChoiceResource)
4092
+ });
4093
+ continue;
4094
+ }
4095
+ if (st === ServiceCheckInWizardStepType.Payment) {
4096
+ out.push({ kind: "payment", sequence: ++seq, stepOrder: step.stepOrder ?? seq });
4097
+ }
4098
+ }
4099
+ return out;
4100
+ }
4101
+
4102
+ // ../../src/resources/cases/payment-hints.ts
4103
+ function normalizePaymentUrl(url) {
4104
+ if (url == null || url.trim() === "") return void 0;
4105
+ const u = url.trim();
4106
+ if (u.startsWith("http://") || u.startsWith("https://")) return u;
4107
+ return `https://${u}`;
4108
+ }
4109
+ function getTicketPaymentUrlRaw(caseItem) {
4110
+ const raw = caseItem?.personalInfo?.ticketResource?.ticketProperties?.paymentUrl;
4111
+ return raw == null || raw === "" ? void 0 : raw;
4112
+ }
4113
+ function getTicketPaymentUrl(caseItem) {
4114
+ return normalizePaymentUrl(getTicketPaymentUrlRaw(caseItem));
4115
+ }
4116
+ export {
4117
+ AccountingTransactionsFacade,
4118
+ ActionHistoryFacade,
4119
+ AnnouncementsFacade,
4120
+ AuthFacade,
4121
+ BlockReasonsFacade,
4122
+ CalendarsFacade,
4123
+ CasesFacade,
4124
+ ContactsFacade,
4125
+ ContextsFacade,
4126
+ DEFAULT_TORROW_API_BASE_URL,
4127
+ ExportImportFacade,
4128
+ ExternalAuthsFacade,
4129
+ HttpClient,
4130
+ IdGeneratorFacade,
4131
+ IntegrationsFacade,
4132
+ ItemFacade,
4133
+ LoyaltyCardsFacade,
4134
+ LoyaltySystemsFacade,
4135
+ NotesFacade,
4136
+ ProfilesFacade,
4137
+ RawClient,
4138
+ RelationsFacade,
4139
+ ReportsFacade,
4140
+ ResourcesFacade,
4141
+ SearchFacade,
4142
+ ServiceCheckInWizardStepParameterName,
4143
+ ServiceCheckInWizardStepType,
4144
+ ServicesFacade,
4145
+ ShortUrlFacade,
4146
+ ThesaurusFacade,
4147
+ TorrowClient,
4148
+ TorrowHttpError,
4149
+ UserFacade,
4150
+ UserSettingsFacade,
4151
+ ViewsFacade,
4152
+ expandBookingWizardSteps,
4153
+ getResourceGroupIdFromStep,
4154
+ getStepParameter,
4155
+ getTicketPaymentUrl,
4156
+ getTicketPaymentUrlRaw,
4157
+ getTimeStepUiMode,
4158
+ isStepFlag,
4159
+ normalizePaymentUrl,
4160
+ shouldSkipResourceStep,
4161
+ sortStepDescriptionsByOrder
4162
+ };
4163
+ //# sourceMappingURL=index.js.map