@singi-labs/sifa-sdk 0.19.63 → 0.19.65

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/index.cjs CHANGED
@@ -7197,7 +7197,7 @@ function describeSifaRecord(collection, value) {
7197
7197
  }
7198
7198
 
7199
7199
  // src/index.ts
7200
- var SIFA_SDK_VERSION = "0.19.63";
7200
+ var SIFA_SDK_VERSION = "0.19.65";
7201
7201
 
7202
7202
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
7203
7203
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
package/dist/index.js CHANGED
@@ -353,7 +353,7 @@ import {
353
353
  roadmapIssueUrl
354
354
  } from "./roadmap/index.js";
355
355
  import { SIFA_REPO_GROUPS, describeSifaRecord, repoGroupForCollection } from "./repo/index.js";
356
- var SIFA_SDK_VERSION = "0.19.63";
356
+ var SIFA_SDK_VERSION = "0.19.65";
357
357
  export {
358
358
  ACTIVITY_TIERS,
359
359
  ACTIVITY_VERBS,
@@ -177,10 +177,10 @@ interface PendingEndorsement {
177
177
  */
178
178
  uri: string;
179
179
  /**
180
- * CID of the endorsement record, when the AppView has it. Often absent:
181
- * an endorsement written by another AT Protocol app can be indexed without
182
- * its CID ever reaching us. Pass it through to confirm when present; the
183
- * AppView resolves it from the endorser's PDS when it is not.
180
+ * CID of the endorsement record. The AppView fills it from the endorser's
181
+ * PDS when it indexed the endorsement without one, so a native client can
182
+ * confirm straight to its own PDS. Still absent when that PDS could not be
183
+ * read in time; the web confirm endpoint resolves it then.
184
184
  */
185
185
  cid?: string;
186
186
  /** Absent when this endorsement proposes a skill the subject does not have. */
@@ -177,10 +177,10 @@ interface PendingEndorsement {
177
177
  */
178
178
  uri: string;
179
179
  /**
180
- * CID of the endorsement record, when the AppView has it. Often absent:
181
- * an endorsement written by another AT Protocol app can be indexed without
182
- * its CID ever reaching us. Pass it through to confirm when present; the
183
- * AppView resolves it from the endorser's PDS when it is not.
180
+ * CID of the endorsement record. The AppView fills it from the endorser's
181
+ * PDS when it indexed the endorsement without one, so a native client can
182
+ * confirm straight to its own PDS. Still absent when that PDS could not be
183
+ * read in time; the web confirm endpoint resolves it then.
184
184
  */
185
185
  cid?: string;
186
186
  /** Absent when this endorsement proposes a skill the subject does not have. */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/query/fetchers/endorsement-inbox.ts"],"sourcesContent":["import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A received endorsement the subject has neither confirmed nor dismissed. */\nexport interface PendingEndorsement {\n endorserDid: string;\n /**\n * Endorser's handle, when the AppView has resolved one. Absent when the\n * endorser has no Sifa profile yet -- an endorsement can come from any AT\n * Protocol app -- so the UI needs a fallback for having no name to show.\n */\n endorserHandle?: string;\n /** Endorser's display name (Sifa override wins), for naming them without a handle. */\n endorserDisplayName?: string;\n /** Endorser's avatar URL (Sifa override wins). */\n endorserAvatar?: string;\n rkey: string;\n /**\n * AT-URI of the endorsement record. The confirm mutation needs a strongRef,\n * so the AppView hands this back rather than making callers rebuild it.\n */\n uri: string;\n /**\n * CID of the endorsement record, when the AppView has it. Often absent:\n * an endorsement written by another AT Protocol app can be indexed without\n * its CID ever reaching us. Pass it through to confirm when present; the\n * AppView resolves it from the endorser's PDS when it is not.\n */\n cid?: string;\n /** Absent when this endorsement proposes a skill the subject does not have. */\n skillUri?: string;\n skillCid?: string;\n /**\n * True when accepting this will add `skillName` to the profile as well as\n * publishing the endorsement. The UI must say so: it is a bigger action than\n * confirming an endorsement of a skill already listed.\n */\n proposesNewSkill?: boolean;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface PendingEndorsementsPage {\n endorsements: PendingEndorsement[];\n cursor?: string;\n}\n\n/** Body accepted by {@link dismissEndorsement}. */\nexport interface DismissEndorsementInput {\n endorserDid: string;\n rkey: string;\n}\n\n/** The method binding for the pending-inbox service-auth token; MUST match the\n * sifa-api endpoint's `lxm`. */\nexport const PENDING_ENDORSEMENTS_LXM = 'id.sifa.endorsement.getPending';\n\n/** Options for {@link fetchPendingEndorsements}, adding RSC cookie forwarding. */\nexport interface FetchPendingEndorsementsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Endorsements awaiting the signed-in user's decision. Requires credentials --\n * the AppView reads the subject DID from the caller's identity, not from a\n * parameter, so there is no way to read someone else's inbox.\n *\n * Auth is identity-only server-side, so the NATIVE app supplies\n * `config.getAuthToken` to mint a service-auth Bearer, while WEB relies on its\n * session cookie (`credentials: 'include'`).\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingEndorsements(\n config: SifaApiConfig,\n options: FetchPendingEndorsementsOptions = {},\n): Promise<PendingEndorsementsPage> {\n const { cookieHeader, ...rest } = options;\n const headers: Record<string, string> = { ...(rest.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n if (config.getAuthToken) {\n const token = await config.getAuthToken(PENDING_ENDORSEMENTS_LXM);\n if (token) headers.Authorization = `Bearer ${token}`;\n }\n try {\n const data = await apiFetch<PendingEndorsementsPage>(config, '/api/endorsements/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...rest,\n headers,\n });\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n\n/**\n * Take a received endorsement out of the inbox.\n *\n * This writes nothing to any PDS. An endorsement only displays once the subject\n * has confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection.\n */\nexport function dismissEndorsement(\n config: SifaApiConfig,\n data: DismissEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/endorsement/dismiss', 'POST', { body: data, ...options });\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAuDA,IAAM,2BAA2B;AAwBxC,eAAsB,yBACpB,QACA,UAA2C,CAAC,GACV;AAClC,QAAM,EAAE,cAAc,GAAG,KAAK,IAAI;AAClC,QAAM,UAAkC,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG;AAClE,MAAI,aAAc,SAAQ,SAAS;AACnC,MAAI,OAAO,cAAc;AACvB,UAAM,QAAQ,MAAM,OAAO,aAAa,wBAAwB;AAChE,QAAI,MAAO,SAAQ,gBAAgB,UAAU,KAAK;AAAA,EACpD;AACA,MAAI;AACF,UAAM,OAAO,MAAM,SAAkC,QAAQ,6BAA6B;AAAA,MACxF,OAAO;AAAA,MACP,aAAa;AAAA,MACb,WAAW;AAAA,MACX,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AACD,WAAO,EAAE,cAAc,MAAM,gBAAgB,CAAC,GAAG,QAAQ,MAAM,OAAO;AAAA,EACxE,QAAQ;AACN,WAAO,EAAE,cAAc,CAAC,EAAE;AAAA,EAC5B;AACF;AASO,SAAS,mBACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,4BAA4B,QAAQ,EAAE,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxF;","names":[]}
1
+ {"version":3,"sources":["../../../src/query/fetchers/endorsement-inbox.ts"],"sourcesContent":["import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** A received endorsement the subject has neither confirmed nor dismissed. */\nexport interface PendingEndorsement {\n endorserDid: string;\n /**\n * Endorser's handle, when the AppView has resolved one. Absent when the\n * endorser has no Sifa profile yet -- an endorsement can come from any AT\n * Protocol app -- so the UI needs a fallback for having no name to show.\n */\n endorserHandle?: string;\n /** Endorser's display name (Sifa override wins), for naming them without a handle. */\n endorserDisplayName?: string;\n /** Endorser's avatar URL (Sifa override wins). */\n endorserAvatar?: string;\n rkey: string;\n /**\n * AT-URI of the endorsement record. The confirm mutation needs a strongRef,\n * so the AppView hands this back rather than making callers rebuild it.\n */\n uri: string;\n /**\n * CID of the endorsement record. The AppView fills it from the endorser's\n * PDS when it indexed the endorsement without one, so a native client can\n * confirm straight to its own PDS. Still absent when that PDS could not be\n * read in time; the web confirm endpoint resolves it then.\n */\n cid?: string;\n /** Absent when this endorsement proposes a skill the subject does not have. */\n skillUri?: string;\n skillCid?: string;\n /**\n * True when accepting this will add `skillName` to the profile as well as\n * publishing the endorsement. The UI must say so: it is a bigger action than\n * confirming an endorsement of a skill already listed.\n */\n proposesNewSkill?: boolean;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface PendingEndorsementsPage {\n endorsements: PendingEndorsement[];\n cursor?: string;\n}\n\n/** Body accepted by {@link dismissEndorsement}. */\nexport interface DismissEndorsementInput {\n endorserDid: string;\n rkey: string;\n}\n\n/** The method binding for the pending-inbox service-auth token; MUST match the\n * sifa-api endpoint's `lxm`. */\nexport const PENDING_ENDORSEMENTS_LXM = 'id.sifa.endorsement.getPending';\n\n/** Options for {@link fetchPendingEndorsements}, adding RSC cookie forwarding. */\nexport interface FetchPendingEndorsementsOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * `credentials: 'include'` does NOT propagate browser cookies in RSC,\n * so authenticated server fetches must forward the header explicitly.\n */\n cookieHeader?: string;\n}\n\n/**\n * Endorsements awaiting the signed-in user's decision. Requires credentials --\n * the AppView reads the subject DID from the caller's identity, not from a\n * parameter, so there is no way to read someone else's inbox.\n *\n * Auth is identity-only server-side, so the NATIVE app supplies\n * `config.getAuthToken` to mint a service-auth Bearer, while WEB relies on its\n * session cookie (`credentials: 'include'`).\n *\n * Returns an empty page on failure so a broken inbox degrades to \"nothing\n * pending\" rather than breaking the surface hosting it.\n */\nexport async function fetchPendingEndorsements(\n config: SifaApiConfig,\n options: FetchPendingEndorsementsOptions = {},\n): Promise<PendingEndorsementsPage> {\n const { cookieHeader, ...rest } = options;\n const headers: Record<string, string> = { ...(rest.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n if (config.getAuthToken) {\n const token = await config.getAuthToken(PENDING_ENDORSEMENTS_LXM);\n if (token) headers.Authorization = `Bearer ${token}`;\n }\n try {\n const data = await apiFetch<PendingEndorsementsPage>(config, '/api/endorsements/pending', {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...rest,\n headers,\n });\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n\n/**\n * Take a received endorsement out of the inbox.\n *\n * This writes nothing to any PDS. An endorsement only displays once the subject\n * has confirmed it, so declining is already the default state -- the dismissal\n * is a local flag that stops it reappearing, not a published rejection.\n */\nexport function dismissEndorsement(\n config: SifaApiConfig,\n data: DismissEndorsementInput,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/endorsement/dismiss', 'POST', { body: data, ...options });\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAuDA,IAAM,2BAA2B;AAwBxC,eAAsB,yBACpB,QACA,UAA2C,CAAC,GACV;AAClC,QAAM,EAAE,cAAc,GAAG,KAAK,IAAI;AAClC,QAAM,UAAkC,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG;AAClE,MAAI,aAAc,SAAQ,SAAS;AACnC,MAAI,OAAO,cAAc;AACvB,UAAM,QAAQ,MAAM,OAAO,aAAa,wBAAwB;AAChE,QAAI,MAAO,SAAQ,gBAAgB,UAAU,KAAK;AAAA,EACpD;AACA,MAAI;AACF,UAAM,OAAO,MAAM,SAAkC,QAAQ,6BAA6B;AAAA,MACxF,OAAO;AAAA,MACP,aAAa;AAAA,MACb,WAAW;AAAA,MACX,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AACD,WAAO,EAAE,cAAc,MAAM,gBAAgB,CAAC,GAAG,QAAQ,MAAM,OAAO;AAAA,EACxE,QAAQ;AACN,WAAO,EAAE,cAAc,CAAC,EAAE;AAAA,EAC5B;AACF;AASO,SAAS,mBACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,4BAA4B,QAAQ,EAAE,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxF;","names":[]}