@moontaiworks/fanbox-dl 1.7.2 → 1.7.4

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 (33) hide show
  1. package/dist/bundle/index.cjs +1 -1
  2. package/dist/bundle/index.cjs.map +1 -1
  3. package/dist/bundle/index.d.cts +10 -3
  4. package/dist/bundle/index.d.ts +10 -3
  5. package/dist/bundle/index.js +1 -1
  6. package/dist/bundle/index.js.map +1 -1
  7. package/dist/cjs/client/endpoints/creator-list-posts.d.ts +3 -1
  8. package/dist/cjs/client/endpoints/creator-list-posts.d.ts.map +1 -1
  9. package/dist/cjs/client/endpoints/creator-list-posts.js.map +1 -1
  10. package/dist/cjs/client/endpoints/post-info.d.ts +3 -1
  11. package/dist/cjs/client/endpoints/post-info.d.ts.map +1 -1
  12. package/dist/cjs/client/endpoints/post-info.js.map +1 -1
  13. package/dist/cjs/client/models/post.d.ts +3 -0
  14. package/dist/cjs/client/models/post.d.ts.map +1 -1
  15. package/dist/cjs/downloader/creator/discover-posts.js +1 -1
  16. package/dist/cjs/downloader/creator/discover-posts.js.map +1 -1
  17. package/dist/cjs/downloader/creator/sync.d.ts.map +1 -1
  18. package/dist/cjs/downloader/creator/sync.js +1 -0
  19. package/dist/cjs/downloader/creator/sync.js.map +1 -1
  20. package/dist/esm/client/endpoints/creator-list-posts.d.ts +3 -1
  21. package/dist/esm/client/endpoints/creator-list-posts.d.ts.map +1 -1
  22. package/dist/esm/client/endpoints/creator-list-posts.js.map +1 -1
  23. package/dist/esm/client/endpoints/post-info.d.ts +3 -1
  24. package/dist/esm/client/endpoints/post-info.d.ts.map +1 -1
  25. package/dist/esm/client/endpoints/post-info.js.map +1 -1
  26. package/dist/esm/client/models/post.d.ts +3 -0
  27. package/dist/esm/client/models/post.d.ts.map +1 -1
  28. package/dist/esm/downloader/creator/discover-posts.js +1 -1
  29. package/dist/esm/downloader/creator/discover-posts.js.map +1 -1
  30. package/dist/esm/downloader/creator/sync.d.ts.map +1 -1
  31. package/dist/esm/downloader/creator/sync.js +1 -0
  32. package/dist/esm/downloader/creator/sync.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";var R=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var j=s=>{throw TypeError(s)};var D=(s,t)=>{for(var e in t)R(s,e,{get:t[e],enumerable:!0})},J=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _(t))!B.call(s,r)&&r!==e&&R(s,r,{get:()=>t[r],enumerable:!(o=$(t,r))||o.enumerable});return s};var W=s=>J(R({},"__esModule",{value:!0}),s);var L=(s,t,e)=>t.has(s)||j("Cannot "+e);var n=(s,t,e)=>(L(s,t,"read from private field"),e?e.call(s):t.get(s)),a=(s,t,e)=>t.has(s)?j("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,o)=>(L(s,t,"write to private field"),o?o.call(s,e):t.set(s,e),e),F=(s,t,e)=>(L(s,t,"access private method"),e);var tt={};D(tt,{FanboxApiError:()=>g,FanboxClient:()=>S});module.exports=W(tt);var T=require("http2");var p,P,c,O,I,C=class{constructor({sessionsPerOrigin:t=5}={}){a(this,c);a(this,p,new Map);a(this,P);l(this,P,Math.max(1,Math.floor(t)))}async closeAll(){let t=[...n(this,p).values()].flatMap(e=>e.sessions);n(this,p).clear(),await Promise.all(t.map(X))}getSession(t){let e=new URL(t).origin,o=n(this,p).get(e)??F(this,c,O).call(this,e);if(o.sessions.length<n(this,P)){let i=F(this,c,I).call(this,e);return o.sessions.push(i),i}let r=o.sessions[o.nextIndex%o.sessions.length];return o.nextIndex=(o.nextIndex+1)%o.sessions.length,r}};p=new WeakMap,P=new WeakMap,c=new WeakSet,O=function(t){let e={nextIndex:0,sessions:[]};return n(this,p).set(t,e),e},I=function(t){let e=(0,T.connect)(t),o=()=>{let r=n(this,p).get(t);if(!r)return;let i=r.sessions.indexOf(e);i>=0&&(r.sessions.splice(i,1),r.nextIndex=Math.min(r.nextIndex,r.sessions.length)),r.sessions.length===0&&n(this,p).delete(t)};return e.once("close",o),e.once("error",o),e};function X(s){return s.closed||s.destroyed?Promise.resolve():new Promise(t=>{s.close(t)})}var z=":status",H=class extends Error{constructor(t){super(t),this.name="Http2Error"}},f,b=class{constructor(t={}){a(this,f);l(this,f,new C(t))}fetch(t){let e=t instanceof Request?t:new Request(t),o=K(e),i=n(this,f).getSession(e.url).request(o,{endStream:!e.body});return new Promise((y,h)=>{let u=!1;i.once("error",h),i.once("close",()=>{u||h(new H("HTTP/2 stream closed before response"))}),i.once("response",w=>{u=!0,y(new Response(i,{headers:Q(w),status:V(w[z])}))}),e.body&&i.end(e.body)})}};f=new WeakMap;function K(s){let t=new URL(s.url),e={...Object.fromEntries(s.headers)};return e[":authority"]=t.host,e[":method"]=s.method.toUpperCase(),e[":path"]=`${t.pathname}${t.search}`,e[":scheme"]=t.protocol.slice(0,-1),e}function Q(s){let t=new Headers;for(let[e,o]of Object.entries(s))if(!(e.startsWith(":")||o===void 0))if(Array.isArray(o))for(let r of o)t.append(e,r);else t.set(e,o);return t}function V(s){return typeof s=="number"?s:Array.isArray(s)?Number(s[0]??0):Number(s??0)}async function A(s){return this.get("creator.get",s)}async function U(s){return this.get("post.paginateCreator",s)}async function E(s){return this.get("plan.listCreator",s)}async function M(s){return this.get("post.listCreator",s)}async function v(s){return this.get("post.info",s)}async function q(s={}){return this.get("post.listHome",s)}async function G(s={}){return this.get("post.listSupporting",s)}async function k(){return this.get("creator.listFollowing")}async function N(){return this.get("plan.listSupporting")}var Y="https://api.fanbox.cc",g=class extends Error{constructor(t,e){super(`FANBOX API request failed: ${t.status} ${t.statusText}`),this.name="FanboxApiError",this.body=e,this.status=t.status,this.statusText=t.statusText}},m,x,d,S=class{constructor(t={}){this.getCreator=A;this.getPost=v;this.listCreatorPlans=E;this.listCreatorPosts=M;this.listFollowingCreators=k;this.listHomePosts=q;this.listSupportingPlans=N;this.listSupportingPosts=G;this.paginateCreatorPosts=U;a(this,m);a(this,x);a(this,d);l(this,m,t.baseUrl??Y),l(this,x,t.headers??{}),l(this,d,t.transport??new b)}async get(t,e={}){let o=new URL(t,n(this,m).endsWith("/")?n(this,m):`${n(this,m)}/`);for(let[h,u]of Object.entries(e))u!==void 0&&o.searchParams.set(h,String(u));let r=new Request(o,{headers:n(this,x)}),i=await n(this,d).fetch(r),y=await Z(i);if(!i.ok)throw new g(i,y);return y.body}};m=new WeakMap,x=new WeakMap,d=new WeakMap;async function Z(s){let t=await s.text();try{return JSON.parse(t)}catch{return t}}0&&(module.exports={FanboxApiError,FanboxClient});
1
+ "use strict";var R=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var j=s=>{throw TypeError(s)};var D=(s,t)=>{for(var e in t)R(s,e,{get:t[e],enumerable:!0})},J=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _(t))!B.call(s,r)&&r!==e&&R(s,r,{get:()=>t[r],enumerable:!(o=$(t,r))||o.enumerable});return s};var W=s=>J(R({},"__esModule",{value:!0}),s);var L=(s,t,e)=>t.has(s)||j("Cannot "+e);var n=(s,t,e)=>(L(s,t,"read from private field"),e?e.call(s):t.get(s)),a=(s,t,e)=>t.has(s)?j("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,o)=>(L(s,t,"write to private field"),o?o.call(s,e):t.set(s,e),e),F=(s,t,e)=>(L(s,t,"access private method"),e);var tt={};D(tt,{FanboxApiError:()=>g,FanboxClient:()=>S});module.exports=W(tt);var T=require("http2");var p,P,c,O,I,C=class{constructor({sessionsPerOrigin:t=5}={}){a(this,c);a(this,p,new Map);a(this,P);l(this,P,Math.max(1,Math.floor(t)))}async closeAll(){let t=[...n(this,p).values()].flatMap(e=>e.sessions);n(this,p).clear(),await Promise.all(t.map(X))}getSession(t){let e=new URL(t).origin,o=n(this,p).get(e)??F(this,c,O).call(this,e);if(o.sessions.length<n(this,P)){let i=F(this,c,I).call(this,e);return o.sessions.push(i),i}let r=o.sessions[o.nextIndex%o.sessions.length];return o.nextIndex=(o.nextIndex+1)%o.sessions.length,r}};p=new WeakMap,P=new WeakMap,c=new WeakSet,O=function(t){let e={nextIndex:0,sessions:[]};return n(this,p).set(t,e),e},I=function(t){let e=(0,T.connect)(t),o=()=>{let r=n(this,p).get(t);if(!r)return;let i=r.sessions.indexOf(e);i>=0&&(r.sessions.splice(i,1),r.nextIndex=Math.min(r.nextIndex,r.sessions.length)),r.sessions.length===0&&n(this,p).delete(t)};return e.once("close",o),e.once("error",o),e};function X(s){return s.closed||s.destroyed?Promise.resolve():new Promise(t=>{s.close(t)})}var z=":status",H=class extends Error{constructor(t){super(t),this.name="Http2Error"}},f,b=class{constructor(t={}){a(this,f);l(this,f,new C(t))}fetch(t){let e=t instanceof Request?t:new Request(t),o=K(e),i=n(this,f).getSession(e.url).request(o,{endStream:!e.body});return new Promise((h,y)=>{let u=!1;i.once("error",y),i.once("close",()=>{u||y(new H("HTTP/2 stream closed before response"))}),i.once("response",w=>{u=!0,h(new Response(i,{headers:Q(w),status:V(w[z])}))}),e.body&&i.end(e.body)})}};f=new WeakMap;function K(s){let t=new URL(s.url),e={...Object.fromEntries(s.headers)};return e[":authority"]=t.host,e[":method"]=s.method.toUpperCase(),e[":path"]=`${t.pathname}${t.search}`,e[":scheme"]=t.protocol.slice(0,-1),e}function Q(s){let t=new Headers;for(let[e,o]of Object.entries(s))if(!(e.startsWith(":")||o===void 0))if(Array.isArray(o))for(let r of o)t.append(e,r);else t.set(e,o);return t}function V(s){return typeof s=="number"?s:Array.isArray(s)?Number(s[0]??0):Number(s??0)}async function A(s){return this.get("creator.get",s)}async function U(s){return this.get("post.paginateCreator",s)}async function E(s){return this.get("plan.listCreator",s)}async function M(s){return this.get("post.listCreator",s)}async function v(s){return this.get("post.info",s)}async function q(s={}){return this.get("post.listHome",s)}async function G(s={}){return this.get("post.listSupporting",s)}async function k(){return this.get("creator.listFollowing")}async function N(){return this.get("plan.listSupporting")}var Y="https://api.fanbox.cc",g=class extends Error{constructor(t,e){super(`FANBOX API request failed: ${t.status} ${t.statusText}`),this.name="FanboxApiError",this.body=e,this.status=t.status,this.statusText=t.statusText}},m,x,d,S=class{constructor(t={}){this.getCreator=A;this.getPost=v;this.listCreatorPlans=E;this.listCreatorPosts=M;this.listFollowingCreators=k;this.listHomePosts=q;this.listSupportingPlans=N;this.listSupportingPosts=G;this.paginateCreatorPosts=U;a(this,m);a(this,x);a(this,d);l(this,m,t.baseUrl??Y),l(this,x,t.headers??{}),l(this,d,t.transport??new b)}async get(t,e={}){let o=new URL(t,n(this,m).endsWith("/")?n(this,m):`${n(this,m)}/`);for(let[y,u]of Object.entries(e))u!==void 0&&o.searchParams.set(y,String(u));let r=new Request(o,{headers:n(this,x)}),i=await n(this,d).fetch(r),h=await Z(i);if(!i.ok)throw new g(i,h);return h.body}};m=new WeakMap,x=new WeakMap,d=new WeakMap;async function Z(s){let t=await s.text();try{return JSON.parse(t)}catch{return t}}0&&(module.exports={FanboxApiError,FanboxClient});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/transport/http2-session.ts","../../src/transport/http2.ts","../../src/client/endpoints/creator-get.ts","../../src/client/endpoints/creator-list-pages.ts","../../src/client/endpoints/creator-list-plans.ts","../../src/client/endpoints/creator-list-posts.ts","../../src/client/endpoints/post-info.ts","../../src/client/endpoints/post-list-home.ts","../../src/client/endpoints/post-list-supporting.ts","../../src/client/endpoints/user-list-following.ts","../../src/client/endpoints/user-list-supporting.ts","../../src/client/client.ts"],"sourcesContent":["export { FanboxApiError, FanboxClient } from \"./client/client.js\";\nexport type * from \"./client/types.js\";\n","import { type ClientHttp2Session, connect } from \"node:http2\";\n\nexport interface Http2SessionManagerOptions {\n sessionsPerOrigin?: number;\n}\n\ninterface OriginSessionPool {\n nextIndex: number;\n sessions: ClientHttp2Session[];\n}\n\nexport class Http2SessionManager {\n readonly #pools = new Map<string, OriginSessionPool>();\n readonly #sessionsPerOrigin: number;\n\n constructor({ sessionsPerOrigin = 5 }: Http2SessionManagerOptions = {}) {\n this.#sessionsPerOrigin = Math.max(1, Math.floor(sessionsPerOrigin));\n }\n\n async closeAll(): Promise<void> {\n const sessions = [...this.#pools.values()].flatMap((pool) => pool.sessions);\n this.#pools.clear();\n await Promise.all(sessions.map(closeHttp2Session));\n }\n\n getSession(url: string): ClientHttp2Session {\n const origin = new URL(url).origin;\n const pool = this.#pools.get(origin) ?? this.#createPool(origin);\n\n if (pool.sessions.length < this.#sessionsPerOrigin) {\n const session = this.#createSession(origin);\n pool.sessions.push(session);\n return session;\n }\n\n const session = pool.sessions[pool.nextIndex % pool.sessions.length];\n pool.nextIndex = (pool.nextIndex + 1) % pool.sessions.length;\n\n return session;\n }\n\n #createPool(origin: string): OriginSessionPool {\n const pool = { nextIndex: 0, sessions: [] };\n this.#pools.set(origin, pool);\n return pool;\n }\n\n #createSession(origin: string) {\n const session = connect(origin);\n\n const cleanup = () => {\n const pool = this.#pools.get(origin);\n if (!pool) return;\n\n const index = pool.sessions.indexOf(session);\n if (index >= 0) {\n pool.sessions.splice(index, 1);\n pool.nextIndex = Math.min(pool.nextIndex, pool.sessions.length);\n }\n\n if (pool.sessions.length === 0) {\n this.#pools.delete(origin);\n }\n };\n session.once(\"close\", cleanup);\n session.once(\"error\", cleanup);\n\n return session;\n }\n}\n\nfunction closeHttp2Session(session: ClientHttp2Session): Promise<void> {\n if (session.closed || session.destroyed) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n session.close(resolve);\n });\n}\n","import {\n Http2SessionManager,\n type Http2SessionManagerOptions,\n} from \"./http2-session.js\";\n\nconst HTTP2_HEADER_STATUS = \":status\";\n\nexport interface HttpTransport {\n fetch(input: Request | string | URL): Promise<Response>;\n}\n\nexport class Http2Error extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"Http2Error\";\n }\n}\n\nexport class Http2Transport {\n readonly #pool: Http2SessionManager;\n\n constructor(options: Http2SessionManagerOptions = {}) {\n this.#pool = new Http2SessionManager(options);\n }\n\n fetch(input: Request | string | URL) {\n const request = input instanceof Request ? input : new Request(input);\n const headers = attachHttp2Headers(request);\n\n const session = this.#pool.getSession(request.url);\n const stream = session.request(headers, { endStream: !request.body });\n\n return new Promise<Response>((resolve, reject) => {\n let settled = false;\n stream.once(\"error\", reject);\n stream.once(\"close\", () => {\n if (!settled) {\n reject(new Http2Error(`HTTP/2 stream closed before response`));\n }\n });\n\n stream.once(\"response\", (responseHeaders) => {\n settled = true;\n resolve(\n new Response(stream, {\n headers: createResponseHeaders(responseHeaders),\n status: parseStatus(responseHeaders[HTTP2_HEADER_STATUS]),\n }),\n );\n });\n\n // If the request has a body, write it to the stream. If writing fails, destroy the stream to trigger error handling.\n if (request.body) stream.end(request.body);\n });\n }\n}\n\nfunction attachHttp2Headers(request: Request) {\n const url = new URL(request.url);\n const headers = { ...Object.fromEntries(request.headers) };\n\n headers[\":authority\"] = url.host;\n headers[\":method\"] = request.method.toUpperCase();\n headers[\":path\"] = `${url.pathname}${url.search}`;\n headers[\":scheme\"] = url.protocol.slice(0, -1);\n\n return headers;\n}\n\nfunction createResponseHeaders(\n headers: Record<string, string | string[] | undefined>,\n): Headers {\n const result = new Headers();\n for (const [key, value] of Object.entries(headers)) {\n if (\n // ignore HTTP/2 pseudo-headers in the response\n key.startsWith(\":\") ||\n value === undefined\n )\n continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n result.append(key, item);\n }\n } else {\n result.set(key, value);\n }\n }\n\n return result;\n}\n\nfunction parseStatus(status: number | string | string[] | undefined): number {\n if (typeof status === \"number\") {\n return status;\n }\n if (Array.isArray(status)) {\n return Number(status[0] ?? 0);\n }\n\n return Number(status ?? 0);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Creator } from \"../models/creator.js\";\n\nexport interface GetCreatorParams {\n creatorId: string;\n}\n\nexport type GetCreatorResult = Creator;\n\n/**\n * Get detailed information about a specific creator.\n */\nexport async function getCreator(\n this: FanboxClient,\n params: GetCreatorParams,\n): Promise<GetCreatorResult> {\n return this.get(\"creator.get\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostSort } from \"../models/post.js\";\n\nexport interface PaginateCreatorPostsParams {\n creatorId: string;\n sort?: PostSort;\n}\n\nexport type PaginateCreatorPostsResult = string[];\n\n/**\n * List all urls to the pages, which paginated by the given conditions.\n */\nexport async function paginateCreatorPosts(\n this: FanboxClient,\n params: PaginateCreatorPostsParams,\n): Promise<PaginateCreatorPostsResult> {\n return this.get(\"post.paginateCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Plan } from \"../models/plan.js\";\n\nexport interface ListCreatorPlansParams {\n creatorId: string;\n}\n\nexport type ListCreatorPlansResult = Plan[];\n\n/**\n * List plans for a specific creator.\n */\nexport async function listCreatorPlans(\n this: FanboxClient,\n params: ListCreatorPlansParams,\n): Promise<ListCreatorPlansResult> {\n return this.get(\"plan.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSort, PostSummary } from \"../models/post.js\";\n\nexport interface ListCreatorPostsParams extends PostListParams {\n creatorId: string;\n firstId?: string;\n firstPublishedDatetime?: string;\n sort?: PostSort;\n}\n\nexport type ListCreatorPostsResult = PostSummary[];\n\n/**\n * List posts for a specific creator.\n */\nexport async function listCreatorPosts(\n this: FanboxClient,\n params: ListCreatorPostsParams,\n): Promise<ListCreatorPostsResult> {\n return this.get(\"post.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Post } from \"../models/post.js\";\n\nexport interface GetPostParams {\n postId: string;\n}\n\nexport type GetPostResult = Post;\n\n/**\n * Get detailed information about a specific post.\n */\nexport async function getPost(\n this: FanboxClient,\n params: GetPostParams,\n): Promise<GetPostResult> {\n return this.get(\"post.info\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListHomePostsParams = PostListParams;\n\nexport type ListHomePostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from both following and supporting\n * creators. This endpoint is only available to logged-in users.\n */\nexport async function listHomePosts(\n this: FanboxClient,\n params: ListHomePostsParams = {},\n): Promise<ListHomePostsResult> {\n return this.get(\"post.listHome\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListSupportingPostsParams = PostListParams;\n\nexport type ListSupportingPostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from supporting creators only. This\n * endpoint is only available to logged-in users.\n */\nexport async function listSupportingPosts(\n this: FanboxClient,\n params: ListSupportingPostsParams = {},\n): Promise<ListSupportingPostsResult> {\n return this.get(\"post.listSupporting\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { CreatorSummary } from \"../models/creator.js\";\n\nexport interface ListFollowingCreatorsResult {\n creators: CreatorSummary[];\n}\n\n/**\n * List creators that the authenticated user is following.\n */\nexport async function listFollowingCreators(\n this: FanboxClient,\n): Promise<ListFollowingCreatorsResult> {\n return this.get(\"creator.listFollowing\");\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { SupportingPlan } from \"../models/plan.js\";\n\nexport interface ListSupportingPlansResult {\n plans: SupportingPlan[];\n}\n\n/**\n * List plans that the authenticated user is supporting.\n */\nexport async function listSupportingPlans(\n this: FanboxClient,\n): Promise<ListSupportingPlansResult> {\n return this.get(\"plan.listSupporting\");\n}\n","import { Http2Transport, type HttpTransport } from \"../transport/http2.js\";\nimport { getCreator } from \"./endpoints/creator-get.js\";\nimport { paginateCreatorPosts } from \"./endpoints/creator-list-pages.js\";\nimport { listCreatorPlans } from \"./endpoints/creator-list-plans.js\";\nimport { listCreatorPosts } from \"./endpoints/creator-list-posts.js\";\nimport { getPost } from \"./endpoints/post-info.js\";\nimport { listHomePosts } from \"./endpoints/post-list-home.js\";\nimport { listSupportingPosts } from \"./endpoints/post-list-supporting.js\";\nimport { listFollowingCreators } from \"./endpoints/user-list-following.js\";\nimport { listSupportingPlans } from \"./endpoints/user-list-supporting.js\";\nimport type { FanboxEnvelope } from \"./fanbox-envelope.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.fanbox.cc\";\n\nexport interface FanboxClientOptions {\n baseUrl?: string;\n headers?: Record<string, string>;\n transport?: HttpTransport;\n}\n\nexport class FanboxApiError extends Error {\n public readonly body: unknown;\n public readonly status: number;\n public readonly statusText: string;\n\n public constructor(response: Response, body: unknown) {\n super(\n `FANBOX API request failed: ${response.status} ${response.statusText}`,\n );\n this.name = \"FanboxApiError\";\n this.body = body;\n this.status = response.status;\n this.statusText = response.statusText;\n }\n}\n\nexport class FanboxClient {\n getCreator = getCreator;\n getPost = getPost;\n listCreatorPlans = listCreatorPlans;\n listCreatorPosts = listCreatorPosts;\n listFollowingCreators = listFollowingCreators;\n listHomePosts = listHomePosts;\n listSupportingPlans = listSupportingPlans;\n listSupportingPosts = listSupportingPosts;\n paginateCreatorPosts = paginateCreatorPosts;\n\n readonly #baseUrl: string;\n readonly #headers: Record<string, string>;\n readonly #transport: HttpTransport;\n\n public constructor(options: FanboxClientOptions = {}) {\n this.#baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.#headers = options.headers ?? {};\n this.#transport = options.transport ?? new Http2Transport();\n }\n\n protected async get<T>(path: string, query: object = {}): Promise<T> {\n const url = new URL(\n path,\n this.#baseUrl.endsWith(\"/\") ? this.#baseUrl : `${this.#baseUrl}/`,\n );\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n\n const request = new Request(url, { headers: this.#headers });\n const response = await this.#transport.fetch(request);\n const body = await parseJSONBody<FanboxEnvelope<T>>(response);\n if (!response.ok) {\n throw new FanboxApiError(response, body);\n }\n\n return body.body;\n }\n}\n\nasync function parseJSONBody<T>(response: Response): Promise<T> {\n const text = await response.text();\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n}\n"],"mappings":"kyBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,EAAA,iBAAAC,IAAA,eAAAC,EAAAJ,ICAA,IAAAK,EAAiD,iBAAjD,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAWaC,EAAN,KAA0B,CAI/B,YAAY,CAAE,kBAAAC,EAAoB,CAAE,EAAgC,CAAC,EAAG,CAJnEC,EAAA,KAAAL,GACLK,EAAA,KAASP,EAAS,IAAI,KACtBO,EAAA,KAASN,GAGPO,EAAA,KAAKP,EAAqB,KAAK,IAAI,EAAG,KAAK,MAAMK,CAAiB,CAAC,EACrE,CAEA,MAAM,UAA0B,CAC9B,IAAMG,EAAW,CAAC,GAAGC,EAAA,KAAKV,GAAO,OAAO,CAAC,EAAE,QAASW,GAASA,EAAK,QAAQ,EAC1ED,EAAA,KAAKV,GAAO,MAAM,EAClB,MAAM,QAAQ,IAAIS,EAAS,IAAIG,CAAiB,CAAC,CACnD,CAEA,WAAWC,EAAiC,CAC1C,IAAMC,EAAS,IAAI,IAAID,CAAG,EAAE,OACtBF,EAAOD,EAAA,KAAKV,GAAO,IAAIc,CAAM,GAAKC,EAAA,KAAKb,EAAAC,GAAL,UAAiBW,GAEzD,GAAIH,EAAK,SAAS,OAASD,EAAA,KAAKT,GAAoB,CAClD,IAAMe,EAAUD,EAAA,KAAKb,EAAAE,GAAL,UAAoBU,GACpC,OAAAH,EAAK,SAAS,KAAKK,CAAO,EACnBA,CACT,CAEA,IAAMA,EAAUL,EAAK,SAASA,EAAK,UAAYA,EAAK,SAAS,MAAM,EACnE,OAAAA,EAAK,WAAaA,EAAK,UAAY,GAAKA,EAAK,SAAS,OAE/CK,CACT,CA8BF,EAzDWhB,EAAA,YACAC,EAAA,YAFJC,EAAA,YA8BLC,EAAW,SAACW,EAAmC,CAC7C,IAAMH,EAAO,CAAE,UAAW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AAKd,EAAWG,EAAQ,SAAW,CAAC,GACpCW,EAAA,KAAKb,EAAaE,EAAQ,WAAa,IAAIY,EAC7C,CAEA,MAAgB,IAAOC,EAAcC,EAAgB,CAAC,EAAe,CACnE,IAAMC,EAAM,IAAI,IACdF,EACAG,EAAA,KAAKpB,GAAS,SAAS,GAAG,EAAIoB,EAAA,KAAKpB,GAAW,GAAGoB,EAAA,KAAKpB,EAAQ,GAChE,EACA,OAAW,CAACqB,EAAKC,CAAK,IAAK,OAAO,QAAQJ,CAAK,EACzCI,IAAU,QACZH,EAAI,aAAa,IAAIE,EAAK,OAAOC,CAAK,CAAC,EAI3C,IAAMC,EAAU,IAAI,QAAQJ,EAAK,CAAE,QAASC,EAAA,KAAKnB,EAAS,CAAC,EACrDH,EAAW,MAAMsB,EAAA,KAAKlB,GAAW,MAAMqB,CAAO,EAC9CxB,EAAO,MAAMyB,EAAiC1B,CAAQ,EAC5D,GAAI,CAACA,EAAS,GACZ,MAAM,IAAID,EAAeC,EAAUC,CAAI,EAGzC,OAAOA,EAAK,IACd,CACF,EA9BWC,EAAA,YACAC,EAAA,YACAC,EAAA,YA8BX,eAAesB,EAAiB1B,EAAgC,CAC9D,IAAM2B,EAAO,MAAM3B,EAAS,KAAK,EACjC,GAAI,CACF,OAAO,KAAK,MAAM2B,CAAI,CACxB,MAAQ,CACN,OAAOA,CACT,CACF","names":["index_exports","__export","FanboxApiError","FanboxClient","__toCommonJS","import_node_http2","_pools","_sessionsPerOrigin","_Http2SessionManager_instances","createPool_fn","createSession_fn","Http2SessionManager","sessionsPerOrigin","__privateAdd","__privateSet","sessions","__privateGet","pool","closeHttp2Session","url","origin","__privateMethod","session","cleanup","index","resolve","HTTP2_HEADER_STATUS","Http2Error","message","_pool","Http2Transport","options","__privateAdd","__privateSet","Http2SessionManager","input","request","headers","attachHttp2Headers","stream","__privateGet","resolve","reject","settled","responseHeaders","createResponseHeaders","parseStatus","url","result","key","value","item","status","getCreator","params","paginateCreatorPosts","params","listCreatorPlans","params","listCreatorPosts","params","getPost","params","listHomePosts","params","listSupportingPosts","params","listFollowingCreators","listSupportingPlans","DEFAULT_BASE_URL","FanboxApiError","response","body","_baseUrl","_headers","_transport","FanboxClient","options","getCreator","getPost","listCreatorPlans","listCreatorPosts","listFollowingCreators","listHomePosts","listSupportingPlans","listSupportingPosts","paginateCreatorPosts","__privateAdd","__privateSet","Http2Transport","path","query","url","__privateGet","key","value","request","parseJSONBody","text"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/transport/http2-session.ts","../../src/transport/http2.ts","../../src/client/endpoints/creator-get.ts","../../src/client/endpoints/creator-list-pages.ts","../../src/client/endpoints/creator-list-plans.ts","../../src/client/endpoints/creator-list-posts.ts","../../src/client/endpoints/post-info.ts","../../src/client/endpoints/post-list-home.ts","../../src/client/endpoints/post-list-supporting.ts","../../src/client/endpoints/user-list-following.ts","../../src/client/endpoints/user-list-supporting.ts","../../src/client/client.ts"],"sourcesContent":["export { FanboxApiError, FanboxClient } from \"./client/client.js\";\nexport type * from \"./client/types.js\";\n","import { type ClientHttp2Session, connect } from \"node:http2\";\n\nexport interface Http2SessionManagerOptions {\n sessionsPerOrigin?: number;\n}\n\ninterface OriginSessionPool {\n nextIndex: number;\n sessions: ClientHttp2Session[];\n}\n\nexport class Http2SessionManager {\n readonly #pools = new Map<string, OriginSessionPool>();\n readonly #sessionsPerOrigin: number;\n\n constructor({ sessionsPerOrigin = 5 }: Http2SessionManagerOptions = {}) {\n this.#sessionsPerOrigin = Math.max(1, Math.floor(sessionsPerOrigin));\n }\n\n async closeAll(): Promise<void> {\n const sessions = [...this.#pools.values()].flatMap((pool) => pool.sessions);\n this.#pools.clear();\n await Promise.all(sessions.map(closeHttp2Session));\n }\n\n getSession(url: string): ClientHttp2Session {\n const origin = new URL(url).origin;\n const pool = this.#pools.get(origin) ?? this.#createPool(origin);\n\n if (pool.sessions.length < this.#sessionsPerOrigin) {\n const session = this.#createSession(origin);\n pool.sessions.push(session);\n return session;\n }\n\n const session = pool.sessions[pool.nextIndex % pool.sessions.length];\n pool.nextIndex = (pool.nextIndex + 1) % pool.sessions.length;\n\n return session;\n }\n\n #createPool(origin: string): OriginSessionPool {\n const pool = { nextIndex: 0, sessions: [] };\n this.#pools.set(origin, pool);\n return pool;\n }\n\n #createSession(origin: string) {\n const session = connect(origin);\n\n const cleanup = () => {\n const pool = this.#pools.get(origin);\n if (!pool) return;\n\n const index = pool.sessions.indexOf(session);\n if (index >= 0) {\n pool.sessions.splice(index, 1);\n pool.nextIndex = Math.min(pool.nextIndex, pool.sessions.length);\n }\n\n if (pool.sessions.length === 0) {\n this.#pools.delete(origin);\n }\n };\n session.once(\"close\", cleanup);\n session.once(\"error\", cleanup);\n\n return session;\n }\n}\n\nfunction closeHttp2Session(session: ClientHttp2Session): Promise<void> {\n if (session.closed || session.destroyed) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n session.close(resolve);\n });\n}\n","import {\n Http2SessionManager,\n type Http2SessionManagerOptions,\n} from \"./http2-session.js\";\n\nconst HTTP2_HEADER_STATUS = \":status\";\n\nexport interface HttpTransport {\n fetch(input: Request | string | URL): Promise<Response>;\n}\n\nexport class Http2Error extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"Http2Error\";\n }\n}\n\nexport class Http2Transport {\n readonly #pool: Http2SessionManager;\n\n constructor(options: Http2SessionManagerOptions = {}) {\n this.#pool = new Http2SessionManager(options);\n }\n\n fetch(input: Request | string | URL) {\n const request = input instanceof Request ? input : new Request(input);\n const headers = attachHttp2Headers(request);\n\n const session = this.#pool.getSession(request.url);\n const stream = session.request(headers, { endStream: !request.body });\n\n return new Promise<Response>((resolve, reject) => {\n let settled = false;\n stream.once(\"error\", reject);\n stream.once(\"close\", () => {\n if (!settled) {\n reject(new Http2Error(`HTTP/2 stream closed before response`));\n }\n });\n\n stream.once(\"response\", (responseHeaders) => {\n settled = true;\n resolve(\n new Response(stream, {\n headers: createResponseHeaders(responseHeaders),\n status: parseStatus(responseHeaders[HTTP2_HEADER_STATUS]),\n }),\n );\n });\n\n // If the request has a body, write it to the stream. If writing fails, destroy the stream to trigger error handling.\n if (request.body) stream.end(request.body);\n });\n }\n}\n\nfunction attachHttp2Headers(request: Request) {\n const url = new URL(request.url);\n const headers = { ...Object.fromEntries(request.headers) };\n\n headers[\":authority\"] = url.host;\n headers[\":method\"] = request.method.toUpperCase();\n headers[\":path\"] = `${url.pathname}${url.search}`;\n headers[\":scheme\"] = url.protocol.slice(0, -1);\n\n return headers;\n}\n\nfunction createResponseHeaders(\n headers: Record<string, string | string[] | undefined>,\n): Headers {\n const result = new Headers();\n for (const [key, value] of Object.entries(headers)) {\n if (\n // ignore HTTP/2 pseudo-headers in the response\n key.startsWith(\":\") ||\n value === undefined\n )\n continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n result.append(key, item);\n }\n } else {\n result.set(key, value);\n }\n }\n\n return result;\n}\n\nfunction parseStatus(status: number | string | string[] | undefined): number {\n if (typeof status === \"number\") {\n return status;\n }\n if (Array.isArray(status)) {\n return Number(status[0] ?? 0);\n }\n\n return Number(status ?? 0);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Creator } from \"../models/creator.js\";\n\nexport interface GetCreatorParams {\n creatorId: string;\n}\n\nexport type GetCreatorResult = Creator;\n\n/**\n * Get detailed information about a specific creator.\n */\nexport async function getCreator(\n this: FanboxClient,\n params: GetCreatorParams,\n): Promise<GetCreatorResult> {\n return this.get(\"creator.get\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostSort } from \"../models/post.js\";\n\nexport interface PaginateCreatorPostsParams {\n creatorId: string;\n sort?: PostSort;\n}\n\nexport type PaginateCreatorPostsResult = string[];\n\n/**\n * List all urls to the pages, which paginated by the given conditions.\n */\nexport async function paginateCreatorPosts(\n this: FanboxClient,\n params: PaginateCreatorPostsParams,\n): Promise<PaginateCreatorPostsResult> {\n return this.get(\"post.paginateCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Plan } from \"../models/plan.js\";\n\nexport interface ListCreatorPlansParams {\n creatorId: string;\n}\n\nexport type ListCreatorPlansResult = Plan[];\n\n/**\n * List plans for a specific creator.\n */\nexport async function listCreatorPlans(\n this: FanboxClient,\n params: ListCreatorPlansParams,\n): Promise<ListCreatorPlansResult> {\n return this.get(\"plan.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSort, PostSummary } from \"../models/post.js\";\n\nexport interface ListCreatorPostsParams extends PostListParams {\n creatorId: string;\n firstId?: string;\n firstPublishedDatetime?: string;\n sort?: PostSort;\n}\n\nexport interface ListCreatorPostsResult {\n posts: PostSummary[];\n}\n\n/**\n * List posts for a specific creator.\n */\nexport async function listCreatorPosts(\n this: FanboxClient,\n params: ListCreatorPostsParams,\n): Promise<ListCreatorPostsResult> {\n return this.get(\"post.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Post } from \"../models/post.js\";\n\nexport interface GetPostParams {\n postId: string;\n}\n\nexport interface GetPostResult {\n post: Post;\n}\n\n/**\n * Get detailed information about a specific post.\n */\nexport async function getPost(\n this: FanboxClient,\n params: GetPostParams,\n): Promise<GetPostResult> {\n return this.get(\"post.info\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListHomePostsParams = PostListParams;\n\nexport type ListHomePostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from both following and supporting\n * creators. This endpoint is only available to logged-in users.\n */\nexport async function listHomePosts(\n this: FanboxClient,\n params: ListHomePostsParams = {},\n): Promise<ListHomePostsResult> {\n return this.get(\"post.listHome\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListSupportingPostsParams = PostListParams;\n\nexport type ListSupportingPostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from supporting creators only. This\n * endpoint is only available to logged-in users.\n */\nexport async function listSupportingPosts(\n this: FanboxClient,\n params: ListSupportingPostsParams = {},\n): Promise<ListSupportingPostsResult> {\n return this.get(\"post.listSupporting\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { CreatorSummary } from \"../models/creator.js\";\n\nexport interface ListFollowingCreatorsResult {\n creators: CreatorSummary[];\n}\n\n/**\n * List creators that the authenticated user is following.\n */\nexport async function listFollowingCreators(\n this: FanboxClient,\n): Promise<ListFollowingCreatorsResult> {\n return this.get(\"creator.listFollowing\");\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { SupportingPlan } from \"../models/plan.js\";\n\nexport interface ListSupportingPlansResult {\n plans: SupportingPlan[];\n}\n\n/**\n * List plans that the authenticated user is supporting.\n */\nexport async function listSupportingPlans(\n this: FanboxClient,\n): Promise<ListSupportingPlansResult> {\n return this.get(\"plan.listSupporting\");\n}\n","import { Http2Transport, type HttpTransport } from \"../transport/http2.js\";\nimport { getCreator } from \"./endpoints/creator-get.js\";\nimport { paginateCreatorPosts } from \"./endpoints/creator-list-pages.js\";\nimport { listCreatorPlans } from \"./endpoints/creator-list-plans.js\";\nimport { listCreatorPosts } from \"./endpoints/creator-list-posts.js\";\nimport { getPost } from \"./endpoints/post-info.js\";\nimport { listHomePosts } from \"./endpoints/post-list-home.js\";\nimport { listSupportingPosts } from \"./endpoints/post-list-supporting.js\";\nimport { listFollowingCreators } from \"./endpoints/user-list-following.js\";\nimport { listSupportingPlans } from \"./endpoints/user-list-supporting.js\";\nimport type { FanboxEnvelope } from \"./fanbox-envelope.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.fanbox.cc\";\n\nexport interface FanboxClientOptions {\n baseUrl?: string;\n headers?: Record<string, string>;\n transport?: HttpTransport;\n}\n\nexport class FanboxApiError extends Error {\n public readonly body: unknown;\n public readonly status: number;\n public readonly statusText: string;\n\n public constructor(response: Response, body: unknown) {\n super(\n `FANBOX API request failed: ${response.status} ${response.statusText}`,\n );\n this.name = \"FanboxApiError\";\n this.body = body;\n this.status = response.status;\n this.statusText = response.statusText;\n }\n}\n\nexport class FanboxClient {\n getCreator = getCreator;\n getPost = getPost;\n listCreatorPlans = listCreatorPlans;\n listCreatorPosts = listCreatorPosts;\n listFollowingCreators = listFollowingCreators;\n listHomePosts = listHomePosts;\n listSupportingPlans = listSupportingPlans;\n listSupportingPosts = listSupportingPosts;\n paginateCreatorPosts = paginateCreatorPosts;\n\n readonly #baseUrl: string;\n readonly #headers: Record<string, string>;\n readonly #transport: HttpTransport;\n\n public constructor(options: FanboxClientOptions = {}) {\n this.#baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.#headers = options.headers ?? {};\n this.#transport = options.transport ?? new Http2Transport();\n }\n\n protected async get<T>(path: string, query: object = {}): Promise<T> {\n const url = new URL(\n path,\n this.#baseUrl.endsWith(\"/\") ? this.#baseUrl : `${this.#baseUrl}/`,\n );\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n\n const request = new Request(url, { headers: this.#headers });\n const response = await this.#transport.fetch(request);\n const body = await parseJSONBody<FanboxEnvelope<T>>(response);\n if (!response.ok) {\n throw new FanboxApiError(response, body);\n }\n\n return body.body;\n }\n}\n\nasync function parseJSONBody<T>(response: Response): Promise<T> {\n const text = await response.text();\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n}\n"],"mappings":"kyBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,EAAA,iBAAAC,IAAA,eAAAC,EAAAJ,ICAA,IAAAK,EAAiD,iBAAjD,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAWaC,EAAN,KAA0B,CAI/B,YAAY,CAAE,kBAAAC,EAAoB,CAAE,EAAgC,CAAC,EAAG,CAJnEC,EAAA,KAAAL,GACLK,EAAA,KAASP,EAAS,IAAI,KACtBO,EAAA,KAASN,GAGPO,EAAA,KAAKP,EAAqB,KAAK,IAAI,EAAG,KAAK,MAAMK,CAAiB,CAAC,EACrE,CA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ACrDH,EAAW,MAAMsB,EAAA,KAAKlB,GAAW,MAAMqB,CAAO,EAC9CxB,EAAO,MAAMyB,EAAiC1B,CAAQ,EAC5D,GAAI,CAACA,EAAS,GACZ,MAAM,IAAID,EAAeC,EAAUC,CAAI,EAGzC,OAAOA,EAAK,IACd,CACF,EA9BWC,EAAA,YACAC,EAAA,YACAC,EAAA,YA8BX,eAAesB,EAAiB1B,EAAgC,CAC9D,IAAM2B,EAAO,MAAM3B,EAAS,KAAK,EACjC,GAAI,CACF,OAAO,KAAK,MAAM2B,CAAI,CACxB,MAAQ,CACN,OAAOA,CACT,CACF","names":["index_exports","__export","FanboxApiError","FanboxClient","__toCommonJS","import_node_http2","_pools","_sessionsPerOrigin","_Http2SessionManager_instances","createPool_fn","createSession_fn","Http2SessionManager","sessionsPerOrigin","__privateAdd","__privateSet","sessions","__privateGet","pool","closeHttp2Session","url","origin","__privateMethod","session","cleanup","index","resolve","HTTP2_HEADER_STATUS","Http2Error","message","_pool","Http2Transport","options","__privateAdd","__privateSet","Http2SessionManager","input","request","headers","attachHttp2Headers","stream","__privateGet","resolve","reject","settled","responseHeaders","createResponseHeaders","parseStatus","url","result","key","value","item","status","getCreator","params","paginateCreatorPosts","params","listCreatorPlans","params","listCreatorPosts","params","getPost","params","listHomePosts","params","listSupportingPosts","params","listFollowingCreators","listSupportingPlans","DEFAULT_BASE_URL","FanboxApiError","response","body","_baseUrl","_headers","_transport","FanboxClient","options","getCreator","getPost","listCreatorPlans","listCreatorPosts","listFollowingCreators","listHomePosts","listSupportingPlans","listSupportingPosts","paginateCreatorPosts","__privateAdd","__privateSet","Http2Transport","path","query","url","__privateGet","key","value","request","parseJSONBody","text"]}
@@ -163,6 +163,9 @@ interface PostCover {
163
163
  type: "cover_image" | "post_image";
164
164
  url: string;
165
165
  }
166
+ interface PostItem {
167
+ post: PostSummary;
168
+ }
166
169
  interface PostListParams {
167
170
  limit?: number;
168
171
  maxId?: string;
@@ -254,13 +257,17 @@ interface ListCreatorPostsParams extends PostListParams {
254
257
  firstPublishedDatetime?: string;
255
258
  sort?: PostSort;
256
259
  }
257
- type ListCreatorPostsResult = PostSummary[];
260
+ interface ListCreatorPostsResult {
261
+ posts: PostSummary[];
262
+ }
258
263
  declare function listCreatorPosts(this: FanboxClient, params: ListCreatorPostsParams): Promise<ListCreatorPostsResult>;
259
264
 
260
265
  interface GetPostParams {
261
266
  postId: string;
262
267
  }
263
- type GetPostResult = Post;
268
+ interface GetPostResult {
269
+ post: Post;
270
+ }
264
271
  declare function getPost(this: FanboxClient, params: GetPostParams): Promise<GetPostResult>;
265
272
 
266
273
  type ListHomePostsParams = PostListParams;
@@ -307,4 +314,4 @@ declare class FanboxClient {
307
314
  protected get<T>(path: string, query?: object): Promise<T>;
308
315
  }
309
316
 
310
- export { type ArticlePost, type Creator, type CreatorProfileImage, type CreatorProfileItem, type CreatorProfileUnknownItem, type CreatorSummary, FanboxApiError, FanboxClient, type FanboxUser, type FilePost, type FilePostBody, type GetCreatorParams, type GetCreatorResult, type GetPostParams, type GetPostResult, type ImagePost, type ImagePostBody, type KnownPost, type ListCreatorPlansParams, type ListCreatorPlansResult, type ListCreatorPostsParams, type ListCreatorPostsResult, type ListFollowingCreatorsResult, type ListHomePostsParams, type ListHomePostsResult, type ListSupportingPlansResult, type ListSupportingPostsParams, type ListSupportingPostsResult, type NeighboringPost, type PaginateCreatorPostsParams, type PaginateCreatorPostsResult, type Plan, type Post, type PostCover, type PostListParams, type PostSort, type PostSummary, type SupportingPlan, type TextPost, type TextPostBody, type UnknownPost, type UnknownPostBody, type VideoPost, type VideoPostBody, getCreator, getPost, listCreatorPlans, listCreatorPosts, listFollowingCreators, listHomePosts, listSupportingPlans, listSupportingPosts, paginateCreatorPosts };
317
+ export { type ArticlePost, type Creator, type CreatorProfileImage, type CreatorProfileItem, type CreatorProfileUnknownItem, type CreatorSummary, FanboxApiError, FanboxClient, type FanboxUser, type FilePost, type FilePostBody, type GetCreatorParams, type GetCreatorResult, type GetPostParams, type GetPostResult, type ImagePost, type ImagePostBody, type KnownPost, type ListCreatorPlansParams, type ListCreatorPlansResult, type ListCreatorPostsParams, type ListCreatorPostsResult, type ListFollowingCreatorsResult, type ListHomePostsParams, type ListHomePostsResult, type ListSupportingPlansResult, type ListSupportingPostsParams, type ListSupportingPostsResult, type NeighboringPost, type PaginateCreatorPostsParams, type PaginateCreatorPostsResult, type Plan, type Post, type PostCover, type PostItem, type PostListParams, type PostSort, type PostSummary, type SupportingPlan, type TextPost, type TextPostBody, type UnknownPost, type UnknownPostBody, type VideoPost, type VideoPostBody, getCreator, getPost, listCreatorPlans, listCreatorPosts, listFollowingCreators, listHomePosts, listSupportingPlans, listSupportingPosts, paginateCreatorPosts };
@@ -163,6 +163,9 @@ interface PostCover {
163
163
  type: "cover_image" | "post_image";
164
164
  url: string;
165
165
  }
166
+ interface PostItem {
167
+ post: PostSummary;
168
+ }
166
169
  interface PostListParams {
167
170
  limit?: number;
168
171
  maxId?: string;
@@ -254,13 +257,17 @@ interface ListCreatorPostsParams extends PostListParams {
254
257
  firstPublishedDatetime?: string;
255
258
  sort?: PostSort;
256
259
  }
257
- type ListCreatorPostsResult = PostSummary[];
260
+ interface ListCreatorPostsResult {
261
+ posts: PostSummary[];
262
+ }
258
263
  declare function listCreatorPosts(this: FanboxClient, params: ListCreatorPostsParams): Promise<ListCreatorPostsResult>;
259
264
 
260
265
  interface GetPostParams {
261
266
  postId: string;
262
267
  }
263
- type GetPostResult = Post;
268
+ interface GetPostResult {
269
+ post: Post;
270
+ }
264
271
  declare function getPost(this: FanboxClient, params: GetPostParams): Promise<GetPostResult>;
265
272
 
266
273
  type ListHomePostsParams = PostListParams;
@@ -307,4 +314,4 @@ declare class FanboxClient {
307
314
  protected get<T>(path: string, query?: object): Promise<T>;
308
315
  }
309
316
 
310
- export { type ArticlePost, type Creator, type CreatorProfileImage, type CreatorProfileItem, type CreatorProfileUnknownItem, type CreatorSummary, FanboxApiError, FanboxClient, type FanboxUser, type FilePost, type FilePostBody, type GetCreatorParams, type GetCreatorResult, type GetPostParams, type GetPostResult, type ImagePost, type ImagePostBody, type KnownPost, type ListCreatorPlansParams, type ListCreatorPlansResult, type ListCreatorPostsParams, type ListCreatorPostsResult, type ListFollowingCreatorsResult, type ListHomePostsParams, type ListHomePostsResult, type ListSupportingPlansResult, type ListSupportingPostsParams, type ListSupportingPostsResult, type NeighboringPost, type PaginateCreatorPostsParams, type PaginateCreatorPostsResult, type Plan, type Post, type PostCover, type PostListParams, type PostSort, type PostSummary, type SupportingPlan, type TextPost, type TextPostBody, type UnknownPost, type UnknownPostBody, type VideoPost, type VideoPostBody, getCreator, getPost, listCreatorPlans, listCreatorPosts, listFollowingCreators, listHomePosts, listSupportingPlans, listSupportingPosts, paginateCreatorPosts };
317
+ export { type ArticlePost, type Creator, type CreatorProfileImage, type CreatorProfileItem, type CreatorProfileUnknownItem, type CreatorSummary, FanboxApiError, FanboxClient, type FanboxUser, type FilePost, type FilePostBody, type GetCreatorParams, type GetCreatorResult, type GetPostParams, type GetPostResult, type ImagePost, type ImagePostBody, type KnownPost, type ListCreatorPlansParams, type ListCreatorPlansResult, type ListCreatorPostsParams, type ListCreatorPostsResult, type ListFollowingCreatorsResult, type ListHomePostsParams, type ListHomePostsResult, type ListSupportingPlansResult, type ListSupportingPostsParams, type ListSupportingPostsResult, type NeighboringPost, type PaginateCreatorPostsParams, type PaginateCreatorPostsResult, type Plan, type Post, type PostCover, type PostItem, type PostListParams, type PostSort, type PostSummary, type SupportingPlan, type TextPost, type TextPostBody, type UnknownPost, type UnknownPostBody, type VideoPost, type VideoPostBody, getCreator, getPost, listCreatorPlans, listCreatorPosts, listFollowingCreators, listHomePosts, listSupportingPlans, listSupportingPosts, paginateCreatorPosts };
@@ -1,2 +1,2 @@
1
- var w=s=>{throw TypeError(s)};var S=(s,t,e)=>t.has(s)||w("Cannot "+e);var r=(s,t,e)=>(S(s,t,"read from private field"),e?e.call(s):t.get(s)),a=(s,t,e)=>t.has(s)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,o)=>(S(s,t,"write to private field"),o?o.call(s,e):t.set(s,e),e),R=(s,t,e)=>(S(s,t,"access private method"),e);import{connect as k}from"http2";var p,P,c,j,T,h=class{constructor({sessionsPerOrigin:t=5}={}){a(this,c);a(this,p,new Map);a(this,P);l(this,P,Math.max(1,Math.floor(t)))}async closeAll(){let t=[...r(this,p).values()].flatMap(e=>e.sessions);r(this,p).clear(),await Promise.all(t.map(N))}getSession(t){let e=new URL(t).origin,o=r(this,p).get(e)??R(this,c,j).call(this,e);if(o.sessions.length<r(this,P)){let n=R(this,c,T).call(this,e);return o.sessions.push(n),n}let i=o.sessions[o.nextIndex%o.sessions.length];return o.nextIndex=(o.nextIndex+1)%o.sessions.length,i}};p=new WeakMap,P=new WeakMap,c=new WeakSet,j=function(t){let e={nextIndex:0,sessions:[]};return r(this,p).set(t,e),e},T=function(t){let e=k(t),o=()=>{let i=r(this,p).get(t);if(!i)return;let n=i.sessions.indexOf(e);n>=0&&(i.sessions.splice(n,1),i.nextIndex=Math.min(i.nextIndex,i.sessions.length)),i.sessions.length===0&&r(this,p).delete(t)};return e.once("close",o),e.once("error",o),e};function N(s){return s.closed||s.destroyed?Promise.resolve():new Promise(t=>{s.close(t)})}var $=":status",L=class extends Error{constructor(t){super(t),this.name="Http2Error"}},f,C=class{constructor(t={}){a(this,f);l(this,f,new h(t))}fetch(t){let e=t instanceof Request?t:new Request(t),o=_(e),n=r(this,f).getSession(e.url).request(o,{endStream:!e.body});return new Promise((d,y)=>{let u=!1;n.once("error",y),n.once("close",()=>{u||y(new L("HTTP/2 stream closed before response"))}),n.once("response",H=>{u=!0,d(new Response(n,{headers:B(H),status:D(H[$])}))}),e.body&&n.end(e.body)})}};f=new WeakMap;function _(s){let t=new URL(s.url),e={...Object.fromEntries(s.headers)};return e[":authority"]=t.host,e[":method"]=s.method.toUpperCase(),e[":path"]=`${t.pathname}${t.search}`,e[":scheme"]=t.protocol.slice(0,-1),e}function B(s){let t=new Headers;for(let[e,o]of Object.entries(s))if(!(e.startsWith(":")||o===void 0))if(Array.isArray(o))for(let i of o)t.append(e,i);else t.set(e,o);return t}function D(s){return typeof s=="number"?s:Array.isArray(s)?Number(s[0]??0):Number(s??0)}async function O(s){return this.get("creator.get",s)}async function I(s){return this.get("post.paginateCreator",s)}async function A(s){return this.get("plan.listCreator",s)}async function U(s){return this.get("post.listCreator",s)}async function E(s){return this.get("post.info",s)}async function M(s={}){return this.get("post.listHome",s)}async function v(s={}){return this.get("post.listSupporting",s)}async function q(){return this.get("creator.listFollowing")}async function G(){return this.get("plan.listSupporting")}var J="https://api.fanbox.cc",b=class extends Error{constructor(t,e){super(`FANBOX API request failed: ${t.status} ${t.statusText}`),this.name="FanboxApiError",this.body=e,this.status=t.status,this.statusText=t.statusText}},m,g,x,F=class{constructor(t={}){this.getCreator=O;this.getPost=E;this.listCreatorPlans=A;this.listCreatorPosts=U;this.listFollowingCreators=q;this.listHomePosts=M;this.listSupportingPlans=G;this.listSupportingPosts=v;this.paginateCreatorPosts=I;a(this,m);a(this,g);a(this,x);l(this,m,t.baseUrl??J),l(this,g,t.headers??{}),l(this,x,t.transport??new C)}async get(t,e={}){let o=new URL(t,r(this,m).endsWith("/")?r(this,m):`${r(this,m)}/`);for(let[y,u]of Object.entries(e))u!==void 0&&o.searchParams.set(y,String(u));let i=new Request(o,{headers:r(this,g)}),n=await r(this,x).fetch(i),d=await W(n);if(!n.ok)throw new b(n,d);return d.body}};m=new WeakMap,g=new WeakMap,x=new WeakMap;async function W(s){let t=await s.text();try{return JSON.parse(t)}catch{return t}}export{b as FanboxApiError,F as FanboxClient};
1
+ var w=s=>{throw TypeError(s)};var S=(s,t,e)=>t.has(s)||w("Cannot "+e);var r=(s,t,e)=>(S(s,t,"read from private field"),e?e.call(s):t.get(s)),a=(s,t,e)=>t.has(s)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),l=(s,t,e,o)=>(S(s,t,"write to private field"),o?o.call(s,e):t.set(s,e),e),R=(s,t,e)=>(S(s,t,"access private method"),e);import{connect as k}from"http2";var p,P,c,j,T,y=class{constructor({sessionsPerOrigin:t=5}={}){a(this,c);a(this,p,new Map);a(this,P);l(this,P,Math.max(1,Math.floor(t)))}async closeAll(){let t=[...r(this,p).values()].flatMap(e=>e.sessions);r(this,p).clear(),await Promise.all(t.map(N))}getSession(t){let e=new URL(t).origin,o=r(this,p).get(e)??R(this,c,j).call(this,e);if(o.sessions.length<r(this,P)){let n=R(this,c,T).call(this,e);return o.sessions.push(n),n}let i=o.sessions[o.nextIndex%o.sessions.length];return o.nextIndex=(o.nextIndex+1)%o.sessions.length,i}};p=new WeakMap,P=new WeakMap,c=new WeakSet,j=function(t){let e={nextIndex:0,sessions:[]};return r(this,p).set(t,e),e},T=function(t){let e=k(t),o=()=>{let i=r(this,p).get(t);if(!i)return;let n=i.sessions.indexOf(e);n>=0&&(i.sessions.splice(n,1),i.nextIndex=Math.min(i.nextIndex,i.sessions.length)),i.sessions.length===0&&r(this,p).delete(t)};return e.once("close",o),e.once("error",o),e};function N(s){return s.closed||s.destroyed?Promise.resolve():new Promise(t=>{s.close(t)})}var $=":status",L=class extends Error{constructor(t){super(t),this.name="Http2Error"}},f,C=class{constructor(t={}){a(this,f);l(this,f,new y(t))}fetch(t){let e=t instanceof Request?t:new Request(t),o=_(e),n=r(this,f).getSession(e.url).request(o,{endStream:!e.body});return new Promise((d,h)=>{let u=!1;n.once("error",h),n.once("close",()=>{u||h(new L("HTTP/2 stream closed before response"))}),n.once("response",H=>{u=!0,d(new Response(n,{headers:B(H),status:D(H[$])}))}),e.body&&n.end(e.body)})}};f=new WeakMap;function _(s){let t=new URL(s.url),e={...Object.fromEntries(s.headers)};return e[":authority"]=t.host,e[":method"]=s.method.toUpperCase(),e[":path"]=`${t.pathname}${t.search}`,e[":scheme"]=t.protocol.slice(0,-1),e}function B(s){let t=new Headers;for(let[e,o]of Object.entries(s))if(!(e.startsWith(":")||o===void 0))if(Array.isArray(o))for(let i of o)t.append(e,i);else t.set(e,o);return t}function D(s){return typeof s=="number"?s:Array.isArray(s)?Number(s[0]??0):Number(s??0)}async function O(s){return this.get("creator.get",s)}async function I(s){return this.get("post.paginateCreator",s)}async function A(s){return this.get("plan.listCreator",s)}async function U(s){return this.get("post.listCreator",s)}async function E(s){return this.get("post.info",s)}async function M(s={}){return this.get("post.listHome",s)}async function v(s={}){return this.get("post.listSupporting",s)}async function q(){return this.get("creator.listFollowing")}async function G(){return this.get("plan.listSupporting")}var J="https://api.fanbox.cc",b=class extends Error{constructor(t,e){super(`FANBOX API request failed: ${t.status} ${t.statusText}`),this.name="FanboxApiError",this.body=e,this.status=t.status,this.statusText=t.statusText}},m,g,x,F=class{constructor(t={}){this.getCreator=O;this.getPost=E;this.listCreatorPlans=A;this.listCreatorPosts=U;this.listFollowingCreators=q;this.listHomePosts=M;this.listSupportingPlans=G;this.listSupportingPosts=v;this.paginateCreatorPosts=I;a(this,m);a(this,g);a(this,x);l(this,m,t.baseUrl??J),l(this,g,t.headers??{}),l(this,x,t.transport??new C)}async get(t,e={}){let o=new URL(t,r(this,m).endsWith("/")?r(this,m):`${r(this,m)}/`);for(let[h,u]of Object.entries(e))u!==void 0&&o.searchParams.set(h,String(u));let i=new Request(o,{headers:r(this,g)}),n=await r(this,x).fetch(i),d=await W(n);if(!n.ok)throw new b(n,d);return d.body}};m=new WeakMap,g=new WeakMap,x=new WeakMap;async function W(s){let t=await s.text();try{return JSON.parse(t)}catch{return t}}export{b as FanboxApiError,F as FanboxClient};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/transport/http2-session.ts","../../src/transport/http2.ts","../../src/client/endpoints/creator-get.ts","../../src/client/endpoints/creator-list-pages.ts","../../src/client/endpoints/creator-list-plans.ts","../../src/client/endpoints/creator-list-posts.ts","../../src/client/endpoints/post-info.ts","../../src/client/endpoints/post-list-home.ts","../../src/client/endpoints/post-list-supporting.ts","../../src/client/endpoints/user-list-following.ts","../../src/client/endpoints/user-list-supporting.ts","../../src/client/client.ts"],"sourcesContent":["import { type ClientHttp2Session, connect } from \"node:http2\";\n\nexport interface Http2SessionManagerOptions {\n sessionsPerOrigin?: number;\n}\n\ninterface OriginSessionPool {\n nextIndex: number;\n sessions: ClientHttp2Session[];\n}\n\nexport class Http2SessionManager {\n readonly #pools = new Map<string, OriginSessionPool>();\n readonly #sessionsPerOrigin: number;\n\n constructor({ sessionsPerOrigin = 5 }: Http2SessionManagerOptions = {}) {\n this.#sessionsPerOrigin = Math.max(1, Math.floor(sessionsPerOrigin));\n }\n\n async closeAll(): Promise<void> {\n const sessions = [...this.#pools.values()].flatMap((pool) => pool.sessions);\n this.#pools.clear();\n await Promise.all(sessions.map(closeHttp2Session));\n }\n\n getSession(url: string): ClientHttp2Session {\n const origin = new URL(url).origin;\n const pool = this.#pools.get(origin) ?? this.#createPool(origin);\n\n if (pool.sessions.length < this.#sessionsPerOrigin) {\n const session = this.#createSession(origin);\n pool.sessions.push(session);\n return session;\n }\n\n const session = pool.sessions[pool.nextIndex % pool.sessions.length];\n pool.nextIndex = (pool.nextIndex + 1) % pool.sessions.length;\n\n return session;\n }\n\n #createPool(origin: string): OriginSessionPool {\n const pool = { nextIndex: 0, sessions: [] };\n this.#pools.set(origin, pool);\n return pool;\n }\n\n #createSession(origin: string) {\n const session = connect(origin);\n\n const cleanup = () => {\n const pool = this.#pools.get(origin);\n if (!pool) return;\n\n const index = pool.sessions.indexOf(session);\n if (index >= 0) {\n pool.sessions.splice(index, 1);\n pool.nextIndex = Math.min(pool.nextIndex, pool.sessions.length);\n }\n\n if (pool.sessions.length === 0) {\n this.#pools.delete(origin);\n }\n };\n session.once(\"close\", cleanup);\n session.once(\"error\", cleanup);\n\n return session;\n }\n}\n\nfunction closeHttp2Session(session: ClientHttp2Session): Promise<void> {\n if (session.closed || session.destroyed) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n session.close(resolve);\n });\n}\n","import {\n Http2SessionManager,\n type Http2SessionManagerOptions,\n} from \"./http2-session.js\";\n\nconst HTTP2_HEADER_STATUS = \":status\";\n\nexport interface HttpTransport {\n fetch(input: Request | string | URL): Promise<Response>;\n}\n\nexport class Http2Error extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"Http2Error\";\n }\n}\n\nexport class Http2Transport {\n readonly #pool: Http2SessionManager;\n\n constructor(options: Http2SessionManagerOptions = {}) {\n this.#pool = new Http2SessionManager(options);\n }\n\n fetch(input: Request | string | URL) {\n const request = input instanceof Request ? input : new Request(input);\n const headers = attachHttp2Headers(request);\n\n const session = this.#pool.getSession(request.url);\n const stream = session.request(headers, { endStream: !request.body });\n\n return new Promise<Response>((resolve, reject) => {\n let settled = false;\n stream.once(\"error\", reject);\n stream.once(\"close\", () => {\n if (!settled) {\n reject(new Http2Error(`HTTP/2 stream closed before response`));\n }\n });\n\n stream.once(\"response\", (responseHeaders) => {\n settled = true;\n resolve(\n new Response(stream, {\n headers: createResponseHeaders(responseHeaders),\n status: parseStatus(responseHeaders[HTTP2_HEADER_STATUS]),\n }),\n );\n });\n\n // If the request has a body, write it to the stream. If writing fails, destroy the stream to trigger error handling.\n if (request.body) stream.end(request.body);\n });\n }\n}\n\nfunction attachHttp2Headers(request: Request) {\n const url = new URL(request.url);\n const headers = { ...Object.fromEntries(request.headers) };\n\n headers[\":authority\"] = url.host;\n headers[\":method\"] = request.method.toUpperCase();\n headers[\":path\"] = `${url.pathname}${url.search}`;\n headers[\":scheme\"] = url.protocol.slice(0, -1);\n\n return headers;\n}\n\nfunction createResponseHeaders(\n headers: Record<string, string | string[] | undefined>,\n): Headers {\n const result = new Headers();\n for (const [key, value] of Object.entries(headers)) {\n if (\n // ignore HTTP/2 pseudo-headers in the response\n key.startsWith(\":\") ||\n value === undefined\n )\n continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n result.append(key, item);\n }\n } else {\n result.set(key, value);\n }\n }\n\n return result;\n}\n\nfunction parseStatus(status: number | string | string[] | undefined): number {\n if (typeof status === \"number\") {\n return status;\n }\n if (Array.isArray(status)) {\n return Number(status[0] ?? 0);\n }\n\n return Number(status ?? 0);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Creator } from \"../models/creator.js\";\n\nexport interface GetCreatorParams {\n creatorId: string;\n}\n\nexport type GetCreatorResult = Creator;\n\n/**\n * Get detailed information about a specific creator.\n */\nexport async function getCreator(\n this: FanboxClient,\n params: GetCreatorParams,\n): Promise<GetCreatorResult> {\n return this.get(\"creator.get\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostSort } from \"../models/post.js\";\n\nexport interface PaginateCreatorPostsParams {\n creatorId: string;\n sort?: PostSort;\n}\n\nexport type PaginateCreatorPostsResult = string[];\n\n/**\n * List all urls to the pages, which paginated by the given conditions.\n */\nexport async function paginateCreatorPosts(\n this: FanboxClient,\n params: PaginateCreatorPostsParams,\n): Promise<PaginateCreatorPostsResult> {\n return this.get(\"post.paginateCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Plan } from \"../models/plan.js\";\n\nexport interface ListCreatorPlansParams {\n creatorId: string;\n}\n\nexport type ListCreatorPlansResult = Plan[];\n\n/**\n * List plans for a specific creator.\n */\nexport async function listCreatorPlans(\n this: FanboxClient,\n params: ListCreatorPlansParams,\n): Promise<ListCreatorPlansResult> {\n return this.get(\"plan.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSort, PostSummary } from \"../models/post.js\";\n\nexport interface ListCreatorPostsParams extends PostListParams {\n creatorId: string;\n firstId?: string;\n firstPublishedDatetime?: string;\n sort?: PostSort;\n}\n\nexport type ListCreatorPostsResult = PostSummary[];\n\n/**\n * List posts for a specific creator.\n */\nexport async function listCreatorPosts(\n this: FanboxClient,\n params: ListCreatorPostsParams,\n): Promise<ListCreatorPostsResult> {\n return this.get(\"post.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Post } from \"../models/post.js\";\n\nexport interface GetPostParams {\n postId: string;\n}\n\nexport type GetPostResult = Post;\n\n/**\n * Get detailed information about a specific post.\n */\nexport async function getPost(\n this: FanboxClient,\n params: GetPostParams,\n): Promise<GetPostResult> {\n return this.get(\"post.info\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListHomePostsParams = PostListParams;\n\nexport type ListHomePostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from both following and supporting\n * creators. This endpoint is only available to logged-in users.\n */\nexport async function listHomePosts(\n this: FanboxClient,\n params: ListHomePostsParams = {},\n): Promise<ListHomePostsResult> {\n return this.get(\"post.listHome\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListSupportingPostsParams = PostListParams;\n\nexport type ListSupportingPostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from supporting creators only. This\n * endpoint is only available to logged-in users.\n */\nexport async function listSupportingPosts(\n this: FanboxClient,\n params: ListSupportingPostsParams = {},\n): Promise<ListSupportingPostsResult> {\n return this.get(\"post.listSupporting\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { CreatorSummary } from \"../models/creator.js\";\n\nexport interface ListFollowingCreatorsResult {\n creators: CreatorSummary[];\n}\n\n/**\n * List creators that the authenticated user is following.\n */\nexport async function listFollowingCreators(\n this: FanboxClient,\n): Promise<ListFollowingCreatorsResult> {\n return this.get(\"creator.listFollowing\");\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { SupportingPlan } from \"../models/plan.js\";\n\nexport interface ListSupportingPlansResult {\n plans: SupportingPlan[];\n}\n\n/**\n * List plans that the authenticated user is supporting.\n */\nexport async function listSupportingPlans(\n this: FanboxClient,\n): Promise<ListSupportingPlansResult> {\n return this.get(\"plan.listSupporting\");\n}\n","import { Http2Transport, type HttpTransport } from \"../transport/http2.js\";\nimport { getCreator } from \"./endpoints/creator-get.js\";\nimport { paginateCreatorPosts } from \"./endpoints/creator-list-pages.js\";\nimport { listCreatorPlans } from \"./endpoints/creator-list-plans.js\";\nimport { listCreatorPosts } from \"./endpoints/creator-list-posts.js\";\nimport { getPost } from \"./endpoints/post-info.js\";\nimport { listHomePosts } from \"./endpoints/post-list-home.js\";\nimport { listSupportingPosts } from \"./endpoints/post-list-supporting.js\";\nimport { listFollowingCreators } from \"./endpoints/user-list-following.js\";\nimport { listSupportingPlans } from \"./endpoints/user-list-supporting.js\";\nimport type { FanboxEnvelope } from \"./fanbox-envelope.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.fanbox.cc\";\n\nexport interface FanboxClientOptions {\n baseUrl?: string;\n headers?: Record<string, string>;\n transport?: HttpTransport;\n}\n\nexport class FanboxApiError extends Error {\n public readonly body: unknown;\n public readonly status: number;\n public readonly statusText: string;\n\n public constructor(response: Response, body: unknown) {\n super(\n `FANBOX API request failed: ${response.status} ${response.statusText}`,\n );\n this.name = \"FanboxApiError\";\n this.body = body;\n this.status = response.status;\n this.statusText = response.statusText;\n }\n}\n\nexport class FanboxClient {\n getCreator = getCreator;\n getPost = getPost;\n listCreatorPlans = listCreatorPlans;\n listCreatorPosts = listCreatorPosts;\n listFollowingCreators = listFollowingCreators;\n listHomePosts = listHomePosts;\n listSupportingPlans = listSupportingPlans;\n listSupportingPosts = listSupportingPosts;\n paginateCreatorPosts = paginateCreatorPosts;\n\n readonly #baseUrl: string;\n readonly #headers: Record<string, string>;\n readonly #transport: HttpTransport;\n\n public constructor(options: FanboxClientOptions = {}) {\n this.#baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.#headers = options.headers ?? {};\n this.#transport = options.transport ?? new Http2Transport();\n }\n\n protected async get<T>(path: string, query: object = {}): Promise<T> {\n const url = new URL(\n path,\n this.#baseUrl.endsWith(\"/\") ? this.#baseUrl : `${this.#baseUrl}/`,\n );\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n\n const request = new Request(url, { headers: this.#headers });\n const response = await this.#transport.fetch(request);\n const body = await parseJSONBody<FanboxEnvelope<T>>(response);\n if (!response.ok) {\n throw new FanboxApiError(response, body);\n }\n\n return body.body;\n }\n}\n\nasync function parseJSONBody<T>(response: Response): Promise<T> {\n const text = await response.text();\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n}\n"],"mappings":"yXAAA,OAAkC,WAAAA,MAAe,QAAjD,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAWaC,EAAN,KAA0B,CAI/B,YAAY,CAAE,kBAAAC,EAAoB,CAAE,EAAgC,CAAC,EAAG,CAJnEC,EAAA,KAAAL,GACLK,EAAA,KAASP,EAAS,IAAI,KACtBO,EAAA,KAASN,GAGPO,EAAA,KAAKP,EAAqB,KAAK,IAAI,EAAG,KAAK,MAAMK,CAAiB,CAAC,EACrE,CAEA,MAAM,UAA0B,CAC9B,IAAMG,EAAW,CAAC,GAAGC,EAAA,KAAKV,GAAO,OAAO,CAAC,EAAE,QAASW,GAASA,EAAK,QAAQ,EAC1ED,EAAA,KAAKV,GAAO,MAAM,EAClB,MAAM,QAAQ,IAAIS,EAAS,IAAIG,CAAiB,CAAC,CACnD,CAEA,WAAWC,EAAiC,CAC1C,IAAMC,EAAS,IAAI,IAAID,CAAG,EAAE,OACtBF,EAAOD,EAAA,KAAKV,GAAO,IAAIc,CAAM,GAAKC,EAAA,KAAKb,EAAAC,GAAL,UAAiBW,GAEzD,GAAIH,EAAK,SAAS,OAASD,EAAA,KAAKT,GAAoB,CAClD,IAAMe,EAAUD,EAAA,KAAKb,EAAAE,GAAL,UAAoBU,GACpC,OAAAH,EAAK,SAAS,KAAKK,CAAO,EACnBA,CACT,CAEA,IAAMA,EAAUL,EAAK,SAASA,EAAK,UAAYA,EAAK,SAAS,MAAM,EACnE,OAAAA,EAAK,WAAaA,EAAK,UAAY,GAAKA,EAAK,SAAS,OAE/CK,CACT,CA8BF,EAzD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AASd,GACTc,EAAA,KAASb,GACTa,EAAA,KAASZ,GAGPa,EAAA,KAAKf,EAAWI,EAAQ,SAAWR,GACnCmB,EAAA,KAAKd,EAAWG,EAAQ,SAAW,CAAC,GACpCW,EAAA,KAAKb,EAAaE,EAAQ,WAAa,IAAIY,EAC7C,CAEA,MAAgB,IAAOC,EAAcC,EAAgB,CAAC,EAAe,CACnE,IAAMC,EAAM,IAAI,IACdF,EACAG,EAAA,KAAKpB,GAAS,SAAS,GAAG,EAAIoB,EAAA,KAAKpB,GAAW,GAAGoB,EAAA,KAAKpB,EAAQ,GAChE,EACA,OAAW,CAACqB,EAAKC,CAAK,IAAK,OAAO,QAAQJ,CAAK,EACzCI,IAAU,QACZH,EAAI,aAAa,IAAIE,EAAK,OAAOC,CAAK,CAAC,EAI3C,IAAMC,EAAU,IAAI,QAAQJ,EAAK,CAAE,QAASC,EAAA,KAAKnB,EAAS,CAAC,EACrDH,EAAW,MAAMsB,EAAA,KAAKlB,GAAW,MAAMqB,CAAO,EAC9CxB,EAAO,MAAMyB,EAAiC1B,CAAQ,EAC5D,GAAI,CAACA,EAAS,GACZ,MAAM,IAAID,EAAeC,EAAUC,CAAI,EAGzC,OAAOA,EAAK,IACd,CACF,EA9BWC,EAAA,YACAC,EAAA,YACAC,EAAA,YA8BX,eAAesB,EAAiB1B,EAAgC,CAC9D,IAAM2B,EAAO,MAAM3B,EAAS,KAAK,EACjC,GAAI,CACF,OAAO,KAAK,MAAM2B,CAAI,CACxB,MAAQ,CACN,OAAOA,CACT,CACF","names":["connect","_pools","_sessionsPerOrigin","_Http2SessionManager_instances","createPool_fn","createSession_fn","Http2SessionManager","sessionsPerOrigin","__privateAdd","__privateSet","sessions","__privateGet","pool","closeHttp2Session","url","origin","__privateMethod","session","connect","cleanup","index","resolve","HTTP2_HEADER_STATUS","Http2Error","message","_pool","Http2Transport","options","__privateAdd","__privateSet","Http2SessionManager","input","request","headers","attachHttp2Headers","stream","__privateGet","resolve","reject","settled","responseHeaders","createResponseHeaders","parseStatus","url","result","key","value","item","status","getCreator","params","paginateCreatorPosts","params","listCreatorPlans","params","listCreatorPosts","params","getPost","params","listHomePosts","params","listSupportingPosts","params","listFollowingCreators","listSupportingPlans","DEFAULT_BASE_URL","FanboxApiError","response","body","_baseUrl","_headers","_transport","FanboxClient","options","getCreator","getPost","listCreatorPlans","listCreatorPosts","listFollowingCreators","listHomePosts","listSupportingPlans","listSupportingPosts","paginateCreatorPosts","__privateAdd","__privateSet","Http2Transport","path","query","url","__privateGet","key","value","request","parseJSONBody","text"]}
1
+ {"version":3,"sources":["../../src/transport/http2-session.ts","../../src/transport/http2.ts","../../src/client/endpoints/creator-get.ts","../../src/client/endpoints/creator-list-pages.ts","../../src/client/endpoints/creator-list-plans.ts","../../src/client/endpoints/creator-list-posts.ts","../../src/client/endpoints/post-info.ts","../../src/client/endpoints/post-list-home.ts","../../src/client/endpoints/post-list-supporting.ts","../../src/client/endpoints/user-list-following.ts","../../src/client/endpoints/user-list-supporting.ts","../../src/client/client.ts"],"sourcesContent":["import { type ClientHttp2Session, connect } from \"node:http2\";\n\nexport interface Http2SessionManagerOptions {\n sessionsPerOrigin?: number;\n}\n\ninterface OriginSessionPool {\n nextIndex: number;\n sessions: ClientHttp2Session[];\n}\n\nexport class Http2SessionManager {\n readonly #pools = new Map<string, OriginSessionPool>();\n readonly #sessionsPerOrigin: number;\n\n constructor({ sessionsPerOrigin = 5 }: Http2SessionManagerOptions = {}) {\n this.#sessionsPerOrigin = Math.max(1, Math.floor(sessionsPerOrigin));\n }\n\n async closeAll(): Promise<void> {\n const sessions = [...this.#pools.values()].flatMap((pool) => pool.sessions);\n this.#pools.clear();\n await Promise.all(sessions.map(closeHttp2Session));\n }\n\n getSession(url: string): ClientHttp2Session {\n const origin = new URL(url).origin;\n const pool = this.#pools.get(origin) ?? this.#createPool(origin);\n\n if (pool.sessions.length < this.#sessionsPerOrigin) {\n const session = this.#createSession(origin);\n pool.sessions.push(session);\n return session;\n }\n\n const session = pool.sessions[pool.nextIndex % pool.sessions.length];\n pool.nextIndex = (pool.nextIndex + 1) % pool.sessions.length;\n\n return session;\n }\n\n #createPool(origin: string): OriginSessionPool {\n const pool = { nextIndex: 0, sessions: [] };\n this.#pools.set(origin, pool);\n return pool;\n }\n\n #createSession(origin: string) {\n const session = connect(origin);\n\n const cleanup = () => {\n const pool = this.#pools.get(origin);\n if (!pool) return;\n\n const index = pool.sessions.indexOf(session);\n if (index >= 0) {\n pool.sessions.splice(index, 1);\n pool.nextIndex = Math.min(pool.nextIndex, pool.sessions.length);\n }\n\n if (pool.sessions.length === 0) {\n this.#pools.delete(origin);\n }\n };\n session.once(\"close\", cleanup);\n session.once(\"error\", cleanup);\n\n return session;\n }\n}\n\nfunction closeHttp2Session(session: ClientHttp2Session): Promise<void> {\n if (session.closed || session.destroyed) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n session.close(resolve);\n });\n}\n","import {\n Http2SessionManager,\n type Http2SessionManagerOptions,\n} from \"./http2-session.js\";\n\nconst HTTP2_HEADER_STATUS = \":status\";\n\nexport interface HttpTransport {\n fetch(input: Request | string | URL): Promise<Response>;\n}\n\nexport class Http2Error extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"Http2Error\";\n }\n}\n\nexport class Http2Transport {\n readonly #pool: Http2SessionManager;\n\n constructor(options: Http2SessionManagerOptions = {}) {\n this.#pool = new Http2SessionManager(options);\n }\n\n fetch(input: Request | string | URL) {\n const request = input instanceof Request ? input : new Request(input);\n const headers = attachHttp2Headers(request);\n\n const session = this.#pool.getSession(request.url);\n const stream = session.request(headers, { endStream: !request.body });\n\n return new Promise<Response>((resolve, reject) => {\n let settled = false;\n stream.once(\"error\", reject);\n stream.once(\"close\", () => {\n if (!settled) {\n reject(new Http2Error(`HTTP/2 stream closed before response`));\n }\n });\n\n stream.once(\"response\", (responseHeaders) => {\n settled = true;\n resolve(\n new Response(stream, {\n headers: createResponseHeaders(responseHeaders),\n status: parseStatus(responseHeaders[HTTP2_HEADER_STATUS]),\n }),\n );\n });\n\n // If the request has a body, write it to the stream. If writing fails, destroy the stream to trigger error handling.\n if (request.body) stream.end(request.body);\n });\n }\n}\n\nfunction attachHttp2Headers(request: Request) {\n const url = new URL(request.url);\n const headers = { ...Object.fromEntries(request.headers) };\n\n headers[\":authority\"] = url.host;\n headers[\":method\"] = request.method.toUpperCase();\n headers[\":path\"] = `${url.pathname}${url.search}`;\n headers[\":scheme\"] = url.protocol.slice(0, -1);\n\n return headers;\n}\n\nfunction createResponseHeaders(\n headers: Record<string, string | string[] | undefined>,\n): Headers {\n const result = new Headers();\n for (const [key, value] of Object.entries(headers)) {\n if (\n // ignore HTTP/2 pseudo-headers in the response\n key.startsWith(\":\") ||\n value === undefined\n )\n continue;\n\n if (Array.isArray(value)) {\n for (const item of value) {\n result.append(key, item);\n }\n } else {\n result.set(key, value);\n }\n }\n\n return result;\n}\n\nfunction parseStatus(status: number | string | string[] | undefined): number {\n if (typeof status === \"number\") {\n return status;\n }\n if (Array.isArray(status)) {\n return Number(status[0] ?? 0);\n }\n\n return Number(status ?? 0);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Creator } from \"../models/creator.js\";\n\nexport interface GetCreatorParams {\n creatorId: string;\n}\n\nexport type GetCreatorResult = Creator;\n\n/**\n * Get detailed information about a specific creator.\n */\nexport async function getCreator(\n this: FanboxClient,\n params: GetCreatorParams,\n): Promise<GetCreatorResult> {\n return this.get(\"creator.get\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostSort } from \"../models/post.js\";\n\nexport interface PaginateCreatorPostsParams {\n creatorId: string;\n sort?: PostSort;\n}\n\nexport type PaginateCreatorPostsResult = string[];\n\n/**\n * List all urls to the pages, which paginated by the given conditions.\n */\nexport async function paginateCreatorPosts(\n this: FanboxClient,\n params: PaginateCreatorPostsParams,\n): Promise<PaginateCreatorPostsResult> {\n return this.get(\"post.paginateCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Plan } from \"../models/plan.js\";\n\nexport interface ListCreatorPlansParams {\n creatorId: string;\n}\n\nexport type ListCreatorPlansResult = Plan[];\n\n/**\n * List plans for a specific creator.\n */\nexport async function listCreatorPlans(\n this: FanboxClient,\n params: ListCreatorPlansParams,\n): Promise<ListCreatorPlansResult> {\n return this.get(\"plan.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSort, PostSummary } from \"../models/post.js\";\n\nexport interface ListCreatorPostsParams extends PostListParams {\n creatorId: string;\n firstId?: string;\n firstPublishedDatetime?: string;\n sort?: PostSort;\n}\n\nexport interface ListCreatorPostsResult {\n posts: PostSummary[];\n}\n\n/**\n * List posts for a specific creator.\n */\nexport async function listCreatorPosts(\n this: FanboxClient,\n params: ListCreatorPostsParams,\n): Promise<ListCreatorPostsResult> {\n return this.get(\"post.listCreator\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { Post } from \"../models/post.js\";\n\nexport interface GetPostParams {\n postId: string;\n}\n\nexport interface GetPostResult {\n post: Post;\n}\n\n/**\n * Get detailed information about a specific post.\n */\nexport async function getPost(\n this: FanboxClient,\n params: GetPostParams,\n): Promise<GetPostResult> {\n return this.get(\"post.info\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListHomePostsParams = PostListParams;\n\nexport type ListHomePostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from both following and supporting\n * creators. This endpoint is only available to logged-in users.\n */\nexport async function listHomePosts(\n this: FanboxClient,\n params: ListHomePostsParams = {},\n): Promise<ListHomePostsResult> {\n return this.get(\"post.listHome\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { PostListParams, PostSummary } from \"../models/post.js\";\n\nexport type ListSupportingPostsParams = PostListParams;\n\nexport type ListSupportingPostsResult = PostSummary[];\n\n/**\n * List all posts from the home feed from supporting creators only. This\n * endpoint is only available to logged-in users.\n */\nexport async function listSupportingPosts(\n this: FanboxClient,\n params: ListSupportingPostsParams = {},\n): Promise<ListSupportingPostsResult> {\n return this.get(\"post.listSupporting\", params);\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { CreatorSummary } from \"../models/creator.js\";\n\nexport interface ListFollowingCreatorsResult {\n creators: CreatorSummary[];\n}\n\n/**\n * List creators that the authenticated user is following.\n */\nexport async function listFollowingCreators(\n this: FanboxClient,\n): Promise<ListFollowingCreatorsResult> {\n return this.get(\"creator.listFollowing\");\n}\n","import type { FanboxClient } from \"../client.js\";\nimport type { SupportingPlan } from \"../models/plan.js\";\n\nexport interface ListSupportingPlansResult {\n plans: SupportingPlan[];\n}\n\n/**\n * List plans that the authenticated user is supporting.\n */\nexport async function listSupportingPlans(\n this: FanboxClient,\n): Promise<ListSupportingPlansResult> {\n return this.get(\"plan.listSupporting\");\n}\n","import { Http2Transport, type HttpTransport } from \"../transport/http2.js\";\nimport { getCreator } from \"./endpoints/creator-get.js\";\nimport { paginateCreatorPosts } from \"./endpoints/creator-list-pages.js\";\nimport { listCreatorPlans } from \"./endpoints/creator-list-plans.js\";\nimport { listCreatorPosts } from \"./endpoints/creator-list-posts.js\";\nimport { getPost } from \"./endpoints/post-info.js\";\nimport { listHomePosts } from \"./endpoints/post-list-home.js\";\nimport { listSupportingPosts } from \"./endpoints/post-list-supporting.js\";\nimport { listFollowingCreators } from \"./endpoints/user-list-following.js\";\nimport { listSupportingPlans } from \"./endpoints/user-list-supporting.js\";\nimport type { FanboxEnvelope } from \"./fanbox-envelope.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.fanbox.cc\";\n\nexport interface FanboxClientOptions {\n baseUrl?: string;\n headers?: Record<string, string>;\n transport?: HttpTransport;\n}\n\nexport class FanboxApiError extends Error {\n public readonly body: unknown;\n public readonly status: number;\n public readonly statusText: string;\n\n public constructor(response: Response, body: unknown) {\n super(\n `FANBOX API request failed: ${response.status} ${response.statusText}`,\n );\n this.name = \"FanboxApiError\";\n this.body = body;\n this.status = response.status;\n this.statusText = response.statusText;\n }\n}\n\nexport class FanboxClient {\n getCreator = getCreator;\n getPost = getPost;\n listCreatorPlans = listCreatorPlans;\n listCreatorPosts = listCreatorPosts;\n listFollowingCreators = listFollowingCreators;\n listHomePosts = listHomePosts;\n listSupportingPlans = listSupportingPlans;\n listSupportingPosts = listSupportingPosts;\n paginateCreatorPosts = paginateCreatorPosts;\n\n readonly #baseUrl: string;\n readonly #headers: Record<string, string>;\n readonly #transport: HttpTransport;\n\n public constructor(options: FanboxClientOptions = {}) {\n this.#baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.#headers = options.headers ?? {};\n this.#transport = options.transport ?? new Http2Transport();\n }\n\n protected async get<T>(path: string, query: object = {}): Promise<T> {\n const url = new URL(\n path,\n this.#baseUrl.endsWith(\"/\") ? this.#baseUrl : `${this.#baseUrl}/`,\n );\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n\n const request = new Request(url, { headers: this.#headers });\n const response = await this.#transport.fetch(request);\n const body = await parseJSONBody<FanboxEnvelope<T>>(response);\n if (!response.ok) {\n throw new FanboxApiError(response, body);\n }\n\n return body.body;\n }\n}\n\nasync function parseJSONBody<T>(response: Response): Promise<T> {\n const text = await response.text();\n try {\n return JSON.parse(text) as T;\n } catch {\n return text as unknown as T;\n }\n}\n"],"mappings":"yXAAA,OAAkC,WAAAA,MAAe,QAAjD,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAWaC,EAAN,KAA0B,CAI/B,YAAY,CAAE,kBAAAC,EAAoB,CAAE,EAAgC,CAAC,EAAG,CAJnEC,EAAA,KAAAL,GACLK,EAAA,KAASP,EAAS,IAAI,KACtBO,EAAA,KAASN,GAGPO,EAAA,KAAKP,EAAqB,KAAK,IAAI,EAAG,KAAK,MAAMK,CAAiB,CAAC,EACrE,CAEA,MAAM,UAA0B,CAC9B,IAAMG,EAAW,CAAC,GAAGC,EAAA,KAAKV,GAAO,OAAO,CAAC,EAAE,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iC1B,CAAQ,EAC5D,GAAI,CAACA,EAAS,GACZ,MAAM,IAAID,EAAeC,EAAUC,CAAI,EAGzC,OAAOA,EAAK,IACd,CACF,EA9BWC,EAAA,YACAC,EAAA,YACAC,EAAA,YA8BX,eAAesB,EAAiB1B,EAAgC,CAC9D,IAAM2B,EAAO,MAAM3B,EAAS,KAAK,EACjC,GAAI,CACF,OAAO,KAAK,MAAM2B,CAAI,CACxB,MAAQ,CACN,OAAOA,CACT,CACF","names":["connect","_pools","_sessionsPerOrigin","_Http2SessionManager_instances","createPool_fn","createSession_fn","Http2SessionManager","sessionsPerOrigin","__privateAdd","__privateSet","sessions","__privateGet","pool","closeHttp2Session","url","origin","__privateMethod","session","connect","cleanup","index","resolve","HTTP2_HEADER_STATUS","Http2Error","message","_pool","Http2Transport","options","__privateAdd","__privateSet","Http2SessionManager","input","request","headers","attachHttp2Headers","stream","__privateGet","resolve","reject","settled","responseHeaders","createResponseHeaders","parseStatus","url","result","key","value","item","status","getCreator","params","paginateCreatorPosts","params","listCreatorPlans","params","listCreatorPosts","params","getPost","params","listHomePosts","params","listSupportingPosts","params","listFollowingCreators","listSupportingPlans","DEFAULT_BASE_URL","FanboxApiError","response","body","_baseUrl","_headers","_transport","FanboxClient","options","getCreator","getPost","listCreatorPlans","listCreatorPosts","listFollowingCreators","listHomePosts","listSupportingPlans","listSupportingPosts","paginateCreatorPosts","__privateAdd","__privateSet","Http2Transport","path","query","url","__privateGet","key","value","request","parseJSONBody","text"]}
@@ -6,6 +6,8 @@ export interface ListCreatorPostsParams extends PostListParams {
6
6
  firstPublishedDatetime?: string;
7
7
  sort?: PostSort;
8
8
  }
9
- export type ListCreatorPostsResult = PostSummary[];
9
+ export interface ListCreatorPostsResult {
10
+ posts: PostSummary[];
11
+ }
10
12
  export declare function listCreatorPosts(this: FanboxClient, params: ListCreatorPostsParams): Promise<ListCreatorPostsResult>;
11
13
  //# sourceMappingURL=creator-list-posts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"creator-list-posts.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,EAAE,CAAC;AAKnD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
1
+ {"version":3,"file":"creator-list-posts.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAKD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"creator-list-posts.js","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":";;AAeA,4CAKC;AALM,KAAK,UAAU,gBAAgB,CAEpC,MAA8B;IAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
1
+ {"version":3,"file":"creator-list-posts.js","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":";;AAiBA,4CAKC;AALM,KAAK,UAAU,gBAAgB,CAEpC,MAA8B;IAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -3,6 +3,8 @@ import type { Post } from "../models/post.js";
3
3
  export interface GetPostParams {
4
4
  postId: string;
5
5
  }
6
- export type GetPostResult = Post;
6
+ export interface GetPostResult {
7
+ post: Post;
8
+ }
7
9
  export declare function getPost(this: FanboxClient, params: GetPostParams): Promise<GetPostResult>;
8
10
  //# sourceMappingURL=post-info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-info.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC;AAKjC,wBAAsB,OAAO,CAC3B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAExB"}
1
+ {"version":3,"file":"post-info.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ;AAKD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAExB"}
@@ -1 +1 @@
1
- {"version":3,"file":"post-info.js","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":";;AAYA,0BAKC;AALM,KAAK,UAAU,OAAO,CAE3B,MAAqB;IAErB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"post-info.js","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":";;AAcA,0BAKC;AALM,KAAK,UAAU,OAAO,CAE3B,MAAqB;IAErB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
@@ -32,6 +32,9 @@ export interface PostCover {
32
32
  type: "cover_image" | "post_image";
33
33
  url: string;
34
34
  }
35
+ export interface PostItem {
36
+ post: PostSummary;
37
+ }
35
38
  export interface PostListParams {
36
39
  limit?: number;
37
40
  maxId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../../src/client/models/post.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,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AW,EAAE,OAAO,CAAC;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -10,7 +10,7 @@ async function discoverCreatorPosts({ client, logger }, { creatorId, firstId, fi
10
10
  limit,
11
11
  sort: "newest",
12
12
  };
13
- const posts = await client.listCreatorPosts(listCreatorPostsOptions);
13
+ const { posts } = await client.listCreatorPosts(listCreatorPostsOptions);
14
14
  logger.debug(`Discovered ${posts.length} posts for creator ${creatorId}`);
15
15
  if (posts.length < limit)
16
16
  return posts;
@@ -1 +1 @@
1
- {"version":3,"file":"discover-posts.js","sourceRoot":"","sources":["../../../../src/downloader/creator/discover-posts.ts"],"names":[],"mappings":";;AAoBA,oDAqCC;AArCM,KAAK,UAAU,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAoC,EACpD,EACE,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,KAAK,GAAG,GAAG,GACiB;IAE9B,MAAM,CAAC,KAAK,CACV,mBAAmB,KAAK,eAAe,OAAO,IAAI,OAAO,gBAAgB,SAAS,EAAE,CACrF,CAAC;IACF,MAAM,uBAAuB,GAAG;QAC9B,SAAS;QACT,OAAO;QACP,sBAAsB;QACtB,KAAK;QACL,IAAI,EAAE,QAAQ;KACkB,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IACrE,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,OAAO,GAAG,MAAM,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAE,EAClB;QACE,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,EAAE;QACpB,sBAAsB,EAAE,QAAQ,CAAC,iBAAiB;QAClD,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"discover-posts.js","sourceRoot":"","sources":["../../../../src/downloader/creator/discover-posts.ts"],"names":[],"mappings":";;AAoBA,oDAqCC;AArCM,KAAK,UAAU,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAoC,EACpD,EACE,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,KAAK,GAAG,GAAG,GACiB;IAE9B,MAAM,CAAC,KAAK,CACV,mBAAmB,KAAK,eAAe,OAAO,IAAI,OAAO,gBAAgB,SAAS,EAAE,CACrF,CAAC;IACF,MAAM,uBAAuB,GAAG;QAC9B,SAAS;QACT,OAAO;QACP,sBAAsB;QACtB,KAAK;QACL,IAAI,EAAE,QAAQ;KACkB,CAAC;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,OAAO,GAAG,MAAM,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAE,EAClB;QACE,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,EAAE;QACpB,sBAAsB,EAAE,QAAQ,CAAC,iBAAiB;QAClD,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAUhF,UAAU,eAAe;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAc,GACf,EAAE,eAAe,iBAoEjB"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAUhF,UAAU,eAAe;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAc,GACf,EAAE,eAAe,iBAqEjB"}
@@ -19,6 +19,7 @@ async function syncCreator({ client, headers, logger, manifest, pathManager, tra
19
19
  const postPathManager = pathManager.post(postSummary);
20
20
  const post = await client
21
21
  .getPost({ postId: postSummary.id })
22
+ .then((result) => result.post)
22
23
  .catch(async (err) => {
23
24
  logger.error({ err }, `Error occurred while fetch post manifest of ${postIndex}/${postSummaries.length} post ${postSummary.id}, skipping.`);
24
25
  await saveFailedPostManifest(manifest, postSummary, err);
@@ -1 +1 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":";;AAyBA,kCA4EC;AA/FD,6CAA6D;AAC7D,2DAA2D;AAkBpD,KAAK,UAAU,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,GAAG,KAAK,GACE;IAChB,MAAM,aAAa,GAAG,MAAM,IAAA,wCAAoB,EAC9C,EAAE,MAAM,EAAE,MAAM,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aAAa,CAAC,MAAM,qBAAqB,QAAQ,CAAC,SAAS,iEAAiE,CACpI,CAAC;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,sBAAsB,CAC7B,WAA+B,EAC/B,GAAY;IAEZ,OAAO;QACL,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC;QAClB,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,UAAU,EAAE,WAAW,CAAC,YAAY;QACpC,MAAM,EAAE,QAAQ;QAChB,eAAe,EAAE,WAAW,CAAC,eAAe;KAC7C,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,QAAyB,EACzB,WAA+B,EAC/B,GAAY;IAEZ,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,sBAAsB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC1E,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -6,6 +6,8 @@ export interface ListCreatorPostsParams extends PostListParams {
6
6
  firstPublishedDatetime?: string;
7
7
  sort?: PostSort;
8
8
  }
9
- export type ListCreatorPostsResult = PostSummary[];
9
+ export interface ListCreatorPostsResult {
10
+ posts: PostSummary[];
11
+ }
10
12
  export declare function listCreatorPosts(this: FanboxClient, params: ListCreatorPostsParams): Promise<ListCreatorPostsResult>;
11
13
  //# sourceMappingURL=creator-list-posts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"creator-list-posts.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,EAAE,CAAC;AAKnD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
1
+ {"version":3,"file":"creator-list-posts.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAKD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"creator-list-posts.js","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAEpC,MAA8B;IAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
1
+ {"version":3,"file":"creator-list-posts.js","sourceRoot":"","sources":["../../../../src/client/endpoints/creator-list-posts.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAEpC,MAA8B;IAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -3,6 +3,8 @@ import type { Post } from "../models/post.js";
3
3
  export interface GetPostParams {
4
4
  postId: string;
5
5
  }
6
- export type GetPostResult = Post;
6
+ export interface GetPostResult {
7
+ post: Post;
8
+ }
7
9
  export declare function getPost(this: FanboxClient, params: GetPostParams): Promise<GetPostResult>;
8
10
  //# sourceMappingURL=post-info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-info.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC;AAKjC,wBAAsB,OAAO,CAC3B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAExB"}
1
+ {"version":3,"file":"post-info.d.ts","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ;AAKD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAExB"}
@@ -1 +1 @@
1
- {"version":3,"file":"post-info.js","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,OAAO,CAE3B,MAAqB;IAErB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"post-info.js","sourceRoot":"","sources":["../../../../src/client/endpoints/post-info.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,KAAK,UAAU,OAAO,CAE3B,MAAqB;IAErB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
@@ -32,6 +32,9 @@ export interface PostCover {
32
32
  type: "cover_image" | "post_image";
33
33
  url: string;
34
34
  }
35
+ export interface PostItem {
36
+ post: PostSummary;
37
+ }
35
38
  export interface PostListParams {
36
39
  limit?: number;
37
40
  maxId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../../src/client/models/post.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CAC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async function discoverCreatorPosts({ client, logger }, { creatorId, firs
7
7
  limit,
8
8
  sort: "newest",
9
9
  };
10
- const posts = await client.listCreatorPosts(listCreatorPostsOptions);
10
+ const { posts } = await client.listCreatorPosts(listCreatorPostsOptions);
11
11
  logger.debug(`Discovered ${posts.length} posts for creator ${creatorId}`);
12
12
  if (posts.length < limit)
13
13
  return posts;
@@ -1 +1 @@
1
- {"version":3,"file":"discover-posts.js","sourceRoot":"","sources":["../../../../src/downloader/creator/discover-posts.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAoC,EACpD,EACE,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,KAAK,GAAG,GAAG,GACiB;IAE9B,MAAM,CAAC,KAAK,CACV,mBAAmB,KAAK,eAAe,OAAO,IAAI,OAAO,gBAAgB,SAAS,EAAE,CACrF,CAAC;IACF,MAAM,uBAAuB,GAAG;QAC9B,SAAS;QACT,OAAO;QACP,sBAAsB;QACtB,KAAK;QACL,IAAI,EAAE,QAAQ;KACkB,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IACrE,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,OAAO,GAAG,MAAM,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAE,EAClB;QACE,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,EAAE;QACpB,sBAAsB,EAAE,QAAQ,CAAC,iBAAiB;QAClD,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"discover-posts.js","sourceRoot":"","sources":["../../../../src/downloader/creator/discover-posts.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAoC,EACpD,EACE,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,KAAK,GAAG,GAAG,GACiB;IAE9B,MAAM,CAAC,KAAK,CACV,mBAAmB,KAAK,eAAe,OAAO,IAAI,OAAO,gBAAgB,SAAS,EAAE,CACrF,CAAC;IACF,MAAM,uBAAuB,GAAG;QAC9B,SAAS;QACT,OAAO;QACP,sBAAsB;QACtB,KAAK;QACL,IAAI,EAAE,QAAQ;KACkB,CAAC;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,MAAM,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,OAAO,GAAG,MAAM,oBAAoB,CACxC,EAAE,MAAM,EAAE,MAAM,EAAE,EAClB;QACE,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,EAAE;QACpB,sBAAsB,EAAE,QAAQ,CAAC,iBAAiB;QAClD,KAAK;KACN,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAUhF,UAAU,eAAe;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAc,GACf,EAAE,eAAe,iBAoEjB"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAUhF,UAAU,eAAe;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAc,GACf,EAAE,eAAe,iBAqEjB"}
@@ -16,6 +16,7 @@ export async function syncCreator({ client, headers, logger, manifest, pathManag
16
16
  const postPathManager = pathManager.post(postSummary);
17
17
  const post = await client
18
18
  .getPost({ postId: postSummary.id })
19
+ .then((result) => result.post)
19
20
  .catch(async (err) => {
20
21
  logger.error({ err }, `Error occurred while fetch post manifest of ${postIndex}/${postSummaries.length} post ${postSummary.id}, skipping.`);
21
22
  await saveFailedPostManifest(manifest, postSummary, err);
@@ -1 +1 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/downloader/creator/sync.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAkB3D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAChC,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,GAAG,KAAK,GACE;IAChB,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,EAClB,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAClC,CAAC;IACF,MAAM,CAAC,IAAI,CACT,oBAAoB,aAAa,CAAC,MAAM,sBAAsB,QAAQ,CAAC,SAAS,EAAE,CACnF,CAAC;IAEF,MAAM,eAAe,GAAoB,EAAE,CAAC;IAE5C,KAAK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,EAC/B,GAAY;IAEZ,OAAO;QACL,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC;QAClB,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,UAAU,EAAE,WAAW,CAAC,YAAY;QACpC,MAAM,EAAE,QAAQ;QAChB,eAAe,EAAE,WAAW,CAAC,eAAe;KAC7C,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,sBAAsB,CACnC,QAAyB,EACzB,WAA+B,EAC/B,GAAY;IAEZ,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,sBAAsB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC1E,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontaiworks/fanbox-dl",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "A TypeScript PixivFanbox Downloader and SDK",
5
5
  "author": "moontai0724",
6
6
  "license": "MIT",