@torrow/sdk-client 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +508 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,10 @@ const href = communicationHref(comm);
|
|
|
28
28
|
const brand = resolveCommunicationBrand(comm);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## Notes and response dates
|
|
32
|
+
|
|
33
|
+
Notes accept `publicityType: "Link"` on creation (default: `Personal`) and `meta: { version }` on update for optimistic concurrency. The MCP note CRUD, note mutations, parent note views, note search, context creation and context personal-list responses convert only OpenAPI date-time fields to `Date`, preserving user text and arbitrary JSON. Other operations retain legacy ISO-string parsing. See the repository's `docs/response-date-parsing.md` for exact coverage and package verification.
|
|
34
|
+
|
|
31
35
|
## Field docs package
|
|
32
36
|
|
|
33
37
|
MCP and LLM field catalogs live in `@torrow/sdk-docs`.
|
package/dist/index.d.ts
CHANGED
|
@@ -37865,7 +37865,8 @@ declare const ImagePreviewSizeValues: {
|
|
|
37865
37865
|
readonly MediumSlider: "MediumSlider";
|
|
37866
37866
|
readonly LargeSlider: "LargeSlider";
|
|
37867
37867
|
};
|
|
37868
|
-
|
|
37868
|
+
/** Explicit publicity on create; meta.version on update preserves optimistic concurrency. */
|
|
37869
|
+
type NoteItemForCreateOrUpdate = TorrowItemForCreateOrUpdate<NoteItem> & Pick<NoteItem, "publicityType" | "meta">;
|
|
37869
37870
|
|
|
37870
37871
|
type IncludeToParentReq = IncludeToParentReqDto;
|
|
37871
37872
|
type IncludeForUserReq = IncludeForUserReqDto;
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,513 @@ function stringifyJsonBody(body) {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// ../../src/schema/response-dates.generated.ts
|
|
138
|
+
var responseDateNodes = [
|
|
139
|
+
{},
|
|
140
|
+
{
|
|
141
|
+
"ref": 2
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"properties": {
|
|
145
|
+
"files": 3,
|
|
146
|
+
"image": 7,
|
|
147
|
+
"rating": 8,
|
|
148
|
+
"personalInfo": 11,
|
|
149
|
+
"blockInfo": 33,
|
|
150
|
+
"meta": 36
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"items": 4
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"ref": 5
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"properties": {
|
|
161
|
+
"urlExpiration": 6
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"date": true
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"ref": 5
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"ref": 9
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"properties": {
|
|
175
|
+
"date": 10
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"date": true
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"ref": 12
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"properties": {
|
|
186
|
+
"meta": 13,
|
|
187
|
+
"lastUsageTime": 17,
|
|
188
|
+
"personalReminders": 18,
|
|
189
|
+
"subscriptionList": 27
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"ref": 14
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"properties": {
|
|
197
|
+
"lastModified": 15,
|
|
198
|
+
"createDate": 16
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"date": true
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"date": true
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"date": true
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"items": 19
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"ref": 20
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"properties": {
|
|
218
|
+
"date": 21,
|
|
219
|
+
"recurringConditions": 22
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"date": true
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"ref": 23
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"properties": {
|
|
230
|
+
"endDate": 24,
|
|
231
|
+
"beginDate": 25,
|
|
232
|
+
"firstWeekDate": 26
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"date": true
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"date": true
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"date": true
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"items": 28
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"ref": 29
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"properties": {
|
|
252
|
+
"openDate": 30,
|
|
253
|
+
"closeDate": 31,
|
|
254
|
+
"recurringConditions": 32
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"date": true
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"date": true
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"ref": 23
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"ref": 34
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"properties": {
|
|
271
|
+
"blockDate": 35
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"date": true
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"ref": 14
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"ref": 2
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"ref": 2
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"ref": 40
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"properties": {
|
|
291
|
+
"meta": 41
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"ref": 14
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"ref": 40
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"ref": 44
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"properties": {
|
|
305
|
+
"image": 45,
|
|
306
|
+
"rating": 46,
|
|
307
|
+
"personalInfo": 47,
|
|
308
|
+
"blockInfo": 48,
|
|
309
|
+
"meta": 49
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"ref": 5
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"ref": 9
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"ref": 12
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"ref": 34
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"ref": 14
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"ref": 51
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"properties": {
|
|
332
|
+
"includeResp": 52
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"ref": 53
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"properties": {
|
|
340
|
+
"linkMetaList": 54
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"items": 55
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"ref": 56
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"properties": {
|
|
351
|
+
"info": 57
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"ref": 14
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"ref": 59
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"properties": {
|
|
362
|
+
"meta": 60,
|
|
363
|
+
"subscriptionList": 61
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"ref": 14
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"items": 62
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"ref": 29
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"items": 64
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"ref": 65
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"properties": {
|
|
383
|
+
"file": 66,
|
|
384
|
+
"files": 67,
|
|
385
|
+
"itemObject": 69,
|
|
386
|
+
"itemLink": 70,
|
|
387
|
+
"personalViewInfo": 73,
|
|
388
|
+
"image": 79
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"ref": 5
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"items": 68
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"ref": 5
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"ref": 40
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"ref": 71
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"properties": {
|
|
408
|
+
"meta": 72
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"ref": 14
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"ref": 74
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"properties": {
|
|
419
|
+
"meta": 75,
|
|
420
|
+
"lastUsageTime": 76,
|
|
421
|
+
"personalReminders": 77
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"ref": 14
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"date": true
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"items": 78
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"ref": 20
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"ref": 5
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"items": 81
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"ref": 65
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"items": 83
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"ref": 65
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"ref": 85
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"properties": {
|
|
456
|
+
"image": 86,
|
|
457
|
+
"rating": 87,
|
|
458
|
+
"personalInfo": 88,
|
|
459
|
+
"blockInfo": 89,
|
|
460
|
+
"meta": 90
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"ref": 5
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"ref": 9
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"ref": 12
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"ref": 34
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"ref": 14
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"items": 92
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"ref": 85
|
|
483
|
+
}
|
|
484
|
+
];
|
|
485
|
+
var responseDateRoutes = [
|
|
486
|
+
{
|
|
487
|
+
"method": "POST",
|
|
488
|
+
"path": "/api/v1/notes",
|
|
489
|
+
"responses": {
|
|
490
|
+
"200": 1
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"method": "GET",
|
|
495
|
+
"path": "/api/v1/search/notes",
|
|
496
|
+
"responses": {
|
|
497
|
+
"200": 82
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"method": "POST",
|
|
502
|
+
"path": "/api/v1/contexts",
|
|
503
|
+
"responses": {
|
|
504
|
+
"200": 84
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"method": "GET",
|
|
509
|
+
"path": "/api/v1/contexts/personallist",
|
|
510
|
+
"responses": {
|
|
511
|
+
"200": 91
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"method": "GET",
|
|
516
|
+
"path": "/api/v1/notes/personallist",
|
|
517
|
+
"responses": {},
|
|
518
|
+
"legacy": true
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"method": "GET",
|
|
522
|
+
"path": "/api/v1/notes/{torrowId}",
|
|
523
|
+
"responses": {
|
|
524
|
+
"200": 37
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"method": "PUT",
|
|
529
|
+
"path": "/api/v1/notes/{torrowId}",
|
|
530
|
+
"responses": {
|
|
531
|
+
"200": 38
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"method": "DELETE",
|
|
536
|
+
"path": "/api/v1/notes/{torrowId}",
|
|
537
|
+
"responses": {
|
|
538
|
+
"200": 0
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"method": "PUT",
|
|
543
|
+
"path": "/api/v1/notes/{torrowId}/tags",
|
|
544
|
+
"responses": {
|
|
545
|
+
"200": 39
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"method": "PUT",
|
|
550
|
+
"path": "/api/v1/notes/{torrowId}/solutiondata",
|
|
551
|
+
"responses": {
|
|
552
|
+
"200": 42
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"method": "PUT",
|
|
557
|
+
"path": "/api/v1/notes/{torrowId}/group/set",
|
|
558
|
+
"responses": {
|
|
559
|
+
"200": 43
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"method": "PUT",
|
|
564
|
+
"path": "/api/v1/notes/{torrowId}/updategroups",
|
|
565
|
+
"responses": {
|
|
566
|
+
"200": 50
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"method": "PUT",
|
|
571
|
+
"path": "/api/v1/notes/{torrowId}/savetomindmap",
|
|
572
|
+
"responses": {
|
|
573
|
+
"200": 58
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"method": "GET",
|
|
578
|
+
"path": "/api/v1/notes/{parentId}/views/user",
|
|
579
|
+
"responses": {
|
|
580
|
+
"200": 63
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
"method": "GET",
|
|
585
|
+
"path": "/api/v1/notes/{parentId}/views/pinned",
|
|
586
|
+
"responses": {
|
|
587
|
+
"200": 80
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
];
|
|
591
|
+
|
|
592
|
+
// ../../src/util/response-dates.ts
|
|
593
|
+
var routes = responseDateRoutes.map((route) => ({
|
|
594
|
+
...route,
|
|
595
|
+
segments: route.path.split("/")
|
|
596
|
+
}));
|
|
597
|
+
function parseOperationResponse(json, method, path, status) {
|
|
598
|
+
const segments = path.split("?")[0].split("/");
|
|
599
|
+
const route = routes.find((candidate) => candidate.method === method && candidate.segments.length === segments.length && candidate.segments.every((segment, i) => segment.startsWith("{") ? segments[i] !== "" : segment === segments[i]));
|
|
600
|
+
if (!route || route.legacy) return parseJsonWithIsoDates(json);
|
|
601
|
+
if (json === "") return void 0;
|
|
602
|
+
return reviveDeclaredDates(JSON.parse(json), responseDateNodes, route.responses[String(status)] ?? route.responses["2XX"] ?? 0);
|
|
603
|
+
}
|
|
604
|
+
function reviveDeclaredDates(value, nodes, root) {
|
|
605
|
+
const holder = { value };
|
|
606
|
+
function collect(parent, key, id, path, active) {
|
|
607
|
+
const result = /* @__PURE__ */ new Map();
|
|
608
|
+
const current = parent[key];
|
|
609
|
+
const node = nodes[id];
|
|
610
|
+
if (!node || active.has(id) || current == null) return result;
|
|
611
|
+
const next = new Set(active).add(id);
|
|
612
|
+
const merge = (entries) => entries.forEach((entry, name) => result.set(name, entry));
|
|
613
|
+
if (node.date && typeof current === "string") {
|
|
614
|
+
const date = new Date(current);
|
|
615
|
+
if (!Number.isNaN(date.getTime())) result.set(path, { parent, key, date });
|
|
616
|
+
}
|
|
617
|
+
if (node.ref !== void 0) merge(collect(parent, key, node.ref, path, next));
|
|
618
|
+
for (const child of node.all ?? []) merge(collect(parent, key, child, path, next));
|
|
619
|
+
for (const union of node.unions ?? []) {
|
|
620
|
+
const branches = union.map((child) => collect(parent, key, child, path, next));
|
|
621
|
+
for (const [name, candidate] of branches[0] ?? []) {
|
|
622
|
+
if (branches.every((branch) => branch.has(name))) result.set(name, candidate);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (Array.isArray(current) && node.items !== void 0) {
|
|
626
|
+
current.forEach((_entry, i) => merge(collect(current, String(i), node.items, `${path}/${i}`, /* @__PURE__ */ new Set())));
|
|
627
|
+
} else if (typeof current === "object" && !Array.isArray(current)) {
|
|
628
|
+
for (const [property, child] of Object.entries(node.properties ?? {})) {
|
|
629
|
+
if (Object.hasOwn(current, property)) merge(collect(
|
|
630
|
+
current,
|
|
631
|
+
property,
|
|
632
|
+
child,
|
|
633
|
+
`${path}/${property.replace(/~/g, "~0").replace(/\//g, "~1")}`,
|
|
634
|
+
/* @__PURE__ */ new Set()
|
|
635
|
+
));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
for (const { parent, key, date } of collect(holder, "value", root, "", /* @__PURE__ */ new Set()).values()) parent[key] = date;
|
|
641
|
+
return holder.value;
|
|
642
|
+
}
|
|
643
|
+
|
|
137
644
|
// ../../src/util/query-string.ts
|
|
138
645
|
function buildQueryString(queryStringParams) {
|
|
139
646
|
const queryString = [];
|
|
@@ -211,7 +718,7 @@ var HttpClient = class {
|
|
|
211
718
|
if (text === "") {
|
|
212
719
|
return void 0;
|
|
213
720
|
}
|
|
214
|
-
return
|
|
721
|
+
return parseOperationResponse(text, init.method, init.path, res.status);
|
|
215
722
|
}
|
|
216
723
|
buildUrl(path, query) {
|
|
217
724
|
const origin = this.config.baseUrl ?? DEFAULT_TORROW_API_BASE_URL;
|