@ecency/sdk 2.4.15 → 2.4.16

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 (45) hide show
  1. package/dist/browser/{chunk-WTEHM2NW.js → chunk-AGRX3S2G.js} +2 -2
  2. package/dist/browser/{chunk-WTEHM2NW.js.map → chunk-AGRX3S2G.js.map} +1 -1
  3. package/dist/browser/{chunk-O6ZNF26Q.js → chunk-AZR63GSQ.js} +2 -2
  4. package/dist/browser/{chunk-O6ZNF26Q.js.map → chunk-AZR63GSQ.js.map} +1 -1
  5. package/dist/browser/{chunk-VP72GHX2.js → chunk-E6UOGKIO.js} +2 -2
  6. package/dist/browser/{chunk-VP72GHX2.js.map → chunk-E6UOGKIO.js.map} +1 -1
  7. package/dist/browser/{chunk-UPLGU6G7.js → chunk-F6NBFXMD.js} +2 -2
  8. package/dist/browser/{chunk-UPLGU6G7.js.map → chunk-F6NBFXMD.js.map} +1 -1
  9. package/dist/browser/chunk-HBIRNFVS.js +2 -0
  10. package/dist/browser/chunk-HBIRNFVS.js.map +1 -0
  11. package/dist/browser/{chunk-A7EC46DB.js → chunk-IZAIV6WY.js} +2 -2
  12. package/dist/browser/{chunk-A7EC46DB.js.map → chunk-IZAIV6WY.js.map} +1 -1
  13. package/dist/browser/{chunk-LM7BVTOQ.js → chunk-JQBX6M24.js} +2 -2
  14. package/dist/browser/{chunk-LM7BVTOQ.js.map → chunk-JQBX6M24.js.map} +1 -1
  15. package/dist/browser/{chunk-RYI4O7QH.js → chunk-KSQXXIUM.js} +2 -2
  16. package/dist/browser/{chunk-RYI4O7QH.js.map → chunk-KSQXXIUM.js.map} +1 -1
  17. package/dist/browser/{chunk-ZKWRPZHK.js → chunk-R4TN3IDN.js} +2 -2
  18. package/dist/browser/{chunk-ZKWRPZHK.js.map → chunk-R4TN3IDN.js.map} +1 -1
  19. package/dist/browser/{chunk-ISEY5355.js → chunk-Y2O7DW46.js} +2 -2
  20. package/dist/browser/{chunk-ISEY5355.js.map → chunk-Y2O7DW46.js.map} +1 -1
  21. package/dist/browser/chunk-ZLU6INZR.js +2 -0
  22. package/dist/browser/{chunk-WAIGSUA6.js.map → chunk-ZLU6INZR.js.map} +1 -1
  23. package/dist/browser/index.d.ts +70 -5
  24. package/dist/browser/index.js +1 -1
  25. package/dist/browser/modules/curation/index.js +1 -1
  26. package/dist/browser/modules/curation/queries/get-curation-application-query-options.js +1 -1
  27. package/dist/browser/modules/curation/queries/get-curation-applications-query-options.js +1 -1
  28. package/dist/browser/modules/curation/queries/get-curation-feed-infinite-query-options.js +1 -1
  29. package/dist/browser/modules/curation/queries/get-curation-post-query-options.js +1 -1
  30. package/dist/browser/modules/curation/queries/get-curation-recommendations-infinite-query-options.js +1 -1
  31. package/dist/browser/modules/curation/queries/get-curation-recommender-query-options.js +1 -1
  32. package/dist/browser/modules/curation/queries/get-curation-roster-admin-query-options.js +1 -1
  33. package/dist/browser/modules/curation/queries/get-curation-roster-query-options.js +1 -1
  34. package/dist/browser/modules/curation/queries/get-curation-status-query-options.js +1 -1
  35. package/dist/browser/modules/curation/queries/index.js +1 -1
  36. package/dist/browser/modules/curation/requests.js +1 -1
  37. package/dist/browser/modules/curation/types.js +1 -1
  38. package/dist/node/index.cjs +3 -3
  39. package/dist/node/index.cjs.map +1 -1
  40. package/dist/node/index.mjs +3 -3
  41. package/dist/node/index.mjs.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/browser/chunk-4DTETBSG.js +0 -2
  44. package/dist/browser/chunk-4DTETBSG.js.map +0 -1
  45. package/dist/browser/chunk-WAIGSUA6.js +0 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "2.4.15",
4
+ "version": "2.4.16",
5
5
  "description": "Ecency SDK",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-SEACJS36.js';import {c as c$1}from'./chunk-Q567KEFE.js';import {b as b$1}from'./chunk-OS3FCYZY.js';var P="/private-api/curation-desk",c=class extends Error{constructor(o,e,r){super(o);b$1(this,"status");b$1(this,"data");this.name="CurationApiError",this.status=e,this.data=r;}};function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var l=t=>u(t)&&Array.isArray(t.items),w=t=>u(t)&&Array.isArray(t.curators),b=t=>u(t)&&Array.isArray(t.recommenders),x=t=>u(t)&&"vp"in t,M=["window_days","recommended","curated","dismissed","withdrawn","precision"],_=t=>u(t)&&M.every(n=>typeof t[n]=="number")&&typeof t.trusted=="boolean";async function k(t,n,o){if(!t.ok){let i;try{i=await t.json();}catch{i=void 0;}throw new c(`Failed to ${n}: ${t.status}`,t.status,i)}let e=t.headers?.get?.("content-type")??"";if(e&&!e.includes("json"))throw new c(`Unexpected response for ${n}`,t.status);let r;try{r=await t.json();}catch{throw new c(`Unexpected response for ${n}`,t.status)}if(o&&!o(r))throw new c(`Unexpected response for ${n}`,t.status);return r}var T=/^hive-\d{5,6}$/,E=/^[a-z0-9]{8,16}$/,D=new Set(["hide_curated","hide_reviewed","hide_snoozed"]),S=["sort","seed","view","app","community","window","rep_min","rep_max","min_words","max_words","has_images","new_authors","recommended","flagged","hide_curated","hide_reviewed","hide_snoozed","limit"];function A(t={}){let n=t,o={};for(let e of S){let r=n[e];if(r==null||r==="")continue;if(typeof r=="boolean"){D.has(e)?r||(o[e]="0"):r&&(o[e]="1");continue}if(typeof r=="number"){if(!Number.isFinite(r))continue;o[e]=String(Math.trunc(r));continue}let i=String(r);(e==="app"||e==="window")&&i==="all"||e==="community"&&!T.test(i)||e==="seed"&&!E.test(i)||(o[e]=i);}return o.sort!=="random"&&delete o.seed,o}function v(t,n){let o=new URLSearchParams;for(let r of S)t[r]!==void 0&&o.set(r,t[r]);n&&o.set("cursor",n);let e=o.toString();return e?`?${e}`:""}function y(t){return `${c$1.privateApiHost}${P}${t}`}var F=new Set(["localhost","127.0.0.1","::1","[::1]"]);function q(t){let n=c$1.privateApiHost||"",o=typeof window<"u"?window.location?.href:void 0,e;try{e=o?new URL(n,o):new URL(n);}catch{return}if(e.protocol!=="https:"&&!(e.protocol==="http:"&&F.has(e.hostname)))throw new c(`Refusing to ${t} over an insecure connection`,0)}async function d(t,n,o,e){let i=await a()(y(t),{method:"GET",signal:o});return k(i,n,e)}async function s(t,n,o,e,r,i){if(!n)throw new Error("[SDK][Curation] missing auth");q(e);let m=await a()(y(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,code:n}),redirect:"error",signal:r});return k(m,e,i)}function K(t,n,o){return d(`/feed${v(A(t),n)}`,"fetch curation feed",o,l)}function O(t){return d("/status","fetch curation status",t,x)}function N(t){return d("/roster","fetch curation roster",t,w)}function z(t,n,o){let e=new URLSearchParams;t.sort&&e.set("sort",t.sort),t.limit&&e.set("limit",String(t.limit)),n&&e.set("cursor",n);let r=e.toString();return d(`/recommendations${r?`?${r}`:""}`,"fetch curation recommendations",o,l)}function W(t,n){return d(`/recommender/${encodeURIComponent(t)}`,"fetch recommender stats",n,_)}function j(t,n,o){return d(`/post/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,"fetch curation post",o,b)}function H(t,n,o,e){let r={...A(n)};return o&&(r.cursor=o),s("/roster-feed",t,r,"fetch roster feed",e,l)}function J(t,n,o){return s("/tick",t,{since:n.since,need:n.need.slice(0,100),visible:n.visible.slice(0,100)},"tick",o)}function B(t,n){return s("/roster-list",t,{},"list roster",n,w)}function G(t,n){let{curator:o,role:e,rules:r,note:i}=n;if(!o||!e)throw new Error("[SDK][Curation] roster set needs a curator and a role");let a={curator:o,role:e};return r&&(a.rules=r),i!==void 0&&(a.note=i),s("/roster-set",t,a,"set curator")}function Q(t,n){if(!n)throw new Error("[SDK][Curation] roster retire needs a curator");return s("/roster-retire",t,{curator:n},"retire curator")}var f=t=>u(t)&&"application"in t,I=t=>u(t)&&Array.isArray(t.applications),$=t=>u(t)&&u(t.window);function X(t,n){let o=n.motivation?.trim(),e=n.availability?.trim(),r=n.pick?.trim();if(!o||!e||!r)throw new Error("[SDK][Curation] an application needs all three answers");return s("/application-apply",t,{motivation:o,availability:e,pick:r},"apply",void 0,f)}function Y(t,n){return s("/application-mine",t,{},"read your application",n,f)}function V(t){return s("/application-withdraw",t,{},"withdraw your application",void 0,f)}function Z(t,n={},o){let e={};return n.state&&(e.state=n.state),n.limit&&(e.limit=n.limit),s("/application-list",t,e,"list applications",o,I)}function tt(t,n){let{applicant:o,state:e,role:r,note:i}=n;if(!o||!e)throw new Error("[SDK][Curation] a decision needs an applicant and a state");let a={applicant:o,state:e};return e==="accepted"&&r&&(a.role=r),i!==void 0&&(a.note=i),s("/application-decide",t,a,"decide an application",void 0,f)}function nt(t,n){let o={open:n.open};return n.message!==void 0&&(o.message=n.message),s("/application-window",t,o,"set the application window",void 0,$)}function et(t,n){let{author:o,permlink:e,state:r,reason:i,note:a,snooze_until:m,lane:g}=n;if(!o||!e||!r)throw new Error("[SDK][Curation] mark needs author, permlink and state");let p={author:o,permlink:e,state:r};return i&&(p.reason=i),a&&(p.note=a),m&&(p.snooze_until=m),g&&(p.lane=g),s("/mark",t,p,"set mark")}function ot(t,n){if(!n.author||!n.permlink)throw new Error("[SDK][Curation] mark-clear needs author and permlink");return s("/mark-clear",t,{author:n.author,permlink:n.permlink},"clear mark")}function rt(t,n={},o){let e={};return n.state&&(e.state=n.state),n.cursor&&(e.cursor=n.cursor),n.limit&&(e.limit=n.limit),s("/marks",t,e,"fetch my marks",o,l)}function it(t,n){if(!Number.isFinite(n.post_id)||!n.action)throw new Error("[SDK][Curation] cursor needs post_id and action");let o={post_id:n.post_id,action:n.action};return n.reason&&(o.reason=n.reason),s("/cursor",t,o,"move cursor")}var U=/^[0-9a-f]{40}$/;function st(t,n){let{author:o,permlink:e,trx_id:r,ua_class:i}=n;if(!o||!e||!i)throw new Error("[SDK][Curation] recommend-meta needs author, permlink and ua_class");let a={author:o,permlink:e,ua_class:i};return typeof r=="string"&&U.test(r)&&(a.trx_id=r),s("/recommend-meta",t,a,"send recommendation meta")}function at(t,n){if(!n.author||!n.permlink||!n.action)throw new Error("[SDK][Curation] recommendation-dismiss needs author, permlink and action");return s("/recommendation-dismiss",t,{author:n.author,permlink:n.permlink,action:n.action},"dismiss recommendation")}export{c as a,A as b,K as c,O as d,N as e,z as f,W as g,j as h,H as i,J as j,B as k,G as l,Q as m,X as n,Y as o,V as p,Z as q,tt as r,nt as s,et as t,ot as u,rt as v,it as w,st as x,at as y};//# sourceMappingURL=chunk-4DTETBSG.js.map
2
- //# sourceMappingURL=chunk-4DTETBSG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/modules/curation/requests.ts"],"names":["ROUTE","CurationApiError","message","status","data","__publicField","isRecord","hasItems","hasCurators","hasRecommenders","isStatus","SCORECARD_COUNTS","isRecommenderStats","key","parse","response","what","check","contentType","COMMUNITY_RE","SEED_RE","DEFAULT_TRUE","PARAM_ORDER","normalizeCurationParams","params","source","out","name","value","text","toQuery","normalized","cursor","search","url","path","CONFIG","LOOPBACK_HOSTS","assertCredentialTransport","host","page","parsed","getJson","signal","getBoundFetch","postJson","code","body","fetchCurationFeedPage","fetchCurationStatus","fetchCurationRoster","fetchCurationRecommendationsPage","fetchCurationRecommenderStats","username","fetchCurationPost","author","permlink","curationRosterFeedRequest","curationTickRequest","curationRosterListRequest","curationRosterSetRequest","input","curator","role","rules","note","curationRosterRetireRequest","hasApplication","hasApplications","hasWindow","curationApplicationApplyRequest","answers","motivation","availability","pick","curationApplicationMineRequest","curationApplicationWithdrawRequest","curationApplicationListRequest","curationApplicationDecideRequest","applicant","state","curationApplicationWindowRequest","curationMarkRequest","reason","snooze_until","lane","curationMarkClearRequest","curationMyMarksRequest","curationCursorRequest","TRX_ID_RE","curationRecommendMetaRequest","trx_id","ua_class","curationDismissRecoRequest"],"mappings":"0HA0CA,IAAMA,EAAQ,4BAAA,CAEDC,CAAAA,CAAN,cAA+B,KAAM,CAI1C,WAAA,CAAYC,CAA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OAAIA,EAAM,MAAA,GAAQd,CAAAA,CAAK,MAAA,CAASc,CAAAA,CAAM,QAC/BhB,CAAAA,CAAiC,SAAA,CAAWC,EAAMC,CAAAA,CAAM,aAAa,CAC9E,CAEA,IAAM0C,CAAAA,CAAY,gBAAA,CAEX,SAASC,EAAAA,CACd5C,CAAAA,CACAe,EAC0B,CAC1B,GAAM,CAAE,MAAA,CAAAN,CAAAA,CAAQ,QAAA,CAAAC,CAAAA,CAAU,OAAAmC,CAAAA,CAAQ,QAAA,CAAAC,CAAS,CAAA,CAAI/B,EAC/C,GAAI,CAACN,CAAAA,EAAU,CAACC,GAAY,CAACoC,CAAAA,CAC3B,MAAM,IAAI,KAAA,CAAM,oEAAoE,CAAA,CAEtF,IAAM7C,CAAAA,CAAgC,CAAE,OAAAQ,CAAAA,CAAQ,QAAA,CAAAC,EAAU,QAAA,CAAAoC,CAAS,EAGnE,OAAI,OAAOD,CAAAA,EAAW,QAAA,EAAYF,EAAU,IAAA,CAAKE,CAAM,IAAG5C,CAAAA,CAAK,MAAA,CAAS4C,GACjE9C,CAAAA,CAA0B,iBAAA,CAAmBC,CAAAA,CAAMC,CAAAA,CAAM,0BAA0B,CAC5F,CAEO,SAAS8C,EAAAA,CACd/C,EACAe,CAAAA,CACsC,CACtC,GAAI,CAACA,EAAM,MAAA,EAAU,CAACA,EAAM,QAAA,EAAY,CAACA,EAAM,MAAA,CAC7C,MAAM,IAAI,KAAA,CAAM,0EAA0E,CAAA,CAE5F,OAAOhB,EACL,yBAAA,CACAC,CAAAA,CACA,CAAE,MAAA,CAAQe,CAAAA,CAAM,MAAA,CAAQ,QAAA,CAAUA,EAAM,QAAA,CAAU,MAAA,CAAQA,EAAM,MAAO,CAAA,CACvE,wBACF,CACF","file":"chunk-4DTETBSG.js","sourcesContent":["import { CONFIG, getBoundFetch } from \"@/modules/core\";\nimport type {\n CurationApplication,\n CurationApplicationDecideInput,\n CurationApplicationList,\n CurationApplicationMine,\n CurationApplicationState,\n CurationApplicationWindow,\n CurationCursorInput,\n CurationCursorResponse,\n CurationDismissRecoInput,\n CurationDismissRecoResponse,\n CurationFeedPage,\n CurationFeedParams,\n CurationMarkClearResponse,\n CurationMarkInput,\n CurationMarkResponse,\n CurationMyMarksParams,\n CurationMyMarksResponse,\n CurationPost,\n CurationRecommendMetaInput,\n CurationRecommendationsPage,\n CurationRecommendationsParams,\n CurationRecommenderStats,\n CurationRoster,\n CurationRosterAdminEntry,\n CurationRosterAdminList,\n CurationRosterFeedPage,\n CurationRosterFeedParams,\n CurationRosterSetInput,\n CurationStatus,\n CurationTickRequest,\n CurationTickResponse,\n} from \"./types\";\n\n/**\n * Curation desk transport. Public GETs carry no identity; authed POSTs take the\n * HiveSigner access `code` as an explicit argument and send it in the body.\n * Token freshness is the caller's job (web: ensureValidToken; mobile: its token\n * wrapper), so a builder never captures a code that can expire.\n */\n\nconst ROUTE = \"/private-api/curation-desk\";\n\nexport class CurationApiError extends Error {\n readonly status: number;\n readonly data: unknown;\n\n constructor(message: string, status: number, data?: unknown) {\n super(message);\n this.name = \"CurationApiError\";\n this.status = status;\n this.data = data;\n }\n}\n\n/**\n * A light shape check per response family, not a schema validator: it answers\n * \"is this the kind of body the consumers dereference\", so a 200 that carries\n * something else (an error envelope, another route's body) fails here instead\n * of inside a query builder reading `.items.length`.\n */\ntype ShapeCheck = (data: unknown) => boolean;\n\nfunction isRecord(data: unknown): data is Record<string, unknown> {\n return typeof data === \"object\" && data !== null && !Array.isArray(data);\n}\n\n/** Every paged family: the list is what the consumers page over. */\nconst hasItems: ShapeCheck = (data) => isRecord(data) && Array.isArray(data.items);\nconst hasCurators: ShapeCheck = (data) => isRecord(data) && Array.isArray(data.curators);\n/** Route 5: the viewer finds their own recommendation by name in this list. */\nconst hasRecommenders: ShapeCheck = (data) => isRecord(data) && Array.isArray(data.recommenders);\n/** `vp` is nullable, so the field has to be present rather than truthy. */\nconst isStatus: ShapeCheck = (data) => isRecord(data) && \"vp\" in data;\n/**\n * A scorecard is counted, never absent: an unknown recommender answers zeros\n * rather than a 404, so a body without a numeric `recommended` is another\n * route's answer and not an empty scorecard.\n */\n/** Every number the scorecard prints, the window it prints them for included. */\nconst SCORECARD_COUNTS = [\"window_days\", \"recommended\", \"curated\", \"dismissed\", \"withdrawn\", \"precision\"] as const;\nconst isRecommenderStats: ShapeCheck = (data) =>\n isRecord(data) &&\n SCORECARD_COUNTS.every((key) => typeof data[key] === \"number\") &&\n typeof data.trusted === \"boolean\";\n\nasync function parse<T>(response: Response, what: string, check?: ShapeCheck): Promise<T> {\n if (!response.ok) {\n let data: unknown = undefined;\n try {\n data = await response.json();\n } catch {\n data = undefined;\n }\n throw new CurationApiError(`Failed to ${what}: ${response.status}`, response.status, data);\n }\n // The gateway answers an unknown GET with a 200 HTML page. That is never an\n // empty queue, so a non-JSON body is an error too. A body that only claims\n // to be JSON gets the same treatment: parsing it must not reach the caller\n // as a SyntaxError with no status on it.\n const contentType = response.headers?.get?.(\"content-type\") ?? \"\";\n if (contentType && !contentType.includes(\"json\")) {\n throw new CurationApiError(`Unexpected response for ${what}`, response.status);\n }\n let data: unknown;\n try {\n data = await response.json();\n } catch {\n throw new CurationApiError(`Unexpected response for ${what}`, response.status);\n }\n if (check && !check(data)) {\n throw new CurationApiError(`Unexpected response for ${what}`, response.status);\n }\n return data as T;\n}\n\nconst COMMUNITY_RE = /^hive-\\d{5,6}$/;\nconst SEED_RE = /^[a-z0-9]{8,16}$/;\n\n/**\n * Booleans the desk already defaults to true, so only an explicit false says\n * anything. Sending the \"1\" would split memo and cache keys against a gateway\n * that drops it.\n */\nconst DEFAULT_TRUE = new Set([\"hide_curated\", \"hide_reviewed\", \"hide_snoozed\"]);\n\n/** Fixed emission order: keeps memo and shared-cache keys stable across clients. */\nconst PARAM_ORDER = [\n \"sort\",\n \"seed\",\n \"view\",\n \"app\",\n \"community\",\n \"window\",\n \"rep_min\",\n \"rep_max\",\n \"min_words\",\n \"max_words\",\n \"has_images\",\n \"new_authors\",\n \"recommended\",\n \"flagged\",\n \"hide_curated\",\n \"hide_reviewed\",\n \"hide_snoozed\",\n \"limit\",\n] as const;\n\nexport type NormalizedCurationParams = Record<string, string>;\n\n/**\n * Drops defaults and unknown values, emits fixed-order string params. Used for\n * the query string, the roster body and the React Query key, so all three agree.\n */\nexport function normalizeCurationParams(\n params: CurationRosterFeedParams | CurationFeedParams = {}\n): NormalizedCurationParams {\n const source = params as Record<string, unknown>;\n const out: NormalizedCurationParams = {};\n for (const name of PARAM_ORDER) {\n const value = source[name];\n if (value === undefined || value === null || value === \"\") continue;\n if (typeof value === \"boolean\") {\n if (DEFAULT_TRUE.has(name)) {\n if (!value) out[name] = \"0\";\n } else if (value) {\n out[name] = \"1\";\n }\n continue;\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) continue;\n out[name] = String(Math.trunc(value));\n continue;\n }\n const text = String(value);\n if ((name === \"app\" || name === \"window\") && text === \"all\") continue;\n if (name === \"community\" && !COMMUNITY_RE.test(text)) continue;\n if (name === \"seed\" && !SEED_RE.test(text)) continue;\n out[name] = text;\n }\n // The seed only means something for the random order.\n if (out.sort !== \"random\") delete out.seed;\n return out;\n}\n\nfunction toQuery(normalized: NormalizedCurationParams, cursor?: string): string {\n const search = new URLSearchParams();\n for (const name of PARAM_ORDER) {\n if (normalized[name] !== undefined) search.set(name, normalized[name]);\n }\n if (cursor) search.set(\"cursor\", cursor);\n const text = search.toString();\n return text ? `?${text}` : \"\";\n}\n\nfunction url(path: string): string {\n return `${CONFIG.privateApiHost}${ROUTE}${path}`;\n}\n\n/** Hosts a credential may reach without TLS: a local gateway has no certificate. */\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"::1\", \"[::1]\"]);\n\n/**\n * The authed routes put the HiveSigner code in the body, so the transport is\n * the only thing keeping a replayable credential private. A relative host\n * (empty for same-origin, `//gateway`, `/api`) takes the page's own transport,\n * so it is resolved against the page before the scheme is read.\n */\nfunction assertCredentialTransport(what: string) {\n const host = CONFIG.privateApiHost || \"\";\n const page = typeof window !== \"undefined\" ? window.location?.href : undefined;\n let parsed: URL;\n try {\n parsed = page ? new URL(host, page) : new URL(host);\n } catch {\n // Relative with no page to resolve against: outside a browser nothing can\n // be fetched from a relative URL either.\n return;\n }\n if (parsed.protocol === \"https:\") return;\n if (parsed.protocol === \"http:\" && LOOPBACK_HOSTS.has(parsed.hostname)) return;\n throw new CurationApiError(`Refusing to ${what} over an insecure connection`, 0);\n}\n\nasync function getJson<T>(\n path: string,\n what: string,\n signal?: AbortSignal,\n check?: ShapeCheck\n): Promise<T> {\n const fetchApi = getBoundFetch();\n const response = await fetchApi(url(path), { method: \"GET\", signal });\n return parse<T>(response, what, check);\n}\n\nasync function postJson<T>(\n path: string,\n code: string | undefined,\n body: Record<string, unknown>,\n what: string,\n signal?: AbortSignal,\n check?: ShapeCheck\n): Promise<T> {\n if (!code) {\n throw new Error(\"[SDK][Curation] missing auth\");\n }\n assertCredentialTransport(what);\n const fetchApi = getBoundFetch();\n const response = await fetchApi(url(path), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ ...body, code }),\n // A 307 or 308 would resend this body, code included, to wherever the\n // redirect points.\n redirect: \"error\",\n signal,\n });\n return parse<T>(response, what, check);\n}\n\n// ---------------------------------------------------------------------------\n// Public reads (used by the query builders)\n// ---------------------------------------------------------------------------\n\nexport function fetchCurationFeedPage(\n params: CurationFeedParams,\n cursor?: string,\n signal?: AbortSignal\n): Promise<CurationFeedPage> {\n return getJson<CurationFeedPage>(\n `/feed${toQuery(normalizeCurationParams(params), cursor)}`,\n \"fetch curation feed\",\n signal,\n hasItems\n );\n}\n\nexport function fetchCurationStatus(signal?: AbortSignal): Promise<CurationStatus> {\n return getJson<CurationStatus>(\"/status\", \"fetch curation status\", signal, isStatus);\n}\n\nexport function fetchCurationRoster(signal?: AbortSignal): Promise<CurationRoster> {\n return getJson<CurationRoster>(\"/roster\", \"fetch curation roster\", signal, hasCurators);\n}\n\nexport function fetchCurationRecommendationsPage(\n params: CurationRecommendationsParams,\n cursor?: string,\n signal?: AbortSignal\n): Promise<CurationRecommendationsPage> {\n const search = new URLSearchParams();\n if (params.sort) search.set(\"sort\", params.sort);\n if (params.limit) search.set(\"limit\", String(params.limit));\n if (cursor) search.set(\"cursor\", cursor);\n const text = search.toString();\n return getJson<CurationRecommendationsPage>(\n `/recommendations${text ? `?${text}` : \"\"}`,\n \"fetch curation recommendations\",\n signal,\n hasItems\n );\n}\n\nexport function fetchCurationRecommenderStats(\n username: string,\n signal?: AbortSignal\n): Promise<CurationRecommenderStats> {\n return getJson<CurationRecommenderStats>(\n `/recommender/${encodeURIComponent(username)}`,\n \"fetch recommender stats\",\n signal,\n isRecommenderStats\n );\n}\n\nexport function fetchCurationPost(\n author: string,\n permlink: string,\n signal?: AbortSignal\n): Promise<CurationPost> {\n return getJson<CurationPost>(\n `/post/${encodeURIComponent(author)}/${encodeURIComponent(permlink)}`,\n \"fetch curation post\",\n signal,\n hasRecommenders\n );\n}\n\n// ---------------------------------------------------------------------------\n// Authed writes and reads (code in the body)\n// ---------------------------------------------------------------------------\n\nexport function curationRosterFeedRequest(\n code: string | undefined,\n params: CurationRosterFeedParams,\n cursor?: string,\n signal?: AbortSignal\n): Promise<CurationRosterFeedPage> {\n const body: Record<string, unknown> = { ...normalizeCurationParams(params) };\n if (cursor) body.cursor = cursor;\n return postJson<CurationRosterFeedPage>(\n \"/roster-feed\",\n code,\n body,\n \"fetch roster feed\",\n signal,\n hasItems\n );\n}\n\nexport function curationTickRequest(\n code: string | undefined,\n body: CurationTickRequest,\n signal?: AbortSignal\n): Promise<CurationTickResponse> {\n return postJson<CurationTickResponse>(\n \"/tick\",\n code,\n {\n since: body.since,\n need: body.need.slice(0, 100),\n visible: body.visible.slice(0, 100),\n },\n \"tick\",\n signal\n );\n}\n\n/**\n * The roster admin routes. All three are admin-only upstream, and all three are\n * POSTs: the private view carries notes and retired rows, which must never enter\n * the edge-cached roster GET.\n */\nexport function curationRosterListRequest(\n code: string | undefined,\n signal?: AbortSignal\n): Promise<CurationRosterAdminList> {\n // Same shape check as the public roster: a 200 carrying an error envelope, or any\n // body without `curators`, must reach the query's error path. Without it the panel\n // renders `data?.curators ?? []` and an outage looks like an empty roster.\n return postJson<CurationRosterAdminList>(\"/roster-list\", code, {}, \"list roster\", signal, hasCurators);\n}\n\nexport function curationRosterSetRequest(\n code: string | undefined,\n input: CurationRosterSetInput\n): Promise<{ curator: CurationRosterAdminEntry }> {\n const { curator, role, rules, note } = input;\n if (!curator || !role) {\n throw new Error(\"[SDK][Curation] roster set needs a curator and a role\");\n }\n const body: Record<string, unknown> = { curator, role };\n // Sent whole or not at all: the backend replaces the stored rules with what\n // arrives, so a partial object would silently drop the rules left out.\n if (rules) body.rules = rules;\n if (note !== undefined) body.note = note;\n return postJson<{ curator: CurationRosterAdminEntry }>(\"/roster-set\", code, body, \"set curator\");\n}\n\nexport function curationRosterRetireRequest(\n code: string | undefined,\n curator: string\n): Promise<{ ok: boolean; curator: string }> {\n if (!curator) {\n throw new Error(\"[SDK][Curation] roster retire needs a curator\");\n }\n return postJson<{ ok: boolean; curator: string }>(\n \"/roster-retire\",\n code,\n { curator },\n \"retire curator\"\n );\n}\n\n/**\n * Guest curator applications. Apply, mine and withdraw are open to any signed-in\n * account; the other three are admin-only upstream. All six are POSTs, so every\n * private field stays off the edge-cached GET tier.\n */\nconst hasApplication: ShapeCheck = (data) => isRecord(data) && \"application\" in data;\nconst hasApplications: ShapeCheck = (data) => isRecord(data) && Array.isArray(data.applications);\nconst hasWindow: ShapeCheck = (data) => isRecord(data) && isRecord(data.window);\n\nexport function curationApplicationApplyRequest(\n code: string | undefined,\n answers: { motivation: string; availability: string; pick: string }\n): Promise<{ application: CurationApplication; window: CurationApplicationWindow }> {\n const motivation = answers.motivation?.trim();\n const availability = answers.availability?.trim();\n const pick = answers.pick?.trim();\n if (!motivation || !availability || !pick) {\n throw new Error(\"[SDK][Curation] an application needs all three answers\");\n }\n return postJson(\"/application-apply\", code, { motivation, availability, pick }, \"apply\", undefined, hasApplication);\n}\n\nexport function curationApplicationMineRequest(\n code: string | undefined,\n signal?: AbortSignal\n): Promise<CurationApplicationMine> {\n return postJson(\"/application-mine\", code, {}, \"read your application\", signal, hasApplication);\n}\n\nexport function curationApplicationWithdrawRequest(\n code: string | undefined\n): Promise<{ application: CurationApplication }> {\n return postJson(\"/application-withdraw\", code, {}, \"withdraw your application\", undefined, hasApplication);\n}\n\nexport function curationApplicationListRequest(\n code: string | undefined,\n params: { state?: CurationApplicationState; limit?: number } = {},\n signal?: AbortSignal\n): Promise<CurationApplicationList> {\n const body: Record<string, unknown> = {};\n if (params.state) body.state = params.state;\n if (params.limit) body.limit = params.limit;\n // Same reason the roster list checks its shape: without it a 200 carrying an\n // error envelope renders as an empty queue rather than reaching the error path.\n return postJson(\"/application-list\", code, body, \"list applications\", signal, hasApplications);\n}\n\nexport function curationApplicationDecideRequest(\n code: string | undefined,\n input: CurationApplicationDecideInput\n): Promise<{ application: CurationApplication }> {\n const { applicant, state, role, note } = input;\n if (!applicant || !state) {\n throw new Error(\"[SDK][Curation] a decision needs an applicant and a state\");\n }\n const body: Record<string, unknown> = { applicant, state };\n // The role belongs to an acceptance only. The desk ignores it on a decline\n // rather than refusing it, so sending one would be a lie in the audit log.\n if (state === \"accepted\" && role) body.role = role;\n if (note !== undefined) body.note = note;\n return postJson(\"/application-decide\", code, body, \"decide an application\", undefined, hasApplication);\n}\n\nexport function curationApplicationWindowRequest(\n code: string | undefined,\n input: { open: boolean; message?: string | null }\n): Promise<{ window: CurationApplicationWindow }> {\n const body: Record<string, unknown> = { open: input.open };\n // A present null clears the message; absent leaves the stored one in place.\n if (input.message !== undefined) body.message = input.message;\n return postJson(\"/application-window\", code, body, \"set the application window\", undefined, hasWindow);\n}\n\nexport function curationMarkRequest(\n code: string | undefined,\n input: CurationMarkInput\n): Promise<CurationMarkResponse> {\n const { author, permlink, state, reason, note, snooze_until, lane } = input;\n if (!author || !permlink || !state) {\n throw new Error(\"[SDK][Curation] mark needs author, permlink and state\");\n }\n const body: Record<string, unknown> = { author, permlink, state };\n if (reason) body.reason = reason;\n if (note) body.note = note;\n if (snooze_until) body.snooze_until = snooze_until;\n if (lane) body.lane = lane;\n return postJson<CurationMarkResponse>(\"/mark\", code, body, \"set mark\");\n}\n\nexport function curationMarkClearRequest(\n code: string | undefined,\n input: { author: string; permlink: string }\n): Promise<CurationMarkClearResponse> {\n if (!input.author || !input.permlink) {\n throw new Error(\"[SDK][Curation] mark-clear needs author and permlink\");\n }\n return postJson<CurationMarkClearResponse>(\n \"/mark-clear\",\n code,\n { author: input.author, permlink: input.permlink },\n \"clear mark\"\n );\n}\n\nexport function curationMyMarksRequest(\n code: string | undefined,\n params: CurationMyMarksParams = {},\n signal?: AbortSignal\n): Promise<CurationMyMarksResponse> {\n const body: Record<string, unknown> = {};\n if (params.state) body.state = params.state;\n if (params.cursor) body.cursor = params.cursor;\n if (params.limit) body.limit = params.limit;\n return postJson<CurationMyMarksResponse>(\"/marks\", code, body, \"fetch my marks\", signal, hasItems);\n}\n\nexport function curationCursorRequest(\n code: string | undefined,\n input: CurationCursorInput\n): Promise<CurationCursorResponse> {\n if (!Number.isFinite(input.post_id) || !input.action) {\n throw new Error(\"[SDK][Curation] cursor needs post_id and action\");\n }\n const body: Record<string, unknown> = { post_id: input.post_id, action: input.action };\n if (input.reason) body.reason = input.reason;\n return postJson<CurationCursorResponse>(\"/cursor\", code, body, \"move cursor\");\n}\n\nconst TRX_ID_RE = /^[0-9a-f]{40}$/;\n\nexport function curationRecommendMetaRequest(\n code: string | undefined,\n input: CurationRecommendMetaInput\n): Promise<{ ok: boolean }> {\n const { author, permlink, trx_id, ua_class } = input;\n if (!author || !permlink || !ua_class) {\n throw new Error(\"[SDK][Curation] recommend-meta needs author, permlink and ua_class\");\n }\n const body: Record<string, unknown> = { author, permlink, ua_class };\n // Optional and informational: only a well-formed id travels, so a path that\n // returned an odd shape never turns the ping into a 400.\n if (typeof trx_id === \"string\" && TRX_ID_RE.test(trx_id)) body.trx_id = trx_id;\n return postJson<{ ok: boolean }>(\"/recommend-meta\", code, body, \"send recommendation meta\");\n}\n\nexport function curationDismissRecoRequest(\n code: string | undefined,\n input: CurationDismissRecoInput\n): Promise<CurationDismissRecoResponse> {\n if (!input.author || !input.permlink || !input.action) {\n throw new Error(\"[SDK][Curation] recommendation-dismiss needs author, permlink and action\");\n }\n return postJson<CurationDismissRecoResponse>(\n \"/recommendation-dismiss\",\n code,\n { author: input.author, permlink: input.permlink, action: input.action },\n \"dismiss recommendation\"\n );\n}\n"]}
@@ -1,2 +0,0 @@
1
- var e=["quality","underrated","newcomer","other"],n=["queue","newest","unique","random"],r=["queue","latest","new-authors","recommended","curated","all","excluded"],t=["all","ecency","peakd","other"],o=["12h","full","half","eighth","locked","all"],a=["reviewed","snoozed","flagged","noted"],i=["plagiarism","ai_slop","recycled","image_only","tag_abuse","farming","nsfw_untagged","other"];export{e as a,n as b,r as c,t as d,o as e,a as f,i as g};//# sourceMappingURL=chunk-WAIGSUA6.js.map
2
- //# sourceMappingURL=chunk-WAIGSUA6.js.map