@nexpress/core 0.3.9 → 0.3.11
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/auth.js +2 -2
- package/dist/{can-U5F4JBZ7.js → can-2CHRJ2FK.js} +3 -3
- package/dist/{chunk-6OUWW6JF.js → chunk-24JEFZMS.js} +3 -3
- package/dist/{chunk-SJ7M2VCC.js → chunk-3ZLWRPCQ.js} +7 -7
- package/dist/{chunk-XPD7EQML.js → chunk-5NCTIJEN.js} +3 -3
- package/dist/{chunk-EWVXP3GP.js → chunk-A3DPN2SP.js} +2 -2
- package/dist/{chunk-TSCXXBOM.js → chunk-AXOG2RJK.js} +15 -15
- package/dist/{chunk-TSCXXBOM.js.map → chunk-AXOG2RJK.js.map} +1 -1
- package/dist/{chunk-XU2GJJ6Z.js → chunk-BGEPMNVB.js} +2 -2
- package/dist/{chunk-QZ52U4ET.js → chunk-IPWHRKIC.js} +3 -3
- package/dist/{chunk-6MRTH734.js → chunk-KNSOZ2NN.js} +2 -2
- package/dist/{chunk-YEOQJ7WW.js → chunk-KS3S6TJS.js} +2 -2
- package/dist/{chunk-TIWJVQOO.js → chunk-LDY26JKB.js} +2 -2
- package/dist/{chunk-2X3GBJOT.js → chunk-MLQKHRW2.js} +2 -2
- package/dist/{chunk-U4QCCLAW.js → chunk-MYUCR3SE.js} +4 -3
- package/dist/{chunk-U4QCCLAW.js.map → chunk-MYUCR3SE.js.map} +1 -1
- package/dist/{chunk-3SW4L3DL.js → chunk-N2IW4JOR.js} +9 -9
- package/dist/{chunk-EAYUAXW3.js → chunk-PXVCVEXV.js} +2 -2
- package/dist/{chunk-K4CJ3KXB.js → chunk-X43DI2QJ.js} +2 -2
- package/dist/{chunk-2OWUHCFY.js → chunk-ZIG5A4TD.js} +2 -2
- package/dist/community.js +11 -11
- package/dist/{config-YDGNUDKP.js → config-V75MS3II.js} +5 -5
- package/dist/{digest-IWHMJPXI.js → digest-U4X45I74.js} +3 -3
- package/dist/{host-HG4QGD3L.js → host-IEQZ5A6K.js} +4 -4
- package/dist/i18n.js +2 -2
- package/dist/index.js +99 -18
- package/dist/index.js.map +1 -1
- package/dist/jobs.js +1 -1
- package/dist/media.js +2 -2
- package/dist/{mentions-LQRZWAGO.js → mentions-FRPM6LOO.js} +3 -3
- package/dist/{mutes-PQA6U5X7.js → mutes-2JEKADIG.js} +3 -3
- package/dist/{registry-WZVL5HH6.js → registry-JMMSOTJI.js} +2 -2
- package/dist/{scheduled-C2IKVZVK.js → scheduled-RFKXRC6T.js} +5 -5
- package/dist/seo.js +4 -4
- package/dist/{settings-NBAP7E5E.js → settings-5PH4SNIX.js} +2 -2
- package/dist/{strings-O2M7VSKV.js → strings-CKOSVH45.js} +3 -3
- package/package.json +1 -1
- /package/dist/{can-U5F4JBZ7.js.map → can-2CHRJ2FK.js.map} +0 -0
- /package/dist/{chunk-6OUWW6JF.js.map → chunk-24JEFZMS.js.map} +0 -0
- /package/dist/{chunk-SJ7M2VCC.js.map → chunk-3ZLWRPCQ.js.map} +0 -0
- /package/dist/{chunk-XPD7EQML.js.map → chunk-5NCTIJEN.js.map} +0 -0
- /package/dist/{chunk-EWVXP3GP.js.map → chunk-A3DPN2SP.js.map} +0 -0
- /package/dist/{chunk-XU2GJJ6Z.js.map → chunk-BGEPMNVB.js.map} +0 -0
- /package/dist/{chunk-QZ52U4ET.js.map → chunk-IPWHRKIC.js.map} +0 -0
- /package/dist/{chunk-6MRTH734.js.map → chunk-KNSOZ2NN.js.map} +0 -0
- /package/dist/{chunk-YEOQJ7WW.js.map → chunk-KS3S6TJS.js.map} +0 -0
- /package/dist/{chunk-TIWJVQOO.js.map → chunk-LDY26JKB.js.map} +0 -0
- /package/dist/{chunk-2X3GBJOT.js.map → chunk-MLQKHRW2.js.map} +0 -0
- /package/dist/{chunk-3SW4L3DL.js.map → chunk-N2IW4JOR.js.map} +0 -0
- /package/dist/{chunk-EAYUAXW3.js.map → chunk-PXVCVEXV.js.map} +0 -0
- /package/dist/{chunk-K4CJ3KXB.js.map → chunk-X43DI2QJ.js.map} +0 -0
- /package/dist/{chunk-2OWUHCFY.js.map → chunk-ZIG5A4TD.js.map} +0 -0
- /package/dist/{config-YDGNUDKP.js.map → config-V75MS3II.js.map} +0 -0
- /package/dist/{digest-IWHMJPXI.js.map → digest-U4X45I74.js.map} +0 -0
- /package/dist/{host-HG4QGD3L.js.map → host-IEQZ5A6K.js.map} +0 -0
- /package/dist/{mentions-LQRZWAGO.js.map → mentions-FRPM6LOO.js.map} +0 -0
- /package/dist/{mutes-PQA6U5X7.js.map → mutes-2JEKADIG.js.map} +0 -0
- /package/dist/{registry-WZVL5HH6.js.map → registry-JMMSOTJI.js.map} +0 -0
- /package/dist/{scheduled-C2IKVZVK.js.map → scheduled-RFKXRC6T.js.map} +0 -0
- /package/dist/{settings-NBAP7E5E.js.map → settings-5PH4SNIX.js.map} +0 -0
- /package/dist/{strings-O2M7VSKV.js.map → strings-CKOSVH45.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
introspectThemeSettingsSchema,
|
|
5
5
|
pluginConfigCacheTag,
|
|
6
6
|
setPluginConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZIG5A4TD.js";
|
|
8
8
|
import {
|
|
9
9
|
getPluginTemplatesForCollection,
|
|
10
10
|
registerPluginTemplates,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
renderSitemapIndexXml,
|
|
42
42
|
renderSitemapXml,
|
|
43
43
|
validateSeoSettingsPatch
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-IPWHRKIC.js";
|
|
45
45
|
import {
|
|
46
46
|
ARGON2_OPTIONS,
|
|
47
47
|
authenticated,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
verifyPassword,
|
|
83
83
|
verifyToken,
|
|
84
84
|
verifyTokenFull
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-LDY26JKB.js";
|
|
86
86
|
import {
|
|
87
87
|
DEFAULT_REACTION_KINDS,
|
|
88
88
|
addReaction,
|
|
@@ -130,14 +130,14 @@ import {
|
|
|
130
130
|
unfollow,
|
|
131
131
|
unresolvedReportCount,
|
|
132
132
|
updateComment
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-N2IW4JOR.js";
|
|
134
134
|
import {
|
|
135
135
|
publishScheduledDocuments
|
|
136
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-24JEFZMS.js";
|
|
137
137
|
import {
|
|
138
138
|
buildDigestEmail,
|
|
139
139
|
runDigestSweep
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-X43DI2QJ.js";
|
|
141
141
|
import {
|
|
142
142
|
assertNotBanned,
|
|
143
143
|
getCommunityRole,
|
|
@@ -146,14 +146,14 @@ import {
|
|
|
146
146
|
registerCommunityRole,
|
|
147
147
|
resetCommunityRoles,
|
|
148
148
|
withMemberWrite
|
|
149
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-BGEPMNVB.js";
|
|
150
150
|
import {
|
|
151
151
|
getMutedTargetIds,
|
|
152
152
|
isMuted,
|
|
153
153
|
listMutes,
|
|
154
154
|
muteMember,
|
|
155
155
|
unmuteMember
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-KS3S6TJS.js";
|
|
157
157
|
import {
|
|
158
158
|
getMemberNotificationPrefs,
|
|
159
159
|
isNotificationKindEnabled,
|
|
@@ -175,7 +175,7 @@ import {
|
|
|
175
175
|
markNotificationsRead,
|
|
176
176
|
resolveMentionedMembers,
|
|
177
177
|
unreadNotificationCount
|
|
178
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-5NCTIJEN.js";
|
|
179
179
|
import {
|
|
180
180
|
applyReputation,
|
|
181
181
|
getReputationAdapter,
|
|
@@ -194,7 +194,7 @@ import {
|
|
|
194
194
|
} from "./chunk-KU5M27ZC.js";
|
|
195
195
|
import {
|
|
196
196
|
getMediaUrl
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-A3DPN2SP.js";
|
|
198
198
|
import {
|
|
199
199
|
autosaveRevision,
|
|
200
200
|
buildSearchVector,
|
|
@@ -229,7 +229,7 @@ import {
|
|
|
229
229
|
schedulePluginTask,
|
|
230
230
|
updateMemberDocument,
|
|
231
231
|
withDeferredPostCommit
|
|
232
|
-
} from "./chunk-
|
|
232
|
+
} from "./chunk-AXOG2RJK.js";
|
|
233
233
|
import {
|
|
234
234
|
DEFAULT_IMAGE_SIZES,
|
|
235
235
|
cleanupDeletedMedia,
|
|
@@ -241,7 +241,7 @@ import {
|
|
|
241
241
|
processMediaImage,
|
|
242
242
|
setStorageAdapter,
|
|
243
243
|
uploadMedia
|
|
244
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-PXVCVEXV.js";
|
|
245
245
|
import {
|
|
246
246
|
can
|
|
247
247
|
} from "./chunk-EQ2Z3KMD.js";
|
|
@@ -254,7 +254,7 @@ import {
|
|
|
254
254
|
getCommunitySettings,
|
|
255
255
|
updateCommunitySettings,
|
|
256
256
|
validateCommunitySettingsPatch
|
|
257
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-KNSOZ2NN.js";
|
|
258
258
|
import {
|
|
259
259
|
createDbConnection,
|
|
260
260
|
generateDocumentsModule,
|
|
@@ -303,7 +303,7 @@ import {
|
|
|
303
303
|
setStrings,
|
|
304
304
|
t,
|
|
305
305
|
tSync
|
|
306
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-MLQKHRW2.js";
|
|
307
307
|
import {
|
|
308
308
|
getI18nConfig,
|
|
309
309
|
resetI18nConfig,
|
|
@@ -326,7 +326,7 @@ import {
|
|
|
326
326
|
registerCollection,
|
|
327
327
|
resolveSiteForHostname,
|
|
328
328
|
updateSite
|
|
329
|
-
} from "./chunk-
|
|
329
|
+
} from "./chunk-MYUCR3SE.js";
|
|
330
330
|
import {
|
|
331
331
|
getCurrentSiteId,
|
|
332
332
|
resetCurrentSiteResolver,
|
|
@@ -366,7 +366,7 @@ import {
|
|
|
366
366
|
startWorker,
|
|
367
367
|
stopProducer,
|
|
368
368
|
stopWorker
|
|
369
|
-
} from "./chunk-
|
|
369
|
+
} from "./chunk-3ZLWRPCQ.js";
|
|
370
370
|
import {
|
|
371
371
|
DEFAULT_JOB_LOG_RETENTION_MS,
|
|
372
372
|
countJobLogs,
|
|
@@ -1058,7 +1058,7 @@ function defineCollection(config) {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
1060
|
// src/content/helpers.ts
|
|
1061
|
-
import { and as and2, desc, eq as eq2 } from "drizzle-orm";
|
|
1061
|
+
import { and as and2, desc, eq as eq2, getTableColumns, inArray } from "drizzle-orm";
|
|
1062
1062
|
|
|
1063
1063
|
// src/theme/defaults.ts
|
|
1064
1064
|
var DEFAULT_THEME = {
|
|
@@ -1327,7 +1327,88 @@ async function getPostBySlug(slug, options) {
|
|
|
1327
1327
|
return result.docs[0] ?? null;
|
|
1328
1328
|
}
|
|
1329
1329
|
async function findPosts(options, user) {
|
|
1330
|
-
|
|
1330
|
+
const resolved = await resolveHasManyRelationshipWhere("posts", options);
|
|
1331
|
+
if (resolved.empty) {
|
|
1332
|
+
return emptyFindResult(options);
|
|
1333
|
+
}
|
|
1334
|
+
return findDocuments("posts", { ...options, where: resolved.where }, user);
|
|
1335
|
+
}
|
|
1336
|
+
function emptyFindResult(options) {
|
|
1337
|
+
const limit = options.limit ?? 20;
|
|
1338
|
+
return {
|
|
1339
|
+
docs: [],
|
|
1340
|
+
totalDocs: 0,
|
|
1341
|
+
totalPages: 0,
|
|
1342
|
+
page: options.page ?? 1,
|
|
1343
|
+
limit,
|
|
1344
|
+
hasNextPage: false,
|
|
1345
|
+
hasPrevPage: false
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
async function resolveHasManyRelationshipWhere(collectionSlug, options) {
|
|
1349
|
+
const where = options.where ? { ...options.where } : {};
|
|
1350
|
+
const registration = getCollectionRegistration(collectionSlug);
|
|
1351
|
+
const joinTables = registration.joinTables ?? {};
|
|
1352
|
+
const matchedIds = [];
|
|
1353
|
+
for (const field of registration.config.fields) {
|
|
1354
|
+
if (field.type !== "relationship" || !field.hasMany) continue;
|
|
1355
|
+
const value = where[field.name];
|
|
1356
|
+
if (value === void 0) continue;
|
|
1357
|
+
const table = joinTables[field.name];
|
|
1358
|
+
if (!table) {
|
|
1359
|
+
throw new Error(
|
|
1360
|
+
`Collection "${collectionSlug}" relationship field "${field.name}" has no registered join table.`
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
delete where[field.name];
|
|
1364
|
+
const targetIds = (Array.isArray(value) ? value : [value]).filter(
|
|
1365
|
+
(item) => typeof item === "string" && item.length > 0
|
|
1366
|
+
);
|
|
1367
|
+
if (targetIds.length === 0) {
|
|
1368
|
+
matchedIds.push([]);
|
|
1369
|
+
continue;
|
|
1370
|
+
}
|
|
1371
|
+
const pgTable = table;
|
|
1372
|
+
const rows = await getDb().select({ id: parentColumn(pgTable) }).from(pgTable).where(inArray(column(pgTable, "targetId"), targetIds));
|
|
1373
|
+
matchedIds.push(rows.map((row) => String(row.id)));
|
|
1374
|
+
}
|
|
1375
|
+
if (matchedIds.length === 0) {
|
|
1376
|
+
return { where, empty: false };
|
|
1377
|
+
}
|
|
1378
|
+
let ids = matchedIds[0] ?? [];
|
|
1379
|
+
for (let i = 1; i < matchedIds.length; i++) {
|
|
1380
|
+
const allowed = new Set(matchedIds[i]);
|
|
1381
|
+
ids = ids.filter((id) => allowed.has(id));
|
|
1382
|
+
}
|
|
1383
|
+
const existingId = where.id;
|
|
1384
|
+
if (typeof existingId === "string") {
|
|
1385
|
+
ids = ids.includes(existingId) ? [existingId] : [];
|
|
1386
|
+
} else if (Array.isArray(existingId)) {
|
|
1387
|
+
const allowed = new Set(existingId.filter((item) => typeof item === "string"));
|
|
1388
|
+
ids = ids.filter((id) => allowed.has(id));
|
|
1389
|
+
}
|
|
1390
|
+
if (ids.length === 0) {
|
|
1391
|
+
return { where, empty: true };
|
|
1392
|
+
}
|
|
1393
|
+
where.id = ids;
|
|
1394
|
+
return { where, empty: false };
|
|
1395
|
+
}
|
|
1396
|
+
function column(table, key) {
|
|
1397
|
+
const selected = getTableColumns(table)[key];
|
|
1398
|
+
if (!selected) {
|
|
1399
|
+
throw new Error(`Column '${key}' not found on relationship join table.`);
|
|
1400
|
+
}
|
|
1401
|
+
return selected;
|
|
1402
|
+
}
|
|
1403
|
+
function parentColumn(table) {
|
|
1404
|
+
const columns = getTableColumns(table);
|
|
1405
|
+
const key = Object.keys(columns).find(
|
|
1406
|
+
(candidate) => candidate !== "id" && candidate !== "targetId" && candidate !== "order" && candidate.endsWith("Id")
|
|
1407
|
+
);
|
|
1408
|
+
if (!key) {
|
|
1409
|
+
throw new Error("Parent column not found on relationship join table.");
|
|
1410
|
+
}
|
|
1411
|
+
return columns[key];
|
|
1331
1412
|
}
|
|
1332
1413
|
async function getAllPageSlugs() {
|
|
1333
1414
|
const result = await findDocuments("pages", {
|