@sublay/js 7.2.0 → 7.4.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/core/spaceReputationParams.d.ts +57 -0
- package/dist/index.d.mts +425 -10
- package/dist/index.d.ts +2 -0
- package/dist/index.js +605 -35
- package/dist/index.mjs +605 -35
- package/dist/interfaces/Event.d.ts +66 -0
- package/dist/interfaces/SpaceReputation.d.ts +44 -6
- package/dist/modules/comments/fetchManyComments.d.ts +11 -1
- package/dist/modules/entities/fetchManyEntities.d.ts +5 -1
- package/dist/modules/events/addHost.d.ts +8 -0
- package/dist/modules/events/addInvite.d.ts +8 -0
- package/dist/modules/events/cancelEvent.d.ts +6 -0
- package/dist/modules/events/createEvent.d.ts +49 -0
- package/dist/modules/events/deleteEvent.d.ts +5 -0
- package/dist/modules/events/fetchEvent.d.ts +8 -0
- package/dist/modules/events/fetchEventRsvps.d.ts +19 -0
- package/dist/modules/events/fetchInvitees.d.ts +12 -0
- package/dist/modules/events/fetchManyEvents.d.ts +42 -0
- package/dist/modules/events/index.d.ts +14 -0
- package/dist/modules/events/removeHost.d.ts +8 -0
- package/dist/modules/events/removeInvite.d.ts +8 -0
- package/dist/modules/events/setRsvp.d.ts +7 -0
- package/dist/modules/events/updateEvent.d.ts +43 -0
- package/dist/modules/events/withdrawRsvp.d.ts +6 -0
- package/dist/modules/search/askContent.d.ts +6 -0
- package/dist/modules/search/index.d.ts +1 -0
- package/dist/modules/search/matchUsers.d.ts +36 -0
- package/dist/modules/search/searchContent.d.ts +6 -0
- package/dist/modules/spaces/createSpace.d.ts +14 -0
- package/dist/modules/spaces/updateSpace.d.ts +8 -0
- package/dist/modules/storage/uploadImage.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -319,9 +319,59 @@ __export(users_exports, {
|
|
|
319
319
|
updateUser: () => updateUser
|
|
320
320
|
});
|
|
321
321
|
|
|
322
|
+
// src/core/spaceReputationParams.ts
|
|
323
|
+
var bothFormsWarned = false;
|
|
324
|
+
function isProduction() {
|
|
325
|
+
return typeof process !== "undefined" && !!process.env && process.env.NODE_ENV === "production";
|
|
326
|
+
}
|
|
327
|
+
function buildSpaceReputationParams(input) {
|
|
328
|
+
const { spaceReputation, spaceReputationId, spaceReputationDescendants } = input;
|
|
329
|
+
const objectPresent = spaceReputation !== void 0;
|
|
330
|
+
const flatPresent = spaceReputationId !== void 0 && spaceReputationId !== null || spaceReputationDescendants !== void 0 && spaceReputationDescendants !== null;
|
|
331
|
+
if (objectPresent && flatPresent && !bothFormsWarned && !isProduction()) {
|
|
332
|
+
bothFormsWarned = true;
|
|
333
|
+
console.warn(
|
|
334
|
+
"[Sublay] Both `spaceReputation` and the deprecated flat props (`spaceReputationId` / `spaceReputationDescendants`) were supplied. The `spaceReputation` object takes precedence; the flat props are ignored. Remove the flat props \u2014 they are deprecated."
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
const result = {};
|
|
338
|
+
if (objectPresent) {
|
|
339
|
+
const spaceId = spaceReputation.spaceId;
|
|
340
|
+
if (spaceId !== void 0 && spaceId !== null) {
|
|
341
|
+
result.spaceReputationId = spaceId;
|
|
342
|
+
}
|
|
343
|
+
const includeDescendants = spaceReputation.includeDescendants;
|
|
344
|
+
if (includeDescendants !== void 0 && includeDescendants !== null) {
|
|
345
|
+
result.spaceReputationDescendants = includeDescendants;
|
|
346
|
+
}
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
if (spaceReputationId !== void 0 && spaceReputationId !== null) {
|
|
350
|
+
result.spaceReputationId = spaceReputationId;
|
|
351
|
+
}
|
|
352
|
+
if (spaceReputationDescendants !== void 0 && spaceReputationDescendants !== null) {
|
|
353
|
+
result.spaceReputationDescendants = spaceReputationDescendants;
|
|
354
|
+
}
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
|
|
322
358
|
// src/modules/users/fetchUserById.ts
|
|
323
359
|
async function fetchUserById(client, data) {
|
|
324
|
-
const {
|
|
360
|
+
const {
|
|
361
|
+
userId,
|
|
362
|
+
spaceReputation,
|
|
363
|
+
spaceReputationId,
|
|
364
|
+
spaceReputationDescendants,
|
|
365
|
+
...rest
|
|
366
|
+
} = data;
|
|
367
|
+
const params = {
|
|
368
|
+
...rest,
|
|
369
|
+
...buildSpaceReputationParams({
|
|
370
|
+
spaceReputation,
|
|
371
|
+
spaceReputationId,
|
|
372
|
+
spaceReputationDescendants
|
|
373
|
+
})
|
|
374
|
+
};
|
|
325
375
|
const response = await client.projectInstance.get(`/users/${userId}`, {
|
|
326
376
|
params
|
|
327
377
|
});
|
|
@@ -330,27 +380,72 @@ async function fetchUserById(client, data) {
|
|
|
330
380
|
|
|
331
381
|
// src/modules/users/fetchUserByForeignId.ts
|
|
332
382
|
async function fetchUserByForeignId(client, data) {
|
|
383
|
+
const {
|
|
384
|
+
spaceReputation,
|
|
385
|
+
spaceReputationId,
|
|
386
|
+
spaceReputationDescendants,
|
|
387
|
+
...rest
|
|
388
|
+
} = data;
|
|
333
389
|
const response = await client.projectInstance.get(
|
|
334
390
|
"/users/by-foreign-id",
|
|
335
|
-
{
|
|
391
|
+
{
|
|
392
|
+
params: {
|
|
393
|
+
...rest,
|
|
394
|
+
...buildSpaceReputationParams({
|
|
395
|
+
spaceReputation,
|
|
396
|
+
spaceReputationId,
|
|
397
|
+
spaceReputationDescendants
|
|
398
|
+
})
|
|
399
|
+
}
|
|
400
|
+
}
|
|
336
401
|
);
|
|
337
402
|
return response.data;
|
|
338
403
|
}
|
|
339
404
|
|
|
340
405
|
// src/modules/users/fetchUserByUsername.ts
|
|
341
406
|
async function fetchUserByUsername(client, data) {
|
|
407
|
+
const {
|
|
408
|
+
spaceReputation,
|
|
409
|
+
spaceReputationId,
|
|
410
|
+
spaceReputationDescendants,
|
|
411
|
+
...rest
|
|
412
|
+
} = data;
|
|
342
413
|
const response = await client.projectInstance.get(
|
|
343
414
|
"/users/by-username",
|
|
344
|
-
{
|
|
415
|
+
{
|
|
416
|
+
params: {
|
|
417
|
+
...rest,
|
|
418
|
+
...buildSpaceReputationParams({
|
|
419
|
+
spaceReputation,
|
|
420
|
+
spaceReputationId,
|
|
421
|
+
spaceReputationDescendants
|
|
422
|
+
})
|
|
423
|
+
}
|
|
424
|
+
}
|
|
345
425
|
);
|
|
346
426
|
return response.data;
|
|
347
427
|
}
|
|
348
428
|
|
|
349
429
|
// src/modules/users/fetchUserSuggestions.ts
|
|
350
430
|
async function fetchUserSuggestions(client, data) {
|
|
431
|
+
const {
|
|
432
|
+
spaceReputation,
|
|
433
|
+
spaceReputationId,
|
|
434
|
+
spaceReputationDescendants,
|
|
435
|
+
...rest
|
|
436
|
+
} = data;
|
|
351
437
|
const response = await client.projectInstance.get(
|
|
352
438
|
"/users/suggestions",
|
|
353
|
-
{
|
|
439
|
+
{
|
|
440
|
+
params: {
|
|
441
|
+
...rest,
|
|
442
|
+
...buildSpaceReputationParams({
|
|
443
|
+
spaceReputation,
|
|
444
|
+
spaceReputationId,
|
|
445
|
+
spaceReputationDescendants
|
|
446
|
+
})
|
|
447
|
+
}
|
|
448
|
+
}
|
|
354
449
|
);
|
|
355
450
|
return response.data;
|
|
356
451
|
}
|
|
@@ -409,7 +504,21 @@ async function updateUser(client, data) {
|
|
|
409
504
|
|
|
410
505
|
// src/modules/users/fetchFollowersByUserId.ts
|
|
411
506
|
async function fetchFollowersByUserId(client, data) {
|
|
412
|
-
const {
|
|
507
|
+
const {
|
|
508
|
+
userId,
|
|
509
|
+
spaceReputation,
|
|
510
|
+
spaceReputationId,
|
|
511
|
+
spaceReputationDescendants,
|
|
512
|
+
...rest
|
|
513
|
+
} = data;
|
|
514
|
+
const params = {
|
|
515
|
+
...rest,
|
|
516
|
+
...buildSpaceReputationParams({
|
|
517
|
+
spaceReputation,
|
|
518
|
+
spaceReputationId,
|
|
519
|
+
spaceReputationDescendants
|
|
520
|
+
})
|
|
521
|
+
};
|
|
413
522
|
const response = await client.projectInstance.get(`/users/${userId}/followers`, { params });
|
|
414
523
|
return response.data;
|
|
415
524
|
}
|
|
@@ -425,7 +534,21 @@ async function fetchFollowersCountByUserId(client, data) {
|
|
|
425
534
|
|
|
426
535
|
// src/modules/users/fetchFollowingByUserId.ts
|
|
427
536
|
async function fetchFollowingByUserId(client, data) {
|
|
428
|
-
const {
|
|
537
|
+
const {
|
|
538
|
+
userId,
|
|
539
|
+
spaceReputation,
|
|
540
|
+
spaceReputationId,
|
|
541
|
+
spaceReputationDescendants,
|
|
542
|
+
...rest
|
|
543
|
+
} = data;
|
|
544
|
+
const params = {
|
|
545
|
+
...rest,
|
|
546
|
+
...buildSpaceReputationParams({
|
|
547
|
+
spaceReputation,
|
|
548
|
+
spaceReputationId,
|
|
549
|
+
spaceReputationDescendants
|
|
550
|
+
})
|
|
551
|
+
};
|
|
429
552
|
const response = await client.projectInstance.get(`/users/${userId}/following`, { params });
|
|
430
553
|
return response.data;
|
|
431
554
|
}
|
|
@@ -441,7 +564,21 @@ async function fetchFollowingCountByUserId(client, data) {
|
|
|
441
564
|
|
|
442
565
|
// src/modules/users/fetchConnectionsByUserId.ts
|
|
443
566
|
async function fetchConnectionsByUserId(client, data) {
|
|
444
|
-
const {
|
|
567
|
+
const {
|
|
568
|
+
userId,
|
|
569
|
+
spaceReputation,
|
|
570
|
+
spaceReputationId,
|
|
571
|
+
spaceReputationDescendants,
|
|
572
|
+
...rest
|
|
573
|
+
} = data;
|
|
574
|
+
const params = {
|
|
575
|
+
...rest,
|
|
576
|
+
...buildSpaceReputationParams({
|
|
577
|
+
spaceReputation,
|
|
578
|
+
spaceReputationId,
|
|
579
|
+
spaceReputationDescendants
|
|
580
|
+
})
|
|
581
|
+
};
|
|
445
582
|
const response = await client.projectInstance.get(`/users/${userId}/connections`, { params });
|
|
446
583
|
return response.data;
|
|
447
584
|
}
|
|
@@ -537,7 +674,21 @@ async function createEntity(client, data) {
|
|
|
537
674
|
|
|
538
675
|
// src/modules/entities/fetchEntity.ts
|
|
539
676
|
async function fetchEntity(client, data) {
|
|
540
|
-
const {
|
|
677
|
+
const {
|
|
678
|
+
entityId,
|
|
679
|
+
spaceReputation,
|
|
680
|
+
spaceReputationId,
|
|
681
|
+
spaceReputationDescendants,
|
|
682
|
+
...rest
|
|
683
|
+
} = data;
|
|
684
|
+
const params = {
|
|
685
|
+
...rest,
|
|
686
|
+
...buildSpaceReputationParams({
|
|
687
|
+
spaceReputation,
|
|
688
|
+
spaceReputationId,
|
|
689
|
+
spaceReputationDescendants
|
|
690
|
+
})
|
|
691
|
+
};
|
|
541
692
|
const response = await client.projectInstance.get(
|
|
542
693
|
`/entities/${entityId}`,
|
|
543
694
|
{ params }
|
|
@@ -566,10 +717,23 @@ async function fetchEntityByShortId(client, data) {
|
|
|
566
717
|
// src/modules/entities/fetchManyEntities.ts
|
|
567
718
|
async function fetchManyEntities(client, data) {
|
|
568
719
|
const path = `/entities`;
|
|
720
|
+
const {
|
|
721
|
+
spaceReputation,
|
|
722
|
+
spaceReputationId,
|
|
723
|
+
spaceReputationDescendants,
|
|
724
|
+
...rest
|
|
725
|
+
} = data;
|
|
569
726
|
const response = await client.projectInstance.get(
|
|
570
727
|
path,
|
|
571
728
|
{
|
|
572
|
-
params:
|
|
729
|
+
params: {
|
|
730
|
+
...rest,
|
|
731
|
+
...buildSpaceReputationParams({
|
|
732
|
+
spaceReputation,
|
|
733
|
+
spaceReputationId,
|
|
734
|
+
spaceReputationDescendants
|
|
735
|
+
})
|
|
736
|
+
}
|
|
573
737
|
}
|
|
574
738
|
);
|
|
575
739
|
return response.data;
|
|
@@ -641,7 +805,21 @@ async function removeReaction(client, data) {
|
|
|
641
805
|
|
|
642
806
|
// src/modules/entities/fetchReactions.ts
|
|
643
807
|
async function fetchReactions(client, data) {
|
|
644
|
-
const {
|
|
808
|
+
const {
|
|
809
|
+
entityId,
|
|
810
|
+
spaceReputation,
|
|
811
|
+
spaceReputationId,
|
|
812
|
+
spaceReputationDescendants,
|
|
813
|
+
...rest
|
|
814
|
+
} = data;
|
|
815
|
+
const params = {
|
|
816
|
+
...rest,
|
|
817
|
+
...buildSpaceReputationParams({
|
|
818
|
+
spaceReputation,
|
|
819
|
+
spaceReputationId,
|
|
820
|
+
spaceReputationDescendants
|
|
821
|
+
})
|
|
822
|
+
};
|
|
645
823
|
const response = await client.projectInstance.get(
|
|
646
824
|
`/entities/${entityId}/reactions`,
|
|
647
825
|
{ params }
|
|
@@ -667,6 +845,183 @@ async function isEntitySaved(client, data) {
|
|
|
667
845
|
return response.data;
|
|
668
846
|
}
|
|
669
847
|
|
|
848
|
+
// src/modules/events/index.ts
|
|
849
|
+
var events_exports = {};
|
|
850
|
+
__export(events_exports, {
|
|
851
|
+
addHost: () => addHost,
|
|
852
|
+
addInvite: () => addInvite,
|
|
853
|
+
cancelEvent: () => cancelEvent,
|
|
854
|
+
createEvent: () => createEvent,
|
|
855
|
+
deleteEvent: () => deleteEvent,
|
|
856
|
+
fetchEvent: () => fetchEvent,
|
|
857
|
+
fetchEventRsvps: () => fetchEventRsvps,
|
|
858
|
+
fetchInvitees: () => fetchInvitees,
|
|
859
|
+
fetchManyEvents: () => fetchManyEvents,
|
|
860
|
+
removeHost: () => removeHost,
|
|
861
|
+
removeInvite: () => removeInvite,
|
|
862
|
+
setRsvp: () => setRsvp,
|
|
863
|
+
updateEvent: () => updateEvent,
|
|
864
|
+
withdrawRsvp: () => withdrawRsvp
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// src/modules/events/createEvent.ts
|
|
868
|
+
async function createEvent(client, data) {
|
|
869
|
+
const { cover, gallery, ...body } = data;
|
|
870
|
+
const hasCover = !!cover;
|
|
871
|
+
const hasGallery = !!gallery && gallery.files.length > 0;
|
|
872
|
+
if (hasCover || hasGallery) {
|
|
873
|
+
const formData = new FormData();
|
|
874
|
+
if (cover) {
|
|
875
|
+
appendFile(formData, "cover", cover.file, { fallback: "cover" });
|
|
876
|
+
appendField(formData, "cover.options", cover.options);
|
|
877
|
+
}
|
|
878
|
+
if (hasGallery) {
|
|
879
|
+
gallery.files.forEach(
|
|
880
|
+
(file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
|
|
881
|
+
);
|
|
882
|
+
appendField(formData, "gallery.options", gallery.options);
|
|
883
|
+
}
|
|
884
|
+
appendFields(formData, body);
|
|
885
|
+
const response2 = await client.projectInstance.post(
|
|
886
|
+
"/events",
|
|
887
|
+
formData
|
|
888
|
+
);
|
|
889
|
+
return response2.data;
|
|
890
|
+
}
|
|
891
|
+
const response = await client.projectInstance.post("/events", body);
|
|
892
|
+
return response.data;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/modules/events/fetchEvent.ts
|
|
896
|
+
async function fetchEvent(client, data) {
|
|
897
|
+
const { eventId, ...params } = data;
|
|
898
|
+
const response = await client.projectInstance.get(
|
|
899
|
+
`/events/${eventId}`,
|
|
900
|
+
{ params }
|
|
901
|
+
);
|
|
902
|
+
return response.data;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// src/modules/events/fetchManyEvents.ts
|
|
906
|
+
async function fetchManyEvents(client, data = {}) {
|
|
907
|
+
const response = await client.projectInstance.get(
|
|
908
|
+
`/events`,
|
|
909
|
+
{ params: data }
|
|
910
|
+
);
|
|
911
|
+
return response.data;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// src/modules/events/updateEvent.ts
|
|
915
|
+
async function updateEvent(client, data) {
|
|
916
|
+
const { eventId, cover, gallery, ...body } = data;
|
|
917
|
+
const path = `/events/${eventId}`;
|
|
918
|
+
const hasCover = !!cover;
|
|
919
|
+
const hasGallery = !!gallery && gallery.files.length > 0;
|
|
920
|
+
if (hasCover || hasGallery) {
|
|
921
|
+
const formData = new FormData();
|
|
922
|
+
if (cover) {
|
|
923
|
+
appendFile(formData, "cover", cover.file, { fallback: "cover" });
|
|
924
|
+
appendField(formData, "cover.options", cover.options);
|
|
925
|
+
}
|
|
926
|
+
if (hasGallery) {
|
|
927
|
+
gallery.files.forEach(
|
|
928
|
+
(file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
|
|
929
|
+
);
|
|
930
|
+
appendField(formData, "gallery.options", gallery.options);
|
|
931
|
+
}
|
|
932
|
+
appendFields(formData, body);
|
|
933
|
+
const response2 = await client.projectInstance.patch(path, formData);
|
|
934
|
+
return response2.data;
|
|
935
|
+
}
|
|
936
|
+
const response = await client.projectInstance.patch(path, body);
|
|
937
|
+
return response.data;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/modules/events/cancelEvent.ts
|
|
941
|
+
async function cancelEvent(client, data) {
|
|
942
|
+
const response = await client.projectInstance.post(
|
|
943
|
+
`/events/${data.eventId}/cancel`
|
|
944
|
+
);
|
|
945
|
+
return response.data;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// src/modules/events/deleteEvent.ts
|
|
949
|
+
async function deleteEvent(client, data) {
|
|
950
|
+
await client.projectInstance.delete(`/events/${data.eventId}`);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// src/modules/events/setRsvp.ts
|
|
954
|
+
async function setRsvp(client, data) {
|
|
955
|
+
const { eventId, status } = data;
|
|
956
|
+
const response = await client.projectInstance.post(
|
|
957
|
+
`/events/${eventId}/rsvp`,
|
|
958
|
+
{ status }
|
|
959
|
+
);
|
|
960
|
+
return response.data;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// src/modules/events/withdrawRsvp.ts
|
|
964
|
+
async function withdrawRsvp(client, data) {
|
|
965
|
+
const response = await client.projectInstance.delete(
|
|
966
|
+
`/events/${data.eventId}/rsvp`
|
|
967
|
+
);
|
|
968
|
+
return response.data;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// src/modules/events/addHost.ts
|
|
972
|
+
async function addHost(client, data) {
|
|
973
|
+
const { eventId, userId } = data;
|
|
974
|
+
const response = await client.projectInstance.post(
|
|
975
|
+
`/events/${eventId}/hosts`,
|
|
976
|
+
{ userId }
|
|
977
|
+
);
|
|
978
|
+
return response.data;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/modules/events/removeHost.ts
|
|
982
|
+
async function removeHost(client, data) {
|
|
983
|
+
const { eventId, userId } = data;
|
|
984
|
+
const response = await client.projectInstance.delete(
|
|
985
|
+
`/events/${eventId}/hosts`,
|
|
986
|
+
{ data: { userId } }
|
|
987
|
+
);
|
|
988
|
+
return response.data;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// src/modules/events/addInvite.ts
|
|
992
|
+
async function addInvite(client, data) {
|
|
993
|
+
const { eventId, userId } = data;
|
|
994
|
+
const response = await client.projectInstance.post(
|
|
995
|
+
`/events/${eventId}/invites`,
|
|
996
|
+
{ userId }
|
|
997
|
+
);
|
|
998
|
+
return response.data;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/modules/events/removeInvite.ts
|
|
1002
|
+
async function removeInvite(client, data) {
|
|
1003
|
+
const { eventId, userId } = data;
|
|
1004
|
+
const response = await client.projectInstance.delete(
|
|
1005
|
+
`/events/${eventId}/invites`,
|
|
1006
|
+
{ data: { userId } }
|
|
1007
|
+
);
|
|
1008
|
+
return response.data;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/modules/events/fetchInvitees.ts
|
|
1012
|
+
async function fetchInvitees(client, data) {
|
|
1013
|
+
const { eventId, ...params } = data;
|
|
1014
|
+
const response = await client.projectInstance.get(`/events/${eventId}/invites`, { params });
|
|
1015
|
+
return response.data;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// src/modules/events/fetchEventRsvps.ts
|
|
1019
|
+
async function fetchEventRsvps(client, data) {
|
|
1020
|
+
const { eventId, ...params } = data;
|
|
1021
|
+
const response = await client.projectInstance.get(`/events/${eventId}/rsvps`, { params });
|
|
1022
|
+
return response.data;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
670
1025
|
// src/modules/comments/index.ts
|
|
671
1026
|
var comments_exports = {};
|
|
672
1027
|
__export(comments_exports, {
|
|
@@ -693,7 +1048,21 @@ async function createComment(client, data) {
|
|
|
693
1048
|
|
|
694
1049
|
// src/modules/comments/fetchComment.ts
|
|
695
1050
|
async function fetchComment(client, data) {
|
|
696
|
-
const {
|
|
1051
|
+
const {
|
|
1052
|
+
commentId,
|
|
1053
|
+
spaceReputation,
|
|
1054
|
+
spaceReputationId,
|
|
1055
|
+
spaceReputationDescendants,
|
|
1056
|
+
...rest
|
|
1057
|
+
} = data;
|
|
1058
|
+
const params = {
|
|
1059
|
+
...rest,
|
|
1060
|
+
...buildSpaceReputationParams({
|
|
1061
|
+
spaceReputation,
|
|
1062
|
+
spaceReputationId,
|
|
1063
|
+
spaceReputationDescendants
|
|
1064
|
+
})
|
|
1065
|
+
};
|
|
697
1066
|
const response = await client.projectInstance.get(
|
|
698
1067
|
`/comments/${commentId}`,
|
|
699
1068
|
{ params }
|
|
@@ -730,9 +1099,24 @@ async function deleteComment(client, data) {
|
|
|
730
1099
|
|
|
731
1100
|
// src/modules/comments/fetchManyComments.ts
|
|
732
1101
|
async function fetchManyComments(client, data) {
|
|
1102
|
+
const {
|
|
1103
|
+
spaceReputation,
|
|
1104
|
+
spaceReputationId,
|
|
1105
|
+
spaceReputationDescendants,
|
|
1106
|
+
...rest
|
|
1107
|
+
} = data;
|
|
733
1108
|
const response = await client.projectInstance.get(
|
|
734
1109
|
"/comments",
|
|
735
|
-
{
|
|
1110
|
+
{
|
|
1111
|
+
params: {
|
|
1112
|
+
...rest,
|
|
1113
|
+
...buildSpaceReputationParams({
|
|
1114
|
+
spaceReputation,
|
|
1115
|
+
spaceReputationId,
|
|
1116
|
+
spaceReputationDescendants
|
|
1117
|
+
})
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
736
1120
|
);
|
|
737
1121
|
return response.data;
|
|
738
1122
|
}
|
|
@@ -758,7 +1142,21 @@ async function removeReaction2(client, data) {
|
|
|
758
1142
|
|
|
759
1143
|
// src/modules/comments/fetchReactions.ts
|
|
760
1144
|
async function fetchReactions2(client, data) {
|
|
761
|
-
const {
|
|
1145
|
+
const {
|
|
1146
|
+
commentId,
|
|
1147
|
+
spaceReputation,
|
|
1148
|
+
spaceReputationId,
|
|
1149
|
+
spaceReputationDescendants,
|
|
1150
|
+
...rest
|
|
1151
|
+
} = data;
|
|
1152
|
+
const params = {
|
|
1153
|
+
...rest,
|
|
1154
|
+
...buildSpaceReputationParams({
|
|
1155
|
+
spaceReputation,
|
|
1156
|
+
spaceReputationId,
|
|
1157
|
+
spaceReputationDescendants
|
|
1158
|
+
})
|
|
1159
|
+
};
|
|
762
1160
|
const response = await client.projectInstance.get(
|
|
763
1161
|
`/comments/${commentId}/reactions`,
|
|
764
1162
|
{ params }
|
|
@@ -819,7 +1217,25 @@ __export(spaces_exports, {
|
|
|
819
1217
|
|
|
820
1218
|
// src/modules/spaces/createSpace.ts
|
|
821
1219
|
async function createSpace(client, data) {
|
|
822
|
-
const
|
|
1220
|
+
const { avatarFile, bannerFile, ...body } = data;
|
|
1221
|
+
if (avatarFile || bannerFile) {
|
|
1222
|
+
const formData = new FormData();
|
|
1223
|
+
if (avatarFile) {
|
|
1224
|
+
appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
|
|
1225
|
+
appendField(formData, "avatarFile.options", avatarFile.options);
|
|
1226
|
+
}
|
|
1227
|
+
if (bannerFile) {
|
|
1228
|
+
appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
|
|
1229
|
+
appendField(formData, "bannerFile.options", bannerFile.options);
|
|
1230
|
+
}
|
|
1231
|
+
appendFields(formData, body);
|
|
1232
|
+
const response2 = await client.projectInstance.post(
|
|
1233
|
+
"/spaces",
|
|
1234
|
+
formData
|
|
1235
|
+
);
|
|
1236
|
+
return response2.data;
|
|
1237
|
+
}
|
|
1238
|
+
const response = await client.projectInstance.post("/spaces", body);
|
|
823
1239
|
return response.data;
|
|
824
1240
|
}
|
|
825
1241
|
|
|
@@ -888,11 +1304,23 @@ async function checkSlugAvailability(client, data) {
|
|
|
888
1304
|
|
|
889
1305
|
// src/modules/spaces/updateSpace.ts
|
|
890
1306
|
async function updateSpace(client, data) {
|
|
891
|
-
const { spaceId, ...body } = data;
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1307
|
+
const { spaceId, avatarFile, bannerFile, ...body } = data;
|
|
1308
|
+
const path = `/spaces/${spaceId}`;
|
|
1309
|
+
if (avatarFile || bannerFile) {
|
|
1310
|
+
const formData = new FormData();
|
|
1311
|
+
if (avatarFile) {
|
|
1312
|
+
appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
|
|
1313
|
+
appendField(formData, "avatarFile.options", avatarFile.options);
|
|
1314
|
+
}
|
|
1315
|
+
if (bannerFile) {
|
|
1316
|
+
appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
|
|
1317
|
+
appendField(formData, "bannerFile.options", bannerFile.options);
|
|
1318
|
+
}
|
|
1319
|
+
appendFields(formData, body);
|
|
1320
|
+
const response2 = await client.projectInstance.patch(path, formData);
|
|
1321
|
+
return response2.data;
|
|
1322
|
+
}
|
|
1323
|
+
const response = await client.projectInstance.patch(path, body);
|
|
896
1324
|
return response.data;
|
|
897
1325
|
}
|
|
898
1326
|
|
|
@@ -953,7 +1381,21 @@ async function checkMyMembership(client, data) {
|
|
|
953
1381
|
|
|
954
1382
|
// src/modules/spaces/fetchSpaceMembers.ts
|
|
955
1383
|
async function fetchSpaceMembers(client, data) {
|
|
956
|
-
const {
|
|
1384
|
+
const {
|
|
1385
|
+
spaceId,
|
|
1386
|
+
spaceReputation,
|
|
1387
|
+
spaceReputationId,
|
|
1388
|
+
spaceReputationDescendants,
|
|
1389
|
+
...rest
|
|
1390
|
+
} = data;
|
|
1391
|
+
const params = {
|
|
1392
|
+
...rest,
|
|
1393
|
+
...buildSpaceReputationParams({
|
|
1394
|
+
spaceReputation,
|
|
1395
|
+
spaceReputationId,
|
|
1396
|
+
spaceReputationDescendants
|
|
1397
|
+
})
|
|
1398
|
+
};
|
|
957
1399
|
const response = await client.projectInstance.get(
|
|
958
1400
|
`/spaces/${spaceId}/members`,
|
|
959
1401
|
{ params }
|
|
@@ -963,7 +1405,21 @@ async function fetchSpaceMembers(client, data) {
|
|
|
963
1405
|
|
|
964
1406
|
// src/modules/spaces/fetchSpaceTeam.ts
|
|
965
1407
|
async function fetchSpaceTeam(client, data) {
|
|
966
|
-
const {
|
|
1408
|
+
const {
|
|
1409
|
+
spaceId,
|
|
1410
|
+
spaceReputation,
|
|
1411
|
+
spaceReputationId,
|
|
1412
|
+
spaceReputationDescendants,
|
|
1413
|
+
...rest
|
|
1414
|
+
} = data;
|
|
1415
|
+
const params = {
|
|
1416
|
+
...rest,
|
|
1417
|
+
...buildSpaceReputationParams({
|
|
1418
|
+
spaceReputation,
|
|
1419
|
+
spaceReputationId,
|
|
1420
|
+
spaceReputationDescendants
|
|
1421
|
+
})
|
|
1422
|
+
};
|
|
967
1423
|
const response = await client.projectInstance.get(
|
|
968
1424
|
`/spaces/${spaceId}/team`,
|
|
969
1425
|
{ params }
|
|
@@ -1418,9 +1874,24 @@ async function createReport(client, data) {
|
|
|
1418
1874
|
|
|
1419
1875
|
// src/modules/reports/fetchModeratedReports.ts
|
|
1420
1876
|
async function fetchModeratedReports(client, data) {
|
|
1877
|
+
const {
|
|
1878
|
+
spaceReputation,
|
|
1879
|
+
spaceReputationId,
|
|
1880
|
+
spaceReputationDescendants,
|
|
1881
|
+
...rest
|
|
1882
|
+
} = data;
|
|
1421
1883
|
const response = await client.projectInstance.get(
|
|
1422
1884
|
"/reports/moderated",
|
|
1423
|
-
{
|
|
1885
|
+
{
|
|
1886
|
+
params: {
|
|
1887
|
+
...rest,
|
|
1888
|
+
...buildSpaceReputationParams({
|
|
1889
|
+
spaceReputation,
|
|
1890
|
+
spaceReputationId,
|
|
1891
|
+
spaceReputationDescendants
|
|
1892
|
+
})
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1424
1895
|
);
|
|
1425
1896
|
return response.data;
|
|
1426
1897
|
}
|
|
@@ -1429,6 +1900,7 @@ async function fetchModeratedReports(client, data) {
|
|
|
1429
1900
|
var search_exports = {};
|
|
1430
1901
|
__export(search_exports, {
|
|
1431
1902
|
askContent: () => askContent,
|
|
1903
|
+
matchUsers: () => matchUsers,
|
|
1432
1904
|
searchContent: () => searchContent,
|
|
1433
1905
|
searchSpaces: () => searchSpaces,
|
|
1434
1906
|
searchUsers: () => searchUsers
|
|
@@ -1436,11 +1908,22 @@ __export(search_exports, {
|
|
|
1436
1908
|
|
|
1437
1909
|
// src/modules/search/searchContent.ts
|
|
1438
1910
|
async function searchContent(client, data) {
|
|
1439
|
-
const {
|
|
1911
|
+
const {
|
|
1912
|
+
spaceReputation,
|
|
1913
|
+
spaceReputationId,
|
|
1914
|
+
spaceReputationDescendants,
|
|
1915
|
+
...body
|
|
1916
|
+
} = data;
|
|
1440
1917
|
const response = await client.projectInstance.post(
|
|
1441
1918
|
"/search/content",
|
|
1442
1919
|
body,
|
|
1443
|
-
{
|
|
1920
|
+
{
|
|
1921
|
+
params: buildSpaceReputationParams({
|
|
1922
|
+
spaceReputation,
|
|
1923
|
+
spaceReputationId,
|
|
1924
|
+
spaceReputationDescendants
|
|
1925
|
+
})
|
|
1926
|
+
}
|
|
1444
1927
|
);
|
|
1445
1928
|
return response.data;
|
|
1446
1929
|
}
|
|
@@ -1497,20 +1980,31 @@ function parseSseBlock(block) {
|
|
|
1497
1980
|
}
|
|
1498
1981
|
}
|
|
1499
1982
|
async function* askContent(client, data) {
|
|
1500
|
-
const {
|
|
1983
|
+
const {
|
|
1984
|
+
signal,
|
|
1985
|
+
spaceReputation,
|
|
1986
|
+
spaceReputationId,
|
|
1987
|
+
spaceReputationDescendants,
|
|
1988
|
+
...body
|
|
1989
|
+
} = data;
|
|
1501
1990
|
const baseURL = client.projectInstance.defaults.baseURL ?? "";
|
|
1502
1991
|
const authHeader = await client.getAuthHeader();
|
|
1503
1992
|
const headers = {
|
|
1504
1993
|
"Content-Type": "application/json"
|
|
1505
1994
|
};
|
|
1506
1995
|
if (authHeader) headers.Authorization = authHeader;
|
|
1996
|
+
const flatParams = buildSpaceReputationParams({
|
|
1997
|
+
spaceReputation,
|
|
1998
|
+
spaceReputationId,
|
|
1999
|
+
spaceReputationDescendants
|
|
2000
|
+
});
|
|
1507
2001
|
const search = new URLSearchParams();
|
|
1508
|
-
if (spaceReputationId != null)
|
|
1509
|
-
search.set("spaceReputationId", spaceReputationId);
|
|
1510
|
-
if (spaceReputationDescendants != null)
|
|
2002
|
+
if (flatParams.spaceReputationId != null)
|
|
2003
|
+
search.set("spaceReputationId", flatParams.spaceReputationId);
|
|
2004
|
+
if (flatParams.spaceReputationDescendants != null)
|
|
1511
2005
|
search.set(
|
|
1512
2006
|
"spaceReputationDescendants",
|
|
1513
|
-
String(spaceReputationDescendants)
|
|
2007
|
+
String(flatParams.spaceReputationDescendants)
|
|
1514
2008
|
);
|
|
1515
2009
|
const queryString = search.toString();
|
|
1516
2010
|
const url = `${baseURL}/search/ask${queryString ? `?${queryString}` : ""}`;
|
|
@@ -1556,6 +2050,15 @@ async function* askContent(client, data) {
|
|
|
1556
2050
|
}
|
|
1557
2051
|
}
|
|
1558
2052
|
|
|
2053
|
+
// src/modules/search/matchUsers.ts
|
|
2054
|
+
async function matchUsers(client, data) {
|
|
2055
|
+
const response = await client.projectInstance.post(
|
|
2056
|
+
"/match/users",
|
|
2057
|
+
data
|
|
2058
|
+
);
|
|
2059
|
+
return response.data;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
1559
2062
|
// src/modules/storage/index.ts
|
|
1560
2063
|
var storage_exports = {};
|
|
1561
2064
|
__export(storage_exports, {
|
|
@@ -1741,7 +2244,21 @@ async function getUnreadCount(client) {
|
|
|
1741
2244
|
|
|
1742
2245
|
// src/modules/chat/listMembers.ts
|
|
1743
2246
|
async function listMembers(client, data) {
|
|
1744
|
-
const {
|
|
2247
|
+
const {
|
|
2248
|
+
conversationId,
|
|
2249
|
+
spaceReputation,
|
|
2250
|
+
spaceReputationId,
|
|
2251
|
+
spaceReputationDescendants,
|
|
2252
|
+
...rest
|
|
2253
|
+
} = data;
|
|
2254
|
+
const params = {
|
|
2255
|
+
...rest,
|
|
2256
|
+
...buildSpaceReputationParams({
|
|
2257
|
+
spaceReputation,
|
|
2258
|
+
spaceReputationId,
|
|
2259
|
+
spaceReputationDescendants
|
|
2260
|
+
})
|
|
2261
|
+
};
|
|
1745
2262
|
const response = await client.projectInstance.get(`/chat/conversations/${conversationId}/members`, { params });
|
|
1746
2263
|
return response.data;
|
|
1747
2264
|
}
|
|
@@ -1786,7 +2303,21 @@ async function changeMemberRole(client, data) {
|
|
|
1786
2303
|
|
|
1787
2304
|
// src/modules/chat/listMessages.ts
|
|
1788
2305
|
async function listMessages(client, data) {
|
|
1789
|
-
const {
|
|
2306
|
+
const {
|
|
2307
|
+
conversationId,
|
|
2308
|
+
spaceReputation,
|
|
2309
|
+
spaceReputationId,
|
|
2310
|
+
spaceReputationDescendants,
|
|
2311
|
+
...rest
|
|
2312
|
+
} = data;
|
|
2313
|
+
const params = {
|
|
2314
|
+
...rest,
|
|
2315
|
+
...buildSpaceReputationParams({
|
|
2316
|
+
spaceReputation,
|
|
2317
|
+
spaceReputationId,
|
|
2318
|
+
spaceReputationDescendants
|
|
2319
|
+
})
|
|
2320
|
+
};
|
|
1790
2321
|
const response = await client.projectInstance.get(
|
|
1791
2322
|
`/chat/conversations/${conversationId}/messages`,
|
|
1792
2323
|
{ params }
|
|
@@ -1800,13 +2331,20 @@ async function sendMessage(client, data) {
|
|
|
1800
2331
|
conversationId,
|
|
1801
2332
|
files,
|
|
1802
2333
|
// The server reads these from `req.query`, not the body, so they are
|
|
1803
|
-
// forwarded as query params (in both the JSON and multipart branches)
|
|
2334
|
+
// forwarded as query params (in both the JSON and multipart branches),
|
|
2335
|
+
// flattened via the helper so the `spaceReputation` object never reaches
|
|
2336
|
+
// the serializer.
|
|
2337
|
+
spaceReputation,
|
|
1804
2338
|
spaceReputationId,
|
|
1805
2339
|
spaceReputationDescendants,
|
|
1806
2340
|
...body
|
|
1807
2341
|
} = data;
|
|
1808
2342
|
const path = `/chat/conversations/${conversationId}/messages`;
|
|
1809
|
-
const params = {
|
|
2343
|
+
const params = buildSpaceReputationParams({
|
|
2344
|
+
spaceReputation,
|
|
2345
|
+
spaceReputationId,
|
|
2346
|
+
spaceReputationDescendants
|
|
2347
|
+
});
|
|
1810
2348
|
if (files && files.length > 0) {
|
|
1811
2349
|
const formData = new FormData();
|
|
1812
2350
|
for (const file of files) {
|
|
@@ -1828,7 +2366,22 @@ async function sendMessage(client, data) {
|
|
|
1828
2366
|
|
|
1829
2367
|
// src/modules/chat/getMessage.ts
|
|
1830
2368
|
async function getMessage(client, data) {
|
|
1831
|
-
const {
|
|
2369
|
+
const {
|
|
2370
|
+
conversationId,
|
|
2371
|
+
messageId,
|
|
2372
|
+
spaceReputation,
|
|
2373
|
+
spaceReputationId,
|
|
2374
|
+
spaceReputationDescendants,
|
|
2375
|
+
...rest
|
|
2376
|
+
} = data;
|
|
2377
|
+
const params = {
|
|
2378
|
+
...rest,
|
|
2379
|
+
...buildSpaceReputationParams({
|
|
2380
|
+
spaceReputation,
|
|
2381
|
+
spaceReputationId,
|
|
2382
|
+
spaceReputationDescendants
|
|
2383
|
+
})
|
|
2384
|
+
};
|
|
1832
2385
|
const response = await client.projectInstance.get(
|
|
1833
2386
|
`/chat/conversations/${conversationId}/messages/${messageId}`,
|
|
1834
2387
|
{ params }
|
|
@@ -1867,7 +2420,22 @@ async function toggleReaction(client, data) {
|
|
|
1867
2420
|
|
|
1868
2421
|
// src/modules/chat/listReactions.ts
|
|
1869
2422
|
async function listReactions(client, data) {
|
|
1870
|
-
const {
|
|
2423
|
+
const {
|
|
2424
|
+
conversationId,
|
|
2425
|
+
messageId,
|
|
2426
|
+
spaceReputation,
|
|
2427
|
+
spaceReputationId,
|
|
2428
|
+
spaceReputationDescendants,
|
|
2429
|
+
...rest
|
|
2430
|
+
} = data;
|
|
2431
|
+
const params = {
|
|
2432
|
+
...rest,
|
|
2433
|
+
...buildSpaceReputationParams({
|
|
2434
|
+
spaceReputation,
|
|
2435
|
+
spaceReputationId,
|
|
2436
|
+
spaceReputationDescendants
|
|
2437
|
+
})
|
|
2438
|
+
};
|
|
1871
2439
|
const response = await client.projectInstance.get(
|
|
1872
2440
|
`/chat/conversations/${conversationId}/messages/${messageId}/reactions`,
|
|
1873
2441
|
{ params }
|
|
@@ -1990,6 +2558,7 @@ var SublayClient = class _SublayClient {
|
|
|
1990
2558
|
auth;
|
|
1991
2559
|
users;
|
|
1992
2560
|
entities;
|
|
2561
|
+
events;
|
|
1993
2562
|
comments;
|
|
1994
2563
|
spaces;
|
|
1995
2564
|
collections;
|
|
@@ -2006,6 +2575,7 @@ var SublayClient = class _SublayClient {
|
|
|
2006
2575
|
this.auth = bindModule(auth_exports, this.http);
|
|
2007
2576
|
this.users = bindModule(users_exports, this.http);
|
|
2008
2577
|
this.entities = bindModule(entities_exports, this.http);
|
|
2578
|
+
this.events = bindModule(events_exports, this.http);
|
|
2009
2579
|
this.comments = bindModule(comments_exports, this.http);
|
|
2010
2580
|
this.spaces = bindModule(spaces_exports, this.http);
|
|
2011
2581
|
this.collections = bindModule(collections_exports, this.http);
|