@pkcprotocol/pkc-js 0.0.113 → 0.0.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pages/page-sort-scoring.d.ts +4 -0
- package/dist/browser/pages/page-sort-scoring.js +20 -3
- package/dist/browser/pages/page-sort-scoring.js.map +1 -1
- package/dist/browser/runtime/node/community/db-handler.js +6 -6
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/page-generator.js +11 -17
- package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +37 -37
- package/dist/bundled/chunks/{helia-for-pkc-DoOp7t8V.js → helia-for-pkc-hSpmyI9D.js} +33 -33
- package/dist/bundled/chunks/{local-community-CFX753RE.js → local-community-Dc_fNPrx.js} +1 -1
- package/dist/bundled/chunks/{local-community-CaV30etW.js → local-community-EeQMdfYM.js} +39 -47
- package/dist/bundled/chunks/{node-gyqBss4j.js → node-apYZl3B3.js} +5 -5
- package/dist/bundled/chunks/{rpc-local-community-DWv8wZMB.js → rpc-local-community-C_0FRCqg.js} +15 -2
- package/dist/bundled/chunks/{util-CH8WrVZq.js → util-B2SuJZg-.js} +1 -1
- package/dist/bundled/chunks/{util-B9JenRyE.js → util-DFGl6QDd.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pages/page-sort-scoring.d.ts +4 -0
- package/dist/node/pages/page-sort-scoring.js +20 -3
- package/dist/node/pages/page-sort-scoring.js.map +1 -1
- package/dist/node/runtime/node/community/db-handler.js +6 -6
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/page-generator.js +11 -17
- package/dist/node/runtime/node/community/page-generator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.114";
|
|
@@ -8,6 +8,10 @@ export declare function applyPageSortExclusions<T extends PageSortReplyEntry>({
|
|
|
8
8
|
exclusions: Record<PageSortExclusionOptionName, boolean>;
|
|
9
9
|
communityAddress?: string;
|
|
10
10
|
}): T[];
|
|
11
|
+
export declare function filterRepliesForPageSort<T extends PageSortReplyEntry>({ replies, communityAddress }: {
|
|
12
|
+
replies: T[];
|
|
13
|
+
communityAddress: string;
|
|
14
|
+
}): T[];
|
|
11
15
|
export declare function partitionPageCommentsForSort({ comments, reserved, baseTimestamp }: {
|
|
12
16
|
comments: PageComment[];
|
|
13
17
|
reserved: Pick<ParsedReservedPageSortOptions, "pinnedFirst" | "maxAgeSeconds">;
|
|
@@ -13,8 +13,7 @@ export function validatePageSortFile(rawFile) {
|
|
|
13
13
|
...(raw.validatePageSortSettings ? { validatePageSortSettings: raw.validatePageSortSettings } : {})
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
// The reserved exclusions applied to page entries in JS
|
|
17
|
-
// (exclusionClauses): a comment is removed when commentUpdate.removed is true, deleted when its author's edit says so,
|
|
16
|
+
// The reserved exclusions applied to page entries in JS. Mirrors the SQL clauses in DbHandler (exclusionClauses): a comment is removed when commentUpdate.removed is true, deleted when its author's edit says so,
|
|
18
17
|
// disapproved when commentUpdate.approved is false, pending when commentUpdate.pendingApproval is true.
|
|
19
18
|
export function applyPageSortExclusions({ comments, exclusions, communityAddress }) {
|
|
20
19
|
const equivalentAddresses = communityAddress ? new Set(getEquivalentCommunityAddresses(communityAddress)) : undefined;
|
|
@@ -36,6 +35,24 @@ export function applyPageSortExclusions({ comments, exclusions, communityAddress
|
|
|
36
35
|
return true;
|
|
37
36
|
});
|
|
38
37
|
}
|
|
38
|
+
// The `replies` a requireReplies file receives: every reply in the scope except ones from another community address
|
|
39
|
+
// (issue #407). The sort's exclude* options are not applied, they reach the file in `options`: a removed or deleted
|
|
40
|
+
// reply is a tombstone whose present replies still count (docs/protocol/comment-lifecycle.md, "Which replies count"),
|
|
41
|
+
// so dropping it would cut its subtree, and the file decides what counts. Replies with no CommentUpdate never get
|
|
42
|
+
// here (the DB query joins on commentUpdates). Reply pages keep tombstones too, so a client walking them gets this set.
|
|
43
|
+
export function filterRepliesForPageSort({ replies, communityAddress }) {
|
|
44
|
+
return applyPageSortExclusions({
|
|
45
|
+
comments: replies,
|
|
46
|
+
exclusions: {
|
|
47
|
+
excludeRemovedComments: false,
|
|
48
|
+
excludeDeletedComments: false,
|
|
49
|
+
excludeCommentWithApprovedFalse: false,
|
|
50
|
+
excludeCommentPendingApproval: false,
|
|
51
|
+
excludeCommentsWithDifferentCommunityAddress: true
|
|
52
|
+
},
|
|
53
|
+
communityAddress
|
|
54
|
+
});
|
|
55
|
+
}
|
|
39
56
|
// Pinned placement and the maxAge window, the two reserved options that shape every sort's set and order. Pinned
|
|
40
57
|
// comments sort first and bypass the window when pinnedFirst is on (the default), so a sticky never ages out of a
|
|
41
58
|
// windowed index; with pinnedFirst off they are ordinary comments. Shared with the community's page generator.
|
|
@@ -77,7 +94,7 @@ export function stripRepliesFromPageComment(entry) {
|
|
|
77
94
|
// The `replies` a file with requireReplies gets per scored comment: its descendants, out of one flat list of every
|
|
78
95
|
// descendant of the page's comments (the community loads the scope's descendants once; a client passes what it
|
|
79
96
|
// walked). Indexed by parentCid, so a reply on a reply page gets its own subtree and a post gets everything under it;
|
|
80
|
-
// a node whose parent
|
|
97
|
+
// a node whose parent is not in the list is unreachable (only a foreign reply's subtree, see filterRepliesForPageSort).
|
|
81
98
|
export function createDescendantsLookup(replies) {
|
|
82
99
|
const childrenByParent = new Map();
|
|
83
100
|
for (const entry of replies) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-sort-scoring.js","sourceRoot":"","sources":["../../../src/pages/page-sort-scoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,k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cAAc,CAAC,CAAC,CAAC,qBAAqB,IAAI,uBAAuB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxH,OAAO,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC;YACd,OAAO;YACP,aAAa;YACb,OAAO;YACP,aAAa;YACb,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -3162,13 +3162,13 @@ export class DbHandler {
|
|
|
3162
3162
|
activeScore: Math.max(post.comment.timestamp, post.commentUpdate.lastReplyTimestamp ?? 0)
|
|
3163
3163
|
}));
|
|
3164
3164
|
}
|
|
3165
|
-
// Every reply (depth > 0) in the community, or under one post, with no exclusions applied:
|
|
3166
|
-
// generation loads for its requireReplies sorts
|
|
3167
|
-
//
|
|
3168
|
-
// (createDescendantsLookup). Lean on purpose (PageSortReplyEntry): a fixed column list mapped by hand, no
|
|
3165
|
+
// Every reply (depth > 0) with a CommentUpdate in the community, or under one post, with no exclusions applied:
|
|
3166
|
+
// the one reply set a generation loads for its requireReplies sorts. Only foreign replies are then dropped
|
|
3167
|
+
// (filterRepliesForPageSort); removed, deleted, pending and disapproved replies all reach the file, which applies
|
|
3168
|
+
// the sort's exclusions itself (issue #407). Each comment's subtree is sliced from it (createDescendantsLookup). Lean on purpose (PageSortReplyEntry): a fixed column list mapped by hand, no
|
|
3169
3169
|
// signature, no nested pages, no schema row parser, since a board can hold a million replies and this runs per
|
|
3170
|
-
// generation. A pending-approval reply is marked on its CommentUpdate the way the mod queue marks one, so
|
|
3171
|
-
//
|
|
3170
|
+
// generation. A pending-approval reply is marked on its CommentUpdate the way the mod queue marks one, so a file
|
|
3171
|
+
// can see it; the list never reaches a page.
|
|
3172
3172
|
queryAllRepliesForPageSort(opts = {}) {
|
|
3173
3173
|
// A list of posts streams in batches under the SQLite variable cap: what a post sort with requireReplies
|
|
3174
3174
|
// scores over, one batch of posts' subtrees at a time (issue #351)
|