@bitsocial/bitsocial-react-hooks 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/dist/hooks/accounts/accounts.d.ts.map +1 -1
- package/dist/hooks/accounts/accounts.js +35 -10
- package/dist/hooks/accounts/accounts.js.map +1 -1
- package/dist/hooks/actions/actions.d.ts.map +1 -1
- package/dist/hooks/actions/actions.js +166 -93
- package/dist/hooks/actions/actions.js.map +1 -1
- package/dist/hooks/authors/author-avatars.d.ts +2 -2
- package/dist/hooks/authors/author-avatars.d.ts.map +1 -1
- package/dist/hooks/authors/author-avatars.js +48 -20
- package/dist/hooks/authors/author-avatars.js.map +1 -1
- package/dist/hooks/authors/authors.d.ts.map +1 -1
- package/dist/hooks/authors/authors.js +68 -22
- package/dist/hooks/authors/authors.js.map +1 -1
- package/dist/hooks/comments.d.ts.map +1 -1
- package/dist/hooks/comments.js +54 -3
- package/dist/hooks/comments.js.map +1 -1
- package/dist/hooks/communities.d.ts.map +1 -1
- package/dist/hooks/communities.js +41 -12
- package/dist/hooks/communities.js.map +1 -1
- package/dist/hooks/feeds/feeds.d.ts.map +1 -1
- package/dist/hooks/feeds/feeds.js +47 -11
- package/dist/hooks/feeds/feeds.js.map +1 -1
- package/dist/hooks/pkc-rpc.d.ts.map +1 -1
- package/dist/hooks/pkc-rpc.js +33 -20
- package/dist/hooks/pkc-rpc.js.map +1 -1
- package/dist/hooks/replies.d.ts.map +1 -1
- package/dist/hooks/replies.js +30 -4
- package/dist/hooks/replies.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/debug-utils.d.ts +4 -4
- package/dist/lib/debug-utils.d.ts.map +1 -1
- package/dist/lib/debug-utils.js +56 -11
- package/dist/lib/debug-utils.js.map +1 -1
- package/dist/lib/localforage-lru/localforage-lru.d.ts +1 -0
- package/dist/lib/localforage-lru/localforage-lru.d.ts.map +1 -1
- package/dist/lib/localforage-lru/localforage-lru.js +48 -10
- package/dist/lib/localforage-lru/localforage-lru.js.map +1 -1
- package/dist/lib/page-sorts.d.ts +6 -0
- package/dist/lib/page-sorts.d.ts.map +1 -1
- package/dist/lib/page-sorts.js +45 -9
- package/dist/lib/page-sorts.js.map +1 -1
- package/dist/lib/pkc-js/pkc-js-mock-content.d.ts.map +1 -1
- package/dist/lib/pkc-js/pkc-js-mock-content.js +5 -1
- package/dist/lib/pkc-js/pkc-js-mock-content.js.map +1 -1
- package/dist/lib/utils/utils.d.ts.map +1 -1
- package/dist/lib/utils/utils.js +24 -16
- package/dist/lib/utils/utils.js.map +1 -1
- package/dist/lib/validator.d.ts +1 -1
- package/dist/lib/validator.d.ts.map +1 -1
- package/dist/lib/validator.js +7 -1
- package/dist/lib/validator.js.map +1 -1
- package/dist/stores/accounts/account-generator.d.ts +1 -0
- package/dist/stores/accounts/account-generator.d.ts.map +1 -1
- package/dist/stores/accounts/account-generator.js +12 -4
- package/dist/stores/accounts/account-generator.js.map +1 -1
- package/dist/stores/accounts/accounts-actions-internal.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-actions-internal.js +24 -6
- package/dist/stores/accounts/accounts-actions-internal.js.map +1 -1
- package/dist/stores/accounts/accounts-actions.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-actions.js +339 -98
- package/dist/stores/accounts/accounts-actions.js.map +1 -1
- package/dist/stores/accounts/accounts-database.d.ts +1 -0
- package/dist/stores/accounts/accounts-database.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-database.js +82 -15
- package/dist/stores/accounts/accounts-database.js.map +1 -1
- package/dist/stores/accounts/accounts-store.d.ts +1 -1
- package/dist/stores/accounts/accounts-store.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-store.js +1 -1
- package/dist/stores/accounts/accounts-store.js.map +1 -1
- package/dist/stores/accounts/utils.d.ts +5 -1
- package/dist/stores/accounts/utils.d.ts.map +1 -1
- package/dist/stores/accounts/utils.js +58 -0
- package/dist/stores/accounts/utils.js.map +1 -1
- package/dist/stores/authors-comments/authors-comments-store.d.ts.map +1 -1
- package/dist/stores/authors-comments/authors-comments-store.js +39 -12
- package/dist/stores/authors-comments/authors-comments-store.js.map +1 -1
- package/dist/stores/comments/comments-store.d.ts +2 -0
- package/dist/stores/comments/comments-store.d.ts.map +1 -1
- package/dist/stores/comments/comments-store.js +170 -21
- package/dist/stores/comments/comments-store.js.map +1 -1
- package/dist/stores/communities/communities-store.d.ts.map +1 -1
- package/dist/stores/communities/communities-store.js +27 -7
- package/dist/stores/communities/communities-store.js.map +1 -1
- package/dist/stores/communities-pages/communities-pages-store.d.ts.map +1 -1
- package/dist/stores/communities-pages/communities-pages-store.js +60 -8
- package/dist/stores/communities-pages/communities-pages-store.js.map +1 -1
- package/dist/stores/feeds/feed-sorter.d.ts +5 -2
- package/dist/stores/feeds/feed-sorter.d.ts.map +1 -1
- package/dist/stores/feeds/feed-sorter.js +15 -4
- package/dist/stores/feeds/feed-sorter.js.map +1 -1
- package/dist/stores/feeds/feeds-store.d.ts +3 -0
- package/dist/stores/feeds/feeds-store.d.ts.map +1 -1
- package/dist/stores/feeds/feeds-store.js +36 -26
- package/dist/stores/feeds/feeds-store.js.map +1 -1
- package/dist/stores/feeds/utils.d.ts +16 -0
- package/dist/stores/feeds/utils.d.ts.map +1 -1
- package/dist/stores/feeds/utils.js +82 -26
- package/dist/stores/feeds/utils.js.map +1 -1
- package/dist/stores/replies/replies-store.d.ts.map +1 -1
- package/dist/stores/replies/replies-store.js +32 -6
- package/dist/stores/replies/replies-store.js.map +1 -1
- package/dist/stores/replies/utils.d.ts +3 -2
- package/dist/stores/replies/utils.d.ts.map +1 -1
- package/dist/stores/replies/utils.js +38 -5
- package/dist/stores/replies/utils.js.map +1 -1
- package/dist/stores/replies-pages/replies-pages-store.d.ts.map +1 -1
- package/dist/stores/replies-pages/replies-pages-store.js +68 -13
- package/dist/stores/replies-pages/replies-pages-store.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-sorts.js","sourceRoot":"","sources":["../../src/lib/page-sorts.ts"],"names":[],"mappings":"AASA,oGAAoG;AACpG,iGAAiG;AACjG,qGAAqG;AACrG,MAAM,+BAA+B,GAAG;IACtC,KAAK;IACL,KAAK;IACL,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;CACT,CAAC;AACF,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAEtF,kGAAkG;AAClG,yFAAyF;AACzF,MAAM,+BAA+B,GAAG,CAAC,OAAiB,EAAY,EAAE;IACtE,MAAM,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA,CAAC;IACxF,OAAO,MAAM;QACX,CAAC,CAAC,gCAAgC;QAClC,CAAC,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,6FAA6F;AAC7F,iEAAiE;AACjE,MAAM,uBAAuB,GAA2B;IACtD,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAi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oBAAoB,GAAG,CAClC,OAA4B,EAC5B,iBAA0B,EACN,EAAE,CACtB,qBAAqB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC","sourcesContent":["import { Comment, Community } from \"../types\";\n\ntype PagesRecord = {\n pages?: Record<string, unknown>;\n pageCids?: Record<string, unknown>;\n};\n\ntype PreloadedPage = { comments?: unknown; nextCid?: string } | undefined;\n\n// Standard pkc-js sorts (pkc-js src/pages/util.ts) whose scoring the feed sorter reproduces. pkc-js\n// preloads a single sort and only publishes pageCids once that page overflows, so a record whose\n// comments all fit in the preloaded page can serve any of these by re-sorting that page client-side.\nconst CLIENT_SORTABLE_POST_SORT_TYPES = [\n \"hot\",\n \"new\",\n \"active\",\n \"topHour\",\n \"topDay\",\n \"topWeek\",\n \"topMonth\",\n \"topYear\",\n \"topAll\",\n];\nconst CLIENT_SORTABLE_REPLY_SORT_TYPES = [\"best\", \"new\", \"old\", \"newFlat\", \"oldFlat\"];\n\n// pkc-js only publishes flat sorts for a post's replies (REPLY_REPLIES_SORT_TYPES has none), so a\n// nested reply must not advertise them while its replies still fit in the preloaded page\nconst getClientSortableReplySortTypes = (comment?: Comment): string[] => {\n const isPost = comment?.depth !== undefined ? comment.depth === 0 : !comment?.parentCid;\n return isPost\n ? CLIENT_SORTABLE_REPLY_SORT_TYPES\n : CLIENT_SORTABLE_REPLY_SORT_TYPES.filter((sortType) => !isFlatSortType(sortType));\n};\n\n// pkc-js TIMEFRAMES_TO_SECONDS, applied client-side when a timeframe sort is computed from a\n// preloaded page instead of a page the community windowed itself\nconst SORT_TIMEFRAMES_SECONDS: Record<string, number> = {\n Hour: 3600,\n Day: 86400,\n Week: 604800,\n Month: 2629746,\n Year: 31557600,\n};\n\nexport const isFlatSortType = (sortType?: string): boolean => Boolean(sortType?.endsWith(\"Flat\"));\n\nexport const getSortTimeframeSeconds = (sortType?: string): number | undefined => {\n const timeframe = sortType?.match(/^(?:top|controversial)(Hour|Day|Week|Month|Year)$/)?.[1];\n return timeframe ? SORT_TIMEFRAMES_SECONDS[timeframe] : undefined;\n};\n\nconst getPublishedPageSortTypes = (record?: PagesRecord): string[] => {\n const sortTypes = new Set<string>();\n for (const sortType of Object.keys(record?.pages || {})) {\n if (sortType) sortTypes.add(sortType);\n }\n for (const sortType of Object.keys(record?.pageCids || {})) {\n if (sortType) sortTypes.add(sortType);\n }\n return [...sortTypes];\n};\n\n// preloaded pages holding the record's complete comment set: no page continues with a nextCid and\n// no pageCids are published (pkc-js publishes pageCids for every sort once the preloaded page overflows)\nconst getCompletePreloadedPageSortTypes = (record?: PagesRecord): string[] => {\n if (Object.keys(record?.pageCids || {}).length > 0) {\n return [];\n }\n const pages = record?.pages || {};\n const sortTypes = Object.keys(pages).filter((sortType) =>\n Array.isArray((pages[sortType] as PreloadedPage)?.comments),\n );\n if (\n !sortTypes.length ||\n sortTypes.some((sortType) => (pages[sortType] as PreloadedPage)?.nextCid)\n ) {\n return [];\n }\n // a page windowed by a timeframe sort only holds that window, never the complete set\n return sortTypes.filter((sortType) => !getSortTimeframeSeconds(sortType));\n};\n\n// a flat sort flattens the whole reply tree, so every nested reply chain must be complete too\nconst hasCompleteReplyTree = (page: PreloadedPage): boolean =>\n ((page?.comments as Comment[] | undefined) || []).every((comment) => {\n const completeSortTypes = getCompletePreloadedPageSortTypes(comment?.replies);\n if (!completeSortTypes.length) {\n // no preloaded replies is only complete when the comment reports none, and a continued or\n // paged chain is never complete\n return !(comment?.replyCount > 0) && !Object.keys(comment?.replies?.pages || {}).length;\n }\n const hierarchicalSortType = completeSortTypes.find((sortType) => !isFlatSortType(sortType));\n return hierarchicalSortType === undefined\n ? true\n : hasCompleteReplyTree(comment.replies.pages[hierarchicalSortType]);\n });\n\n// a flat page cannot rebuild the reply tree, so it only serves flat sorts; a hierarchical page\n// serves flat sorts only when its nested reply chains are complete\nconst getClientSortableSortTypes = (\n record: PagesRecord | undefined,\n clientSortableSortTypes: string[],\n): string[] => {\n const completeSortTypes = getCompletePreloadedPageSortTypes(record);\n if (!completeSortTypes.length) {\n return [];\n }\n const hierarchicalSortType = completeSortTypes.find((sortType) => !isFlatSortType(sortType));\n if (hierarchicalSortType === undefined) {\n return clientSortableSortTypes.filter(isFlatSortType);\n }\n const canFlatten =\n completeSortTypes.some(isFlatSortType) ||\n hasCompleteReplyTree(record?.pages?.[hierarchicalSortType] as PreloadedPage);\n return canFlatten\n ? clientSortableSortTypes\n : clientSortableSortTypes.filter((sortType) => !isFlatSortType(sortType));\n};\n\nconst getAvailablePageSortTypes = (\n record: PagesRecord | undefined,\n clientSortableSortTypes: string[],\n): string[] => {\n const sortTypes = getPublishedPageSortTypes(record);\n for (const sortType of getClientSortableSortTypes(record, clientSortableSortTypes)) {\n if (!sortTypes.includes(sortType)) sortTypes.push(sortType);\n }\n return sortTypes;\n};\n\nconst getPreloadedPageSortType = (record?: PagesRecord): string | undefined => {\n const preloadedSortType = Object.keys(record?.pages || {}).find(Boolean);\n return preloadedSortType || getPublishedPageSortTypes(record)[0];\n};\n\nconst resolvePageSortType = (\n record: PagesRecord | undefined,\n requestedSortType: string | undefined,\n clientSortableSortTypes: string[],\n): string | undefined => {\n if (requestedSortType !== undefined) {\n return getAvailablePageSortTypes(record, clientSortableSortTypes).includes(requestedSortType)\n ? requestedSortType\n : undefined;\n }\n return getPreloadedPageSortType(record);\n};\n\n// the page that serves a resolved sort: its published page, or the complete preloaded page the\n// client re-sorts (a flat sort prefers a complete flat page, else flattens a hierarchical one)\nconst getPageSortTypeToRead = (\n record: PagesRecord | undefined,\n sortType: string | undefined,\n): string | undefined => {\n if (sortType === undefined) {\n return undefined;\n }\n if (getPublishedPageSortTypes(record).includes(sortType)) {\n return sortType;\n }\n const completeSortTypes = getCompletePreloadedPageSortTypes(record);\n const hierarchicalSortType = completeSortTypes.find(\n (preloadedSortType) => !isFlatSortType(preloadedSortType),\n );\n if (isFlatSortType(sortType)) {\n return completeSortTypes.find(isFlatSortType) ?? hierarchicalSortType;\n }\n return hierarchicalSortType;\n};\n\nexport const getAvailablePostSortTypes = (community?: Community): string[] =>\n getAvailablePageSortTypes(community?.posts, CLIENT_SORTABLE_POST_SORT_TYPES);\n\nexport const getAvailableReplySortTypes = (comment?: Comment): string[] =>\n getAvailablePageSortTypes(comment?.replies, getClientSortableReplySortTypes(comment));\n\nexport const getPreloadedPostSortType = (community?: Community): string | undefined =>\n getPreloadedPageSortType(community?.posts);\n\nexport const getPreloadedReplySortType = (comment?: Comment): string | undefined =>\n getPreloadedPageSortType(comment?.replies);\n\nexport const resolvePostSortType = (\n community: Community | undefined,\n requestedSortType?: string,\n): string | undefined =>\n resolvePageSortType(community?.posts, requestedSortType, CLIENT_SORTABLE_POST_SORT_TYPES);\n\nexport const resolveReplySortType = (\n comment: Comment | undefined,\n requestedSortType?: string,\n): string | undefined =>\n resolvePageSortType(\n comment?.replies,\n requestedSortType,\n getClientSortableReplySortTypes(comment),\n );\n\n// the options pkc-js applies to every sort; any other published option belongs to the sort file itself\nconst RESERVED_PAGE_SORT_OPTIONS = new Set([\n \"maxAge\",\n \"pinnedFirst\",\n \"excludeRemovedComments\",\n \"excludeDeletedComments\",\n \"excludeCommentPendingApproval\",\n \"excludeCommentWithApprovedFalse\",\n \"excludeCommentsWithDifferentCommunityAddress\",\n]);\n\n// a community configured with `settings.pages` publishes `community.pageSorts`, naming the file behind\n// each key; a package or path file published under a built-in key (e.g. a keyword no-bump `active`)\n// orders its pages by a score the client sorters do not reproduce. A node may also register such a\n// file under the built-in name itself, which its own options (e.g. `noBumpKeywords`) still reveal.\n// Unconfigured communities publish no `pageSorts`, so their keys are the built-ins.\nexport const isBuiltInPostSortType = (\n community: Community | undefined,\n sortType: string | undefined,\n): boolean => {\n const publishedPageSort = sortType ? community?.pageSorts?.posts?.[sortType] : undefined;\n return (\n !publishedPageSort ||\n (publishedPageSort.name === sortType &&\n Object.keys(publishedPageSort.publicOptions || {}).every((option) =>\n RESERVED_PAGE_SORT_OPTIONS.has(option),\n ))\n );\n};\n\n// the `community.posts` page sort that serves a request, e.g. the preloaded `hot` page when a\n// single-page community serves `active` client-side; undefined when the sort cannot be served\nexport const getPostPageSortType = (\n community: Community | undefined,\n requestedSortType?: string,\n): string | undefined =>\n getPageSortTypeToRead(community?.posts, resolvePostSortType(community, requestedSortType));\n\nexport const getReplyPageSortType = (\n comment: Comment | undefined,\n requestedSortType?: string,\n): string | undefined =>\n getPageSortTypeToRead(comment?.replies, resolveReplySortType(comment, requestedSortType));\n"]}
|
|
1
|
+
{"version":3,"file":"page-sorts.js","sourceRoot":"","sources":["../../src/lib/page-sorts.ts"],"names":[],"mappings":"AASA,oGAAoG;AACpG,iGAAiG;AACjG,oFAAoF;AACpF,MAAM,+BAA+B,GAAG;IACtC,KAAK;IACL,KAAK;IACL,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;CACT,CAAC;AACF,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAEtF,kGAAkG;AAClG,yFAAyF;AACzF,MAAM,+BAA+B,GAAG,CAAC,OAAiB,EAAY,EAAE;IACtE,MAAM,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA,CAAC;IACxF,OAAO,MAAM;QACX,CAAC,CAAC,gCAAgC;QAClC,CAAC,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,6FAA6F;AAC7F,iEAAiE;AACjE,MA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AC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,aAAa,0CAAE,WAAW,CAAC;IAClE,OAAO,CAAC,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,SAAgC,EAChC,QAAiB,EACR,EAAE,CACX,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,SAAgC,EAChC,OAA4B,EAC5B,QAAiB,EACR,EAAE,CACX,yBAAyB,CACvB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CACxC,CAAC","sourcesContent":["import { Comment, Community } from \"../types\";\n\ntype PagesRecord = {\n pages?: Record<string, unknown>;\n pageCids?: Record<string, unknown>;\n};\n\ntype PreloadedPage = { comments?: unknown; nextCid?: string } | undefined;\n\n// Standard pkc-js sorts (pkc-js src/pages/util.ts) whose scoring the feed sorter reproduces. pkc-js\n// only publishes pageCids once a preloaded page overflows, so a record whose comments all fit in\n// its preloaded pages can serve any of these by re-sorting such a page client-side.\nconst CLIENT_SORTABLE_POST_SORT_TYPES = [\n \"hot\",\n \"new\",\n \"active\",\n \"topHour\",\n \"topDay\",\n \"topWeek\",\n \"topMonth\",\n \"topYear\",\n \"topAll\",\n];\nconst CLIENT_SORTABLE_REPLY_SORT_TYPES = [\"best\", \"new\", \"old\", \"newFlat\", \"oldFlat\"];\n\n// pkc-js only publishes flat sorts for a post's replies (REPLY_REPLIES_SORT_TYPES has none), so a\n// nested reply must not advertise them while its replies still fit in the preloaded page\nconst getClientSortableReplySortTypes = (comment?: Comment): string[] => {\n const isPost = comment?.depth !== undefined ? comment.depth === 0 : !comment?.parentCid;\n return isPost\n ? CLIENT_SORTABLE_REPLY_SORT_TYPES\n : CLIENT_SORTABLE_REPLY_SORT_TYPES.filter((sortType) => !isFlatSortType(sortType));\n};\n\n// pkc-js TIMEFRAMES_TO_SECONDS, applied client-side when a timeframe sort is computed from a\n// preloaded page instead of a page the community windowed itself\nconst SORT_TIMEFRAMES_SECONDS: Record<string, number> = {\n Hour: 3600,\n Day: 86400,\n Week: 604800,\n Month: 2629746,\n Year: 31557600,\n};\n\nexport const isFlatSortType = (sortType?: string): boolean => Boolean(sortType?.endsWith(\"Flat\"));\n\nexport const getSortTimeframeSeconds = (sortType?: string): number | undefined => {\n const timeframe = sortType?.match(/^(?:top|controversial)(Hour|Day|Week|Month|Year)$/)?.[1];\n return timeframe ? SORT_TIMEFRAMES_SECONDS[timeframe] : undefined;\n};\n\nconst getPublishedPageSortTypes = (record?: PagesRecord): string[] => {\n const sortTypes = new Set<string>();\n for (const sortType of Object.keys(record?.pages || {})) {\n if (sortType) sortTypes.add(sortType);\n }\n for (const sortType of Object.keys(record?.pageCids || {})) {\n if (sortType) sortTypes.add(sortType);\n }\n return [...sortTypes];\n};\n\n// preloaded pages holding the record's complete comment set: no page continues with a nextCid and\n// no pageCids are published (pkc-js publishes pageCids for every sort once the preloaded page overflows)\nconst getCompletePreloadedPageSortTypes = (record?: PagesRecord): string[] => {\n if (Object.keys(record?.pageCids || {}).length > 0) {\n return [];\n }\n const pages = record?.pages || {};\n const sortTypes = Object.keys(pages).filter((sortType) =>\n Array.isArray((pages[sortType] as PreloadedPage)?.comments),\n );\n if (\n !sortTypes.length ||\n sortTypes.some((sortType) => (pages[sortType] as PreloadedPage)?.nextCid)\n ) {\n return [];\n }\n // a page windowed by a timeframe sort only holds that window, never the complete set\n return sortTypes.filter((sortType) => !getSortTimeframeSeconds(sortType));\n};\n\n// a flat sort flattens the whole reply tree, so every nested reply chain must be complete too\nconst hasCompleteReplyTree = (page: PreloadedPage): boolean =>\n ((page?.comments as Comment[] | undefined) || []).every((comment) => {\n const completeSortTypes = getCompletePreloadedPageSortTypes(comment?.replies);\n if (!completeSortTypes.length) {\n // no preloaded replies is only complete when the comment reports none, and a continued or\n // paged chain is never complete\n return !(comment?.replyCount > 0) && !Object.keys(comment?.replies?.pages || {}).length;\n }\n const hierarchicalSortType = completeSortTypes.find((sortType) => !isFlatSortType(sortType));\n return hierarchicalSortType === undefined\n ? true\n : hasCompleteReplyTree(comment.replies.pages[hierarchicalSortType]);\n });\n\n// a flat page cannot rebuild the reply tree, so it only serves flat sorts; a hierarchical page\n// serves flat sorts only when its nested reply chains are complete\nconst getClientSortableSortTypes = (\n record: PagesRecord | undefined,\n clientSortableSortTypes: string[],\n): string[] => {\n const completeSortTypes = getCompletePreloadedPageSortTypes(record);\n if (!completeSortTypes.length) {\n return [];\n }\n const hierarchicalSortType = completeSortTypes.find((sortType) => !isFlatSortType(sortType));\n if (hierarchicalSortType === undefined) {\n return clientSortableSortTypes.filter(isFlatSortType);\n }\n const canFlatten =\n completeSortTypes.some(isFlatSortType) ||\n hasCompleteReplyTree(record?.pages?.[hierarchicalSortType] as PreloadedPage);\n return canFlatten\n ? clientSortableSortTypes\n : clientSortableSortTypes.filter((sortType) => !isFlatSortType(sortType));\n};\n\nconst getAvailablePageSortTypes = (\n record: PagesRecord | undefined,\n clientSortableSortTypes: string[],\n): string[] => {\n const sortTypes = getPublishedPageSortTypes(record);\n for (const sortType of getClientSortableSortTypes(record, clientSortableSortTypes)) {\n if (!sortTypes.includes(sortType)) sortTypes.push(sortType);\n }\n return sortTypes;\n};\n\n// the sorts whose first page the record embeds, in the record's key order. pkc-js publishes records\n// with sorted keys, so that order is not guaranteed to be the one the community configured and the\n// first sort is not necessarily its preference. A community may preload several sorts, or none: a\n// record with empty `pages` has no preloaded sort, even when it publishes `pageCids`.\nconst getPreloadedPageSortTypes = (record?: PagesRecord): string[] =>\n Object.keys(record?.pages || {}).filter(Boolean);\n\n// whether the record publishes any comment: a page cid, or a preloaded page that holds comments or\n// continues. A record with no comments can still carry empty preloaded pages (`comments: []`).\nconst hasPublishedComments = (record?: PagesRecord): boolean =>\n Object.keys(record?.pageCids || {}).length > 0 ||\n Object.values(record?.pages || {}).some((page) => {\n const { comments, nextCid } = (page as PreloadedPage) || {};\n return Boolean(nextCid) || (Array.isArray(comments) && comments.length > 0);\n });\n\n// a requested sort the record does not serve, as opposed to a record that has not loaded or has no\n// comments at all, where there is nothing a different sort would show\nconst isPageSortTypeUnavailable = (\n record: PagesRecord | undefined,\n requestedSortType: string | undefined,\n clientSortableSortTypes: string[],\n): boolean =>\n requestedSortType !== undefined &&\n hasPublishedComments(record) &&\n !getAvailablePageSortTypes(record, clientSortableSortTypes).includes(requestedSortType);\n\nconst resolvePageSortType = (\n record: PagesRecord | undefined,\n requestedSortType: string | undefined,\n clientSortableSortTypes: string[],\n): string | undefined => {\n if (requestedSortType !== undefined) {\n return getAvailablePageSortTypes(record, clientSortableSortTypes).includes(requestedSortType)\n ? requestedSortType\n : undefined;\n }\n // no sort requested: use the first preloaded sort in the record's key order. A record that preloads\n // nothing still has to load something, so it falls back to the first sort it publishes page cids for.\n return getPreloadedPageSortTypes(record)[0] ?? getPublishedPageSortTypes(record)[0];\n};\n\n// the page that serves a resolved sort: its published page, or the complete preloaded page the\n// client re-sorts (a flat sort prefers a complete flat page, else flattens a hierarchical one)\nconst getPageSortTypeToRead = (\n record: PagesRecord | undefined,\n sortType: string | undefined,\n): string | undefined => {\n if (sortType === undefined) {\n return undefined;\n }\n if (getPublishedPageSortTypes(record).includes(sortType)) {\n return sortType;\n }\n const completeSortTypes = getCompletePreloadedPageSortTypes(record);\n const hierarchicalSortType = completeSortTypes.find(\n (preloadedSortType) => !isFlatSortType(preloadedSortType),\n );\n if (isFlatSortType(sortType)) {\n return completeSortTypes.find(isFlatSortType) ?? hierarchicalSortType;\n }\n return hierarchicalSortType;\n};\n\nexport const getAvailablePostSortTypes = (community?: Community): string[] =>\n getAvailablePageSortTypes(community?.posts, CLIENT_SORTABLE_POST_SORT_TYPES);\n\nexport const getAvailableReplySortTypes = (comment?: Comment): string[] =>\n getAvailablePageSortTypes(comment?.replies, getClientSortableReplySortTypes(comment));\n\nexport const getPreloadedPostSortTypes = (community?: Community): string[] =>\n getPreloadedPageSortTypes(community?.posts);\n\nexport const getPreloadedReplySortTypes = (comment?: Comment): string[] =>\n getPreloadedPageSortTypes(comment?.replies);\n\n// the first preloaded sort in the record's key order, undefined when the record preloads none\nexport const getPreloadedPostSortType = (community?: Community): string | undefined =>\n getPreloadedPostSortTypes(community)[0];\n\nexport const getPreloadedReplySortType = (comment?: Comment): string | undefined =>\n getPreloadedReplySortTypes(comment)[0];\n\nexport const isPostSortTypeUnavailable = (\n community: Community | undefined,\n requestedSortType?: string,\n): boolean =>\n isPageSortTypeUnavailable(community?.posts, requestedSortType, CLIENT_SORTABLE_POST_SORT_TYPES);\n\nexport const isReplySortTypeUnavailable = (\n comment: Comment | undefined,\n requestedSortType?: string,\n): boolean =>\n isPageSortTypeUnavailable(\n comment?.replies,\n requestedSortType,\n getClientSortableReplySortTypes(comment),\n );\n\nexport const resolvePostSortType = (\n community: Community | undefined,\n requestedSortType?: string,\n): string | undefined =>\n resolvePageSortType(community?.posts, requestedSortType, CLIENT_SORTABLE_POST_SORT_TYPES);\n\nexport const resolveReplySortType = (\n comment: Comment | undefined,\n requestedSortType?: string,\n): string | undefined =>\n resolvePageSortType(\n comment?.replies,\n requestedSortType,\n getClientSortableReplySortTypes(comment),\n );\n\n// the options pkc-js applies to every sort; any other published option belongs to the sort file itself\nconst RESERVED_PAGE_SORT_OPTIONS = new Set([\n \"maxAge\",\n \"pinnedFirst\",\n \"excludeRemovedComments\",\n \"excludeDeletedComments\",\n \"excludeCommentPendingApproval\",\n \"excludeCommentWithApprovedFalse\",\n \"excludeCommentsWithDifferentCommunityAddress\",\n]);\n\n// a community configured with `settings.pages` publishes `community.pageSorts`, naming the file behind\n// each key; a package or path file published under a built-in key (e.g. a keyword no-bump `active`)\n// orders its pages by a score the client sorters do not reproduce. A node may also register such a\n// file under the built-in name itself, which its own options (e.g. `noBumpKeywords`) still reveal.\n// Unconfigured communities publish no `pageSorts`, so their keys are the built-ins.\nexport const isBuiltInPostSortType = (\n community: Community | undefined,\n sortType: string | undefined,\n): boolean => {\n const publishedPageSort = sortType ? community?.pageSorts?.posts?.[sortType] : undefined;\n return (\n !publishedPageSort ||\n (publishedPageSort.name === sortType &&\n Object.keys(publishedPageSort.publicOptions || {}).every((option) =>\n RESERVED_PAGE_SORT_OPTIONS.has(option),\n ))\n );\n};\n\n// the `community.posts` page sort that serves a request, e.g. the preloaded `hot` page when a\n// single-page community serves `active` client-side; undefined when the sort cannot be served\nexport const getPostPageSortType = (\n community: Community | undefined,\n requestedSortType?: string,\n): string | undefined =>\n getPageSortTypeToRead(community?.posts, resolvePostSortType(community, requestedSortType));\n\nexport const getReplyPageSortType = (\n comment: Comment | undefined,\n requestedSortType?: string,\n): string | undefined =>\n getPageSortTypeToRead(comment?.replies, resolveReplySortType(comment, requestedSortType));\n\n// whether a sort puts pinned comments first. A community configured with `settings.pages` publishes\n// every sort's reserved options in `community.pageSorts`, so `pinnedFirst: \"false\"` (pinned comments\n// ranked and filtered like any other) is readable from the record; pkc-js defaults it to \"true\", which\n// is also what an unconfigured community, publishing no `pageSorts`, has always done. A sort the\n// client computes from another sort's complete page follows that page's placement when the community\n// published nothing about the requested sort.\nconst isPinnedFirstPageSortType = (\n community: Community | undefined,\n scope: \"posts\" | \"replies\",\n sortType: string | undefined,\n pageSortType: string | undefined,\n): boolean => {\n const publishedPageSorts = community?.pageSorts?.[scope];\n const publishedPageSort =\n (sortType !== undefined ? publishedPageSorts?.[sortType] : undefined) ??\n (pageSortType !== undefined ? publishedPageSorts?.[pageSortType] : undefined);\n const pinnedFirst = publishedPageSort?.publicOptions?.pinnedFirst;\n return !(typeof pinnedFirst === \"string\" && pinnedFirst.trim().toLowerCase() === \"false\");\n};\n\nexport const isPinnedFirstPostSortType = (\n community: Community | undefined,\n sortType?: string,\n): boolean =>\n isPinnedFirstPageSortType(community, \"posts\", sortType, getPostPageSortType(community, sortType));\n\nexport const isPinnedFirstReplySortType = (\n community: Community | undefined,\n comment: Comment | undefined,\n sortType?: string,\n): boolean =>\n isPinnedFirstPageSortType(\n community,\n \"replies\",\n sortType,\n getReplyPageSortType(comment, sortType),\n );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkc-js-mock-content.d.ts","sourceRoot":"","sources":["../../../src/lib/pkc-js/pkc-js-mock-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pkc-js-mock-content.d.ts","sourceRoot":"","sources":["../../../src/lib/pkc-js/pkc-js-mock-content.ts"],"names":[],"mappings":"AAmgDA,QAAA,MAAM,SAAS,EAAE,GAEhB,CAAC;AAeF,eAAe,SAAS,CAAC"}
|
|
@@ -1105,6 +1105,7 @@ class Publication extends EventEmitter {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
+
const commentUpdateLoops = new WeakMap();
|
|
1108
1109
|
class Comment extends Publication {
|
|
1109
1110
|
constructor(createCommentOptions) {
|
|
1110
1111
|
super();
|
|
@@ -1158,12 +1159,15 @@ class Comment extends Publication {
|
|
|
1158
1159
|
this.updating = true;
|
|
1159
1160
|
this.updatingState = "fetching-ipfs";
|
|
1160
1161
|
this.emit("updatingstatechange", "fetching-ipfs");
|
|
1162
|
+
// a loop started before stop() ends even if update() started a new one before it woke up
|
|
1163
|
+
const updateLoop = (commentUpdateLoops.get(this) || 0) + 1;
|
|
1164
|
+
commentUpdateLoops.set(this, updateLoop);
|
|
1161
1165
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1162
1166
|
while (this.updating) {
|
|
1163
1167
|
yield simulateLoadingTime();
|
|
1164
1168
|
yield simulateLoadingTime();
|
|
1165
1169
|
yield simulateLoadingTime();
|
|
1166
|
-
if (!this.updating) {
|
|
1170
|
+
if (!this.updating || commentUpdateLoops.get(this) !== updateLoop) {
|
|
1167
1171
|
return;
|
|
1168
1172
|
}
|
|
1169
1173
|
this.simulateUpdateEvent();
|