@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.
Files changed (32) hide show
  1. package/dist/core/spaceReputationParams.d.ts +57 -0
  2. package/dist/index.d.mts +425 -10
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +605 -35
  5. package/dist/index.mjs +605 -35
  6. package/dist/interfaces/Event.d.ts +66 -0
  7. package/dist/interfaces/SpaceReputation.d.ts +44 -6
  8. package/dist/modules/comments/fetchManyComments.d.ts +11 -1
  9. package/dist/modules/entities/fetchManyEntities.d.ts +5 -1
  10. package/dist/modules/events/addHost.d.ts +8 -0
  11. package/dist/modules/events/addInvite.d.ts +8 -0
  12. package/dist/modules/events/cancelEvent.d.ts +6 -0
  13. package/dist/modules/events/createEvent.d.ts +49 -0
  14. package/dist/modules/events/deleteEvent.d.ts +5 -0
  15. package/dist/modules/events/fetchEvent.d.ts +8 -0
  16. package/dist/modules/events/fetchEventRsvps.d.ts +19 -0
  17. package/dist/modules/events/fetchInvitees.d.ts +12 -0
  18. package/dist/modules/events/fetchManyEvents.d.ts +42 -0
  19. package/dist/modules/events/index.d.ts +14 -0
  20. package/dist/modules/events/removeHost.d.ts +8 -0
  21. package/dist/modules/events/removeInvite.d.ts +8 -0
  22. package/dist/modules/events/setRsvp.d.ts +7 -0
  23. package/dist/modules/events/updateEvent.d.ts +43 -0
  24. package/dist/modules/events/withdrawRsvp.d.ts +6 -0
  25. package/dist/modules/search/askContent.d.ts +6 -0
  26. package/dist/modules/search/index.d.ts +1 -0
  27. package/dist/modules/search/matchUsers.d.ts +36 -0
  28. package/dist/modules/search/searchContent.d.ts +6 -0
  29. package/dist/modules/spaces/createSpace.d.ts +14 -0
  30. package/dist/modules/spaces/updateSpace.d.ts +8 -0
  31. package/dist/modules/storage/uploadImage.d.ts +2 -1
  32. package/package.json +3 -3
@@ -0,0 +1,66 @@
1
+ import { User } from "./User";
2
+ import { Space } from "./Space";
3
+ import { File } from "./File";
4
+ export type EventType = "online" | "physical" | "hybrid";
5
+ export type EventVisibility = "public" | "members" | "invite";
6
+ export type EventStatus = "active" | "cancelled";
7
+ export type RsvpStatus = "going" | "maybe" | "not_going";
8
+ export interface RsvpCounts {
9
+ going: number;
10
+ maybe: number;
11
+ not_going: number;
12
+ }
13
+ export interface Event {
14
+ id: string;
15
+ shortId: string;
16
+ projectId: string;
17
+ userId: string | null;
18
+ user?: User | null;
19
+ title: string;
20
+ description: string | null;
21
+ startTime: string;
22
+ endTime: string | null;
23
+ timezone: string | null;
24
+ type: EventType;
25
+ url: string | null;
26
+ venueName: string | null;
27
+ address: string | null;
28
+ location: {
29
+ type: "Point";
30
+ coordinates: [number, number];
31
+ } | null;
32
+ spaceId: string | null;
33
+ space?: Space | null;
34
+ visibility: EventVisibility;
35
+ status: EventStatus;
36
+ allowMaybe: boolean;
37
+ guestListVisible: boolean;
38
+ capacity: number | null;
39
+ hostIds: string[];
40
+ coverImageId: string | null;
41
+ files?: File[];
42
+ rsvpCounts: RsvpCounts;
43
+ userRsvp?: RsvpStatus | null;
44
+ metadata: Record<string, any>;
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ deletedAt: string | null;
48
+ }
49
+ export interface EventRsvp {
50
+ id: string;
51
+ eventId: string;
52
+ userId: string;
53
+ user?: User | null;
54
+ status: RsvpStatus;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ }
58
+ export interface EventInvite {
59
+ id: string;
60
+ eventId: string;
61
+ userId: string;
62
+ user?: User | null;
63
+ invitedAt: string;
64
+ createdAt: string;
65
+ updatedAt: string;
66
+ }
@@ -20,18 +20,37 @@
20
20
  */
21
21
  export interface SpaceReputationContextParams {
22
22
  /**
23
+ * Opt into space-scoped reputation enrichment. The primary form: an object
24
+ * describing the space and whether to include descendants.
25
+ *
26
+ * - `spaceId` — a space `<uuid>` (reputation within that specific space),
27
+ * `"none"` (no space context — global reputation only), or `"context"`
28
+ * (derive the space from each record's own context, e.g. a feed enriches
29
+ * each row's author with reputation in that row's space).
30
+ * - `includeDescendants` — whether to include descendant spaces when
31
+ * computing space-scoped reputation. Only honored with an explicit space
32
+ * `<uuid>` (ignored for `"none"` / `"context"`).
33
+ */
34
+ spaceReputation?: {
35
+ spaceId: string | "none" | "context";
36
+ includeDescendants?: boolean;
37
+ };
38
+ /**
39
+ * @deprecated Pass the `spaceReputation` object instead. Retained for
40
+ * back-compat; removal is a later major version.
41
+ *
23
42
  * Opt into space-scoped reputation enrichment. Accepted forms:
24
43
  * - a space `<uuid>` — reputation within that specific space;
25
44
  * - `"none"` — no space context (global reputation only);
26
45
  * - `"context"` — derive the space from each record's own context
27
46
  * (e.g. a feed enriches each row's author with reputation in that row's
28
47
  * space).
29
- *
30
- * Plain `string` — a `string | "none" | "context"` union adds no safety
31
- * since a uuid is already a string.
32
48
  */
33
49
  spaceReputationId?: string;
34
50
  /**
51
+ * @deprecated Pass the `spaceReputation` object (`includeDescendants`)
52
+ * instead. Retained for back-compat; removal is a later major version.
53
+ *
35
54
  * Whether to include descendant spaces when computing space-scoped
36
55
  * reputation. Only honored with an explicit space `<uuid>` (ignored for
37
56
  * `"none"` / `"context"`).
@@ -43,18 +62,37 @@ export interface SpaceReputationContextParams {
43
62
  */
44
63
  export interface SpaceReputationUserParams {
45
64
  /**
65
+ * Opt into space-scoped reputation enrichment. The primary form: an object
66
+ * describing the space and whether to include descendants.
67
+ *
68
+ * - `spaceId` — a space `<uuid>` (reputation within that specific space) or
69
+ * `"none"` (no space context — global reputation only). `"context"` is
70
+ * **rejected by the server (400)** on user-direct endpoints — there is no
71
+ * per-record context to derive a space from.
72
+ * - `includeDescendants` — whether to include descendant spaces when
73
+ * computing space-scoped reputation. Only honored with an explicit space
74
+ * `<uuid>`.
75
+ */
76
+ spaceReputation?: {
77
+ spaceId: string | "none";
78
+ includeDescendants?: boolean;
79
+ };
80
+ /**
81
+ * @deprecated Pass the `spaceReputation` object instead. Retained for
82
+ * back-compat; removal is a later major version.
83
+ *
46
84
  * Opt into space-scoped reputation enrichment. Accepted forms:
47
85
  * - a space `<uuid>` — reputation within that specific space;
48
86
  * - `"none"` — no space context (global reputation only).
49
87
  *
50
88
  * `"context"` is **rejected by the server (400)** on user-direct endpoints —
51
89
  * there is no per-record context to derive a space from.
52
- *
53
- * Plain `string` — a `string | "none"` union adds no safety since a uuid is
54
- * already a string.
55
90
  */
56
91
  spaceReputationId?: string;
57
92
  /**
93
+ * @deprecated Pass the `spaceReputation` object (`includeDescendants`)
94
+ * instead. Retained for back-compat; removal is a later major version.
95
+ *
58
96
  * Whether to include descendant spaces when computing space-scoped
59
97
  * reputation. Only honored with an explicit space `<uuid>`.
60
98
  */
@@ -8,7 +8,17 @@ export interface FetchManyCommentsProps extends SpaceReputationContextParams {
8
8
  parentId?: string;
9
9
  page?: number;
10
10
  limit?: number;
11
- sortBy?: "new" | "old" | "top" | "controversial";
11
+ sortBy?: "createdAt" | "top" | "controversial"
12
+ /** @deprecated Use "createdAt" instead. "new" is a directional alias for
13
+ * createdAt DESC, removed in v8; the server still accepts it (identical
14
+ * behavior) but responds with deprecation headers. */
15
+ | "new"
16
+ /** @deprecated Use "createdAt" with sortDir:"asc" instead. "old" is a
17
+ * directional alias for createdAt ASC, removed in v8; the server still
18
+ * accepts it (identical behavior) but responds with deprecation headers. */
19
+ | "old";
20
+ /** Sort direction for `sortBy: "createdAt"`. Defaults to "desc". */
21
+ sortDir?: "asc" | "desc";
12
22
  include?: string;
13
23
  sourceId?: string;
14
24
  }
@@ -35,7 +35,11 @@ export interface LocationFilters {
35
35
  export interface FetchManyEntitiesProps extends SpaceReputationContextParams {
36
36
  sourceId?: string;
37
37
  spaceId?: string;
38
- sortBy?: "new" | "hot" | "top" | "controversial" | (string & {});
38
+ sortBy?: "createdAt" | "hot" | "top" | "controversial"
39
+ /** @deprecated Use "createdAt" instead. "new" is a directional alias removed
40
+ * in v8; the server still accepts it (identical behavior) but responds with
41
+ * deprecation headers. */
42
+ | "new" | (string & {});
39
43
  sortDir?: "asc" | "desc";
40
44
  sortType?: "auto" | "numeric" | "text" | "boolean" | "timestamp";
41
45
  sortByReaction?: "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface AddHostProps {
4
+ eventId: string;
5
+ /** The user to grant host on the event. */
6
+ userId: string;
7
+ }
8
+ export declare function addHost(client: SublayHttpClient, data: AddHostProps): Promise<Event>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface AddInviteProps {
4
+ eventId: string;
5
+ /** The user to invite (userId only — never a foreignId). Idempotent. */
6
+ userId: string;
7
+ }
8
+ export declare function addInvite(client: SublayHttpClient, data: AddInviteProps): Promise<Event>;
@@ -0,0 +1,6 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface CancelEventProps {
4
+ eventId: string;
5
+ }
6
+ export declare function cancelEvent(client: SublayHttpClient, data: CancelEventProps): Promise<Event>;
@@ -0,0 +1,49 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event, EventType, EventVisibility } from "../../interfaces/Event";
3
+ import { ImageOptions } from "../../interfaces/ImageProcessing";
4
+ /** A single cover image plus its processing options (stored as Event.coverImageId). */
5
+ export interface EventCoverUpload {
6
+ file: Blob | File;
7
+ /** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
8
+ options: ImageOptions;
9
+ }
10
+ /** A gallery image set plus shared processing options (Files with eventId + position). */
11
+ export interface EventGalleryUpload {
12
+ files: (Blob | File)[];
13
+ /** Image-processing config applied to every gallery image — see {@link ImageOptions}. */
14
+ options: ImageOptions;
15
+ }
16
+ export interface CreateEventProps {
17
+ title: string;
18
+ description?: string;
19
+ startTime: string;
20
+ endTime?: string;
21
+ timezone?: string;
22
+ type: EventType;
23
+ url?: string;
24
+ venueName?: string;
25
+ address?: string;
26
+ location?: {
27
+ latitude: number;
28
+ longitude: number;
29
+ };
30
+ spaceId?: string;
31
+ visibility?: EventVisibility;
32
+ capacity?: number;
33
+ allowMaybe?: boolean;
34
+ guestListVisible?: boolean;
35
+ /** Additional host user IDs (the logged-in user is auto-added as a host). */
36
+ hostIds?: string[];
37
+ metadata?: Record<string, any>;
38
+ /**
39
+ * Inline cover image (single). When present the request is sent as
40
+ * `multipart/form-data`. Requires the `files-images` bundle.
41
+ */
42
+ cover?: EventCoverUpload;
43
+ /**
44
+ * Inline gallery images (multi). When present the request is sent as
45
+ * `multipart/form-data`. Requires the `files-images` bundle.
46
+ */
47
+ gallery?: EventGalleryUpload;
48
+ }
49
+ export declare function createEvent(client: SublayHttpClient, data: CreateEventProps): Promise<Event>;
@@ -0,0 +1,5 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeleteEventProps {
3
+ eventId: string;
4
+ }
5
+ export declare function deleteEvent(client: SublayHttpClient, data: DeleteEventProps): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface FetchEventProps {
4
+ eventId: string;
5
+ /** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
6
+ include?: string;
7
+ }
8
+ export declare function fetchEvent(client: SublayHttpClient, data: FetchEventProps): Promise<Event>;
@@ -0,0 +1,19 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { EventRsvp } from "../../interfaces/Event";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface FetchEventRsvpsProps {
5
+ eventId: string;
6
+ page?: number;
7
+ limit?: number;
8
+ /**
9
+ * Comma-separated RSVP statuses to filter by, e.g. "going,maybe". When
10
+ * omitted, all statuses are returned.
11
+ */
12
+ status?: string;
13
+ }
14
+ /**
15
+ * Named RSVP (guest) list. Visible to hosts always, or to any viewer when the
16
+ * event's `guestListVisible` is true; otherwise 403. RSVP counts themselves are
17
+ * public via the event's `rsvpCounts`.
18
+ */
19
+ export declare function fetchEventRsvps(client: SublayHttpClient, data: FetchEventRsvpsProps): Promise<PaginatedResponse<EventRsvp>>;
@@ -0,0 +1,12 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { EventInvite } from "../../interfaces/Event";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface FetchInviteesProps {
5
+ eventId: string;
6
+ page?: number;
7
+ limit?: number;
8
+ }
9
+ /**
10
+ * Host-only invitee (guest) list. Non-hosts get 403.
11
+ */
12
+ export declare function fetchInvitees(client: SublayHttpClient, data: FetchInviteesProps): Promise<PaginatedResponse<EventInvite>>;
@@ -0,0 +1,42 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event, EventType, EventStatus } from "../../interfaces/Event";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface EventTextFilters {
5
+ hasTitle?: "true" | "false";
6
+ includes?: string | string[];
7
+ doesNotInclude?: string | string[];
8
+ }
9
+ export interface EventDescriptionFilters {
10
+ hasDescription?: "true" | "false";
11
+ includes?: string | string[];
12
+ doesNotInclude?: string | string[];
13
+ }
14
+ export interface EventLocationFilters {
15
+ latitude: string;
16
+ longitude: string;
17
+ radius: string;
18
+ }
19
+ export interface FetchManyEventsProps {
20
+ page?: number;
21
+ limit?: number;
22
+ sortBy?: "startTime" | "going";
23
+ sortDir?: "asc" | "desc";
24
+ timeWindow?: "upcoming" | "ongoing" | "past";
25
+ startsAfter?: string;
26
+ startsBefore?: string;
27
+ spaceId?: string;
28
+ hostId?: string;
29
+ type?: EventType;
30
+ status?: EventStatus;
31
+ /**
32
+ * Comma-separated RSVP statuses the logged-in user RSVP'd with, e.g.
33
+ * "going,maybe". Filters to events the caller has that RSVP on.
34
+ */
35
+ myRsvp?: string;
36
+ locationFilters?: EventLocationFilters;
37
+ titleFilters?: EventTextFilters;
38
+ descriptionFilters?: EventDescriptionFilters;
39
+ /** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
40
+ include?: string;
41
+ }
42
+ export declare function fetchManyEvents(client: SublayHttpClient, data?: FetchManyEventsProps): Promise<PaginatedResponse<Event>>;
@@ -0,0 +1,14 @@
1
+ export { createEvent } from "./createEvent";
2
+ export { fetchEvent } from "./fetchEvent";
3
+ export { fetchManyEvents } from "./fetchManyEvents";
4
+ export { updateEvent } from "./updateEvent";
5
+ export { cancelEvent } from "./cancelEvent";
6
+ export { deleteEvent } from "./deleteEvent";
7
+ export { setRsvp } from "./setRsvp";
8
+ export { withdrawRsvp } from "./withdrawRsvp";
9
+ export { addHost } from "./addHost";
10
+ export { removeHost } from "./removeHost";
11
+ export { addInvite } from "./addInvite";
12
+ export { removeInvite } from "./removeInvite";
13
+ export { fetchInvitees } from "./fetchInvitees";
14
+ export { fetchEventRsvps } from "./fetchEventRsvps";
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface RemoveHostProps {
4
+ eventId: string;
5
+ /** The host to remove. Rejected if it would leave the event with no hosts. */
6
+ userId: string;
7
+ }
8
+ export declare function removeHost(client: SublayHttpClient, data: RemoveHostProps): Promise<Event>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface RemoveInviteProps {
4
+ eventId: string;
5
+ /** The invitee to remove. Also drops their RSVP and revokes access. */
6
+ userId: string;
7
+ }
8
+ export declare function removeInvite(client: SublayHttpClient, data: RemoveInviteProps): Promise<Event>;
@@ -0,0 +1,7 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event, RsvpStatus } from "../../interfaces/Event";
3
+ export interface SetRsvpProps {
4
+ eventId: string;
5
+ status: RsvpStatus;
6
+ }
7
+ export declare function setRsvp(client: SublayHttpClient, data: SetRsvpProps): Promise<Event>;
@@ -0,0 +1,43 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event, EventType, EventVisibility } from "../../interfaces/Event";
3
+ import type { EventCoverUpload, EventGalleryUpload } from "./createEvent";
4
+ export interface UpdateEventProps {
5
+ eventId: string;
6
+ title?: string;
7
+ description?: string;
8
+ startTime?: string;
9
+ endTime?: string;
10
+ timezone?: string;
11
+ type?: EventType;
12
+ url?: string;
13
+ venueName?: string;
14
+ address?: string;
15
+ location?: {
16
+ latitude: number;
17
+ longitude: number;
18
+ };
19
+ visibility?: EventVisibility;
20
+ capacity?: number;
21
+ allowMaybe?: boolean;
22
+ guestListVisible?: boolean;
23
+ metadata?: Record<string, any>;
24
+ /**
25
+ * File IDs of existing event images to REMOVE (gallery photos and/or the
26
+ * current cover). Combine with `gallery` (append) + `cover` (replace) to fully
27
+ * curate the image set in one update. Sent in the JSON body, or — when an
28
+ * image file is also attached — as a JSON-string field the server parses.
29
+ */
30
+ removeImageIds?: string[];
31
+ /**
32
+ * New cover image (single) — REPLACES the existing cover. When present the
33
+ * request is sent as `multipart/form-data`. Requires the `files-images` bundle.
34
+ */
35
+ cover?: EventCoverUpload;
36
+ /**
37
+ * Gallery images (multi) — APPENDED to the event's existing images. When
38
+ * present the request is sent as `multipart/form-data`. Requires the
39
+ * `files-images` bundle.
40
+ */
41
+ gallery?: EventGalleryUpload;
42
+ }
43
+ export declare function updateEvent(client: SublayHttpClient, data: UpdateEventProps): Promise<Event>;
@@ -0,0 +1,6 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Event } from "../../interfaces/Event";
3
+ export interface WithdrawRsvpProps {
4
+ eventId: string;
5
+ }
6
+ export declare function withdrawRsvp(client: SublayHttpClient, data: WithdrawRsvpProps): Promise<Event>;
@@ -5,6 +5,12 @@ export interface AskContentProps extends SpaceReputationContextParams {
5
5
  query: string;
6
6
  sourceTypes?: ("entity" | "comment" | "message")[];
7
7
  spaceId?: string;
8
+ /**
9
+ * With a `spaceId`, also search every space nested under it (children,
10
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
11
+ * Defaults to false (exact-space search).
12
+ */
13
+ includeChildSpaces?: boolean;
8
14
  conversationId?: string;
9
15
  limit?: number;
10
16
  /** Abort the in-flight stream (e.g. when the user navigates away). */
@@ -2,3 +2,4 @@ export { searchContent } from "./searchContent";
2
2
  export { searchUsers } from "./searchUsers";
3
3
  export { searchSpaces } from "./searchSpaces";
4
4
  export { askContent } from "./askContent";
5
+ export { matchUsers } from "./matchUsers";
@@ -0,0 +1,36 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { User } from "../../interfaces/User";
3
+ export interface MatchUsersProps {
4
+ mode: "passive" | "directed";
5
+ query?: string;
6
+ limit?: number;
7
+ spaceId?: string;
8
+ includeChildSpaces?: boolean;
9
+ includeSampleContent?: boolean;
10
+ excludeSelf?: boolean;
11
+ }
12
+ export interface MatchFacetRef {
13
+ id: string;
14
+ hotness: number;
15
+ }
16
+ export interface SampleContent {
17
+ sourceType: "entity" | "comment" | "message";
18
+ recordId: string;
19
+ content: string;
20
+ similarity: number;
21
+ }
22
+ export interface MatchedFacet {
23
+ similarity: number;
24
+ askerFacet?: MatchFacetRef;
25
+ candidateFacet: MatchFacetRef;
26
+ sampleContent?: SampleContent[];
27
+ }
28
+ export interface UserMatchResult {
29
+ user: User;
30
+ score: number;
31
+ matchedFacets: MatchedFacet[];
32
+ }
33
+ export interface MatchUsersResponse {
34
+ results: UserMatchResult[];
35
+ }
36
+ export declare function matchUsers(client: SublayHttpClient, data: MatchUsersProps): Promise<MatchUsersResponse>;
@@ -7,6 +7,12 @@ export interface SearchContentProps extends SpaceReputationContextParams {
7
7
  query: string;
8
8
  sourceTypes?: ("entity" | "comment" | "message")[];
9
9
  spaceId?: string;
10
+ /**
11
+ * With a `spaceId`, also search every space nested under it (children,
12
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
13
+ * Defaults to false (exact-space search).
14
+ */
15
+ includeChildSpaces?: boolean;
10
16
  conversationId?: string;
11
17
  limit?: number;
12
18
  }
@@ -1,5 +1,12 @@
1
1
  import { SublayHttpClient } from "../../core/client";
2
2
  import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
3
+ import { ImageOptions } from "../../interfaces/ImageProcessing";
4
+ /** A file plus the image-processing options the server requires alongside it. */
5
+ export interface SpaceImageUpload {
6
+ file: Blob | File;
7
+ /** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
8
+ options: ImageOptions;
9
+ }
3
10
  export interface CreateSpaceProps {
4
11
  name: string;
5
12
  slug?: string;
@@ -9,5 +16,12 @@ export interface CreateSpaceProps {
9
16
  requireJoinApproval?: boolean;
10
17
  parentSpaceId?: string;
11
18
  metadata?: Record<string, any>;
19
+ /**
20
+ * Avatar image. When present the request is sent as `multipart/form-data` and
21
+ * the server processes the image per `options`.
22
+ */
23
+ avatarFile?: SpaceImageUpload;
24
+ /** Banner image; same contract as {@link CreateSpaceProps.avatarFile}. */
25
+ bannerFile?: SpaceImageUpload;
12
26
  }
13
27
  export declare function createSpace(client: SublayHttpClient, data: CreateSpaceProps): Promise<Space>;
@@ -1,5 +1,6 @@
1
1
  import { SublayHttpClient } from "../../core/client";
2
2
  import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
3
+ import type { SpaceImageUpload } from "./createSpace";
3
4
  export interface UpdateSpaceProps {
4
5
  spaceId: string;
5
6
  name?: string;
@@ -8,5 +9,12 @@ export interface UpdateSpaceProps {
8
9
  readingPermission?: ReadingPermission;
9
10
  postingPermission?: PostingPermission;
10
11
  metadata?: Record<string, any>;
12
+ /**
13
+ * New avatar image. When present the request is sent as `multipart/form-data`
14
+ * and the server processes the image per `options`, replacing the old avatar.
15
+ */
16
+ avatarFile?: SpaceImageUpload;
17
+ /** New banner image; same contract as {@link UpdateSpaceProps.avatarFile}. */
18
+ bannerFile?: SpaceImageUpload;
11
19
  }
12
20
  export declare function updateSpace(client: SublayHttpClient, data: UpdateSpaceProps): Promise<Space>;
@@ -33,9 +33,10 @@ export interface UploadImageProps {
33
33
  imageOptions: ImageOptions;
34
34
  /** Storage path segments, e.g. ["spaces", spaceId, "banner"]. */
35
35
  pathParts?: string[];
36
- /** Only one of entityId/commentId/spaceId may be set. */
36
+ /** Only one of entityId/commentId/spaceId/eventId may be set. */
37
37
  entityId?: string;
38
38
  commentId?: string;
39
39
  spaceId?: string;
40
+ eventId?: string;
40
41
  }
41
42
  export declare function uploadImage(client: SublayHttpClient, data: UploadImageProps): Promise<UploadImageResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublay/js",
3
- "version": "7.2.0",
3
+ "version": "7.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -36,8 +36,8 @@
36
36
  "test": "jest",
37
37
  "version:patch": "pnpm version patch --no-git-tag-version --no-git-checks",
38
38
  "version:minor": "pnpm version minor --no-git-tag-version --no-git-checks",
39
- "publish-beta": "pnpm publish --tag beta --no-git-checks",
40
- "publish-prod": "pnpm publish --no-git-checks",
39
+ "publish-beta": "pnpm test && pnpm publish --tag beta --no-git-checks",
40
+ "publish-prod": "pnpm test && pnpm publish --no-git-checks",
41
41
  "publish-beta:patch": "pnpm version:patch && pnpm publish-beta",
42
42
  "publish-beta:minor": "pnpm version:minor && pnpm publish-beta",
43
43
  "publish-prod:patch": "pnpm version:patch && pnpm publish-prod",