@singi-labs/sifa-sdk 0.19.108 → 0.19.110
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/germ-declaration-BQBocGww.d.cts +33 -0
- package/dist/germ-declaration-BQBocGww.d.ts +33 -0
- package/dist/index.cjs +82 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/logic/germ.js +71 -0
- package/dist/logic/germ.js.map +1 -0
- package/dist/logic/index.js +14 -0
- package/dist/logic/index.js.map +1 -1
- package/dist/{network-map-CVr1LskK.d.cts → network-map-CInWwHXW.d.cts} +41 -1
- package/dist/{network-map-DTlhFNIf.d.ts → network-map-zDjAIXXR.d.ts} +41 -1
- package/dist/query/fetchers/germ.js +46 -0
- package/dist/query/fetchers/germ.js.map +1 -0
- package/dist/query/fetchers/index.cjs +50 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +2 -1
- package/dist/query/fetchers/index.d.ts +2 -1
- package/dist/query/fetchers/index.js +6 -0
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/index.cjs +50 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -2
- package/dist/query/index.d.ts +3 -2
- package/dist/query/index.js +6 -0
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/germ-declaration.js +17 -0
- package/dist/schemas/germ-declaration.js.map +1 -0
- package/dist/schemas/index.cjs +12 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +6 -0
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as Profile, d as ProfilePosition, Y as SkillRef, D as PresentationLinkView } from './index-BQAKeEoj.cjs';
|
|
2
2
|
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-jE1ofoPI.cjs';
|
|
3
|
+
import { c as GermShowButtonTo } from './germ-declaration-BQBocGww.cjs';
|
|
3
4
|
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-C5LlxPKK.cjs';
|
|
4
5
|
import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, l as EntitySelectRequest, n as EntitySelectResponse } from './follow-profile-CgLLLQtJ.cjs';
|
|
5
6
|
|
|
@@ -19,6 +20,45 @@ declare function fetchProfile(config: SifaApiConfig, handleOrDid: string, option
|
|
|
19
20
|
*/
|
|
20
21
|
declare function fetchAtFundLink(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<string | null>;
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Germ DM state of a profile, as seen by the current viewer.
|
|
25
|
+
*
|
|
26
|
+
* - `eligible`: render the "Message on Germ" button. Its `href` is
|
|
27
|
+
* {@link germRedirectPath}, which counts the click and forwards to Germ.
|
|
28
|
+
* - `owner`: the viewer looks at their own profile. `showButtonTo` is the
|
|
29
|
+
* owner's Germ setting, for a status note; `null` when the record has no
|
|
30
|
+
* `messageMe` or the value is not one Sifa knows.
|
|
31
|
+
*
|
|
32
|
+
* `null` means no button and no note.
|
|
33
|
+
*/
|
|
34
|
+
type GermMessageLink = {
|
|
35
|
+
status: 'eligible';
|
|
36
|
+
} | {
|
|
37
|
+
status: 'owner';
|
|
38
|
+
showButtonTo: GermShowButtonTo | null;
|
|
39
|
+
};
|
|
40
|
+
interface FetchGermMessageLinkOptions extends ApiFetchOptions {
|
|
41
|
+
/** Raw `Cookie` header for RSC calls, so the API sees the viewer's session. */
|
|
42
|
+
cookieHeader?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The visitor's User-Agent, for RSC calls. The API uses it for the platform
|
|
45
|
+
* hint, the iPhone/iPad-only mode and bot-free show counts.
|
|
46
|
+
*/
|
|
47
|
+
viewerUserAgent?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Germ DM state for a profile (see {@link GermMessageLink}). Pass the viewer's
|
|
51
|
+
* `cookieHeader` and `viewerUserAgent` from server components; without a
|
|
52
|
+
* cookie the result is the logged-out view. Returns `null` on any error.
|
|
53
|
+
*/
|
|
54
|
+
declare function fetchGermMessageLink(config: SifaApiConfig, did: string, options?: FetchGermMessageLinkOptions): Promise<GermMessageLink | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Path of the click route the button links to. The route re-checks the
|
|
57
|
+
* viewer, counts the click and redirects to Germ, so clicks are counted
|
|
58
|
+
* without client-side JavaScript. Prefix it with the API origin.
|
|
59
|
+
*/
|
|
60
|
+
declare function germRedirectPath(did: string): string;
|
|
61
|
+
|
|
22
62
|
/**
|
|
23
63
|
* Read the aggregated public profile view via the `id.sifa.getProfileView`
|
|
24
64
|
* XRPC query. This is the AppView-only join (positions, education, skills,
|
|
@@ -509,4 +549,4 @@ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string,
|
|
|
509
549
|
*/
|
|
510
550
|
declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
|
|
511
551
|
|
|
512
|
-
export {
|
|
552
|
+
export { mintEntityDomain as $, fetchEndorsementCount as A, fetchEntitySearch as B, fetchGermMessageLink as C, type DismissEndorsementInput as D, fetchGetProfileView as E, type FetchGermMessageLinkOptions as F, type GermMessageLink as G, fetchNetworkMap as H, fetchNetworkStreamCount as I, fetchPendingEndorsements as J, fetchProfile as K, fetchProfileSummary as L, fetchReceivedEndorsements as M, type NetworkMapEdge as N, fetchReciprocityCandidate as O, type PendingEndorsementsPage as P, fetchSpeakers as Q, type ReceivedEndorsementsPage as R, type SpeakerCard as S, type TalkEvent as T, fetchTalks as U, germRedirectPath as V, hideKeytraceClaim as W, importSearchEntities as X, initiateNetworkMapGeneration as Y, isNetworkMapResponse as Z, linkSkillToPosition as _, type ReciprocityCandidate as a, resolveEntityDomain as a0, revealMarqueDomain as a1, selectEntity as a2, setPositionPrimary as a3, unhideKeytraceClaim as a4, unlinkSkillFromPosition as a5, unrevealMarqueDomain as a6, unsetPositionPrimary as a7, updateEducation as a8, updatePosition as a9, updateRecord as aa, type FetchNetworkStreamCountOptions as b, type FetchPendingEndorsementsOptions as c, type NetworkMapGenerationJob as d, type NetworkMapGraphData as e, type NetworkMapNode as f, type NetworkMapPendingJob as g, type NetworkMapResponse as h, type PendingEndorsement as i, type ReceivedEndorsement as j, type ReciprocitySkill as k, type SpeakerDirectoryFilters as l, type SpeakerGroup as m, type SpeakersResponse as n, type TalkRow as o, type TalkSpeaker as p, type TalksResponse as q, checkNetworkMapJobStatus as r, createEducation as s, createPosition as t, createRecord as u, deleteEducation as v, deletePosition as w, deleteRecord as x, dismissEndorsement as y, fetchAtFundLink as z };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as Profile, d as ProfilePosition, Y as SkillRef, D as PresentationLinkView } from './index-DDh2RLvx.js';
|
|
2
2
|
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-B0zZiWDH.js';
|
|
3
|
+
import { c as GermShowButtonTo } from './germ-declaration-BQBocGww.js';
|
|
3
4
|
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-0T0VS7Rz.js';
|
|
4
5
|
import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, l as EntitySelectRequest, n as EntitySelectResponse } from './follow-profile-CVcA2w1v.js';
|
|
5
6
|
|
|
@@ -19,6 +20,45 @@ declare function fetchProfile(config: SifaApiConfig, handleOrDid: string, option
|
|
|
19
20
|
*/
|
|
20
21
|
declare function fetchAtFundLink(config: SifaApiConfig, did: string, options?: ApiFetchOptions): Promise<string | null>;
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Germ DM state of a profile, as seen by the current viewer.
|
|
25
|
+
*
|
|
26
|
+
* - `eligible`: render the "Message on Germ" button. Its `href` is
|
|
27
|
+
* {@link germRedirectPath}, which counts the click and forwards to Germ.
|
|
28
|
+
* - `owner`: the viewer looks at their own profile. `showButtonTo` is the
|
|
29
|
+
* owner's Germ setting, for a status note; `null` when the record has no
|
|
30
|
+
* `messageMe` or the value is not one Sifa knows.
|
|
31
|
+
*
|
|
32
|
+
* `null` means no button and no note.
|
|
33
|
+
*/
|
|
34
|
+
type GermMessageLink = {
|
|
35
|
+
status: 'eligible';
|
|
36
|
+
} | {
|
|
37
|
+
status: 'owner';
|
|
38
|
+
showButtonTo: GermShowButtonTo | null;
|
|
39
|
+
};
|
|
40
|
+
interface FetchGermMessageLinkOptions extends ApiFetchOptions {
|
|
41
|
+
/** Raw `Cookie` header for RSC calls, so the API sees the viewer's session. */
|
|
42
|
+
cookieHeader?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The visitor's User-Agent, for RSC calls. The API uses it for the platform
|
|
45
|
+
* hint, the iPhone/iPad-only mode and bot-free show counts.
|
|
46
|
+
*/
|
|
47
|
+
viewerUserAgent?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Germ DM state for a profile (see {@link GermMessageLink}). Pass the viewer's
|
|
51
|
+
* `cookieHeader` and `viewerUserAgent` from server components; without a
|
|
52
|
+
* cookie the result is the logged-out view. Returns `null` on any error.
|
|
53
|
+
*/
|
|
54
|
+
declare function fetchGermMessageLink(config: SifaApiConfig, did: string, options?: FetchGermMessageLinkOptions): Promise<GermMessageLink | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Path of the click route the button links to. The route re-checks the
|
|
57
|
+
* viewer, counts the click and redirects to Germ, so clicks are counted
|
|
58
|
+
* without client-side JavaScript. Prefix it with the API origin.
|
|
59
|
+
*/
|
|
60
|
+
declare function germRedirectPath(did: string): string;
|
|
61
|
+
|
|
22
62
|
/**
|
|
23
63
|
* Read the aggregated public profile view via the `id.sifa.getProfileView`
|
|
24
64
|
* XRPC query. This is the AppView-only join (positions, education, skills,
|
|
@@ -509,4 +549,4 @@ declare function checkNetworkMapJobStatus(config: SifaApiConfig, jobId: string,
|
|
|
509
549
|
*/
|
|
510
550
|
declare function fetchNetworkMap(config: SifaApiConfig, options?: ApiFetchOptions): Promise<NetworkMapResponse | null>;
|
|
511
551
|
|
|
512
|
-
export {
|
|
552
|
+
export { mintEntityDomain as $, fetchEndorsementCount as A, fetchEntitySearch as B, fetchGermMessageLink as C, type DismissEndorsementInput as D, fetchGetProfileView as E, type FetchGermMessageLinkOptions as F, type GermMessageLink as G, fetchNetworkMap as H, fetchNetworkStreamCount as I, fetchPendingEndorsements as J, fetchProfile as K, fetchProfileSummary as L, fetchReceivedEndorsements as M, type NetworkMapEdge as N, fetchReciprocityCandidate as O, type PendingEndorsementsPage as P, fetchSpeakers as Q, type ReceivedEndorsementsPage as R, type SpeakerCard as S, type TalkEvent as T, fetchTalks as U, germRedirectPath as V, hideKeytraceClaim as W, importSearchEntities as X, initiateNetworkMapGeneration as Y, isNetworkMapResponse as Z, linkSkillToPosition as _, type ReciprocityCandidate as a, resolveEntityDomain as a0, revealMarqueDomain as a1, selectEntity as a2, setPositionPrimary as a3, unhideKeytraceClaim as a4, unlinkSkillFromPosition as a5, unrevealMarqueDomain as a6, unsetPositionPrimary as a7, updateEducation as a8, updatePosition as a9, updateRecord as aa, type FetchNetworkStreamCountOptions as b, type FetchPendingEndorsementsOptions as c, type NetworkMapGenerationJob as d, type NetworkMapGraphData as e, type NetworkMapNode as f, type NetworkMapPendingJob as g, type NetworkMapResponse as h, type PendingEndorsement as i, type ReceivedEndorsement as j, type ReciprocitySkill as k, type SpeakerDirectoryFilters as l, type SpeakerGroup as m, type SpeakersResponse as n, type TalkRow as o, type TalkSpeaker as p, type TalksResponse as q, checkNetworkMapJobStatus as r, createEducation as s, createPosition as t, createRecord as u, deleteEducation as v, deletePosition as w, deleteRecord as x, dismissEndorsement as y, fetchAtFundLink as z };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/query/fetchers/germ.ts
|
|
2
|
+
import {
|
|
3
|
+
GERM_SHOW_BUTTON_TO_VALUES
|
|
4
|
+
} from "../../schemas/germ-declaration.js";
|
|
5
|
+
import { apiFetch, encodeIdentifier } from "../client.js";
|
|
6
|
+
var GERM_LINK_TIMEOUT_MS = 1500;
|
|
7
|
+
function isShowButtonTo(value) {
|
|
8
|
+
return GERM_SHOW_BUTTON_TO_VALUES.includes(value);
|
|
9
|
+
}
|
|
10
|
+
function parseGermMessageLink(data) {
|
|
11
|
+
if (typeof data !== "object" || data === null) return null;
|
|
12
|
+
const { status, showButtonTo } = data;
|
|
13
|
+
if (status === "eligible") return { status: "eligible" };
|
|
14
|
+
if (status === "owner") {
|
|
15
|
+
if (showButtonTo === void 0 || showButtonTo === null) {
|
|
16
|
+
return { status: "owner", showButtonTo: null };
|
|
17
|
+
}
|
|
18
|
+
if (isShowButtonTo(showButtonTo)) return { status: "owner", showButtonTo };
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
async function fetchGermMessageLink(config, did, options = {}) {
|
|
23
|
+
const { cookieHeader, viewerUserAgent, ...rest } = options;
|
|
24
|
+
const headers = { ...rest.headers ?? {} };
|
|
25
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
26
|
+
if (viewerUserAgent) headers["x-viewer-user-agent"] = viewerUserAgent;
|
|
27
|
+
const caching = { cache: "no-store", next: void 0 };
|
|
28
|
+
try {
|
|
29
|
+
const data = await apiFetch(
|
|
30
|
+
config,
|
|
31
|
+
`/api/profiles/${encodeIdentifier(did)}/germ-message-link`,
|
|
32
|
+
{ timeoutMs: GERM_LINK_TIMEOUT_MS, credentials: "include", ...rest, ...caching, headers }
|
|
33
|
+
);
|
|
34
|
+
return parseGermMessageLink(data);
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function germRedirectPath(did) {
|
|
40
|
+
return `/api/profiles/${encodeIdentifier(did)}/germ-redirect`;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
fetchGermMessageLink,
|
|
44
|
+
germRedirectPath
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=germ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/germ.ts"],"sourcesContent":["import {\n GERM_SHOW_BUTTON_TO_VALUES,\n type GermShowButtonTo,\n} from '../../schemas/germ-declaration.js';\nimport { apiFetch, encodeIdentifier, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Germ DM state of a profile, as seen by the current viewer.\n *\n * - `eligible`: render the \"Message on Germ\" button. Its `href` is\n * {@link germRedirectPath}, which counts the click and forwards to Germ.\n * - `owner`: the viewer looks at their own profile. `showButtonTo` is the\n * owner's Germ setting, for a status note; `null` when the record has no\n * `messageMe` or the value is not one Sifa knows.\n *\n * `null` means no button and no note.\n */\nexport type GermMessageLink =\n { status: 'eligible' } | { status: 'owner'; showButtonTo: GermShowButtonTo | null };\n\nexport interface FetchGermMessageLinkOptions extends ApiFetchOptions {\n /** Raw `Cookie` header for RSC calls, so the API sees the viewer's session. */\n cookieHeader?: string;\n /**\n * The visitor's User-Agent, for RSC calls. The API uses it for the platform\n * hint, the iPhone/iPad-only mode and bot-free show counts.\n */\n viewerUserAgent?: string;\n}\n\n// Below the profile page's patience: a slow lookup drops the button, not the page.\nconst GERM_LINK_TIMEOUT_MS = 1500;\n\nfunction isShowButtonTo(value: unknown): value is GermShowButtonTo {\n return (GERM_SHOW_BUTTON_TO_VALUES as readonly unknown[]).includes(value);\n}\n\nfunction parseGermMessageLink(data: unknown): GermMessageLink | null {\n if (typeof data !== 'object' || data === null) return null;\n const { status, showButtonTo } = data as { status?: unknown; showButtonTo?: unknown };\n if (status === 'eligible') return { status: 'eligible' };\n if (status === 'owner') {\n if (showButtonTo === undefined || showButtonTo === null) {\n return { status: 'owner', showButtonTo: null };\n }\n if (isShowButtonTo(showButtonTo)) return { status: 'owner', showButtonTo };\n }\n return null;\n}\n\n/**\n * Germ DM state for a profile (see {@link GermMessageLink}). Pass the viewer's\n * `cookieHeader` and `viewerUserAgent` from server components; without a\n * cookie the result is the logged-out view. Returns `null` on any error.\n */\nexport async function fetchGermMessageLink(\n config: SifaApiConfig,\n did: string,\n options: FetchGermMessageLinkOptions = {},\n): Promise<GermMessageLink | null> {\n const { cookieHeader, viewerUserAgent, ...rest } = options;\n const headers: Record<string, string> = { ...(rest.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n if (viewerUserAgent) headers['x-viewer-user-agent'] = viewerUserAgent;\n // Applied last, never cached: the answer depends on the viewer and device,\n // and each call counts as a shown button. The API caches the lookups.\n const caching: ApiFetchOptions = { cache: 'no-store', next: undefined };\n try {\n const data = await apiFetch<unknown>(\n config,\n `/api/profiles/${encodeIdentifier(did)}/germ-message-link`,\n { timeoutMs: GERM_LINK_TIMEOUT_MS, credentials: 'include', ...rest, ...caching, headers },\n );\n return parseGermMessageLink(data);\n } catch {\n return null;\n }\n}\n\n/**\n * Path of the click route the button links to. The route re-checks the\n * viewer, counts the click and redirects to Germ, so clicks are counted\n * without client-side JavaScript. Prefix it with the API origin.\n */\nexport function germRedirectPath(did: string): string {\n return `/api/profiles/${encodeIdentifier(did)}/germ-redirect`;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAEK;AACP,SAAS,UAAU,wBAAkE;AA2BrF,IAAM,uBAAuB;AAE7B,SAAS,eAAe,OAA2C;AACjE,SAAQ,2BAAkD,SAAS,KAAK;AAC1E;AAEA,SAAS,qBAAqB,MAAuC;AACnE,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,QAAQ,aAAa,IAAI;AACjC,MAAI,WAAW,WAAY,QAAO,EAAE,QAAQ,WAAW;AACvD,MAAI,WAAW,SAAS;AACtB,QAAI,iBAAiB,UAAa,iBAAiB,MAAM;AACvD,aAAO,EAAE,QAAQ,SAAS,cAAc,KAAK;AAAA,IAC/C;AACA,QAAI,eAAe,YAAY,EAAG,QAAO,EAAE,QAAQ,SAAS,aAAa;AAAA,EAC3E;AACA,SAAO;AACT;AAOA,eAAsB,qBACpB,QACA,KACA,UAAuC,CAAC,GACP;AACjC,QAAM,EAAE,cAAc,iBAAiB,GAAG,KAAK,IAAI;AACnD,QAAM,UAAkC,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG;AAClE,MAAI,aAAc,SAAQ,SAAS;AACnC,MAAI,gBAAiB,SAAQ,qBAAqB,IAAI;AAGtD,QAAM,UAA2B,EAAE,OAAO,YAAY,MAAM,OAAU;AACtE,MAAI;AACF,UAAM,OAAO,MAAM;AAAA,MACjB;AAAA,MACA,iBAAiB,iBAAiB,GAAG,CAAC;AAAA,MACtC,EAAE,WAAW,sBAAsB,aAAa,WAAW,GAAG,MAAM,GAAG,SAAS,QAAQ;AAAA,IAC1F;AACA,WAAO,qBAAqB,IAAI;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,iBAAiB,KAAqB;AACpD,SAAO,iBAAiB,iBAAiB,GAAG,CAAC;AAC/C;","names":[]}
|
|
@@ -154,6 +154,54 @@ async function fetchAtFundLink(config, did, options = {}) {
|
|
|
154
154
|
return null;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
var GERM_SHOW_BUTTON_TO_VALUES = ["none", "usersIFollow", "everyone"];
|
|
158
|
+
zod.z.object({
|
|
159
|
+
version: zod.z.string().min(5).max(14),
|
|
160
|
+
// JSON form (`{ $bytes }`, PDS and Jetstream) or decoded CBOR (`Uint8Array`).
|
|
161
|
+
currentKey: zod.z.union([zod.z.object({ $bytes: zod.z.string() }), zod.z.instanceof(Uint8Array)]),
|
|
162
|
+
messageMe: zod.z.object({
|
|
163
|
+
showButtonTo: zod.z.string().min(1).max(100),
|
|
164
|
+
messageMeUrl: zod.z.string().min(1).max(2047)
|
|
165
|
+
}).optional()
|
|
166
|
+
}).passthrough();
|
|
167
|
+
|
|
168
|
+
// src/query/fetchers/germ.ts
|
|
169
|
+
var GERM_LINK_TIMEOUT_MS = 1500;
|
|
170
|
+
function isShowButtonTo(value) {
|
|
171
|
+
return GERM_SHOW_BUTTON_TO_VALUES.includes(value);
|
|
172
|
+
}
|
|
173
|
+
function parseGermMessageLink(data) {
|
|
174
|
+
if (typeof data !== "object" || data === null) return null;
|
|
175
|
+
const { status, showButtonTo } = data;
|
|
176
|
+
if (status === "eligible") return { status: "eligible" };
|
|
177
|
+
if (status === "owner") {
|
|
178
|
+
if (showButtonTo === void 0 || showButtonTo === null) {
|
|
179
|
+
return { status: "owner", showButtonTo: null };
|
|
180
|
+
}
|
|
181
|
+
if (isShowButtonTo(showButtonTo)) return { status: "owner", showButtonTo };
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
async function fetchGermMessageLink(config, did, options = {}) {
|
|
186
|
+
const { cookieHeader, viewerUserAgent, ...rest } = options;
|
|
187
|
+
const headers = { ...rest.headers ?? {} };
|
|
188
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
189
|
+
if (viewerUserAgent) headers["x-viewer-user-agent"] = viewerUserAgent;
|
|
190
|
+
const caching = { cache: "no-store", next: void 0 };
|
|
191
|
+
try {
|
|
192
|
+
const data = await apiFetch(
|
|
193
|
+
config,
|
|
194
|
+
`/api/profiles/${encodeIdentifier(did)}/germ-message-link`,
|
|
195
|
+
{ timeoutMs: GERM_LINK_TIMEOUT_MS, credentials: "include", ...rest, ...caching, headers }
|
|
196
|
+
);
|
|
197
|
+
return parseGermMessageLink(data);
|
|
198
|
+
} catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function germRedirectPath(did) {
|
|
203
|
+
return `/api/profiles/${encodeIdentifier(did)}/germ-redirect`;
|
|
204
|
+
}
|
|
157
205
|
|
|
158
206
|
// src/query/fetchers/get-profile-view.ts
|
|
159
207
|
async function fetchGetProfileView(config, actor, options = {}) {
|
|
@@ -2329,6 +2377,7 @@ exports.fetchFeaturedProfile = fetchFeaturedProfile;
|
|
|
2329
2377
|
exports.fetchFollowing = fetchFollowing;
|
|
2330
2378
|
exports.fetchFollowingFeed = fetchFollowingFeed;
|
|
2331
2379
|
exports.fetchFollowingFeedVersion = fetchFollowingFeedVersion;
|
|
2380
|
+
exports.fetchGermMessageLink = fetchGermMessageLink;
|
|
2332
2381
|
exports.fetchGetProfileView = fetchGetProfileView;
|
|
2333
2382
|
exports.fetchGivenConfirmations = fetchGivenConfirmations;
|
|
2334
2383
|
exports.fetchHeatmapData = fetchHeatmapData;
|
|
@@ -2367,6 +2416,7 @@ exports.fetchUserSettings = fetchUserSettings;
|
|
|
2367
2416
|
exports.fetchViewerPositionConfirmations = fetchViewerPositionConfirmations;
|
|
2368
2417
|
exports.fetchWipePreview = fetchWipePreview;
|
|
2369
2418
|
exports.followUser = followUser;
|
|
2419
|
+
exports.germRedirectPath = germRedirectPath;
|
|
2370
2420
|
exports.getAdminReviewQueues = getAdminReviewQueues;
|
|
2371
2421
|
exports.getBlueskySuggestions = getBlueskySuggestions;
|
|
2372
2422
|
exports.getFollowers = getFollowers;
|