@openpeepshq/core 0.1.31 → 0.1.32
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/analytics/clicks.d.ts +20 -0
- package/dist/analytics/clicks.js +194 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +1 -0
- package/dist/analytics/metrics.d.ts +1 -0
- package/dist/analytics/metrics.js +5 -0
- package/dist/analytics/pdfReport.js +2 -1
- package/dist/analytics/read.js +51 -6
- package/dist/analytics/report.d.ts +31 -0
- package/dist/backups/index.js +7 -2
- package/dist/config/defaults/core.js +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/db/pg/queries/derived.d.ts +5 -0
- package/dist/db/pg/queries/derived.js +21 -0
- package/dist/db/pg/schema/analytics.d.ts +76 -0
- package/dist/db/pg/schema/analytics.js +11 -1
- package/dist/db/pg/schema/edges.js +1 -1
- package/dist/db/pg/schema/index.d.ts +75 -0
- package/dist/db/pg/sql/0005_open_power_man.sql +9 -0
- package/dist/db/pg/sql/0006_fine_trish_tilby.sql +8 -0
- package/dist/db/pg/sql/meta/0004_snapshot.json +1 -1
- package/dist/db/pg/sql/meta/0005_snapshot.json +4179 -0
- package/dist/db/pg/sql/meta/0006_snapshot.json +4200 -0
- package/dist/db/pg/sql/meta/_journal.json +14 -0
- package/dist/db/replaceOrigin.d.ts +11 -0
- package/dist/db/replaceOrigin.js +110 -0
- package/dist/jams/helpers.d.ts +4 -4
- package/dist/jams/index.js +5 -1
- package/dist/jams/waitingRoom.d.ts +2 -0
- package/dist/jams/waitingRoom.js +13 -5
- package/dist/notifications/jobs.js +13 -2
- package/dist/plugins/helpers.d.ts +5 -2
- package/dist/plugins/helpers.js +21 -2
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +14 -10
- package/dist/posts/contextClosure.d.ts +2 -1
- package/dist/posts/contextClosure.js +6 -1
- package/dist/posts/conversationQueries.d.ts +23 -0
- package/dist/posts/conversationQueries.js +135 -0
- package/dist/posts/finders.d.ts +7 -5
- package/dist/posts/finders.js +24 -21
- package/dist/posts/helpers/index.d.ts +18 -18
- package/dist/posts/helpers/index.js +2 -2
- package/dist/posts/index.d.ts +1 -0
- package/dist/posts/index.js +1 -0
- package/dist/posts/mapping.d.ts +179 -0
- package/dist/posts/mapping.js +6 -6
- package/dist/posts/mutations.d.ts +3 -1
- package/dist/posts/mutations.js +27 -5
- package/dist/posts/unseenCounts.d.ts +10 -0
- package/dist/posts/unseenCounts.js +81 -0
- package/dist/profiles/cache.d.ts +2 -0
- package/dist/profiles/cache.js +19 -1
- package/dist/profiles/index.d.ts +1 -0
- package/dist/profiles/index.js +1 -0
- package/dist/profiles/mapping.d.ts +41 -0
- package/dist/profiles/mapping.js +24 -0
- package/dist/reports/helpers.js +2 -1
- package/dist/reports/mapping.js +6 -2
- package/dist/roles/mutations.d.ts +3 -3
- package/dist/roles/mutations.js +5 -3
- package/dist/server/index.d.ts +8 -0
- package/dist/session/index.d.ts +28 -0
- package/dist/session/index.js +79 -0
- package/dist/stats/finders.d.ts +220 -220
- package/dist/stats/mapping.d.ts +5 -5
- package/package.json +6 -6
- package/dist/db/replaceHostname.d.ts +0 -1
- package/dist/db/replaceHostname.js +0 -88
package/dist/stats/mapping.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DbPost } from '@openpeepshq/common/types';
|
|
|
2
2
|
export declare const profileWithActivityScoreMapping: (start?: Date, end?: Date) => import("../db/pg/map").Mapping<object, import("../db/pg/map").WithId<object>, import("@openpeepshq/common").Profile>;
|
|
3
3
|
export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mapping<{
|
|
4
4
|
type: "note" | "question" | "event" | "article";
|
|
5
|
-
visibility: "
|
|
5
|
+
visibility: "local" | "group" | "report" | "public" | "unlisted" | "private" | "direct";
|
|
6
6
|
creatorId: string;
|
|
7
7
|
capabilitiesNeeded?: string[] | undefined;
|
|
8
8
|
data?: {
|
|
@@ -27,7 +27,7 @@ export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mappi
|
|
|
27
27
|
};
|
|
28
28
|
description?: string | undefined;
|
|
29
29
|
blurhash?: string | undefined;
|
|
30
|
-
status?: "
|
|
30
|
+
status?: "failed" | "processing" | "ready" | undefined;
|
|
31
31
|
error?: string | undefined;
|
|
32
32
|
}[] | undefined;
|
|
33
33
|
customEmojis?: {
|
|
@@ -64,7 +64,7 @@ export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mappi
|
|
|
64
64
|
};
|
|
65
65
|
description?: string | undefined;
|
|
66
66
|
blurhash?: string | undefined;
|
|
67
|
-
status?: "
|
|
67
|
+
status?: "failed" | "processing" | "ready" | undefined;
|
|
68
68
|
error?: string | undefined;
|
|
69
69
|
}[] | undefined;
|
|
70
70
|
customEmojis?: {
|
|
@@ -102,7 +102,7 @@ export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mappi
|
|
|
102
102
|
};
|
|
103
103
|
description?: string | undefined;
|
|
104
104
|
blurhash?: string | undefined;
|
|
105
|
-
status?: "
|
|
105
|
+
status?: "failed" | "processing" | "ready" | undefined;
|
|
106
106
|
error?: string | undefined;
|
|
107
107
|
}[] | undefined;
|
|
108
108
|
customEmojis?: {
|
|
@@ -163,7 +163,7 @@ export declare const postsWithActivityScoreMapping: import("../db/pg/map").Mappi
|
|
|
163
163
|
};
|
|
164
164
|
description?: string | undefined;
|
|
165
165
|
blurhash?: string | undefined;
|
|
166
|
-
status?: "
|
|
166
|
+
status?: "failed" | "processing" | "ready" | undefined;
|
|
167
167
|
error?: string | undefined;
|
|
168
168
|
}[] | undefined;
|
|
169
169
|
customEmojis?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"uuidv7": "^1.0.2",
|
|
39
39
|
"web-push": "^3.6.7",
|
|
40
40
|
"zod": "^4.4.3",
|
|
41
|
-
"@openpeepshq/common": "0.1.
|
|
42
|
-
"@openpeepshq/
|
|
43
|
-
"@openpeepshq/
|
|
44
|
-
"@openpeepshq/
|
|
41
|
+
"@openpeepshq/common": "0.1.44",
|
|
42
|
+
"@openpeepshq/geocoder": "^0.1.2",
|
|
43
|
+
"@openpeepshq/fetch-client": "^0.1.7",
|
|
44
|
+
"@openpeepshq/i18n": "^0.1.9"
|
|
45
45
|
},
|
|
46
46
|
"main": "dist/index.js",
|
|
47
47
|
"types": "dist/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"tsc-alias": "^1.8.10",
|
|
79
79
|
"typescript": "^5.7.2",
|
|
80
80
|
"vitest": "^2.1.8",
|
|
81
|
-
"@openpeepshq/arango-querybuilder": "^0.4.
|
|
81
|
+
"@openpeepshq/arango-querybuilder": "^0.4.7"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"lint": "prettier --check . && ESLINT_USE_FLAT_CONFIG=false eslint .",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const replaceHostname: (oldHostname?: string, newHostname?: string) => Promise<void>;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { eq } from 'drizzle-orm';
|
|
2
|
-
import { logger } from '../log/index.js';
|
|
3
|
-
import { pgDb } from './pg/client.js';
|
|
4
|
-
import { asTable, getTableForCollection } from './pg/map/registry.js';
|
|
5
|
-
const log = logger('db:replaceHostname');
|
|
6
|
-
const hostnameCollections = [
|
|
7
|
-
'configs',
|
|
8
|
-
'entries',
|
|
9
|
-
'jamEvents',
|
|
10
|
-
'mediaAttachments',
|
|
11
|
-
'profiles',
|
|
12
|
-
];
|
|
13
|
-
const absoluteHttpUrlPattern = /https?:\/\/[^\s"'<>`]+/g;
|
|
14
|
-
const replaceHostnameInUrl = (urlValue, oldHostname, newHostname) => {
|
|
15
|
-
try {
|
|
16
|
-
const url = new URL(urlValue);
|
|
17
|
-
if (!['http:', 'https:'].includes(url.protocol) ||
|
|
18
|
-
url.hostname !== oldHostname) {
|
|
19
|
-
return urlValue;
|
|
20
|
-
}
|
|
21
|
-
const authorityStart = urlValue.indexOf('://') + 3;
|
|
22
|
-
const afterAuthority = urlValue.slice(authorityStart).search(/[/?#]/);
|
|
23
|
-
const authorityEnd = afterAuthority === -1 ? urlValue.length : authorityStart + afterAuthority;
|
|
24
|
-
const authority = urlValue.slice(authorityStart, authorityEnd);
|
|
25
|
-
const hostStart = authority.lastIndexOf('@') + 1;
|
|
26
|
-
const updatedAuthority = authority.slice(0, hostStart) +
|
|
27
|
-
authority.slice(hostStart).replace(oldHostname, newHostname);
|
|
28
|
-
return (urlValue.slice(0, authorityStart) +
|
|
29
|
-
updatedAuthority +
|
|
30
|
-
urlValue.slice(authorityEnd));
|
|
31
|
-
}
|
|
32
|
-
catch (_a) {
|
|
33
|
-
return urlValue;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const replaceHostnameInUrls = (value, oldHostname, newHostname) => value.replace(absoluteHttpUrlPattern, (urlValue) => replaceHostnameInUrl(urlValue, oldHostname, newHostname));
|
|
37
|
-
const replaceInValue = (value, oldHostname, newHostname) => {
|
|
38
|
-
if (typeof value === 'string') {
|
|
39
|
-
return replaceHostnameInUrls(value, oldHostname, newHostname);
|
|
40
|
-
}
|
|
41
|
-
if (Array.isArray(value)) {
|
|
42
|
-
return value.map((item) => replaceInValue(item, oldHostname, newHostname));
|
|
43
|
-
}
|
|
44
|
-
if (value && typeof value === 'object') {
|
|
45
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
46
|
-
key,
|
|
47
|
-
replaceInValue(item, oldHostname, newHostname),
|
|
48
|
-
]));
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
};
|
|
52
|
-
export const replaceHostname = async (oldHostname, newHostname) => {
|
|
53
|
-
if (!oldHostname || !newHostname || oldHostname === newHostname) {
|
|
54
|
-
log.info('No hostname to replace');
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
log.info(`Replacing restored hostname ${oldHostname} with ${newHostname}`);
|
|
58
|
-
const db = pgDb();
|
|
59
|
-
for (const collectionName of hostnameCollections) {
|
|
60
|
-
const table = getTableForCollection(collectionName);
|
|
61
|
-
const rows = await db.select().from(table);
|
|
62
|
-
let replacedCount = 0;
|
|
63
|
-
for (const row of rows) {
|
|
64
|
-
const current = row;
|
|
65
|
-
const updated = replaceInValue(current, oldHostname, newHostname);
|
|
66
|
-
if (JSON.stringify(current) === JSON.stringify(updated)) {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const t = asTable(table);
|
|
70
|
-
if (collectionName === 'configs') {
|
|
71
|
-
await db
|
|
72
|
-
.update(table)
|
|
73
|
-
.set(updated)
|
|
74
|
-
.where(eq(t.key, current.key));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
await db
|
|
78
|
-
.update(table)
|
|
79
|
-
.set(updated)
|
|
80
|
-
.where(eq(t.id, current.id));
|
|
81
|
-
}
|
|
82
|
-
replacedCount += 1;
|
|
83
|
-
}
|
|
84
|
-
if (replacedCount > 0) {
|
|
85
|
-
log.info(`Replaced hostname in ${replacedCount} ${collectionName} row(s)`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|