@sublay/js 7.3.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.
@@ -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
  */
@@ -2530,6 +2568,12 @@ interface SearchContentProps extends SpaceReputationContextParams {
2530
2568
  query: string;
2531
2569
  sourceTypes?: ("entity" | "comment" | "message")[];
2532
2570
  spaceId?: string;
2571
+ /**
2572
+ * With a `spaceId`, also search every space nested under it (children,
2573
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
2574
+ * Defaults to false (exact-space search).
2575
+ */
2576
+ includeChildSpaces?: boolean;
2533
2577
  conversationId?: string;
2534
2578
  limit?: number;
2535
2579
  }
@@ -2564,6 +2608,12 @@ interface AskContentProps extends SpaceReputationContextParams {
2564
2608
  query: string;
2565
2609
  sourceTypes?: ("entity" | "comment" | "message")[];
2566
2610
  spaceId?: string;
2611
+ /**
2612
+ * With a `spaceId`, also search every space nested under it (children,
2613
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
2614
+ * Defaults to false (exact-space search).
2615
+ */
2616
+ includeChildSpaces?: boolean;
2567
2617
  conversationId?: string;
2568
2618
  limit?: number;
2569
2619
  /** Abort the in-flight stream (e.g. when the user navigates away). */
@@ -2610,12 +2660,48 @@ type AskContentEvent = {
2610
2660
  */
2611
2661
  declare function askContent(client: SublayHttpClient, data: AskContentProps): AsyncGenerator<AskContentEvent, void, unknown>;
2612
2662
 
2663
+ interface MatchUsersProps {
2664
+ mode: "passive" | "directed";
2665
+ query?: string;
2666
+ limit?: number;
2667
+ spaceId?: string;
2668
+ includeChildSpaces?: boolean;
2669
+ includeSampleContent?: boolean;
2670
+ excludeSelf?: boolean;
2671
+ }
2672
+ interface MatchFacetRef {
2673
+ id: string;
2674
+ hotness: number;
2675
+ }
2676
+ interface SampleContent {
2677
+ sourceType: "entity" | "comment" | "message";
2678
+ recordId: string;
2679
+ content: string;
2680
+ similarity: number;
2681
+ }
2682
+ interface MatchedFacet {
2683
+ similarity: number;
2684
+ askerFacet?: MatchFacetRef;
2685
+ candidateFacet: MatchFacetRef;
2686
+ sampleContent?: SampleContent[];
2687
+ }
2688
+ interface UserMatchResult {
2689
+ user: User;
2690
+ score: number;
2691
+ matchedFacets: MatchedFacet[];
2692
+ }
2693
+ interface MatchUsersResponse {
2694
+ results: UserMatchResult[];
2695
+ }
2696
+ declare function matchUsers(client: SublayHttpClient, data: MatchUsersProps): Promise<MatchUsersResponse>;
2697
+
2613
2698
  declare const Search_askContent: typeof askContent;
2699
+ declare const Search_matchUsers: typeof matchUsers;
2614
2700
  declare const Search_searchContent: typeof searchContent;
2615
2701
  declare const Search_searchSpaces: typeof searchSpaces;
2616
2702
  declare const Search_searchUsers: typeof searchUsers;
2617
2703
  declare namespace Search {
2618
- export { Search_askContent as askContent, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
2704
+ export { Search_askContent as askContent, Search_matchUsers as matchUsers, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
2619
2705
  }
2620
2706
 
2621
2707
  interface UploadedImageVariant {