@sublay/js 7.3.0 → 7.4.1
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 +114 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +390 -29
- package/dist/index.mjs +390 -29
- package/dist/interfaces/SpaceReputation.d.ts +44 -6
- package/dist/interfaces/UserSearch.d.ts +13 -0
- package/dist/modules/connections/fetchConnections.d.ts +2 -1
- package/dist/modules/follows/fetchFollowers.d.ts +2 -1
- package/dist/modules/follows/fetchFollowing.d.ts +2 -1
- 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/users/fetchConnectionsByUserId.d.ts +2 -1
- package/dist/modules/users/fetchFollowersByUserId.d.ts +2 -1
- package/dist/modules/users/fetchFollowingByUserId.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input accepted by {@link buildSpaceReputationParams}: either the new
|
|
3
|
+
* `spaceReputation` object or the deprecated flat props.
|
|
4
|
+
*
|
|
5
|
+
* The flat inputs accept `null` (in addition to `undefined`) so the helper's
|
|
6
|
+
* contract matches `@sublay/core` and `@sublay/node` exactly; `null` is treated
|
|
7
|
+
* as unset. js-sdk never persists these params, so the `null` tolerance is not
|
|
8
|
+
* strictly required here, but matching the sibling helpers is harmless and
|
|
9
|
+
* consistent.
|
|
10
|
+
*/
|
|
11
|
+
export interface BuildSpaceReputationParamsInput {
|
|
12
|
+
spaceReputation?: {
|
|
13
|
+
spaceId: string | "none" | "context";
|
|
14
|
+
includeDescendants?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Pass `spaceReputation` instead. Accepted for back-compat.
|
|
18
|
+
*/
|
|
19
|
+
spaceReputationId?: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Pass `spaceReputation` instead. Accepted for back-compat.
|
|
22
|
+
*/
|
|
23
|
+
spaceReputationDescendants?: boolean | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Flat output handed to the query-string serializer (axios `params` or the
|
|
27
|
+
* `askContent` `URLSearchParams`). Both keys are omitted when unset — never
|
|
28
|
+
* bracketed, never nested.
|
|
29
|
+
*/
|
|
30
|
+
export interface SpaceReputationFlatParams {
|
|
31
|
+
spaceReputationId?: string;
|
|
32
|
+
spaceReputationDescendants?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Normalize the `spaceReputation` object or the deprecated flat props down to
|
|
36
|
+
* the flat query params the server understands
|
|
37
|
+
* (`spaceReputationId` / `spaceReputationDescendants`).
|
|
38
|
+
*
|
|
39
|
+
* **Critical:** this is the only thing that prevents the nested
|
|
40
|
+
* `spaceReputation` object from reaching a query-string serializer. Axios would
|
|
41
|
+
* bracket-encode it (`spaceReputation[spaceId]=…`) and the `askContent`
|
|
42
|
+
* `URLSearchParams` path would stringify it to `[object Object]`; the server
|
|
43
|
+
* ignores both — silently no-opping the new (primary) form. Every
|
|
44
|
+
* reputation-consuming module must route the object through here and merge only
|
|
45
|
+
* the flat output.
|
|
46
|
+
*
|
|
47
|
+
* Rules (mirrors the `@sublay/core` / `@sublay/node` helper contract):
|
|
48
|
+
* - **Object wins when present.** "Present" means the `spaceReputation` key was
|
|
49
|
+
* supplied at all (`spaceReputation !== undefined`) — even `{}` or a partial
|
|
50
|
+
* object suppresses the flat props.
|
|
51
|
+
* - When **both** the object and a flat prop are supplied, the object wins and a
|
|
52
|
+
* one-time dev-only `console.warn` fires (never throws).
|
|
53
|
+
* - The flat inputs tolerate `null` (treated as unset → param omitted).
|
|
54
|
+
* - Output keys are omitted when unset; the result is always the two flat keys,
|
|
55
|
+
* never a bracketed/nested object.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildSpaceReputationParams(input: BuildSpaceReputationParamsInput): SpaceReputationFlatParams;
|
package/dist/index.d.mts
CHANGED
|
@@ -322,18 +322,37 @@ declare namespace Auth {
|
|
|
322
322
|
*/
|
|
323
323
|
interface SpaceReputationContextParams {
|
|
324
324
|
/**
|
|
325
|
+
* Opt into space-scoped reputation enrichment. The primary form: an object
|
|
326
|
+
* describing the space and whether to include descendants.
|
|
327
|
+
*
|
|
328
|
+
* - `spaceId` — a space `<uuid>` (reputation within that specific space),
|
|
329
|
+
* `"none"` (no space context — global reputation only), or `"context"`
|
|
330
|
+
* (derive the space from each record's own context, e.g. a feed enriches
|
|
331
|
+
* each row's author with reputation in that row's space).
|
|
332
|
+
* - `includeDescendants` — whether to include descendant spaces when
|
|
333
|
+
* computing space-scoped reputation. Only honored with an explicit space
|
|
334
|
+
* `<uuid>` (ignored for `"none"` / `"context"`).
|
|
335
|
+
*/
|
|
336
|
+
spaceReputation?: {
|
|
337
|
+
spaceId: string | "none" | "context";
|
|
338
|
+
includeDescendants?: boolean;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* @deprecated Pass the `spaceReputation` object instead. Retained for
|
|
342
|
+
* back-compat; removal is a later major version.
|
|
343
|
+
*
|
|
325
344
|
* Opt into space-scoped reputation enrichment. Accepted forms:
|
|
326
345
|
* - a space `<uuid>` — reputation within that specific space;
|
|
327
346
|
* - `"none"` — no space context (global reputation only);
|
|
328
347
|
* - `"context"` — derive the space from each record's own context
|
|
329
348
|
* (e.g. a feed enriches each row's author with reputation in that row's
|
|
330
349
|
* space).
|
|
331
|
-
*
|
|
332
|
-
* Plain `string` — a `string | "none" | "context"` union adds no safety
|
|
333
|
-
* since a uuid is already a string.
|
|
334
350
|
*/
|
|
335
351
|
spaceReputationId?: string;
|
|
336
352
|
/**
|
|
353
|
+
* @deprecated Pass the `spaceReputation` object (`includeDescendants`)
|
|
354
|
+
* instead. Retained for back-compat; removal is a later major version.
|
|
355
|
+
*
|
|
337
356
|
* Whether to include descendant spaces when computing space-scoped
|
|
338
357
|
* reputation. Only honored with an explicit space `<uuid>` (ignored for
|
|
339
358
|
* `"none"` / `"context"`).
|
|
@@ -345,18 +364,37 @@ interface SpaceReputationContextParams {
|
|
|
345
364
|
*/
|
|
346
365
|
interface SpaceReputationUserParams {
|
|
347
366
|
/**
|
|
367
|
+
* Opt into space-scoped reputation enrichment. The primary form: an object
|
|
368
|
+
* describing the space and whether to include descendants.
|
|
369
|
+
*
|
|
370
|
+
* - `spaceId` — a space `<uuid>` (reputation within that specific space) or
|
|
371
|
+
* `"none"` (no space context — global reputation only). `"context"` is
|
|
372
|
+
* **rejected by the server (400)** on user-direct endpoints — there is no
|
|
373
|
+
* per-record context to derive a space from.
|
|
374
|
+
* - `includeDescendants` — whether to include descendant spaces when
|
|
375
|
+
* computing space-scoped reputation. Only honored with an explicit space
|
|
376
|
+
* `<uuid>`.
|
|
377
|
+
*/
|
|
378
|
+
spaceReputation?: {
|
|
379
|
+
spaceId: string | "none";
|
|
380
|
+
includeDescendants?: boolean;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* @deprecated Pass the `spaceReputation` object instead. Retained for
|
|
384
|
+
* back-compat; removal is a later major version.
|
|
385
|
+
*
|
|
348
386
|
* Opt into space-scoped reputation enrichment. Accepted forms:
|
|
349
387
|
* - a space `<uuid>` — reputation within that specific space;
|
|
350
388
|
* - `"none"` — no space context (global reputation only).
|
|
351
389
|
*
|
|
352
390
|
* `"context"` is **rejected by the server (400)** on user-direct endpoints —
|
|
353
391
|
* there is no per-record context to derive a space from.
|
|
354
|
-
*
|
|
355
|
-
* Plain `string` — a `string | "none"` union adds no safety since a uuid is
|
|
356
|
-
* already a string.
|
|
357
392
|
*/
|
|
358
393
|
spaceReputationId?: string;
|
|
359
394
|
/**
|
|
395
|
+
* @deprecated Pass the `spaceReputation` object (`includeDescendants`)
|
|
396
|
+
* instead. Retained for back-compat; removal is a later major version.
|
|
397
|
+
*
|
|
360
398
|
* Whether to include descendant spaces when computing space-scoped
|
|
361
399
|
* reputation. Only honored with an explicit space `<uuid>`.
|
|
362
400
|
*/
|
|
@@ -517,7 +555,21 @@ interface PaginatedResponse<T> {
|
|
|
517
555
|
pagination: PaginationMetadata;
|
|
518
556
|
}
|
|
519
557
|
|
|
520
|
-
|
|
558
|
+
/**
|
|
559
|
+
* Shared optional params for text-searching a list of users
|
|
560
|
+
* (followers / following / connections).
|
|
561
|
+
*
|
|
562
|
+
* - `query` — free-text search term. When omitted, no filtering is applied.
|
|
563
|
+
* - `searchFields` — narrows which user field the term matches against. When
|
|
564
|
+
* omitted, the term matches either `username` OR `name` (case-insensitive
|
|
565
|
+
* substring). `"username"` / `"name"` restrict the match to that one field.
|
|
566
|
+
*/
|
|
567
|
+
interface UserSearchParams {
|
|
568
|
+
query?: string;
|
|
569
|
+
searchFields?: "username" | "name";
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
interface FetchFollowersByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
|
|
521
573
|
userId: string;
|
|
522
574
|
page?: number;
|
|
523
575
|
limit?: number;
|
|
@@ -532,7 +584,7 @@ interface FollowersCountResponse$1 {
|
|
|
532
584
|
}
|
|
533
585
|
declare function fetchFollowersCountByUserId(client: SublayHttpClient, data: FetchFollowersCountByUserIdProps): Promise<FollowersCountResponse$1>;
|
|
534
586
|
|
|
535
|
-
interface FetchFollowingByUserIdProps extends SpaceReputationUserParams {
|
|
587
|
+
interface FetchFollowingByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
|
|
536
588
|
userId: string;
|
|
537
589
|
page?: number;
|
|
538
590
|
limit?: number;
|
|
@@ -606,7 +658,7 @@ interface ConnectionStatusDeclined {
|
|
|
606
658
|
}
|
|
607
659
|
type ConnectionStatusResponse = ConnectionStatusNone | ConnectionStatusPending | ConnectionStatusConnected | ConnectionStatusDeclined;
|
|
608
660
|
|
|
609
|
-
interface FetchConnectionsByUserIdProps extends SpaceReputationUserParams {
|
|
661
|
+
interface FetchConnectionsByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
|
|
610
662
|
userId: string;
|
|
611
663
|
page?: number;
|
|
612
664
|
limit?: number;
|
|
@@ -2110,13 +2162,13 @@ declare namespace Collections {
|
|
|
2110
2162
|
export { Collections_addEntityToCollection as addEntityToCollection, Collections_createNewCollection as createNewCollection, Collections_deleteCollection as deleteCollection, Collections_fetchCollectionEntities as fetchCollectionEntities, Collections_fetchRootCollection as fetchRootCollection, Collections_fetchSubCollections as fetchSubCollections, Collections_removeEntityFromCollection as removeEntityFromCollection, Collections_updateCollection as updateCollection };
|
|
2111
2163
|
}
|
|
2112
2164
|
|
|
2113
|
-
interface FetchFollowingProps {
|
|
2165
|
+
interface FetchFollowingProps extends UserSearchParams {
|
|
2114
2166
|
page?: number;
|
|
2115
2167
|
limit?: number;
|
|
2116
2168
|
}
|
|
2117
2169
|
declare function fetchFollowing(client: SublayHttpClient, data: FetchFollowingProps): Promise<PaginatedResponse<FollowListItem>>;
|
|
2118
2170
|
|
|
2119
|
-
interface FetchFollowersProps {
|
|
2171
|
+
interface FetchFollowersProps extends UserSearchParams {
|
|
2120
2172
|
page?: number;
|
|
2121
2173
|
limit?: number;
|
|
2122
2174
|
}
|
|
@@ -2146,7 +2198,7 @@ declare namespace Follows {
|
|
|
2146
2198
|
export { Follows_deleteFollow as deleteFollow, Follows_fetchFollowers as fetchFollowers, Follows_fetchFollowersCount as fetchFollowersCount, Follows_fetchFollowing as fetchFollowing, Follows_fetchFollowingCount as fetchFollowingCount };
|
|
2147
2199
|
}
|
|
2148
2200
|
|
|
2149
|
-
interface FetchConnectionsProps {
|
|
2201
|
+
interface FetchConnectionsProps extends UserSearchParams {
|
|
2150
2202
|
page?: number;
|
|
2151
2203
|
limit?: number;
|
|
2152
2204
|
}
|
|
@@ -2530,6 +2582,12 @@ interface SearchContentProps extends SpaceReputationContextParams {
|
|
|
2530
2582
|
query: string;
|
|
2531
2583
|
sourceTypes?: ("entity" | "comment" | "message")[];
|
|
2532
2584
|
spaceId?: string;
|
|
2585
|
+
/**
|
|
2586
|
+
* With a `spaceId`, also search every space nested under it (children,
|
|
2587
|
+
* grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
|
|
2588
|
+
* Defaults to false (exact-space search).
|
|
2589
|
+
*/
|
|
2590
|
+
includeChildSpaces?: boolean;
|
|
2533
2591
|
conversationId?: string;
|
|
2534
2592
|
limit?: number;
|
|
2535
2593
|
}
|
|
@@ -2564,6 +2622,12 @@ interface AskContentProps extends SpaceReputationContextParams {
|
|
|
2564
2622
|
query: string;
|
|
2565
2623
|
sourceTypes?: ("entity" | "comment" | "message")[];
|
|
2566
2624
|
spaceId?: string;
|
|
2625
|
+
/**
|
|
2626
|
+
* With a `spaceId`, also search every space nested under it (children,
|
|
2627
|
+
* grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
|
|
2628
|
+
* Defaults to false (exact-space search).
|
|
2629
|
+
*/
|
|
2630
|
+
includeChildSpaces?: boolean;
|
|
2567
2631
|
conversationId?: string;
|
|
2568
2632
|
limit?: number;
|
|
2569
2633
|
/** Abort the in-flight stream (e.g. when the user navigates away). */
|
|
@@ -2610,12 +2674,48 @@ type AskContentEvent = {
|
|
|
2610
2674
|
*/
|
|
2611
2675
|
declare function askContent(client: SublayHttpClient, data: AskContentProps): AsyncGenerator<AskContentEvent, void, unknown>;
|
|
2612
2676
|
|
|
2677
|
+
interface MatchUsersProps {
|
|
2678
|
+
mode: "passive" | "directed";
|
|
2679
|
+
query?: string;
|
|
2680
|
+
limit?: number;
|
|
2681
|
+
spaceId?: string;
|
|
2682
|
+
includeChildSpaces?: boolean;
|
|
2683
|
+
includeSampleContent?: boolean;
|
|
2684
|
+
excludeSelf?: boolean;
|
|
2685
|
+
}
|
|
2686
|
+
interface MatchFacetRef {
|
|
2687
|
+
id: string;
|
|
2688
|
+
hotness: number;
|
|
2689
|
+
}
|
|
2690
|
+
interface SampleContent {
|
|
2691
|
+
sourceType: "entity" | "comment" | "message";
|
|
2692
|
+
recordId: string;
|
|
2693
|
+
content: string;
|
|
2694
|
+
similarity: number;
|
|
2695
|
+
}
|
|
2696
|
+
interface MatchedFacet {
|
|
2697
|
+
similarity: number;
|
|
2698
|
+
askerFacet?: MatchFacetRef;
|
|
2699
|
+
candidateFacet: MatchFacetRef;
|
|
2700
|
+
sampleContent?: SampleContent[];
|
|
2701
|
+
}
|
|
2702
|
+
interface UserMatchResult {
|
|
2703
|
+
user: User;
|
|
2704
|
+
score: number;
|
|
2705
|
+
matchedFacets: MatchedFacet[];
|
|
2706
|
+
}
|
|
2707
|
+
interface MatchUsersResponse {
|
|
2708
|
+
results: UserMatchResult[];
|
|
2709
|
+
}
|
|
2710
|
+
declare function matchUsers(client: SublayHttpClient, data: MatchUsersProps): Promise<MatchUsersResponse>;
|
|
2711
|
+
|
|
2613
2712
|
declare const Search_askContent: typeof askContent;
|
|
2713
|
+
declare const Search_matchUsers: typeof matchUsers;
|
|
2614
2714
|
declare const Search_searchContent: typeof searchContent;
|
|
2615
2715
|
declare const Search_searchSpaces: typeof searchSpaces;
|
|
2616
2716
|
declare const Search_searchUsers: typeof searchUsers;
|
|
2617
2717
|
declare namespace Search {
|
|
2618
|
-
export { Search_askContent as askContent, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
|
|
2718
|
+
export { Search_askContent as askContent, Search_matchUsers as matchUsers, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
|
|
2619
2719
|
}
|
|
2620
2720
|
|
|
2621
2721
|
interface UploadedImageVariant {
|
|
@@ -3172,4 +3272,4 @@ declare class SublayClient {
|
|
|
3172
3272
|
clearTokens(): void;
|
|
3173
3273
|
}
|
|
3174
3274
|
|
|
3175
|
-
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, type PaginatedResponse, type PaginationMetadata, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow };
|
|
3275
|
+
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, type PaginatedResponse, type PaginationMetadata, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UserSearchParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -51,4 +51,5 @@ export declare class SublayClient {
|
|
|
51
51
|
export type { ClientConfig, AuthTokens } from "./core/client";
|
|
52
52
|
export type { PaginatedResponse, PaginationMetadata, } from "./interfaces/IPaginatedResponse";
|
|
53
53
|
export type { SpaceReputationContextParams, SpaceReputationUserParams, } from "./interfaces/SpaceReputation";
|
|
54
|
+
export type { UserSearchParams } from "./interfaces/UserSearch";
|
|
54
55
|
export type { TableAccessor, TableRow, TableQuery, DbFilter, DbFilterOperator, BulkDeleteProps, DeleteResult, BulkDeleteResult, } from "./interfaces/Table";
|