@openpeepshq/core 0.5.0 → 0.5.1
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/db/pg/map/relations.js +27 -7
- package/dist/email/send.d.ts +2 -2
- package/dist/groups/finders.d.ts +1 -1
- package/dist/groups/mapping.d.ts +2 -2
- package/dist/posts/helpers/index.js +3 -0
- package/dist/profiles/mapping.d.ts +5 -5
- package/dist/reports/mapping.d.ts +1 -1
- package/package.json +11 -12
|
@@ -32,6 +32,19 @@ const vertexCollectionFor = (relation) => {
|
|
|
32
32
|
const edgeCollectionName = (edge) => typeof edge === 'string' ? edge : edge.name;
|
|
33
33
|
const parentEdgeColumn = (relation) => relation.direction === 'INBOUND' ? 'toId' : 'fromId';
|
|
34
34
|
const vertexEdgeColumn = (relation) => relation.direction === 'INBOUND' ? 'fromId' : 'toId';
|
|
35
|
+
/**
|
|
36
|
+
* Build the edge-condition SQL fragment from a relation's edgeFilter so every
|
|
37
|
+
* edge query applies the same filter.
|
|
38
|
+
*
|
|
39
|
+
* Returns `undefined` when there is no edgeFilter to apply, and the caller
|
|
40
|
+
* must handle that case (usually by pushing the fragment into the edge
|
|
41
|
+
* conditions passed to `and(...)`).
|
|
42
|
+
*/
|
|
43
|
+
const edgeFilterCondition = (relation, edgeTableRef) => typeof relation.edgeFilter === 'string'
|
|
44
|
+
? applyDateRangeToEdgeSql(edgeTableRef, relation.edgeFilter)
|
|
45
|
+
: isSqlFilter(relation.edgeFilter)
|
|
46
|
+
? relation.edgeFilter.where
|
|
47
|
+
: undefined;
|
|
35
48
|
export const fetchRowsByIds = async (db, collection, ids, softDelete) => {
|
|
36
49
|
if (!ids.length)
|
|
37
50
|
return [];
|
|
@@ -151,11 +164,7 @@ const attachRelation = async (db, _parentCollection, docs, relation) => {
|
|
|
151
164
|
return docs;
|
|
152
165
|
const parentCol = edgeTable[parentEdgeColumn(relation)];
|
|
153
166
|
const edgeConditions = [inArray(parentCol, parentIds)];
|
|
154
|
-
const edgeExtraFilter =
|
|
155
|
-
? applyDateRangeToEdgeSql(edgeTableRef, relation.edgeFilter)
|
|
156
|
-
: isSqlFilter(relation.edgeFilter)
|
|
157
|
-
? relation.edgeFilter.where
|
|
158
|
-
: undefined;
|
|
167
|
+
const edgeExtraFilter = edgeFilterCondition(relation, edgeTableRef);
|
|
159
168
|
if (edgeExtraFilter)
|
|
160
169
|
edgeConditions.push(edgeExtraFilter);
|
|
161
170
|
const edgeRows = await db
|
|
@@ -291,10 +300,14 @@ const traverseRelation = async (db, startId, relation) => {
|
|
|
291
300
|
break;
|
|
292
301
|
const parentCol = edgeTable[parentEdgeColumn(relation)];
|
|
293
302
|
const vertexCol = vertexEdgeColumn(relation);
|
|
303
|
+
const edgeConditions = [inArray(parentCol, frontier)];
|
|
304
|
+
const edgeExtraFilter = edgeFilterCondition(relation, edgeTableRef);
|
|
305
|
+
if (edgeExtraFilter)
|
|
306
|
+
edgeConditions.push(edgeExtraFilter);
|
|
294
307
|
const edgeRows = await db
|
|
295
308
|
.select()
|
|
296
309
|
.from(edgeTableRef)
|
|
297
|
-
.where(
|
|
310
|
+
.where(and(...edgeConditions));
|
|
298
311
|
if (!edgeRows.length)
|
|
299
312
|
break;
|
|
300
313
|
let vertexIds = [
|
|
@@ -404,10 +417,14 @@ export const relationsFrom = async (db, start, _parentCollection, relation) => {
|
|
|
404
417
|
const edgeTableRef = getEdgeTable(edgeCollectionName(relation.edgeCollection));
|
|
405
418
|
const edgeTable = asTable(edgeTableRef);
|
|
406
419
|
const parentCol = edgeTable[parentEdgeColumn(relation)];
|
|
420
|
+
const edgeConditions = [eq(parentCol, start.id)];
|
|
421
|
+
const edgeExtraFilter = edgeFilterCondition(relation, edgeTableRef);
|
|
422
|
+
if (edgeExtraFilter)
|
|
423
|
+
edgeConditions.push(edgeExtraFilter);
|
|
407
424
|
const edgeRows = await db
|
|
408
425
|
.select()
|
|
409
426
|
.from(edgeTableRef)
|
|
410
|
-
.where(
|
|
427
|
+
.where(and(...edgeConditions));
|
|
411
428
|
if (relation.count) {
|
|
412
429
|
return [{ count: edgeRows.length }];
|
|
413
430
|
}
|
|
@@ -431,6 +448,9 @@ export const relationsFrom = async (db, start, _parentCollection, relation) => {
|
|
|
431
448
|
};
|
|
432
449
|
export const evaluateDerived = async (db, doc, derived) => derived.resolve(db, doc);
|
|
433
450
|
export const deleteRelationsFor = async (db, startId, relation) => {
|
|
451
|
+
// Deliberately filterless: callers rely on removing every edge of this
|
|
452
|
+
// relation (e.g. deleting all reposts of a post), so Relation.edgeFilter
|
|
453
|
+
// must not narrow the enumeration here.
|
|
434
454
|
const edgeTableRef = getEdgeTable(edgeCollectionName(relation.edgeCollection));
|
|
435
455
|
const edgeTable = asTable(edgeTableRef);
|
|
436
456
|
const parentCol = edgeTable[parentEdgeColumn(relation)];
|
package/dist/email/send.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type SendEmailOptions = {
|
|
|
5
5
|
/** Writes to BullMQ job logs when processing a queued email. */
|
|
6
6
|
log?: EmailJobLog;
|
|
7
7
|
};
|
|
8
|
-
export declare const sendEmail: (emailData: EmailOptions, coreConfig: CoreConfig, options?: SendEmailOptions) => Promise<import("nodemailer
|
|
9
|
-
export declare const send: (job: Job<EmailOptions>) => Promise<import("nodemailer
|
|
8
|
+
export declare const sendEmail: (emailData: EmailOptions, coreConfig: CoreConfig, options?: SendEmailOptions) => Promise<import("nodemailer").SMTPSentMessageInfo>;
|
|
9
|
+
export declare const send: (job: Job<EmailOptions>) => Promise<import("nodemailer").SMTPSentMessageInfo>;
|
package/dist/groups/finders.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const listAdminGroups: () => Promise<{
|
|
|
107
107
|
guestData?: {
|
|
108
108
|
email?: string | undefined;
|
|
109
109
|
resource?: {
|
|
110
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
110
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
111
111
|
id?: string | undefined;
|
|
112
112
|
} | undefined;
|
|
113
113
|
} | undefined;
|
package/dist/groups/mapping.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export declare const adminGroupsMapping: import("../db/pg/map").Mapping<{
|
|
|
109
109
|
guestData?: {
|
|
110
110
|
email?: string | undefined;
|
|
111
111
|
resource?: {
|
|
112
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
112
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
113
113
|
id?: string | undefined;
|
|
114
114
|
} | undefined;
|
|
115
115
|
} | undefined;
|
|
@@ -171,7 +171,7 @@ export declare const adminGroupsMapping: import("../db/pg/map").Mapping<{
|
|
|
171
171
|
guestData?: {
|
|
172
172
|
email?: string | undefined;
|
|
173
173
|
resource?: {
|
|
174
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
174
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
175
175
|
id?: string | undefined;
|
|
176
176
|
} | undefined;
|
|
177
177
|
} | undefined;
|
|
@@ -94,6 +94,9 @@ export const transformPost = async (post, currentProfile, options = {}) => {
|
|
|
94
94
|
const entries = allEntries.filter((entry) => !isReactionHistoryEntry(entry.type));
|
|
95
95
|
const reactions = currentReactionsFromEntries(allEntries)
|
|
96
96
|
.filter((item) => item.reaction === AP_LIKE_REACTION)
|
|
97
|
+
// Privacy boundary: hide reactions from blocked pairs (either direction),
|
|
98
|
+
// mirroring how blocked creators are tombstoned via withBlockTombstone.
|
|
99
|
+
.filter((item) => !currentProfile || !isBlockedPair(currentProfile, item.profile.id))
|
|
97
100
|
.map((item) => ({
|
|
98
101
|
reaction: AP_LIKE_REACTION,
|
|
99
102
|
profile: item.profile,
|
|
@@ -35,7 +35,7 @@ export declare const baseProfilesMapping: import("../db/pg/map").Mapping<{
|
|
|
35
35
|
guestData?: {
|
|
36
36
|
email?: string | undefined;
|
|
37
37
|
resource?: {
|
|
38
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
38
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
39
39
|
id?: string | undefined;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} | undefined;
|
|
@@ -74,7 +74,7 @@ export declare const publicProfilesSearchMapping: import("../db/pg/map").Mapping
|
|
|
74
74
|
guestData?: {
|
|
75
75
|
email?: string | undefined;
|
|
76
76
|
resource?: {
|
|
77
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
77
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
78
78
|
id?: string | undefined;
|
|
79
79
|
} | undefined;
|
|
80
80
|
} | undefined;
|
|
@@ -116,7 +116,7 @@ export declare const publicProfilesMapping: import("../db/pg/map").Mapping<{
|
|
|
116
116
|
guestData?: {
|
|
117
117
|
email?: string | undefined;
|
|
118
118
|
resource?: {
|
|
119
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
119
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
120
120
|
id?: string | undefined;
|
|
121
121
|
} | undefined;
|
|
122
122
|
} | undefined;
|
|
@@ -154,7 +154,7 @@ export declare const profilesMapping: import("../db/pg/map").Mapping<{
|
|
|
154
154
|
guestData?: {
|
|
155
155
|
email?: string | undefined;
|
|
156
156
|
resource?: {
|
|
157
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
157
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
158
158
|
id?: string | undefined;
|
|
159
159
|
} | undefined;
|
|
160
160
|
} | undefined;
|
|
@@ -192,7 +192,7 @@ export declare const membersExportMapping: import("../db/pg/map").Mapping<{
|
|
|
192
192
|
guestData?: {
|
|
193
193
|
email?: string | undefined;
|
|
194
194
|
resource?: {
|
|
195
|
-
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "analytics" | "render";
|
|
195
|
+
type: "db" | "jams" | "profiles" | "self" | "*" | "notifications" | "posts" | "groups" | "reports" | "webhooks" | "conversations" | "analytics" | "render";
|
|
196
196
|
id?: string | undefined;
|
|
197
197
|
} | undefined;
|
|
198
198
|
} | undefined;
|
|
@@ -5,5 +5,5 @@ export declare const reportsMapping: import("../db/pg/map").Mapping<{
|
|
|
5
5
|
uri?: string | undefined;
|
|
6
6
|
forward?: boolean | undefined;
|
|
7
7
|
ruleIds?: number[] | undefined;
|
|
8
|
-
resolution?: "remove" | "
|
|
8
|
+
resolution?: "remove" | "other" | "warn" | "ignore" | "ban" | undefined;
|
|
9
9
|
}, ReportWithMeta, ReportWithMeta>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"cacheable": "^2.1.1",
|
|
16
16
|
"change-case": "^5.4.4",
|
|
17
17
|
"date-fns": "^4.1.0",
|
|
18
|
-
"deepmerge-ts": "^
|
|
18
|
+
"deepmerge-ts": "^8.0.2",
|
|
19
19
|
"dotenv": "^16.4.7",
|
|
20
|
-
"drizzle-orm": "^0.
|
|
20
|
+
"drizzle-orm": "^0.45.2",
|
|
21
21
|
"extract-zip": "^2.0.1",
|
|
22
22
|
"firebase-admin": "^13.4.0",
|
|
23
23
|
"fluent-ffmpeg": "^2.1.3",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"i18next-fs-backend": "^2.6.6",
|
|
27
27
|
"jose": "^5.9.6",
|
|
28
28
|
"livekit-server-sdk": "^2.15.4",
|
|
29
|
-
"nodemailer": "^
|
|
29
|
+
"nodemailer": "^10.0.0",
|
|
30
30
|
"pdfkit": "^0.19.1",
|
|
31
31
|
"pg": "^8.16.0",
|
|
32
32
|
"redis": "^4.7.0",
|
|
33
33
|
"safe-json-stringify": "^1.2.0",
|
|
34
|
-
"sharp": "^0.
|
|
34
|
+
"sharp": "^0.35.5",
|
|
35
35
|
"stripe": "^18.4.0",
|
|
36
36
|
"tweetnacl": "^1.0.3",
|
|
37
37
|
"type-fest": "^4.31.0",
|
|
38
38
|
"uuidv7": "^1.0.2",
|
|
39
39
|
"web-push": "^3.6.7",
|
|
40
|
-
"@openpeepshq/common": "0.6.
|
|
40
|
+
"@openpeepshq/common": "0.6.1",
|
|
41
|
+
"@openpeepshq/i18n": "^0.7.0",
|
|
41
42
|
"@openpeepshq/geocoder": "^0.1.2",
|
|
42
|
-
"@openpeepshq/fetch-client": "^0.2.1"
|
|
43
|
-
"@openpeepshq/i18n": "^0.5.0"
|
|
43
|
+
"@openpeepshq/fetch-client": "^0.2.1"
|
|
44
44
|
},
|
|
45
45
|
"main": "dist/index.js",
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
@@ -59,23 +59,22 @@
|
|
|
59
59
|
"@types/fs-extra": "^11.0.4",
|
|
60
60
|
"@types/html-to-text": "^9.0.4",
|
|
61
61
|
"@types/node": "^22.19.17",
|
|
62
|
-
"@types/nodemailer": "^6.4.17",
|
|
63
62
|
"@types/pdfkit": "^0.17.6",
|
|
64
63
|
"@types/pg": "^8.15.4",
|
|
65
64
|
"@types/safe-json-stringify": "^1.1.5",
|
|
66
65
|
"@types/web-push": "^3.6.4",
|
|
67
66
|
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
68
67
|
"@typescript-eslint/parser": "^8.72.0",
|
|
69
|
-
"concurrently": "^9.
|
|
68
|
+
"concurrently": "^9.2.5",
|
|
70
69
|
"drizzle-kit": "^0.31.1",
|
|
71
|
-
"eslint": "^10.
|
|
70
|
+
"eslint": "^10.14.0",
|
|
72
71
|
"eslint-config-prettier": "^9.1.0",
|
|
73
72
|
"google-auth-library": "^10.7.0",
|
|
74
73
|
"i18next": "^24.2.3",
|
|
75
74
|
"prettier": "^3.4.2",
|
|
76
75
|
"tsc-alias": "^1.8.10",
|
|
77
76
|
"typescript": "^6.0.2",
|
|
78
|
-
"vitest": "^
|
|
77
|
+
"vitest": "^4.1.12",
|
|
79
78
|
"@eslint/js": "^9.17.0"
|
|
80
79
|
},
|
|
81
80
|
"scripts": {
|