@singi-labs/sifa-sdk 0.19.32 → 0.19.34

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 (55) hide show
  1. package/dist/{index-piLIwMN1.d.cts → index-CH8NiQwH.d.cts} +18 -1
  2. package/dist/{index-CpbCm2Fe.d.ts → index-ayiu2kGy.d.ts} +18 -1
  3. package/dist/index.cjs +268 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +125 -7
  6. package/dist/index.d.ts +125 -7
  7. package/dist/index.js +262 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsonld/index.d.cts +1 -1
  10. package/dist/jsonld/index.d.ts +1 -1
  11. package/dist/{network-map-BgeHssxs.d.ts → network-map-CtXK5EY7.d.ts} +3 -4
  12. package/dist/{network-map-9VAyPnle.d.cts → network-map-DG4_UpQ4.d.cts} +3 -4
  13. package/dist/{org-BIbPhHLx.d.cts → org-9B__E4ad.d.cts} +5 -256
  14. package/dist/{org-Dx8K7Mh8.d.ts → org-C_s76iQT.d.ts} +5 -256
  15. package/dist/{profile-investment-PDLfao_i.d.cts → profile-investment-BIOYJf-x.d.cts} +12 -1
  16. package/dist/{profile-investment-PDLfao_i.d.ts → profile-investment-BIOYJf-x.d.ts} +12 -1
  17. package/dist/{profile-summary-Bm3gJPKC.d.cts → profile-summary-BYWU098I.d.cts} +1 -1
  18. package/dist/{profile-summary-CHUPtU__.d.ts → profile-summary-DXnFXPlO.d.ts} +1 -1
  19. package/dist/query/fetchers/index.cjs +3 -1
  20. package/dist/query/fetchers/index.cjs.map +1 -1
  21. package/dist/query/fetchers/index.d.cts +6 -6
  22. package/dist/query/fetchers/index.d.ts +6 -6
  23. package/dist/query/fetchers/index.js +3 -1
  24. package/dist/query/fetchers/index.js.map +1 -1
  25. package/dist/query/hooks/index.cjs +3 -1
  26. package/dist/query/hooks/index.cjs.map +1 -1
  27. package/dist/query/hooks/index.d.cts +4 -5
  28. package/dist/query/hooks/index.d.ts +4 -5
  29. package/dist/query/hooks/index.js +3 -1
  30. package/dist/query/hooks/index.js.map +1 -1
  31. package/dist/query/index.cjs +3 -1
  32. package/dist/query/index.cjs.map +1 -1
  33. package/dist/query/index.d.cts +10 -9
  34. package/dist/query/index.d.ts +10 -9
  35. package/dist/query/index.js +3 -1
  36. package/dist/query/index.js.map +1 -1
  37. package/dist/resume/index.d.cts +1 -1
  38. package/dist/resume/index.d.ts +1 -1
  39. package/dist/schemas/index.cjs +7 -0
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +1 -1
  42. package/dist/schemas/index.d.ts +1 -1
  43. package/dist/schemas/index.js +7 -1
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/schemas/write/index.cjs +9 -0
  46. package/dist/schemas/write/index.cjs.map +1 -1
  47. package/dist/schemas/write/index.d.cts +39 -1
  48. package/dist/schemas/write/index.d.ts +39 -1
  49. package/dist/schemas/write/index.js +9 -1
  50. package/dist/schemas/write/index.js.map +1 -1
  51. package/dist/{types-mmGgHkik.d.cts → types-By-g5caY.d.cts} +259 -2
  52. package/dist/{types-Mosj_JIx.d.ts → types-pK_aShdG.d.ts} +259 -2
  53. package/dist/{use-org-notification-emails-Dsek36iZ.d.ts → use-org-notification-emails-BwYnA7tk.d.ts} +3 -3
  54. package/dist/{use-org-notification-emails-OHgt6WRP.d.cts → use-org-notification-emails-DamYHmQc.d.cts} +3 -3
  55. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { w as PresentationLinkView, b as PdsProviderInfo } from './index-piLIwMN1.cjs';
1
+ import { w as PresentationLinkView, b as PdsProviderInfo, T as SkillSuggestion } from './index-CH8NiQwH.cjs';
2
2
 
3
3
  /**
4
4
  * Types for the `id.sifa.getProfileView` XRPC query: the aggregated public
@@ -177,6 +177,11 @@ interface PublicationView {
177
177
  publicationName?: string;
178
178
  image?: string;
179
179
  primary?: boolean;
180
+ relatedIdentifiers?: {
181
+ identifier: string;
182
+ identifierType?: string;
183
+ relationType: string;
184
+ }[];
180
185
  }
181
186
  interface CourseView {
182
187
  rkey: string;
@@ -335,6 +340,258 @@ interface ProfileView {
335
340
  claimed?: boolean;
336
341
  }
337
342
 
343
+ /**
344
+ * Foundation HTTP client for talking to the Sifa AppView.
345
+ *
346
+ * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React
347
+ * hooks read it from context; non-React consumers pass it explicitly). No
348
+ * singletons, no module-level state.
349
+ */
350
+ /** Configuration passed to every fetcher. */
351
+ interface SifaApiConfig {
352
+ /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */
353
+ baseUrl: string;
354
+ /**
355
+ * Optional fetch implementation. Defaults to {@link globalThis.fetch}.
356
+ * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo
357
+ * consumers can leave this unset.
358
+ */
359
+ fetch?: typeof fetch;
360
+ /**
361
+ * Optional per-request auth-token minter for auth-required reads. The NATIVE
362
+ * app supplies this (it has no sifa-api session cookie): given a method NSID
363
+ * (`lxm`), it mints a short-lived AT Protocol service-auth JWT on the user's
364
+ * PDS (see the SDK's `/atproto` `mintServiceAuthToken`) and returns it; the
365
+ * fetcher attaches it as `Authorization: Bearer`. Web omits this and relies on
366
+ * its session cookie (`credentials: 'include'`). Return `null` to send no
367
+ * token. See `sifa-api` `createIdentityMiddleware`.
368
+ */
369
+ getAuthToken?: (lxm: string) => Promise<string | null>;
370
+ }
371
+ /** Options accepted by {@link apiFetch}. */
372
+ interface ApiFetchOptions {
373
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
374
+ /** Request body. Serialized to JSON automatically. */
375
+ body?: unknown;
376
+ /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */
377
+ signal?: AbortSignal;
378
+ /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */
379
+ timeoutMs?: number;
380
+ /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */
381
+ retryOn429?: boolean;
382
+ /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */
383
+ headers?: Record<string, string>;
384
+ credentials?: RequestCredentials;
385
+ cache?: RequestCache;
386
+ /**
387
+ * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed
388
+ * through transparently as part of {@link RequestInit}.
389
+ */
390
+ next?: {
391
+ revalidate?: number | false;
392
+ tags?: string[];
393
+ };
394
+ }
395
+ /** Error thrown by {@link apiFetch} on non-2xx responses. */
396
+ declare class ApiError extends Error {
397
+ readonly status: number;
398
+ readonly body: unknown;
399
+ constructor(message: string, status: number, body?: unknown);
400
+ }
401
+ /**
402
+ * Generic fetcher used by all SDK query and mutation functions.
403
+ *
404
+ * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx
405
+ * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`
406
+ * instead.
407
+ */
408
+ declare function apiFetch<T = unknown>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T>;
409
+ /**
410
+ * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead
411
+ * of throwing. Useful for "fetch by handle" reads where missing is
412
+ * expected (e.g. unknown profile).
413
+ */
414
+ declare function apiFetchOrNull<T>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T | null>;
415
+ /**
416
+ * Result returned by record-write mutations (create / update / delete).
417
+ *
418
+ * Never throws -- writes against the user's PDS can fail in many ways
419
+ * (network, PDS unreachable, rate limit) and the UI needs structured
420
+ * results to render appropriate messages.
421
+ */
422
+ interface WriteResult {
423
+ success: boolean;
424
+ error?: string;
425
+ /**
426
+ * PDS hostname returned by sifa-api when a write failed at the user's
427
+ * Personal Data Server (issue #167). Lets the UI render
428
+ * "Your data server (eurosky.social) isn't responding" instead of a
429
+ * generic "Request failed (500)".
430
+ */
431
+ pdsHost?: string;
432
+ }
433
+ /** Result returned by create mutations. Includes the newly created `rkey`. */
434
+ interface CreateResult extends WriteResult {
435
+ rkey?: string;
436
+ }
437
+ /**
438
+ * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the
439
+ * never-throws contract used by all sifa-web mutations: returns a
440
+ * structured {@link WriteResult} on both success and failure, and
441
+ * preserves the `pdsHost` field when the AppView reports a PDS-side
442
+ * failure (issue #167).
443
+ *
444
+ * On success: returns `{ success: true, ...payload }` where `payload` is
445
+ * whatever the server returned in JSON (or `{}` for 204).
446
+ *
447
+ * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.
448
+ *
449
+ * Use {@link apiWriteCreate} when you specifically need the `rkey` from a
450
+ * create response folded into the result shape.
451
+ */
452
+ declare function apiWrite<TExtra extends object = Record<never, never>>(config: SifaApiConfig, path: string, method: 'POST' | 'PUT' | 'DELETE' | 'PATCH', options?: Omit<ApiFetchOptions, 'method'>): Promise<WriteResult & TExtra>;
453
+ /**
454
+ * Write mutation that expects the server to return a record key (`rkey`)
455
+ * in its response body. Wraps {@link apiWrite} and folds the `rkey` into
456
+ * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.
457
+ *
458
+ * If the server returns additional fields (e.g. `feedUrl` from external
459
+ * account creation), pass them via the `TExtra` generic to keep them
460
+ * typed.
461
+ */
462
+ declare function apiWriteCreate<TExtra extends object = Record<never, never>>(config: SifaApiConfig, path: string, body: unknown, options?: Omit<ApiFetchOptions, 'method' | 'body'>): Promise<CreateResult & TExtra>;
463
+
464
+ /** Profile entry returned by the search endpoint. */
465
+ interface ProfileSearchResult {
466
+ did?: string;
467
+ handle: string;
468
+ displayName?: string;
469
+ headline?: string;
470
+ avatar?: string;
471
+ about?: string;
472
+ currentRole?: string;
473
+ currentCompany?: string;
474
+ industry?: string;
475
+ domain?: string;
476
+ countryCode?: string;
477
+ locationCountry?: string;
478
+ preferredWorkplace?: string[];
479
+ claimed?: boolean;
480
+ blueskyVerified?: boolean;
481
+ blueskyVerifiedAt?: string | null;
482
+ }
483
+ interface SearchFilters {
484
+ q?: string;
485
+ skill?: string;
486
+ country?: string;
487
+ industry?: string;
488
+ domain?: string;
489
+ workplace?: string;
490
+ app?: string;
491
+ /**
492
+ * Open-to filter. Values are short tokens (e.g. "fullTime", "mentor",
493
+ * "collab") matching `OPEN_TO_OPTIONS[].token` from the taxonomy. The
494
+ * API expands tokens to lex values server-side. Multiple tokens are
495
+ * OR-combined (profile matches if any selected token is set).
496
+ */
497
+ openTo?: string[];
498
+ limit?: number;
499
+ }
500
+ interface SearchResponse {
501
+ profiles: ProfileSearchResult[];
502
+ total: number;
503
+ limit: number;
504
+ offset: number;
505
+ }
506
+ /** Skill typeahead suggestion. */
507
+ interface SkillSearchResult {
508
+ name: string;
509
+ slug: string;
510
+ category: string;
511
+ userCount: number;
512
+ }
513
+ interface FilterOptions {
514
+ countries: {
515
+ countryCode: string;
516
+ country: string;
517
+ count: number;
518
+ }[];
519
+ industries: {
520
+ industry: string;
521
+ count: number;
522
+ }[];
523
+ apps: {
524
+ appId: string;
525
+ count: number;
526
+ }[];
527
+ /**
528
+ * Distribution of openTo selections across indexed profiles. Each entry
529
+ * maps a short token (see {@link SearchFilters.openTo}) to the number of
530
+ * profiles that have it set. Omitted from older API responses; treat
531
+ * absence as "no data" rather than "all zero".
532
+ */
533
+ openTo?: {
534
+ token: string;
535
+ count: number;
536
+ }[];
537
+ }
538
+ /** Company entry returned by company search (workspace#299). */
539
+ interface CompanySearchResult {
540
+ /** Immutable catalogue id; the durable `/c/{publicId}` link. */
541
+ publicId: string;
542
+ name: string;
543
+ domain: string | null;
544
+ country: string | null;
545
+ industry: string | null;
546
+ logoUrl: string | null;
547
+ employeeCount: number | null;
548
+ }
549
+ interface CompanySearchFilters {
550
+ q?: string;
551
+ /** ISO 3166-1 alpha-2. */
552
+ country?: string;
553
+ industry?: string;
554
+ limit?: number;
555
+ }
556
+ interface CompanySearchResponse {
557
+ results: CompanySearchResult[];
558
+ hasMore: boolean;
559
+ }
560
+ /**
561
+ * Search profiles by free-text query and optional filters. Returns an
562
+ * empty result set when no filters are provided (matching sifa-web's
563
+ * "no input, no fetch" behavior).
564
+ */
565
+ declare function fetchSearchProfiles(config: SifaApiConfig, filters: SearchFilters, options?: ApiFetchOptions): Promise<SearchResponse>;
566
+ /**
567
+ * Company search over the entity catalogue (workspace#299).
568
+ *
569
+ * A category of its own rather than part of profile search: the two rank
570
+ * differently and carry different filters, and a slow category should not hold
571
+ * up the rest of a blended results page.
572
+ *
573
+ * An empty query returns nothing without a network call. The API rejects a
574
+ * blank `q` rather than scanning ~200k rows, so asking would only spend a round
575
+ * trip to be told no.
576
+ */
577
+ declare function fetchSearchCompanies(config: SifaApiConfig, filters: CompanySearchFilters, options?: ApiFetchOptions): Promise<CompanySearchResponse>;
578
+ /**
579
+ * Skill typeahead. Returns up to 8 matches for the given prefix. Empty
580
+ * input returns an empty array without hitting the server.
581
+ */
582
+ declare function fetchSkillSuggestions(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<SkillSearchResult[]>;
583
+ /** Available filter facets (countries, industries, apps) for search UI. */
584
+ declare function fetchSearchFilters(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FilterOptions>;
585
+ /**
586
+ * Canonical-skill search backing the position-editor and similar
587
+ * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB
588
+ * lookup) which is distinct from {@link fetchSkillSuggestions}'s
589
+ * `/api/search/skills` (the profile-skill typeahead).
590
+ *
591
+ * Returns `[]` on empty input (no network call) or any error.
592
+ */
593
+ declare function searchSkills(config: SifaApiConfig, query: string, limit?: number, options?: ApiFetchOptions): Promise<SkillSuggestion[]>;
594
+
338
595
  /**
339
596
  * Adult-content gating for Bluesky activity items.
340
597
  *
@@ -540,4 +797,4 @@ interface RepoDeleteResult {
540
797
  };
541
798
  }
542
799
 
543
- export { ADULT_CONTENT_LABELS as A, describeSifaRecord as B, type CertificationView as C, type DurationView as D, type EducationView as E, hasAdultContent as F, repoGroupForCollection as G, type HonorView as H, type IndustryDomain as I, type LanguageView as L, type PositionView as P, type RepoCollectionGroup as R, SIFA_REPO_GROUPS as S, type VolunteeringView as V, type ActiveAppView as a, type ActivityLabel as b, type AdultContentLabel as c, type AtfundLinkView as d, type CoSpeakerView as e, type ContributorView as f, type CourseView as g, type ExternalAccountView as h, type InvolvementLinkView as i, type InvolvementView as j, type PresentationDeliveryView as k, type PresentationView as l, type ProfileLocationView as m, type ProfileView as n, type ProjectMemberView as o, type ProjectView as p, type PublicationView as q, type RepoDeleteOutcome as r, type RepoDeleteRecordResult as s, type RepoDeleteResult as t, type RepoGroupDefinition as u, type RepoGroupId as v, type RepoInventory as w, type RepoRecordLabel as x, type RepoRecordSummary as y, type SkillView as z };
800
+ export { apiWriteCreate as $, ADULT_CONTENT_LABELS as A, type SkillView as B, type CertificationView as C, type DurationView as D, type EducationView as E, describeSifaRecord as F, hasAdultContent as G, type HonorView as H, type IndustryDomain as I, repoGroupForCollection as J, type SifaApiConfig as K, type LanguageView as L, type ApiFetchOptions as M, type CreateResult as N, ApiError as O, type PositionView as P, type FilterOptions as Q, type RepoCollectionGroup as R, type SearchFilters as S, type ProfileSearchResult as T, type SearchResponse as U, type VolunteeringView as V, type WriteResult as W, type SkillSearchResult as X, apiFetch as Y, apiFetchOrNull as Z, apiWrite as _, type ActiveAppView as a, fetchSearchFilters as a0, fetchSearchProfiles as a1, fetchSkillSuggestions as a2, searchSkills as a3, type CompanySearchFilters as a4, type CompanySearchResponse as a5, type CompanySearchResult as a6, fetchSearchCompanies as a7, type ActivityLabel as b, type AdultContentLabel as c, type AtfundLinkView as d, type CoSpeakerView as e, type ContributorView as f, type CourseView as g, type ExternalAccountView as h, type InvolvementLinkView as i, type InvolvementView as j, type PresentationDeliveryView as k, type PresentationView as l, type ProfileLocationView as m, type ProfileView as n, type ProjectMemberView as o, type ProjectView as p, type PublicationView as q, type RepoDeleteOutcome as r, type RepoDeleteRecordResult as s, type RepoDeleteResult as t, type RepoGroupDefinition as u, type RepoGroupId as v, type RepoInventory as w, type RepoRecordLabel as x, type RepoRecordSummary as y, SIFA_REPO_GROUPS as z };
@@ -1,4 +1,4 @@
1
- import { w as PresentationLinkView, b as PdsProviderInfo } from './index-CpbCm2Fe.js';
1
+ import { w as PresentationLinkView, b as PdsProviderInfo, T as SkillSuggestion } from './index-ayiu2kGy.js';
2
2
 
3
3
  /**
4
4
  * Types for the `id.sifa.getProfileView` XRPC query: the aggregated public
@@ -177,6 +177,11 @@ interface PublicationView {
177
177
  publicationName?: string;
178
178
  image?: string;
179
179
  primary?: boolean;
180
+ relatedIdentifiers?: {
181
+ identifier: string;
182
+ identifierType?: string;
183
+ relationType: string;
184
+ }[];
180
185
  }
181
186
  interface CourseView {
182
187
  rkey: string;
@@ -335,6 +340,258 @@ interface ProfileView {
335
340
  claimed?: boolean;
336
341
  }
337
342
 
343
+ /**
344
+ * Foundation HTTP client for talking to the Sifa AppView.
345
+ *
346
+ * Stateless. Consumers supply a {@link SifaApiConfig} per call (the React
347
+ * hooks read it from context; non-React consumers pass it explicitly). No
348
+ * singletons, no module-level state.
349
+ */
350
+ /** Configuration passed to every fetcher. */
351
+ interface SifaApiConfig {
352
+ /** Base URL of the sifa-api AppView, e.g. `https://api.sifa.id`. No trailing slash. */
353
+ baseUrl: string;
354
+ /**
355
+ * Optional fetch implementation. Defaults to {@link globalThis.fetch}.
356
+ * Lets Next.js consumers pass their cache-enhanced fetch; node/Expo
357
+ * consumers can leave this unset.
358
+ */
359
+ fetch?: typeof fetch;
360
+ /**
361
+ * Optional per-request auth-token minter for auth-required reads. The NATIVE
362
+ * app supplies this (it has no sifa-api session cookie): given a method NSID
363
+ * (`lxm`), it mints a short-lived AT Protocol service-auth JWT on the user's
364
+ * PDS (see the SDK's `/atproto` `mintServiceAuthToken`) and returns it; the
365
+ * fetcher attaches it as `Authorization: Bearer`. Web omits this and relies on
366
+ * its session cookie (`credentials: 'include'`). Return `null` to send no
367
+ * token. See `sifa-api` `createIdentityMiddleware`.
368
+ */
369
+ getAuthToken?: (lxm: string) => Promise<string | null>;
370
+ }
371
+ /** Options accepted by {@link apiFetch}. */
372
+ interface ApiFetchOptions {
373
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
374
+ /** Request body. Serialized to JSON automatically. */
375
+ body?: unknown;
376
+ /** AbortSignal. Defaults to `AbortSignal.timeout(timeoutMs)` if `timeoutMs` is set. */
377
+ signal?: AbortSignal;
378
+ /** Per-call timeout in milliseconds. Default: 10_000. Ignored if `signal` is provided. */
379
+ timeoutMs?: number;
380
+ /** Retry on HTTP 429 up to 3 times with the server's `Retry-After` delay (capped at 3s). */
381
+ retryOn429?: boolean;
382
+ /** Additional headers. `Content-Type: application/json` is set automatically when `body` is present. */
383
+ headers?: Record<string, string>;
384
+ credentials?: RequestCredentials;
385
+ cache?: RequestCache;
386
+ /**
387
+ * Next.js-specific cache hints. Ignored on non-Next runtimes. Passed
388
+ * through transparently as part of {@link RequestInit}.
389
+ */
390
+ next?: {
391
+ revalidate?: number | false;
392
+ tags?: string[];
393
+ };
394
+ }
395
+ /** Error thrown by {@link apiFetch} on non-2xx responses. */
396
+ declare class ApiError extends Error {
397
+ readonly status: number;
398
+ readonly body: unknown;
399
+ constructor(message: string, status: number, body?: unknown);
400
+ }
401
+ /**
402
+ * Generic fetcher used by all SDK query and mutation functions.
403
+ *
404
+ * Returns parsed JSON typed as `T`. Throws {@link ApiError} on non-2xx
405
+ * responses. Use {@link apiFetchOrNull} when 404 should resolve to `null`
406
+ * instead.
407
+ */
408
+ declare function apiFetch<T = unknown>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T>;
409
+ /**
410
+ * Variant of {@link apiFetch} that resolves to `null` on HTTP 404 instead
411
+ * of throwing. Useful for "fetch by handle" reads where missing is
412
+ * expected (e.g. unknown profile).
413
+ */
414
+ declare function apiFetchOrNull<T>(config: SifaApiConfig, path: string, options?: ApiFetchOptions): Promise<T | null>;
415
+ /**
416
+ * Result returned by record-write mutations (create / update / delete).
417
+ *
418
+ * Never throws -- writes against the user's PDS can fail in many ways
419
+ * (network, PDS unreachable, rate limit) and the UI needs structured
420
+ * results to render appropriate messages.
421
+ */
422
+ interface WriteResult {
423
+ success: boolean;
424
+ error?: string;
425
+ /**
426
+ * PDS hostname returned by sifa-api when a write failed at the user's
427
+ * Personal Data Server (issue #167). Lets the UI render
428
+ * "Your data server (eurosky.social) isn't responding" instead of a
429
+ * generic "Request failed (500)".
430
+ */
431
+ pdsHost?: string;
432
+ }
433
+ /** Result returned by create mutations. Includes the newly created `rkey`. */
434
+ interface CreateResult extends WriteResult {
435
+ rkey?: string;
436
+ }
437
+ /**
438
+ * Write mutation against the Sifa AppView. Wraps {@link apiFetch} with the
439
+ * never-throws contract used by all sifa-web mutations: returns a
440
+ * structured {@link WriteResult} on both success and failure, and
441
+ * preserves the `pdsHost` field when the AppView reports a PDS-side
442
+ * failure (issue #167).
443
+ *
444
+ * On success: returns `{ success: true, ...payload }` where `payload` is
445
+ * whatever the server returned in JSON (or `{}` for 204).
446
+ *
447
+ * On failure: returns `{ success: false, error, pdsHost? }`. Never throws.
448
+ *
449
+ * Use {@link apiWriteCreate} when you specifically need the `rkey` from a
450
+ * create response folded into the result shape.
451
+ */
452
+ declare function apiWrite<TExtra extends object = Record<never, never>>(config: SifaApiConfig, path: string, method: 'POST' | 'PUT' | 'DELETE' | 'PATCH', options?: Omit<ApiFetchOptions, 'method'>): Promise<WriteResult & TExtra>;
453
+ /**
454
+ * Write mutation that expects the server to return a record key (`rkey`)
455
+ * in its response body. Wraps {@link apiWrite} and folds the `rkey` into
456
+ * the result shape so consumers get `{ success, rkey?, error?, pdsHost? }`.
457
+ *
458
+ * If the server returns additional fields (e.g. `feedUrl` from external
459
+ * account creation), pass them via the `TExtra` generic to keep them
460
+ * typed.
461
+ */
462
+ declare function apiWriteCreate<TExtra extends object = Record<never, never>>(config: SifaApiConfig, path: string, body: unknown, options?: Omit<ApiFetchOptions, 'method' | 'body'>): Promise<CreateResult & TExtra>;
463
+
464
+ /** Profile entry returned by the search endpoint. */
465
+ interface ProfileSearchResult {
466
+ did?: string;
467
+ handle: string;
468
+ displayName?: string;
469
+ headline?: string;
470
+ avatar?: string;
471
+ about?: string;
472
+ currentRole?: string;
473
+ currentCompany?: string;
474
+ industry?: string;
475
+ domain?: string;
476
+ countryCode?: string;
477
+ locationCountry?: string;
478
+ preferredWorkplace?: string[];
479
+ claimed?: boolean;
480
+ blueskyVerified?: boolean;
481
+ blueskyVerifiedAt?: string | null;
482
+ }
483
+ interface SearchFilters {
484
+ q?: string;
485
+ skill?: string;
486
+ country?: string;
487
+ industry?: string;
488
+ domain?: string;
489
+ workplace?: string;
490
+ app?: string;
491
+ /**
492
+ * Open-to filter. Values are short tokens (e.g. "fullTime", "mentor",
493
+ * "collab") matching `OPEN_TO_OPTIONS[].token` from the taxonomy. The
494
+ * API expands tokens to lex values server-side. Multiple tokens are
495
+ * OR-combined (profile matches if any selected token is set).
496
+ */
497
+ openTo?: string[];
498
+ limit?: number;
499
+ }
500
+ interface SearchResponse {
501
+ profiles: ProfileSearchResult[];
502
+ total: number;
503
+ limit: number;
504
+ offset: number;
505
+ }
506
+ /** Skill typeahead suggestion. */
507
+ interface SkillSearchResult {
508
+ name: string;
509
+ slug: string;
510
+ category: string;
511
+ userCount: number;
512
+ }
513
+ interface FilterOptions {
514
+ countries: {
515
+ countryCode: string;
516
+ country: string;
517
+ count: number;
518
+ }[];
519
+ industries: {
520
+ industry: string;
521
+ count: number;
522
+ }[];
523
+ apps: {
524
+ appId: string;
525
+ count: number;
526
+ }[];
527
+ /**
528
+ * Distribution of openTo selections across indexed profiles. Each entry
529
+ * maps a short token (see {@link SearchFilters.openTo}) to the number of
530
+ * profiles that have it set. Omitted from older API responses; treat
531
+ * absence as "no data" rather than "all zero".
532
+ */
533
+ openTo?: {
534
+ token: string;
535
+ count: number;
536
+ }[];
537
+ }
538
+ /** Company entry returned by company search (workspace#299). */
539
+ interface CompanySearchResult {
540
+ /** Immutable catalogue id; the durable `/c/{publicId}` link. */
541
+ publicId: string;
542
+ name: string;
543
+ domain: string | null;
544
+ country: string | null;
545
+ industry: string | null;
546
+ logoUrl: string | null;
547
+ employeeCount: number | null;
548
+ }
549
+ interface CompanySearchFilters {
550
+ q?: string;
551
+ /** ISO 3166-1 alpha-2. */
552
+ country?: string;
553
+ industry?: string;
554
+ limit?: number;
555
+ }
556
+ interface CompanySearchResponse {
557
+ results: CompanySearchResult[];
558
+ hasMore: boolean;
559
+ }
560
+ /**
561
+ * Search profiles by free-text query and optional filters. Returns an
562
+ * empty result set when no filters are provided (matching sifa-web's
563
+ * "no input, no fetch" behavior).
564
+ */
565
+ declare function fetchSearchProfiles(config: SifaApiConfig, filters: SearchFilters, options?: ApiFetchOptions): Promise<SearchResponse>;
566
+ /**
567
+ * Company search over the entity catalogue (workspace#299).
568
+ *
569
+ * A category of its own rather than part of profile search: the two rank
570
+ * differently and carry different filters, and a slow category should not hold
571
+ * up the rest of a blended results page.
572
+ *
573
+ * An empty query returns nothing without a network call. The API rejects a
574
+ * blank `q` rather than scanning ~200k rows, so asking would only spend a round
575
+ * trip to be told no.
576
+ */
577
+ declare function fetchSearchCompanies(config: SifaApiConfig, filters: CompanySearchFilters, options?: ApiFetchOptions): Promise<CompanySearchResponse>;
578
+ /**
579
+ * Skill typeahead. Returns up to 8 matches for the given prefix. Empty
580
+ * input returns an empty array without hitting the server.
581
+ */
582
+ declare function fetchSkillSuggestions(config: SifaApiConfig, query: string, options?: ApiFetchOptions): Promise<SkillSearchResult[]>;
583
+ /** Available filter facets (countries, industries, apps) for search UI. */
584
+ declare function fetchSearchFilters(config: SifaApiConfig, options?: ApiFetchOptions): Promise<FilterOptions>;
585
+ /**
586
+ * Canonical-skill search backing the position-editor and similar
587
+ * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB
588
+ * lookup) which is distinct from {@link fetchSkillSuggestions}'s
589
+ * `/api/search/skills` (the profile-skill typeahead).
590
+ *
591
+ * Returns `[]` on empty input (no network call) or any error.
592
+ */
593
+ declare function searchSkills(config: SifaApiConfig, query: string, limit?: number, options?: ApiFetchOptions): Promise<SkillSuggestion[]>;
594
+
338
595
  /**
339
596
  * Adult-content gating for Bluesky activity items.
340
597
  *
@@ -540,4 +797,4 @@ interface RepoDeleteResult {
540
797
  };
541
798
  }
542
799
 
543
- export { ADULT_CONTENT_LABELS as A, describeSifaRecord as B, type CertificationView as C, type DurationView as D, type EducationView as E, hasAdultContent as F, repoGroupForCollection as G, type HonorView as H, type IndustryDomain as I, type LanguageView as L, type PositionView as P, type RepoCollectionGroup as R, SIFA_REPO_GROUPS as S, type VolunteeringView as V, type ActiveAppView as a, type ActivityLabel as b, type AdultContentLabel as c, type AtfundLinkView as d, type CoSpeakerView as e, type ContributorView as f, type CourseView as g, type ExternalAccountView as h, type InvolvementLinkView as i, type InvolvementView as j, type PresentationDeliveryView as k, type PresentationView as l, type ProfileLocationView as m, type ProfileView as n, type ProjectMemberView as o, type ProjectView as p, type PublicationView as q, type RepoDeleteOutcome as r, type RepoDeleteRecordResult as s, type RepoDeleteResult as t, type RepoGroupDefinition as u, type RepoGroupId as v, type RepoInventory as w, type RepoRecordLabel as x, type RepoRecordSummary as y, type SkillView as z };
800
+ export { apiWriteCreate as $, ADULT_CONTENT_LABELS as A, type SkillView as B, type CertificationView as C, type DurationView as D, type EducationView as E, describeSifaRecord as F, hasAdultContent as G, type HonorView as H, type IndustryDomain as I, repoGroupForCollection as J, type SifaApiConfig as K, type LanguageView as L, type ApiFetchOptions as M, type CreateResult as N, ApiError as O, type PositionView as P, type FilterOptions as Q, type RepoCollectionGroup as R, type SearchFilters as S, type ProfileSearchResult as T, type SearchResponse as U, type VolunteeringView as V, type WriteResult as W, type SkillSearchResult as X, apiFetch as Y, apiFetchOrNull as Z, apiWrite as _, type ActiveAppView as a, fetchSearchFilters as a0, fetchSearchProfiles as a1, fetchSkillSuggestions as a2, searchSkills as a3, type CompanySearchFilters as a4, type CompanySearchResponse as a5, type CompanySearchResult as a6, fetchSearchCompanies as a7, type ActivityLabel as b, type AdultContentLabel as c, type AtfundLinkView as d, type CoSpeakerView as e, type ContributorView as f, type CourseView as g, type ExternalAccountView as h, type InvolvementLinkView as i, type InvolvementView as j, type PresentationDeliveryView as k, type PresentationView as l, type ProfileLocationView as m, type ProfileView as n, type ProjectMemberView as o, type ProjectView as p, type PublicationView as q, type RepoDeleteOutcome as r, type RepoDeleteRecordResult as s, type RepoDeleteResult as t, type RepoGroupDefinition as u, type RepoGroupId as v, type RepoInventory as w, type RepoRecordLabel as x, type RepoRecordSummary as y, SIFA_REPO_GROUPS as z };
@@ -1,10 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult, aI as RefreshPdsResult, b0 as UpdateProfileOverrideInput, b1 as UpdateProfileSelfInput, b2 as UploadAvatarResult, b3 as UploadPronunciationAudioResult, C as CreateResult, ar as PrimarySection, aW as SubCategoryBulkResult, aw as ProfileLocationInput, r as ExternalAccountInput, p as CreateExternalAccountResult, b4 as VerifyExternalAccountResult, E as EndorsementInput, n as ConfirmationInput, o as ConfirmationSubjectInput, a1 as GivenConfirmation, aq as PendingConfirmationsPage, ac as InboxCounts, q as DismissUnlinkedPositionInput, a$ as UnlinkedPositionsResult, as as ProfileCompleteness, aH as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, ab as HideProfileItemInput, a6 as HiddenActivityItem, aa as HideActivityItemInput, aZ as UnhideActivityItemInput, aV as StatsResponse, k as AppRegistryEntry, a7 as HiddenApp, d as AccountSummary, Q as FilterOptions, aQ as SearchFilters, aR as SearchResponse, aU as SkillSearchResult, cK as CompanySearchFilters, cL as CompanySearchResponse, t as FeaturedProfile, aT as SimilarProfile, O as FetchSuggestionsOptions, aY as SuggestionsResponse, V as FollowUserResult, y as FetchFollowListOptions, R as FollowListPage, _ as FollowingResponse, G as FetchFollowingFeedOptions, Z as FollowingFeedResponse, z as FetchFollowProfilePageOptions, U as FollowProfilePageResponse, F as FeatureAllowlistResponse, i as AdminReviewQueues, v as FetchActivityFeedOptions, e as ActivityFeedResponse, h as ActivityTeaserResponse, a5 as HeatmapResponse, ae as MyGithubPullRequestsResponse, c as AccountCheckResult, aG as ReactionStatus, aF as ReactionResult, aE as ReactionError, aP as RoadmapVotesResponse, l as CastRoadmapVoteResult, D as DeleteAccountResult, aK as ResetProfileResult, b5 as WipePreview, aJ as RepoDeleteInput, ag as OrgClaimResult, am as OrgProfileUpdateResult, ah as OrgDomainChallengeResult, ai as OrgDomainVerifyResult, aj as OrgNotificationEmailAddResult, ak as OrgNotificationEmailRemoveResult } from './org-Dx8K7Mh8.js';
3
+ import { K as SifaApiConfig, n as ProfileView, W as WriteResult, N as CreateResult, Q as FilterOptions, S as SearchFilters, U as SearchResponse, X as SkillSearchResult, a4 as CompanySearchFilters, a5 as CompanySearchResponse, t as RepoDeleteResult, w as RepoInventory } from './types-pK_aShdG.js';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseQueryOptions, UseMutationOptions, UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
6
- import { c as Profile, d as ProfilePosition, S as SkillRef, p as ExternalAccount, Q as SkillSuggestion, s as OrgFloorVerdict } from './index-CpbCm2Fe.js';
7
- import { n as ProfileView, t as RepoDeleteResult, w as RepoInventory } from './types-Mosj_JIx.js';
6
+ import { c as Profile, d as ProfilePosition, S as SkillRef, p as ExternalAccount, T as SkillSuggestion, s as OrgFloorVerdict } from './index-ayiu2kGy.js';
7
+ import { s as sifaQueryKeys, aB as RefreshPdsResult, aS as UpdateProfileOverrideInput, aT as UpdateProfileSelfInput, aU as UploadAvatarResult, aV as UploadPronunciationAudioResult, al as PrimarySection, aM as SubCategoryBulkResult, aq as ProfileLocationInput, o as ExternalAccountInput, m as CreateExternalAccountResult, aW as VerifyExternalAccountResult, E as EndorsementInput, k as ConfirmationInput, l as ConfirmationSubjectInput, X as GivenConfirmation, ak as PendingConfirmationsPage, a6 as InboxCounts, n as DismissUnlinkedPositionInput, aR as UnlinkedPositionsResult, am as ProfileCompleteness, aA as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, a5 as HideProfileItemInput, a0 as HiddenActivityItem, a4 as HideActivityItemInput, aP as UnhideActivityItemInput, aL as StatsResponse, h as AppRegistryEntry, a1 as HiddenApp, b as AccountSummary, p as FeaturedProfile, aK as SimilarProfile, L as FetchSuggestionsOptions, aO as SuggestionsResponse, Q as FollowUserResult, v as FetchFollowListOptions, N as FollowListPage, U as FollowingResponse, x as FetchFollowingFeedOptions, T as FollowingFeedResponse, w as FetchFollowProfilePageOptions, P as FollowProfilePageResponse, F as FeatureAllowlistResponse, g as AdminReviewQueues, r as FetchActivityFeedOptions, c as ActivityFeedResponse, f as ActivityTeaserResponse, $ as HeatmapResponse, a8 as MyGithubPullRequestsResponse, A as AccountCheckResult, az as ReactionStatus, ay as ReactionResult, ax as ReactionError, aI as RoadmapVotesResponse, i as CastRoadmapVoteResult, D as DeleteAccountResult, aD as ResetProfileResult, aX as WipePreview, aC as RepoDeleteInput, aa as OrgClaimResult, ag as OrgProfileUpdateResult, ab as OrgDomainChallengeResult, ac as OrgDomainVerifyResult, ad as OrgNotificationEmailAddResult, ae as OrgNotificationEmailRemoveResult } from './org-C_s76iQT.js';
8
8
  import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, n as EntitySelectResponse, l as EntitySelectRequest, r as FeatureFlag } from './follow-profile-D1l6pulB.js';
9
9
  import { O as OrgClaimRequestInput, a as OrgProfileUpdateRequestInput, b as OrgDomainChallengeRequestInput, c as OrgDomainVerifyRequestInput, d as OrgNotificationEmailRequestInput } from './org-settings-C73Sin5E.js';
10
10
 
@@ -1,10 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { S as SifaApiConfig, s as sifaQueryKeys, W as WriteResult, aI as RefreshPdsResult, b0 as UpdateProfileOverrideInput, b1 as UpdateProfileSelfInput, b2 as UploadAvatarResult, b3 as UploadPronunciationAudioResult, C as CreateResult, ar as PrimarySection, aW as SubCategoryBulkResult, aw as ProfileLocationInput, r as ExternalAccountInput, p as CreateExternalAccountResult, b4 as VerifyExternalAccountResult, E as EndorsementInput, n as ConfirmationInput, o as ConfirmationSubjectInput, a1 as GivenConfirmation, aq as PendingConfirmationsPage, ac as InboxCounts, q as DismissUnlinkedPositionInput, a$ as UnlinkedPositionsResult, as as ProfileCompleteness, aH as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, ab as HideProfileItemInput, a6 as HiddenActivityItem, aa as HideActivityItemInput, aZ as UnhideActivityItemInput, aV as StatsResponse, k as AppRegistryEntry, a7 as HiddenApp, d as AccountSummary, Q as FilterOptions, aQ as SearchFilters, aR as SearchResponse, aU as SkillSearchResult, cK as CompanySearchFilters, cL as CompanySearchResponse, t as FeaturedProfile, aT as SimilarProfile, O as FetchSuggestionsOptions, aY as SuggestionsResponse, V as FollowUserResult, y as FetchFollowListOptions, R as FollowListPage, _ as FollowingResponse, G as FetchFollowingFeedOptions, Z as FollowingFeedResponse, z as FetchFollowProfilePageOptions, U as FollowProfilePageResponse, F as FeatureAllowlistResponse, i as AdminReviewQueues, v as FetchActivityFeedOptions, e as ActivityFeedResponse, h as ActivityTeaserResponse, a5 as HeatmapResponse, ae as MyGithubPullRequestsResponse, c as AccountCheckResult, aG as ReactionStatus, aF as ReactionResult, aE as ReactionError, aP as RoadmapVotesResponse, l as CastRoadmapVoteResult, D as DeleteAccountResult, aK as ResetProfileResult, b5 as WipePreview, aJ as RepoDeleteInput, ag as OrgClaimResult, am as OrgProfileUpdateResult, ah as OrgDomainChallengeResult, ai as OrgDomainVerifyResult, aj as OrgNotificationEmailAddResult, ak as OrgNotificationEmailRemoveResult } from './org-BIbPhHLx.cjs';
3
+ import { K as SifaApiConfig, n as ProfileView, W as WriteResult, N as CreateResult, Q as FilterOptions, S as SearchFilters, U as SearchResponse, X as SkillSearchResult, a4 as CompanySearchFilters, a5 as CompanySearchResponse, t as RepoDeleteResult, w as RepoInventory } from './types-By-g5caY.cjs';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseQueryOptions, UseMutationOptions, UseInfiniteQueryOptions, InfiniteData } from '@tanstack/react-query';
6
- import { c as Profile, d as ProfilePosition, S as SkillRef, p as ExternalAccount, Q as SkillSuggestion, s as OrgFloorVerdict } from './index-piLIwMN1.cjs';
7
- import { n as ProfileView, t as RepoDeleteResult, w as RepoInventory } from './types-mmGgHkik.cjs';
6
+ import { c as Profile, d as ProfilePosition, S as SkillRef, p as ExternalAccount, T as SkillSuggestion, s as OrgFloorVerdict } from './index-CH8NiQwH.cjs';
7
+ import { s as sifaQueryKeys, aB as RefreshPdsResult, aS as UpdateProfileOverrideInput, aT as UpdateProfileSelfInput, aU as UploadAvatarResult, aV as UploadPronunciationAudioResult, al as PrimarySection, aM as SubCategoryBulkResult, aq as ProfileLocationInput, o as ExternalAccountInput, m as CreateExternalAccountResult, aW as VerifyExternalAccountResult, E as EndorsementInput, k as ConfirmationInput, l as ConfirmationSubjectInput, X as GivenConfirmation, ak as PendingConfirmationsPage, a6 as InboxCounts, n as DismissUnlinkedPositionInput, aR as UnlinkedPositionsResult, am as ProfileCompleteness, aA as RefreshOrcidPublicationsResult, B as BulkHideProfileItemInput, a5 as HideProfileItemInput, a0 as HiddenActivityItem, a4 as HideActivityItemInput, aP as UnhideActivityItemInput, aL as StatsResponse, h as AppRegistryEntry, a1 as HiddenApp, b as AccountSummary, p as FeaturedProfile, aK as SimilarProfile, L as FetchSuggestionsOptions, aO as SuggestionsResponse, Q as FollowUserResult, v as FetchFollowListOptions, N as FollowListPage, U as FollowingResponse, x as FetchFollowingFeedOptions, T as FollowingFeedResponse, w as FetchFollowProfilePageOptions, P as FollowProfilePageResponse, F as FeatureAllowlistResponse, g as AdminReviewQueues, r as FetchActivityFeedOptions, c as ActivityFeedResponse, f as ActivityTeaserResponse, $ as HeatmapResponse, a8 as MyGithubPullRequestsResponse, A as AccountCheckResult, az as ReactionStatus, ay as ReactionResult, ax as ReactionError, aI as RoadmapVotesResponse, i as CastRoadmapVoteResult, D as DeleteAccountResult, aD as ResetProfileResult, aX as WipePreview, aC as RepoDeleteInput, aa as OrgClaimResult, ag as OrgProfileUpdateResult, ab as OrgDomainChallengeResult, ac as OrgDomainVerifyResult, ad as OrgNotificationEmailAddResult, ae as OrgNotificationEmailRemoveResult } from './org-9B__E4ad.cjs';
8
8
  import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, n as EntitySelectResponse, l as EntitySelectRequest, r as FeatureFlag } from './follow-profile-D1l6pulB.cjs';
9
9
  import { O as OrgClaimRequestInput, a as OrgProfileUpdateRequestInput, b as OrgDomainChallengeRequestInput, c as OrgDomainVerifyRequestInput, d as OrgNotificationEmailRequestInput } from './org-settings-C73Sin5E.cjs';
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singi-labs/sifa-sdk",
3
- "version": "0.19.32",
3
+ "version": "0.19.34",
4
4
  "description": "Sifa SDK — public client library for the Sifa AppView on AT Protocol. Shared by sifa-web and sifa-app.",
5
5
  "license": "MIT",
6
6
  "type": "module",