@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.mjs
CHANGED
|
@@ -289,9 +289,59 @@ __export(users_exports, {
|
|
|
289
289
|
updateUser: () => updateUser
|
|
290
290
|
});
|
|
291
291
|
|
|
292
|
+
// src/core/spaceReputationParams.ts
|
|
293
|
+
var bothFormsWarned = false;
|
|
294
|
+
function isProduction() {
|
|
295
|
+
return typeof process !== "undefined" && !!process.env && process.env.NODE_ENV === "production";
|
|
296
|
+
}
|
|
297
|
+
function buildSpaceReputationParams(input) {
|
|
298
|
+
const { spaceReputation, spaceReputationId, spaceReputationDescendants } = input;
|
|
299
|
+
const objectPresent = spaceReputation !== void 0;
|
|
300
|
+
const flatPresent = spaceReputationId !== void 0 && spaceReputationId !== null || spaceReputationDescendants !== void 0 && spaceReputationDescendants !== null;
|
|
301
|
+
if (objectPresent && flatPresent && !bothFormsWarned && !isProduction()) {
|
|
302
|
+
bothFormsWarned = true;
|
|
303
|
+
console.warn(
|
|
304
|
+
"[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."
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
const result = {};
|
|
308
|
+
if (objectPresent) {
|
|
309
|
+
const spaceId = spaceReputation.spaceId;
|
|
310
|
+
if (spaceId !== void 0 && spaceId !== null) {
|
|
311
|
+
result.spaceReputationId = spaceId;
|
|
312
|
+
}
|
|
313
|
+
const includeDescendants = spaceReputation.includeDescendants;
|
|
314
|
+
if (includeDescendants !== void 0 && includeDescendants !== null) {
|
|
315
|
+
result.spaceReputationDescendants = includeDescendants;
|
|
316
|
+
}
|
|
317
|
+
return result;
|
|
318
|
+
}
|
|
319
|
+
if (spaceReputationId !== void 0 && spaceReputationId !== null) {
|
|
320
|
+
result.spaceReputationId = spaceReputationId;
|
|
321
|
+
}
|
|
322
|
+
if (spaceReputationDescendants !== void 0 && spaceReputationDescendants !== null) {
|
|
323
|
+
result.spaceReputationDescendants = spaceReputationDescendants;
|
|
324
|
+
}
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
|
|
292
328
|
// src/modules/users/fetchUserById.ts
|
|
293
329
|
async function fetchUserById(client, data) {
|
|
294
|
-
const {
|
|
330
|
+
const {
|
|
331
|
+
userId,
|
|
332
|
+
spaceReputation,
|
|
333
|
+
spaceReputationId,
|
|
334
|
+
spaceReputationDescendants,
|
|
335
|
+
...rest
|
|
336
|
+
} = data;
|
|
337
|
+
const params = {
|
|
338
|
+
...rest,
|
|
339
|
+
...buildSpaceReputationParams({
|
|
340
|
+
spaceReputation,
|
|
341
|
+
spaceReputationId,
|
|
342
|
+
spaceReputationDescendants
|
|
343
|
+
})
|
|
344
|
+
};
|
|
295
345
|
const response = await client.projectInstance.get(`/users/${userId}`, {
|
|
296
346
|
params
|
|
297
347
|
});
|
|
@@ -300,27 +350,72 @@ async function fetchUserById(client, data) {
|
|
|
300
350
|
|
|
301
351
|
// src/modules/users/fetchUserByForeignId.ts
|
|
302
352
|
async function fetchUserByForeignId(client, data) {
|
|
353
|
+
const {
|
|
354
|
+
spaceReputation,
|
|
355
|
+
spaceReputationId,
|
|
356
|
+
spaceReputationDescendants,
|
|
357
|
+
...rest
|
|
358
|
+
} = data;
|
|
303
359
|
const response = await client.projectInstance.get(
|
|
304
360
|
"/users/by-foreign-id",
|
|
305
|
-
{
|
|
361
|
+
{
|
|
362
|
+
params: {
|
|
363
|
+
...rest,
|
|
364
|
+
...buildSpaceReputationParams({
|
|
365
|
+
spaceReputation,
|
|
366
|
+
spaceReputationId,
|
|
367
|
+
spaceReputationDescendants
|
|
368
|
+
})
|
|
369
|
+
}
|
|
370
|
+
}
|
|
306
371
|
);
|
|
307
372
|
return response.data;
|
|
308
373
|
}
|
|
309
374
|
|
|
310
375
|
// src/modules/users/fetchUserByUsername.ts
|
|
311
376
|
async function fetchUserByUsername(client, data) {
|
|
377
|
+
const {
|
|
378
|
+
spaceReputation,
|
|
379
|
+
spaceReputationId,
|
|
380
|
+
spaceReputationDescendants,
|
|
381
|
+
...rest
|
|
382
|
+
} = data;
|
|
312
383
|
const response = await client.projectInstance.get(
|
|
313
384
|
"/users/by-username",
|
|
314
|
-
{
|
|
385
|
+
{
|
|
386
|
+
params: {
|
|
387
|
+
...rest,
|
|
388
|
+
...buildSpaceReputationParams({
|
|
389
|
+
spaceReputation,
|
|
390
|
+
spaceReputationId,
|
|
391
|
+
spaceReputationDescendants
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
|
+
}
|
|
315
395
|
);
|
|
316
396
|
return response.data;
|
|
317
397
|
}
|
|
318
398
|
|
|
319
399
|
// src/modules/users/fetchUserSuggestions.ts
|
|
320
400
|
async function fetchUserSuggestions(client, data) {
|
|
401
|
+
const {
|
|
402
|
+
spaceReputation,
|
|
403
|
+
spaceReputationId,
|
|
404
|
+
spaceReputationDescendants,
|
|
405
|
+
...rest
|
|
406
|
+
} = data;
|
|
321
407
|
const response = await client.projectInstance.get(
|
|
322
408
|
"/users/suggestions",
|
|
323
|
-
{
|
|
409
|
+
{
|
|
410
|
+
params: {
|
|
411
|
+
...rest,
|
|
412
|
+
...buildSpaceReputationParams({
|
|
413
|
+
spaceReputation,
|
|
414
|
+
spaceReputationId,
|
|
415
|
+
spaceReputationDescendants
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
}
|
|
324
419
|
);
|
|
325
420
|
return response.data;
|
|
326
421
|
}
|
|
@@ -379,7 +474,21 @@ async function updateUser(client, data) {
|
|
|
379
474
|
|
|
380
475
|
// src/modules/users/fetchFollowersByUserId.ts
|
|
381
476
|
async function fetchFollowersByUserId(client, data) {
|
|
382
|
-
const {
|
|
477
|
+
const {
|
|
478
|
+
userId,
|
|
479
|
+
spaceReputation,
|
|
480
|
+
spaceReputationId,
|
|
481
|
+
spaceReputationDescendants,
|
|
482
|
+
...rest
|
|
483
|
+
} = data;
|
|
484
|
+
const params = {
|
|
485
|
+
...rest,
|
|
486
|
+
...buildSpaceReputationParams({
|
|
487
|
+
spaceReputation,
|
|
488
|
+
spaceReputationId,
|
|
489
|
+
spaceReputationDescendants
|
|
490
|
+
})
|
|
491
|
+
};
|
|
383
492
|
const response = await client.projectInstance.get(`/users/${userId}/followers`, { params });
|
|
384
493
|
return response.data;
|
|
385
494
|
}
|
|
@@ -395,7 +504,21 @@ async function fetchFollowersCountByUserId(client, data) {
|
|
|
395
504
|
|
|
396
505
|
// src/modules/users/fetchFollowingByUserId.ts
|
|
397
506
|
async function fetchFollowingByUserId(client, data) {
|
|
398
|
-
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
|
+
};
|
|
399
522
|
const response = await client.projectInstance.get(`/users/${userId}/following`, { params });
|
|
400
523
|
return response.data;
|
|
401
524
|
}
|
|
@@ -411,7 +534,21 @@ async function fetchFollowingCountByUserId(client, data) {
|
|
|
411
534
|
|
|
412
535
|
// src/modules/users/fetchConnectionsByUserId.ts
|
|
413
536
|
async function fetchConnectionsByUserId(client, data) {
|
|
414
|
-
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
|
+
};
|
|
415
552
|
const response = await client.projectInstance.get(`/users/${userId}/connections`, { params });
|
|
416
553
|
return response.data;
|
|
417
554
|
}
|
|
@@ -507,7 +644,21 @@ async function createEntity(client, data) {
|
|
|
507
644
|
|
|
508
645
|
// src/modules/entities/fetchEntity.ts
|
|
509
646
|
async function fetchEntity(client, data) {
|
|
510
|
-
const {
|
|
647
|
+
const {
|
|
648
|
+
entityId,
|
|
649
|
+
spaceReputation,
|
|
650
|
+
spaceReputationId,
|
|
651
|
+
spaceReputationDescendants,
|
|
652
|
+
...rest
|
|
653
|
+
} = data;
|
|
654
|
+
const params = {
|
|
655
|
+
...rest,
|
|
656
|
+
...buildSpaceReputationParams({
|
|
657
|
+
spaceReputation,
|
|
658
|
+
spaceReputationId,
|
|
659
|
+
spaceReputationDescendants
|
|
660
|
+
})
|
|
661
|
+
};
|
|
511
662
|
const response = await client.projectInstance.get(
|
|
512
663
|
`/entities/${entityId}`,
|
|
513
664
|
{ params }
|
|
@@ -536,10 +687,23 @@ async function fetchEntityByShortId(client, data) {
|
|
|
536
687
|
// src/modules/entities/fetchManyEntities.ts
|
|
537
688
|
async function fetchManyEntities(client, data) {
|
|
538
689
|
const path = `/entities`;
|
|
690
|
+
const {
|
|
691
|
+
spaceReputation,
|
|
692
|
+
spaceReputationId,
|
|
693
|
+
spaceReputationDescendants,
|
|
694
|
+
...rest
|
|
695
|
+
} = data;
|
|
539
696
|
const response = await client.projectInstance.get(
|
|
540
697
|
path,
|
|
541
698
|
{
|
|
542
|
-
params:
|
|
699
|
+
params: {
|
|
700
|
+
...rest,
|
|
701
|
+
...buildSpaceReputationParams({
|
|
702
|
+
spaceReputation,
|
|
703
|
+
spaceReputationId,
|
|
704
|
+
spaceReputationDescendants
|
|
705
|
+
})
|
|
706
|
+
}
|
|
543
707
|
}
|
|
544
708
|
);
|
|
545
709
|
return response.data;
|
|
@@ -611,7 +775,21 @@ async function removeReaction(client, data) {
|
|
|
611
775
|
|
|
612
776
|
// src/modules/entities/fetchReactions.ts
|
|
613
777
|
async function fetchReactions(client, data) {
|
|
614
|
-
const {
|
|
778
|
+
const {
|
|
779
|
+
entityId,
|
|
780
|
+
spaceReputation,
|
|
781
|
+
spaceReputationId,
|
|
782
|
+
spaceReputationDescendants,
|
|
783
|
+
...rest
|
|
784
|
+
} = data;
|
|
785
|
+
const params = {
|
|
786
|
+
...rest,
|
|
787
|
+
...buildSpaceReputationParams({
|
|
788
|
+
spaceReputation,
|
|
789
|
+
spaceReputationId,
|
|
790
|
+
spaceReputationDescendants
|
|
791
|
+
})
|
|
792
|
+
};
|
|
615
793
|
const response = await client.projectInstance.get(
|
|
616
794
|
`/entities/${entityId}/reactions`,
|
|
617
795
|
{ params }
|
|
@@ -637,6 +815,183 @@ async function isEntitySaved(client, data) {
|
|
|
637
815
|
return response.data;
|
|
638
816
|
}
|
|
639
817
|
|
|
818
|
+
// src/modules/events/index.ts
|
|
819
|
+
var events_exports = {};
|
|
820
|
+
__export(events_exports, {
|
|
821
|
+
addHost: () => addHost,
|
|
822
|
+
addInvite: () => addInvite,
|
|
823
|
+
cancelEvent: () => cancelEvent,
|
|
824
|
+
createEvent: () => createEvent,
|
|
825
|
+
deleteEvent: () => deleteEvent,
|
|
826
|
+
fetchEvent: () => fetchEvent,
|
|
827
|
+
fetchEventRsvps: () => fetchEventRsvps,
|
|
828
|
+
fetchInvitees: () => fetchInvitees,
|
|
829
|
+
fetchManyEvents: () => fetchManyEvents,
|
|
830
|
+
removeHost: () => removeHost,
|
|
831
|
+
removeInvite: () => removeInvite,
|
|
832
|
+
setRsvp: () => setRsvp,
|
|
833
|
+
updateEvent: () => updateEvent,
|
|
834
|
+
withdrawRsvp: () => withdrawRsvp
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
// src/modules/events/createEvent.ts
|
|
838
|
+
async function createEvent(client, data) {
|
|
839
|
+
const { cover, gallery, ...body } = data;
|
|
840
|
+
const hasCover = !!cover;
|
|
841
|
+
const hasGallery = !!gallery && gallery.files.length > 0;
|
|
842
|
+
if (hasCover || hasGallery) {
|
|
843
|
+
const formData = new FormData();
|
|
844
|
+
if (cover) {
|
|
845
|
+
appendFile(formData, "cover", cover.file, { fallback: "cover" });
|
|
846
|
+
appendField(formData, "cover.options", cover.options);
|
|
847
|
+
}
|
|
848
|
+
if (hasGallery) {
|
|
849
|
+
gallery.files.forEach(
|
|
850
|
+
(file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
|
|
851
|
+
);
|
|
852
|
+
appendField(formData, "gallery.options", gallery.options);
|
|
853
|
+
}
|
|
854
|
+
appendFields(formData, body);
|
|
855
|
+
const response2 = await client.projectInstance.post(
|
|
856
|
+
"/events",
|
|
857
|
+
formData
|
|
858
|
+
);
|
|
859
|
+
return response2.data;
|
|
860
|
+
}
|
|
861
|
+
const response = await client.projectInstance.post("/events", body);
|
|
862
|
+
return response.data;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// src/modules/events/fetchEvent.ts
|
|
866
|
+
async function fetchEvent(client, data) {
|
|
867
|
+
const { eventId, ...params } = data;
|
|
868
|
+
const response = await client.projectInstance.get(
|
|
869
|
+
`/events/${eventId}`,
|
|
870
|
+
{ params }
|
|
871
|
+
);
|
|
872
|
+
return response.data;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
// src/modules/events/fetchManyEvents.ts
|
|
876
|
+
async function fetchManyEvents(client, data = {}) {
|
|
877
|
+
const response = await client.projectInstance.get(
|
|
878
|
+
`/events`,
|
|
879
|
+
{ params: data }
|
|
880
|
+
);
|
|
881
|
+
return response.data;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// src/modules/events/updateEvent.ts
|
|
885
|
+
async function updateEvent(client, data) {
|
|
886
|
+
const { eventId, cover, gallery, ...body } = data;
|
|
887
|
+
const path = `/events/${eventId}`;
|
|
888
|
+
const hasCover = !!cover;
|
|
889
|
+
const hasGallery = !!gallery && gallery.files.length > 0;
|
|
890
|
+
if (hasCover || hasGallery) {
|
|
891
|
+
const formData = new FormData();
|
|
892
|
+
if (cover) {
|
|
893
|
+
appendFile(formData, "cover", cover.file, { fallback: "cover" });
|
|
894
|
+
appendField(formData, "cover.options", cover.options);
|
|
895
|
+
}
|
|
896
|
+
if (hasGallery) {
|
|
897
|
+
gallery.files.forEach(
|
|
898
|
+
(file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
|
|
899
|
+
);
|
|
900
|
+
appendField(formData, "gallery.options", gallery.options);
|
|
901
|
+
}
|
|
902
|
+
appendFields(formData, body);
|
|
903
|
+
const response2 = await client.projectInstance.patch(path, formData);
|
|
904
|
+
return response2.data;
|
|
905
|
+
}
|
|
906
|
+
const response = await client.projectInstance.patch(path, body);
|
|
907
|
+
return response.data;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// src/modules/events/cancelEvent.ts
|
|
911
|
+
async function cancelEvent(client, data) {
|
|
912
|
+
const response = await client.projectInstance.post(
|
|
913
|
+
`/events/${data.eventId}/cancel`
|
|
914
|
+
);
|
|
915
|
+
return response.data;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// src/modules/events/deleteEvent.ts
|
|
919
|
+
async function deleteEvent(client, data) {
|
|
920
|
+
await client.projectInstance.delete(`/events/${data.eventId}`);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
// src/modules/events/setRsvp.ts
|
|
924
|
+
async function setRsvp(client, data) {
|
|
925
|
+
const { eventId, status } = data;
|
|
926
|
+
const response = await client.projectInstance.post(
|
|
927
|
+
`/events/${eventId}/rsvp`,
|
|
928
|
+
{ status }
|
|
929
|
+
);
|
|
930
|
+
return response.data;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// src/modules/events/withdrawRsvp.ts
|
|
934
|
+
async function withdrawRsvp(client, data) {
|
|
935
|
+
const response = await client.projectInstance.delete(
|
|
936
|
+
`/events/${data.eventId}/rsvp`
|
|
937
|
+
);
|
|
938
|
+
return response.data;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// src/modules/events/addHost.ts
|
|
942
|
+
async function addHost(client, data) {
|
|
943
|
+
const { eventId, userId } = data;
|
|
944
|
+
const response = await client.projectInstance.post(
|
|
945
|
+
`/events/${eventId}/hosts`,
|
|
946
|
+
{ userId }
|
|
947
|
+
);
|
|
948
|
+
return response.data;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// src/modules/events/removeHost.ts
|
|
952
|
+
async function removeHost(client, data) {
|
|
953
|
+
const { eventId, userId } = data;
|
|
954
|
+
const response = await client.projectInstance.delete(
|
|
955
|
+
`/events/${eventId}/hosts`,
|
|
956
|
+
{ data: { userId } }
|
|
957
|
+
);
|
|
958
|
+
return response.data;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// src/modules/events/addInvite.ts
|
|
962
|
+
async function addInvite(client, data) {
|
|
963
|
+
const { eventId, userId } = data;
|
|
964
|
+
const response = await client.projectInstance.post(
|
|
965
|
+
`/events/${eventId}/invites`,
|
|
966
|
+
{ userId }
|
|
967
|
+
);
|
|
968
|
+
return response.data;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// src/modules/events/removeInvite.ts
|
|
972
|
+
async function removeInvite(client, data) {
|
|
973
|
+
const { eventId, userId } = data;
|
|
974
|
+
const response = await client.projectInstance.delete(
|
|
975
|
+
`/events/${eventId}/invites`,
|
|
976
|
+
{ data: { userId } }
|
|
977
|
+
);
|
|
978
|
+
return response.data;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/modules/events/fetchInvitees.ts
|
|
982
|
+
async function fetchInvitees(client, data) {
|
|
983
|
+
const { eventId, ...params } = data;
|
|
984
|
+
const response = await client.projectInstance.get(`/events/${eventId}/invites`, { params });
|
|
985
|
+
return response.data;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// src/modules/events/fetchEventRsvps.ts
|
|
989
|
+
async function fetchEventRsvps(client, data) {
|
|
990
|
+
const { eventId, ...params } = data;
|
|
991
|
+
const response = await client.projectInstance.get(`/events/${eventId}/rsvps`, { params });
|
|
992
|
+
return response.data;
|
|
993
|
+
}
|
|
994
|
+
|
|
640
995
|
// src/modules/comments/index.ts
|
|
641
996
|
var comments_exports = {};
|
|
642
997
|
__export(comments_exports, {
|
|
@@ -663,7 +1018,21 @@ async function createComment(client, data) {
|
|
|
663
1018
|
|
|
664
1019
|
// src/modules/comments/fetchComment.ts
|
|
665
1020
|
async function fetchComment(client, data) {
|
|
666
|
-
const {
|
|
1021
|
+
const {
|
|
1022
|
+
commentId,
|
|
1023
|
+
spaceReputation,
|
|
1024
|
+
spaceReputationId,
|
|
1025
|
+
spaceReputationDescendants,
|
|
1026
|
+
...rest
|
|
1027
|
+
} = data;
|
|
1028
|
+
const params = {
|
|
1029
|
+
...rest,
|
|
1030
|
+
...buildSpaceReputationParams({
|
|
1031
|
+
spaceReputation,
|
|
1032
|
+
spaceReputationId,
|
|
1033
|
+
spaceReputationDescendants
|
|
1034
|
+
})
|
|
1035
|
+
};
|
|
667
1036
|
const response = await client.projectInstance.get(
|
|
668
1037
|
`/comments/${commentId}`,
|
|
669
1038
|
{ params }
|
|
@@ -700,9 +1069,24 @@ async function deleteComment(client, data) {
|
|
|
700
1069
|
|
|
701
1070
|
// src/modules/comments/fetchManyComments.ts
|
|
702
1071
|
async function fetchManyComments(client, data) {
|
|
1072
|
+
const {
|
|
1073
|
+
spaceReputation,
|
|
1074
|
+
spaceReputationId,
|
|
1075
|
+
spaceReputationDescendants,
|
|
1076
|
+
...rest
|
|
1077
|
+
} = data;
|
|
703
1078
|
const response = await client.projectInstance.get(
|
|
704
1079
|
"/comments",
|
|
705
|
-
{
|
|
1080
|
+
{
|
|
1081
|
+
params: {
|
|
1082
|
+
...rest,
|
|
1083
|
+
...buildSpaceReputationParams({
|
|
1084
|
+
spaceReputation,
|
|
1085
|
+
spaceReputationId,
|
|
1086
|
+
spaceReputationDescendants
|
|
1087
|
+
})
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
706
1090
|
);
|
|
707
1091
|
return response.data;
|
|
708
1092
|
}
|
|
@@ -728,7 +1112,21 @@ async function removeReaction2(client, data) {
|
|
|
728
1112
|
|
|
729
1113
|
// src/modules/comments/fetchReactions.ts
|
|
730
1114
|
async function fetchReactions2(client, data) {
|
|
731
|
-
const {
|
|
1115
|
+
const {
|
|
1116
|
+
commentId,
|
|
1117
|
+
spaceReputation,
|
|
1118
|
+
spaceReputationId,
|
|
1119
|
+
spaceReputationDescendants,
|
|
1120
|
+
...rest
|
|
1121
|
+
} = data;
|
|
1122
|
+
const params = {
|
|
1123
|
+
...rest,
|
|
1124
|
+
...buildSpaceReputationParams({
|
|
1125
|
+
spaceReputation,
|
|
1126
|
+
spaceReputationId,
|
|
1127
|
+
spaceReputationDescendants
|
|
1128
|
+
})
|
|
1129
|
+
};
|
|
732
1130
|
const response = await client.projectInstance.get(
|
|
733
1131
|
`/comments/${commentId}/reactions`,
|
|
734
1132
|
{ params }
|
|
@@ -789,7 +1187,25 @@ __export(spaces_exports, {
|
|
|
789
1187
|
|
|
790
1188
|
// src/modules/spaces/createSpace.ts
|
|
791
1189
|
async function createSpace(client, data) {
|
|
792
|
-
const
|
|
1190
|
+
const { avatarFile, bannerFile, ...body } = data;
|
|
1191
|
+
if (avatarFile || bannerFile) {
|
|
1192
|
+
const formData = new FormData();
|
|
1193
|
+
if (avatarFile) {
|
|
1194
|
+
appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
|
|
1195
|
+
appendField(formData, "avatarFile.options", avatarFile.options);
|
|
1196
|
+
}
|
|
1197
|
+
if (bannerFile) {
|
|
1198
|
+
appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
|
|
1199
|
+
appendField(formData, "bannerFile.options", bannerFile.options);
|
|
1200
|
+
}
|
|
1201
|
+
appendFields(formData, body);
|
|
1202
|
+
const response2 = await client.projectInstance.post(
|
|
1203
|
+
"/spaces",
|
|
1204
|
+
formData
|
|
1205
|
+
);
|
|
1206
|
+
return response2.data;
|
|
1207
|
+
}
|
|
1208
|
+
const response = await client.projectInstance.post("/spaces", body);
|
|
793
1209
|
return response.data;
|
|
794
1210
|
}
|
|
795
1211
|
|
|
@@ -858,11 +1274,23 @@ async function checkSlugAvailability(client, data) {
|
|
|
858
1274
|
|
|
859
1275
|
// src/modules/spaces/updateSpace.ts
|
|
860
1276
|
async function updateSpace(client, data) {
|
|
861
|
-
const { spaceId, ...body } = data;
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1277
|
+
const { spaceId, avatarFile, bannerFile, ...body } = data;
|
|
1278
|
+
const path = `/spaces/${spaceId}`;
|
|
1279
|
+
if (avatarFile || bannerFile) {
|
|
1280
|
+
const formData = new FormData();
|
|
1281
|
+
if (avatarFile) {
|
|
1282
|
+
appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
|
|
1283
|
+
appendField(formData, "avatarFile.options", avatarFile.options);
|
|
1284
|
+
}
|
|
1285
|
+
if (bannerFile) {
|
|
1286
|
+
appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
|
|
1287
|
+
appendField(formData, "bannerFile.options", bannerFile.options);
|
|
1288
|
+
}
|
|
1289
|
+
appendFields(formData, body);
|
|
1290
|
+
const response2 = await client.projectInstance.patch(path, formData);
|
|
1291
|
+
return response2.data;
|
|
1292
|
+
}
|
|
1293
|
+
const response = await client.projectInstance.patch(path, body);
|
|
866
1294
|
return response.data;
|
|
867
1295
|
}
|
|
868
1296
|
|
|
@@ -923,7 +1351,21 @@ async function checkMyMembership(client, data) {
|
|
|
923
1351
|
|
|
924
1352
|
// src/modules/spaces/fetchSpaceMembers.ts
|
|
925
1353
|
async function fetchSpaceMembers(client, data) {
|
|
926
|
-
const {
|
|
1354
|
+
const {
|
|
1355
|
+
spaceId,
|
|
1356
|
+
spaceReputation,
|
|
1357
|
+
spaceReputationId,
|
|
1358
|
+
spaceReputationDescendants,
|
|
1359
|
+
...rest
|
|
1360
|
+
} = data;
|
|
1361
|
+
const params = {
|
|
1362
|
+
...rest,
|
|
1363
|
+
...buildSpaceReputationParams({
|
|
1364
|
+
spaceReputation,
|
|
1365
|
+
spaceReputationId,
|
|
1366
|
+
spaceReputationDescendants
|
|
1367
|
+
})
|
|
1368
|
+
};
|
|
927
1369
|
const response = await client.projectInstance.get(
|
|
928
1370
|
`/spaces/${spaceId}/members`,
|
|
929
1371
|
{ params }
|
|
@@ -933,7 +1375,21 @@ async function fetchSpaceMembers(client, data) {
|
|
|
933
1375
|
|
|
934
1376
|
// src/modules/spaces/fetchSpaceTeam.ts
|
|
935
1377
|
async function fetchSpaceTeam(client, data) {
|
|
936
|
-
const {
|
|
1378
|
+
const {
|
|
1379
|
+
spaceId,
|
|
1380
|
+
spaceReputation,
|
|
1381
|
+
spaceReputationId,
|
|
1382
|
+
spaceReputationDescendants,
|
|
1383
|
+
...rest
|
|
1384
|
+
} = data;
|
|
1385
|
+
const params = {
|
|
1386
|
+
...rest,
|
|
1387
|
+
...buildSpaceReputationParams({
|
|
1388
|
+
spaceReputation,
|
|
1389
|
+
spaceReputationId,
|
|
1390
|
+
spaceReputationDescendants
|
|
1391
|
+
})
|
|
1392
|
+
};
|
|
937
1393
|
const response = await client.projectInstance.get(
|
|
938
1394
|
`/spaces/${spaceId}/team`,
|
|
939
1395
|
{ params }
|
|
@@ -1388,9 +1844,24 @@ async function createReport(client, data) {
|
|
|
1388
1844
|
|
|
1389
1845
|
// src/modules/reports/fetchModeratedReports.ts
|
|
1390
1846
|
async function fetchModeratedReports(client, data) {
|
|
1847
|
+
const {
|
|
1848
|
+
spaceReputation,
|
|
1849
|
+
spaceReputationId,
|
|
1850
|
+
spaceReputationDescendants,
|
|
1851
|
+
...rest
|
|
1852
|
+
} = data;
|
|
1391
1853
|
const response = await client.projectInstance.get(
|
|
1392
1854
|
"/reports/moderated",
|
|
1393
|
-
{
|
|
1855
|
+
{
|
|
1856
|
+
params: {
|
|
1857
|
+
...rest,
|
|
1858
|
+
...buildSpaceReputationParams({
|
|
1859
|
+
spaceReputation,
|
|
1860
|
+
spaceReputationId,
|
|
1861
|
+
spaceReputationDescendants
|
|
1862
|
+
})
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1394
1865
|
);
|
|
1395
1866
|
return response.data;
|
|
1396
1867
|
}
|
|
@@ -1399,6 +1870,7 @@ async function fetchModeratedReports(client, data) {
|
|
|
1399
1870
|
var search_exports = {};
|
|
1400
1871
|
__export(search_exports, {
|
|
1401
1872
|
askContent: () => askContent,
|
|
1873
|
+
matchUsers: () => matchUsers,
|
|
1402
1874
|
searchContent: () => searchContent,
|
|
1403
1875
|
searchSpaces: () => searchSpaces,
|
|
1404
1876
|
searchUsers: () => searchUsers
|
|
@@ -1406,11 +1878,22 @@ __export(search_exports, {
|
|
|
1406
1878
|
|
|
1407
1879
|
// src/modules/search/searchContent.ts
|
|
1408
1880
|
async function searchContent(client, data) {
|
|
1409
|
-
const {
|
|
1881
|
+
const {
|
|
1882
|
+
spaceReputation,
|
|
1883
|
+
spaceReputationId,
|
|
1884
|
+
spaceReputationDescendants,
|
|
1885
|
+
...body
|
|
1886
|
+
} = data;
|
|
1410
1887
|
const response = await client.projectInstance.post(
|
|
1411
1888
|
"/search/content",
|
|
1412
1889
|
body,
|
|
1413
|
-
{
|
|
1890
|
+
{
|
|
1891
|
+
params: buildSpaceReputationParams({
|
|
1892
|
+
spaceReputation,
|
|
1893
|
+
spaceReputationId,
|
|
1894
|
+
spaceReputationDescendants
|
|
1895
|
+
})
|
|
1896
|
+
}
|
|
1414
1897
|
);
|
|
1415
1898
|
return response.data;
|
|
1416
1899
|
}
|
|
@@ -1467,20 +1950,31 @@ function parseSseBlock(block) {
|
|
|
1467
1950
|
}
|
|
1468
1951
|
}
|
|
1469
1952
|
async function* askContent(client, data) {
|
|
1470
|
-
const {
|
|
1953
|
+
const {
|
|
1954
|
+
signal,
|
|
1955
|
+
spaceReputation,
|
|
1956
|
+
spaceReputationId,
|
|
1957
|
+
spaceReputationDescendants,
|
|
1958
|
+
...body
|
|
1959
|
+
} = data;
|
|
1471
1960
|
const baseURL = client.projectInstance.defaults.baseURL ?? "";
|
|
1472
1961
|
const authHeader = await client.getAuthHeader();
|
|
1473
1962
|
const headers = {
|
|
1474
1963
|
"Content-Type": "application/json"
|
|
1475
1964
|
};
|
|
1476
1965
|
if (authHeader) headers.Authorization = authHeader;
|
|
1966
|
+
const flatParams = buildSpaceReputationParams({
|
|
1967
|
+
spaceReputation,
|
|
1968
|
+
spaceReputationId,
|
|
1969
|
+
spaceReputationDescendants
|
|
1970
|
+
});
|
|
1477
1971
|
const search = new URLSearchParams();
|
|
1478
|
-
if (spaceReputationId != null)
|
|
1479
|
-
search.set("spaceReputationId", spaceReputationId);
|
|
1480
|
-
if (spaceReputationDescendants != null)
|
|
1972
|
+
if (flatParams.spaceReputationId != null)
|
|
1973
|
+
search.set("spaceReputationId", flatParams.spaceReputationId);
|
|
1974
|
+
if (flatParams.spaceReputationDescendants != null)
|
|
1481
1975
|
search.set(
|
|
1482
1976
|
"spaceReputationDescendants",
|
|
1483
|
-
String(spaceReputationDescendants)
|
|
1977
|
+
String(flatParams.spaceReputationDescendants)
|
|
1484
1978
|
);
|
|
1485
1979
|
const queryString = search.toString();
|
|
1486
1980
|
const url = `${baseURL}/search/ask${queryString ? `?${queryString}` : ""}`;
|
|
@@ -1526,6 +2020,15 @@ async function* askContent(client, data) {
|
|
|
1526
2020
|
}
|
|
1527
2021
|
}
|
|
1528
2022
|
|
|
2023
|
+
// src/modules/search/matchUsers.ts
|
|
2024
|
+
async function matchUsers(client, data) {
|
|
2025
|
+
const response = await client.projectInstance.post(
|
|
2026
|
+
"/match/users",
|
|
2027
|
+
data
|
|
2028
|
+
);
|
|
2029
|
+
return response.data;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
1529
2032
|
// src/modules/storage/index.ts
|
|
1530
2033
|
var storage_exports = {};
|
|
1531
2034
|
__export(storage_exports, {
|
|
@@ -1711,7 +2214,21 @@ async function getUnreadCount(client) {
|
|
|
1711
2214
|
|
|
1712
2215
|
// src/modules/chat/listMembers.ts
|
|
1713
2216
|
async function listMembers(client, data) {
|
|
1714
|
-
const {
|
|
2217
|
+
const {
|
|
2218
|
+
conversationId,
|
|
2219
|
+
spaceReputation,
|
|
2220
|
+
spaceReputationId,
|
|
2221
|
+
spaceReputationDescendants,
|
|
2222
|
+
...rest
|
|
2223
|
+
} = data;
|
|
2224
|
+
const params = {
|
|
2225
|
+
...rest,
|
|
2226
|
+
...buildSpaceReputationParams({
|
|
2227
|
+
spaceReputation,
|
|
2228
|
+
spaceReputationId,
|
|
2229
|
+
spaceReputationDescendants
|
|
2230
|
+
})
|
|
2231
|
+
};
|
|
1715
2232
|
const response = await client.projectInstance.get(`/chat/conversations/${conversationId}/members`, { params });
|
|
1716
2233
|
return response.data;
|
|
1717
2234
|
}
|
|
@@ -1756,7 +2273,21 @@ async function changeMemberRole(client, data) {
|
|
|
1756
2273
|
|
|
1757
2274
|
// src/modules/chat/listMessages.ts
|
|
1758
2275
|
async function listMessages(client, data) {
|
|
1759
|
-
const {
|
|
2276
|
+
const {
|
|
2277
|
+
conversationId,
|
|
2278
|
+
spaceReputation,
|
|
2279
|
+
spaceReputationId,
|
|
2280
|
+
spaceReputationDescendants,
|
|
2281
|
+
...rest
|
|
2282
|
+
} = data;
|
|
2283
|
+
const params = {
|
|
2284
|
+
...rest,
|
|
2285
|
+
...buildSpaceReputationParams({
|
|
2286
|
+
spaceReputation,
|
|
2287
|
+
spaceReputationId,
|
|
2288
|
+
spaceReputationDescendants
|
|
2289
|
+
})
|
|
2290
|
+
};
|
|
1760
2291
|
const response = await client.projectInstance.get(
|
|
1761
2292
|
`/chat/conversations/${conversationId}/messages`,
|
|
1762
2293
|
{ params }
|
|
@@ -1770,13 +2301,20 @@ async function sendMessage(client, data) {
|
|
|
1770
2301
|
conversationId,
|
|
1771
2302
|
files,
|
|
1772
2303
|
// The server reads these from `req.query`, not the body, so they are
|
|
1773
|
-
// forwarded as query params (in both the JSON and multipart branches)
|
|
2304
|
+
// forwarded as query params (in both the JSON and multipart branches),
|
|
2305
|
+
// flattened via the helper so the `spaceReputation` object never reaches
|
|
2306
|
+
// the serializer.
|
|
2307
|
+
spaceReputation,
|
|
1774
2308
|
spaceReputationId,
|
|
1775
2309
|
spaceReputationDescendants,
|
|
1776
2310
|
...body
|
|
1777
2311
|
} = data;
|
|
1778
2312
|
const path = `/chat/conversations/${conversationId}/messages`;
|
|
1779
|
-
const params = {
|
|
2313
|
+
const params = buildSpaceReputationParams({
|
|
2314
|
+
spaceReputation,
|
|
2315
|
+
spaceReputationId,
|
|
2316
|
+
spaceReputationDescendants
|
|
2317
|
+
});
|
|
1780
2318
|
if (files && files.length > 0) {
|
|
1781
2319
|
const formData = new FormData();
|
|
1782
2320
|
for (const file of files) {
|
|
@@ -1798,7 +2336,22 @@ async function sendMessage(client, data) {
|
|
|
1798
2336
|
|
|
1799
2337
|
// src/modules/chat/getMessage.ts
|
|
1800
2338
|
async function getMessage(client, data) {
|
|
1801
|
-
const {
|
|
2339
|
+
const {
|
|
2340
|
+
conversationId,
|
|
2341
|
+
messageId,
|
|
2342
|
+
spaceReputation,
|
|
2343
|
+
spaceReputationId,
|
|
2344
|
+
spaceReputationDescendants,
|
|
2345
|
+
...rest
|
|
2346
|
+
} = data;
|
|
2347
|
+
const params = {
|
|
2348
|
+
...rest,
|
|
2349
|
+
...buildSpaceReputationParams({
|
|
2350
|
+
spaceReputation,
|
|
2351
|
+
spaceReputationId,
|
|
2352
|
+
spaceReputationDescendants
|
|
2353
|
+
})
|
|
2354
|
+
};
|
|
1802
2355
|
const response = await client.projectInstance.get(
|
|
1803
2356
|
`/chat/conversations/${conversationId}/messages/${messageId}`,
|
|
1804
2357
|
{ params }
|
|
@@ -1837,7 +2390,22 @@ async function toggleReaction(client, data) {
|
|
|
1837
2390
|
|
|
1838
2391
|
// src/modules/chat/listReactions.ts
|
|
1839
2392
|
async function listReactions(client, data) {
|
|
1840
|
-
const {
|
|
2393
|
+
const {
|
|
2394
|
+
conversationId,
|
|
2395
|
+
messageId,
|
|
2396
|
+
spaceReputation,
|
|
2397
|
+
spaceReputationId,
|
|
2398
|
+
spaceReputationDescendants,
|
|
2399
|
+
...rest
|
|
2400
|
+
} = data;
|
|
2401
|
+
const params = {
|
|
2402
|
+
...rest,
|
|
2403
|
+
...buildSpaceReputationParams({
|
|
2404
|
+
spaceReputation,
|
|
2405
|
+
spaceReputationId,
|
|
2406
|
+
spaceReputationDescendants
|
|
2407
|
+
})
|
|
2408
|
+
};
|
|
1841
2409
|
const response = await client.projectInstance.get(
|
|
1842
2410
|
`/chat/conversations/${conversationId}/messages/${messageId}/reactions`,
|
|
1843
2411
|
{ params }
|
|
@@ -1960,6 +2528,7 @@ var SublayClient = class _SublayClient {
|
|
|
1960
2528
|
auth;
|
|
1961
2529
|
users;
|
|
1962
2530
|
entities;
|
|
2531
|
+
events;
|
|
1963
2532
|
comments;
|
|
1964
2533
|
spaces;
|
|
1965
2534
|
collections;
|
|
@@ -1976,6 +2545,7 @@ var SublayClient = class _SublayClient {
|
|
|
1976
2545
|
this.auth = bindModule(auth_exports, this.http);
|
|
1977
2546
|
this.users = bindModule(users_exports, this.http);
|
|
1978
2547
|
this.entities = bindModule(entities_exports, this.http);
|
|
2548
|
+
this.events = bindModule(events_exports, this.http);
|
|
1979
2549
|
this.comments = bindModule(comments_exports, this.http);
|
|
1980
2550
|
this.spaces = bindModule(spaces_exports, this.http);
|
|
1981
2551
|
this.collections = bindModule(collections_exports, this.http);
|