@nexpress/core 0.3.0 → 0.3.2
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.d.ts +26 -3
- package/dist/auth.js +5 -3
- package/dist/{can-FKIEV54H.js → can-UJ2NAOIR.js} +3 -3
- package/dist/{chunk-CHQJG4BB.js → chunk-2N53KKIL.js} +2 -2
- package/dist/{chunk-DWG3RZH2.js → chunk-2VZZ7M26.js} +2 -2
- package/dist/{chunk-4EPNN4XG.js → chunk-54KUQF3S.js} +2 -2
- package/dist/{chunk-QYP6E5FP.js → chunk-6UV2P5MW.js} +63 -50
- package/dist/chunk-6UV2P5MW.js.map +1 -0
- package/dist/{chunk-QSJIKNQJ.js → chunk-ANZBCOEH.js} +9 -9
- package/dist/{chunk-TD4KNSEP.js → chunk-C6HXDY46.js} +19 -19
- package/dist/{chunk-26RYBFTF.js → chunk-LMPYQLMH.js} +37 -5
- package/dist/chunk-LMPYQLMH.js.map +1 -0
- package/dist/{chunk-EVOBLRHW.js → chunk-M2FWG5OJ.js} +5 -5
- package/dist/chunk-P5WGQRSG.js +180 -0
- package/dist/chunk-P5WGQRSG.js.map +1 -0
- package/dist/{chunk-HM46WM45.js → chunk-RDTTK27V.js} +6 -6
- package/dist/{chunk-PQBJWZ7D.js → chunk-RJ76SKWQ.js} +4 -4
- package/dist/{chunk-74CGJJDY.js → chunk-RKM4GDWM.js} +1 -1
- package/dist/{chunk-CKT4QZDC.js → chunk-WJJ5MBH5.js} +5 -5
- package/dist/{chunk-DPRBHEHI.js → chunk-YOFCLTBR.js} +7 -4
- package/dist/chunk-YOFCLTBR.js.map +1 -0
- package/dist/{chunk-HTDDXBMY.js → chunk-ZA3IRJUQ.js} +81 -131
- package/dist/chunk-ZA3IRJUQ.js.map +1 -0
- package/dist/community.d.ts +1 -1
- package/dist/community.js +20 -19
- package/dist/{config-2Y2YGD25.js → config-O7QM2OQS.js} +8 -7
- package/dist/db-schema.d.ts +2 -2
- package/dist/db.d.ts +3 -3
- package/dist/db.js +1 -1
- package/dist/fields.d.ts +54 -0
- package/dist/fields.js +14 -0
- package/dist/{host-YSADWU7J.js → host-NI3LR774.js} +6 -5
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.js +1 -1
- package/dist/{index-9IhVtFfA.d.ts → index-CPp-zGgL.d.ts} +2 -2
- package/dist/{index-CXuqW_Gl.d.ts → index-DKoSaszT.d.ts} +1 -1
- package/dist/{index-ClcinJ29.d.ts → index-DymnczhP.d.ts} +1 -1
- package/dist/{index-7_PBSyOq.d.ts → index-UZn29S3i.d.ts} +1 -1
- package/dist/index.d.ts +102 -16
- package/dist/index.js +191 -79
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +2 -2
- package/dist/jobs.js +2 -2
- package/dist/media.d.ts +2 -2
- package/dist/media.js +2 -2
- package/dist/{mentions-NCQR4B72.js → mentions-U4JACYI6.js} +3 -3
- package/dist/{mutes-FJSSU2JP.js → mutes-MNQP6ACF.js} +3 -3
- package/dist/{scheduled-F77QCDOG.js → scheduled-BWJG35Z2.js} +7 -6
- package/dist/seo.d.ts +16 -3
- package/dist/seo.js +6 -5
- package/dist/{settings-JODDWMDB.js → settings-OZWM6L2K.js} +2 -2
- package/dist/settings-OZWM6L2K.js.map +1 -0
- package/dist/strings-4EWJYDOG.js +1 -1
- package/dist/{types-DI3gxsiY.d.ts → types-D31ppGJw.d.ts} +294 -2
- package/package.json +6 -1
- package/dist/chunk-26RYBFTF.js.map +0 -1
- package/dist/chunk-DPRBHEHI.js.map +0 -1
- package/dist/chunk-HTDDXBMY.js.map +0 -1
- package/dist/chunk-QYP6E5FP.js.map +0 -1
- /package/dist/{can-FKIEV54H.js.map → can-UJ2NAOIR.js.map} +0 -0
- /package/dist/{chunk-CHQJG4BB.js.map → chunk-2N53KKIL.js.map} +0 -0
- /package/dist/{chunk-DWG3RZH2.js.map → chunk-2VZZ7M26.js.map} +0 -0
- /package/dist/{chunk-4EPNN4XG.js.map → chunk-54KUQF3S.js.map} +0 -0
- /package/dist/{chunk-QSJIKNQJ.js.map → chunk-ANZBCOEH.js.map} +0 -0
- /package/dist/{chunk-TD4KNSEP.js.map → chunk-C6HXDY46.js.map} +0 -0
- /package/dist/{chunk-EVOBLRHW.js.map → chunk-M2FWG5OJ.js.map} +0 -0
- /package/dist/{chunk-HM46WM45.js.map → chunk-RDTTK27V.js.map} +0 -0
- /package/dist/{chunk-PQBJWZ7D.js.map → chunk-RJ76SKWQ.js.map} +0 -0
- /package/dist/{chunk-74CGJJDY.js.map → chunk-RKM4GDWM.js.map} +0 -0
- /package/dist/{chunk-CKT4QZDC.js.map → chunk-WJJ5MBH5.js.map} +0 -0
- /package/dist/{config-2Y2YGD25.js.map → config-O7QM2OQS.js.map} +0 -0
- /package/dist/{host-YSADWU7J.js.map → fields.js.map} +0 -0
- /package/dist/{mentions-NCQR4B72.js.map → host-NI3LR774.js.map} +0 -0
- /package/dist/{mutes-FJSSU2JP.js.map → mentions-U4JACYI6.js.map} +0 -0
- /package/dist/{scheduled-F77QCDOG.js.map → mutes-MNQP6ACF.js.map} +0 -0
- /package/dist/{settings-JODDWMDB.js.map → scheduled-BWJG35Z2.js.map} +0 -0
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteMedia,
|
|
3
|
+
getMediaById,
|
|
4
|
+
getStorageAdapter,
|
|
5
|
+
listMedia,
|
|
6
|
+
uploadMedia
|
|
7
|
+
} from "./chunk-2VZZ7M26.js";
|
|
8
|
+
import {
|
|
9
|
+
getCollectionZodSchema
|
|
10
|
+
} from "./chunk-P5WGQRSG.js";
|
|
1
11
|
import {
|
|
2
12
|
getI18nConfig
|
|
3
13
|
} from "./chunk-4ZLMEKFX.js";
|
|
@@ -7,6 +17,9 @@ import {
|
|
|
7
17
|
getCollectionRegistration,
|
|
8
18
|
getCollectionTable
|
|
9
19
|
} from "./chunk-U4QCCLAW.js";
|
|
20
|
+
import {
|
|
21
|
+
getCurrentSiteId
|
|
22
|
+
} from "./chunk-SBCVAC2Z.js";
|
|
10
23
|
import {
|
|
11
24
|
NpError,
|
|
12
25
|
NpForbiddenError,
|
|
@@ -14,21 +27,11 @@ import {
|
|
|
14
27
|
NpValidationError
|
|
15
28
|
} from "./chunk-ZCINJSS4.js";
|
|
16
29
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
30
|
+
enqueueJob
|
|
31
|
+
} from "./chunk-V2UNHGAP.js";
|
|
19
32
|
import {
|
|
20
33
|
reportError
|
|
21
34
|
} from "./chunk-WV272MPW.js";
|
|
22
|
-
import {
|
|
23
|
-
deleteMedia,
|
|
24
|
-
getMediaById,
|
|
25
|
-
getStorageAdapter,
|
|
26
|
-
listMedia,
|
|
27
|
-
uploadMedia
|
|
28
|
-
} from "./chunk-DWG3RZH2.js";
|
|
29
|
-
import {
|
|
30
|
-
enqueueJob
|
|
31
|
-
} from "./chunk-V2UNHGAP.js";
|
|
32
35
|
import {
|
|
33
36
|
getLogger,
|
|
34
37
|
getScopedLogger
|
|
@@ -53,6 +56,7 @@ import {
|
|
|
53
56
|
import { and, eq as eq2, gt, isNull, like, or } from "drizzle-orm";
|
|
54
57
|
|
|
55
58
|
// src/collections/pipeline.ts
|
|
59
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
56
60
|
import { randomUUID } from "crypto";
|
|
57
61
|
import { asc, count, desc, eq, inArray, sql as sql2 } from "drizzle-orm";
|
|
58
62
|
|
|
@@ -85,100 +89,6 @@ function applySlugField(config, data, originalDoc) {
|
|
|
85
89
|
data.slug = candidate;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
// src/collections/validation.ts
|
|
89
|
-
import { z } from "zod";
|
|
90
|
-
function buildZodSchema(fields) {
|
|
91
|
-
const shape = {};
|
|
92
|
-
for (const field of fields) {
|
|
93
|
-
if (field.type === "row" || field.type === "collapsible") {
|
|
94
|
-
Object.assign(shape, buildZodSchema(field.fields).shape);
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
if (field.type === "group") {
|
|
98
|
-
const schema = buildZodSchema(field.fields);
|
|
99
|
-
shape[field.name] = applyOptionality(schema, field.required);
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
shape[field.name] = applyOptionality(buildFieldSchema(field), field.required);
|
|
103
|
-
}
|
|
104
|
-
return z.object(shape);
|
|
105
|
-
}
|
|
106
|
-
function getCollectionZodSchema(config) {
|
|
107
|
-
const base = buildZodSchema(config.fields).extend({
|
|
108
|
-
// Phase 21.17 — per-doc visibility flag. Optional on writes;
|
|
109
|
-
// the pipeline lets the column default to "public" when the
|
|
110
|
-
// caller doesn't specify. Allowed values are the same
|
|
111
|
-
// codegen enum from `getBaseColumns`.
|
|
112
|
-
visibility: z.enum(["public", "private"]).optional()
|
|
113
|
-
});
|
|
114
|
-
if (config.i18n) {
|
|
115
|
-
return base.extend({
|
|
116
|
-
locale: z.string().min(1).optional(),
|
|
117
|
-
translationGroupId: z.string().uuid().optional()
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return base;
|
|
121
|
-
}
|
|
122
|
-
function buildFieldSchema(field) {
|
|
123
|
-
switch (field.type) {
|
|
124
|
-
case "text": {
|
|
125
|
-
let schema = z.string();
|
|
126
|
-
if (field.minLength !== void 0) schema = schema.min(field.minLength);
|
|
127
|
-
if (field.maxLength !== void 0) schema = schema.max(field.maxLength);
|
|
128
|
-
return schema;
|
|
129
|
-
}
|
|
130
|
-
case "textarea": {
|
|
131
|
-
let schema = z.string();
|
|
132
|
-
if (field.minLength !== void 0) schema = schema.min(field.minLength);
|
|
133
|
-
if (field.maxLength !== void 0) schema = schema.max(field.maxLength);
|
|
134
|
-
return schema;
|
|
135
|
-
}
|
|
136
|
-
case "email":
|
|
137
|
-
return z.string().email();
|
|
138
|
-
case "number": {
|
|
139
|
-
let schema = z.number();
|
|
140
|
-
if (field.integerOnly) schema = schema.int();
|
|
141
|
-
if (field.min !== void 0) schema = schema.min(field.min);
|
|
142
|
-
if (field.max !== void 0) schema = schema.max(field.max);
|
|
143
|
-
return schema;
|
|
144
|
-
}
|
|
145
|
-
case "checkbox":
|
|
146
|
-
return z.boolean();
|
|
147
|
-
case "select":
|
|
148
|
-
return createEnumSchema(field.options.map((option) => option.value));
|
|
149
|
-
case "radio":
|
|
150
|
-
return createEnumSchema(field.options.map((option) => option.value));
|
|
151
|
-
case "relationship":
|
|
152
|
-
return field.hasMany ? z.array(z.string().uuid()) : z.string().uuid();
|
|
153
|
-
case "upload":
|
|
154
|
-
return z.string().uuid();
|
|
155
|
-
case "date":
|
|
156
|
-
return z.coerce.date();
|
|
157
|
-
case "richText":
|
|
158
|
-
case "blocks":
|
|
159
|
-
case "json":
|
|
160
|
-
return z.unknown();
|
|
161
|
-
case "array": {
|
|
162
|
-
let schema = z.array(buildZodSchema(field.fields));
|
|
163
|
-
if (field.minRows !== void 0) schema = schema.min(field.minRows);
|
|
164
|
-
if (field.maxRows !== void 0) schema = schema.max(field.maxRows);
|
|
165
|
-
return schema;
|
|
166
|
-
}
|
|
167
|
-
default:
|
|
168
|
-
return z.unknown();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function applyOptionality(schema, required) {
|
|
172
|
-
return required ? schema : schema.optional().nullable();
|
|
173
|
-
}
|
|
174
|
-
function createEnumSchema(values) {
|
|
175
|
-
const [first, ...rest] = values;
|
|
176
|
-
if (!first) {
|
|
177
|
-
return z.string();
|
|
178
|
-
}
|
|
179
|
-
return z.enum([first, ...rest]);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
92
|
// src/collections/search.ts
|
|
183
93
|
import { sql } from "drizzle-orm";
|
|
184
94
|
function buildSearchVector(config, data) {
|
|
@@ -280,7 +190,36 @@ function actorPrincipal(actor) {
|
|
|
280
190
|
}
|
|
281
191
|
}
|
|
282
192
|
}
|
|
193
|
+
var deferredPostCommitStore = new AsyncLocalStorage();
|
|
194
|
+
async function withDeferredPostCommit(callback) {
|
|
195
|
+
const queue = [];
|
|
196
|
+
const result = await deferredPostCommitStore.run(queue, callback);
|
|
197
|
+
for (const hook of queue) {
|
|
198
|
+
try {
|
|
199
|
+
await hook.fn();
|
|
200
|
+
} catch (err) {
|
|
201
|
+
const { getLogger: getLogger2 } = await import("./logger-2WUTTELV.js");
|
|
202
|
+
getLogger2().error(
|
|
203
|
+
`deferred post-commit ${hook.label} failed \u2014 outer scope committed, follow-up skipped`,
|
|
204
|
+
{
|
|
205
|
+
collection: hook.context.collection,
|
|
206
|
+
documentId: hook.context.documentId,
|
|
207
|
+
operation: hook.context.operation,
|
|
208
|
+
label: hook.label,
|
|
209
|
+
error: err instanceof Error ? err.message : String(err),
|
|
210
|
+
stack: err instanceof Error ? err.stack : void 0
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
283
217
|
async function runPostCommit(label, context, fn) {
|
|
218
|
+
const queue = deferredPostCommitStore.getStore();
|
|
219
|
+
if (queue) {
|
|
220
|
+
queue.push({ label, context, fn });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
284
223
|
try {
|
|
285
224
|
await fn();
|
|
286
225
|
} catch (err) {
|
|
@@ -318,7 +257,7 @@ async function updateMemberDocument(collection, docId, data, memberId, options)
|
|
|
318
257
|
if (authorId !== memberId) {
|
|
319
258
|
throw new NpForbiddenError(collection, "update");
|
|
320
259
|
}
|
|
321
|
-
const { assertNotBanned } = await import("./can-
|
|
260
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
322
261
|
await assertNotBanned(memberId);
|
|
323
262
|
const moderation = await runMemberDocModeration({
|
|
324
263
|
collection,
|
|
@@ -352,7 +291,7 @@ async function updateMemberDocument(collection, docId, data, memberId, options)
|
|
|
352
291
|
});
|
|
353
292
|
const resultStatus = result.doc.status;
|
|
354
293
|
if (resultStatus === "published") {
|
|
355
|
-
const { extractMentionHandlesFromDocData, fanOutMentionNotifications } = await import("./mentions-
|
|
294
|
+
const { extractMentionHandlesFromDocData, fanOutMentionNotifications } = await import("./mentions-U4JACYI6.js");
|
|
356
295
|
const previousHandles = new Set(extractMentionHandlesFromDocData(originalDoc));
|
|
357
296
|
await fanOutMentionNotifications({
|
|
358
297
|
actorMemberId: memberId,
|
|
@@ -372,7 +311,7 @@ async function createMemberDocument(collection, data, memberId, options) {
|
|
|
372
311
|
if (!config.community?.memberWrite?.create) {
|
|
373
312
|
throw new NpForbiddenError(collection, "create");
|
|
374
313
|
}
|
|
375
|
-
const { assertNotBanned } = await import("./can-
|
|
314
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
376
315
|
await assertNotBanned(memberId);
|
|
377
316
|
const defaultStatus = config.community?.memberWrite?.defaultStatus === "pending" ? "pending" : "published";
|
|
378
317
|
const moderation = await runMemberDocModeration({
|
|
@@ -416,7 +355,7 @@ async function createMemberDocument(collection, data, memberId, options) {
|
|
|
416
355
|
});
|
|
417
356
|
}
|
|
418
357
|
if (spamStatus === "published") {
|
|
419
|
-
const { fanOutMentionNotifications } = await import("./mentions-
|
|
358
|
+
const { fanOutMentionNotifications } = await import("./mentions-U4JACYI6.js");
|
|
420
359
|
await fanOutMentionNotifications({
|
|
421
360
|
actorMemberId: memberId,
|
|
422
361
|
kind: "document.mention",
|
|
@@ -502,9 +441,11 @@ async function initSaveContext(collection, docId, data, actor, options) {
|
|
|
502
441
|
const registration = getCollectionRegistration(collection);
|
|
503
442
|
const table = getCollectionTable(collection);
|
|
504
443
|
const db = getDb();
|
|
505
|
-
const
|
|
444
|
+
const outerTx = options?.tx;
|
|
445
|
+
const validatedData = toRecord(getCollectionZodSchema(config, data).parse(data));
|
|
506
446
|
const operation = docId ? "update" : "create";
|
|
507
|
-
const
|
|
447
|
+
const readHandle = outerTx ?? db;
|
|
448
|
+
const originalDoc = docId ? await getDocumentByIdInternal(readHandle, table, collection, docId) : null;
|
|
508
449
|
return {
|
|
509
450
|
collection,
|
|
510
451
|
docId,
|
|
@@ -515,6 +456,7 @@ async function initSaveContext(collection, docId, data, actor, options) {
|
|
|
515
456
|
registration,
|
|
516
457
|
table,
|
|
517
458
|
db,
|
|
459
|
+
outerTx,
|
|
518
460
|
operation,
|
|
519
461
|
originalDoc,
|
|
520
462
|
userForHooks: actorUserOrNull(actor),
|
|
@@ -533,7 +475,7 @@ async function validateActorAccess(ctx) {
|
|
|
533
475
|
);
|
|
534
476
|
return;
|
|
535
477
|
}
|
|
536
|
-
const { assertNotBanned } = await import("./can-
|
|
478
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
537
479
|
if (ctx.operation === "create") {
|
|
538
480
|
if (!ctx.config.community?.memberWrite?.create) {
|
|
539
481
|
throw new NpForbiddenError(ctx.collection, "create");
|
|
@@ -666,7 +608,7 @@ async function persistDocumentTx(ctx) {
|
|
|
666
608
|
principal: ctx.principal
|
|
667
609
|
});
|
|
668
610
|
}
|
|
669
|
-
|
|
611
|
+
const persist = async (tx) => {
|
|
670
612
|
const persistedDoc = ctx.operation === "update" ? await updateMainDocument(
|
|
671
613
|
tx,
|
|
672
614
|
ctx.table,
|
|
@@ -717,7 +659,11 @@ async function persistDocumentTx(ctx) {
|
|
|
717
659
|
);
|
|
718
660
|
}
|
|
719
661
|
return persistedDoc;
|
|
720
|
-
}
|
|
662
|
+
};
|
|
663
|
+
if (ctx.outerTx) {
|
|
664
|
+
return persist(ctx.outerTx);
|
|
665
|
+
}
|
|
666
|
+
return ctx.db.transaction(persist);
|
|
721
667
|
}
|
|
722
668
|
async function firePostCommitHooks(ctx, savedDoc) {
|
|
723
669
|
const savedDocId = getRecordId(savedDoc);
|
|
@@ -863,8 +809,8 @@ function stableJson(value) {
|
|
|
863
809
|
return val;
|
|
864
810
|
});
|
|
865
811
|
}
|
|
866
|
-
async function deleteDocument(collection, docId, user) {
|
|
867
|
-
return deleteDocumentImpl(collection, docId, { kind: "staff", user });
|
|
812
|
+
async function deleteDocument(collection, docId, user, options) {
|
|
813
|
+
return deleteDocumentImpl(collection, docId, { kind: "staff", user }, options);
|
|
868
814
|
}
|
|
869
815
|
async function deleteMemberDocument(collection, docId, memberId) {
|
|
870
816
|
const table = getCollectionTable(collection);
|
|
@@ -957,12 +903,12 @@ async function promoteMemberDocument(collection, docId, staffUserId) {
|
|
|
957
903
|
});
|
|
958
904
|
return { doc: persistedDoc, operation: "update" };
|
|
959
905
|
}
|
|
960
|
-
async function deleteDocumentImpl(collection, docId, actor) {
|
|
906
|
+
async function deleteDocumentImpl(collection, docId, actor, options) {
|
|
961
907
|
const config = getCollectionConfig(collection);
|
|
962
908
|
const registration = getCollectionRegistration(collection);
|
|
963
909
|
const table = getCollectionTable(collection);
|
|
964
|
-
const
|
|
965
|
-
const originalDoc = await getDocumentByIdInternal(
|
|
910
|
+
const dbHandle = options?.tx ?? getDb();
|
|
911
|
+
const originalDoc = await getDocumentByIdInternal(dbHandle, table, collection, docId);
|
|
966
912
|
if (!originalDoc) {
|
|
967
913
|
throw new NpNotFoundError(collection, docId);
|
|
968
914
|
}
|
|
@@ -981,7 +927,7 @@ async function deleteDocumentImpl(collection, docId, actor) {
|
|
|
981
927
|
if (authorId !== actor.memberId) {
|
|
982
928
|
throw new NpForbiddenError(collection, "delete");
|
|
983
929
|
}
|
|
984
|
-
const { assertNotBanned } = await import("./can-
|
|
930
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
985
931
|
await assertNotBanned(actor.memberId);
|
|
986
932
|
}
|
|
987
933
|
const userForHooks = actorUserOrNull(actor);
|
|
@@ -999,7 +945,7 @@ async function deleteDocumentImpl(collection, docId, actor) {
|
|
|
999
945
|
user: userForHooks,
|
|
1000
946
|
principal
|
|
1001
947
|
});
|
|
1002
|
-
|
|
948
|
+
const cascade = async (tx) => {
|
|
1003
949
|
await deleteChildTables(tx, registration.childTables, docId);
|
|
1004
950
|
await deleteJoinTables(tx, registration.joinTables, docId);
|
|
1005
951
|
await tx.delete(npMediaRefs).where(
|
|
@@ -1029,7 +975,12 @@ async function deleteDocumentImpl(collection, docId, actor) {
|
|
|
1029
975
|
sql2`${eq(getTableColumn(npReports, "targetType"), collection)} and ${eq(getTableColumn(npReports, "targetId"), docId)}`
|
|
1030
976
|
);
|
|
1031
977
|
await tx.delete(table).where(eq(getTableColumn(table, "id"), docId));
|
|
1032
|
-
}
|
|
978
|
+
};
|
|
979
|
+
if (options?.tx) {
|
|
980
|
+
await cascade(options.tx);
|
|
981
|
+
} else {
|
|
982
|
+
await dbHandle.transaction(cascade);
|
|
983
|
+
}
|
|
1033
984
|
const postCommitCtx = { collection, documentId: docId, operation: "delete" };
|
|
1034
985
|
await runPostCommit(
|
|
1035
986
|
"enqueue:content:afterDelete",
|
|
@@ -1885,7 +1836,7 @@ function createPluginRuntimeContext(options) {
|
|
|
1885
1836
|
return row.value;
|
|
1886
1837
|
},
|
|
1887
1838
|
async getPlugin() {
|
|
1888
|
-
const { getPluginConfig } = await import("./config-
|
|
1839
|
+
const { getPluginConfig } = await import("./config-O7QM2OQS.js");
|
|
1889
1840
|
const value = await getPluginConfig(pluginId);
|
|
1890
1841
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1891
1842
|
return value;
|
|
@@ -1893,8 +1844,8 @@ function createPluginRuntimeContext(options) {
|
|
|
1893
1844
|
return {};
|
|
1894
1845
|
},
|
|
1895
1846
|
async setPlugin(data) {
|
|
1896
|
-
const { setPluginConfig } = await import("./config-
|
|
1897
|
-
const { getPluginRegistration: getPluginRegistration2 } = await import("./host-
|
|
1847
|
+
const { setPluginConfig } = await import("./config-O7QM2OQS.js");
|
|
1848
|
+
const { getPluginRegistration: getPluginRegistration2 } = await import("./host-NI3LR774.js");
|
|
1898
1849
|
const reg = getPluginRegistration2(pluginId);
|
|
1899
1850
|
if (reg?.configSchema) {
|
|
1900
1851
|
await setPluginConfig(pluginId, data, null);
|
|
@@ -2125,7 +2076,7 @@ function invalidatePluginEnabled(pluginId) {
|
|
|
2125
2076
|
var fetchOverride = null;
|
|
2126
2077
|
|
|
2127
2078
|
// src/plugins/compat.ts
|
|
2128
|
-
var FRAMEWORK_VERSION_FROM_PACKAGE = true ? "0.3.
|
|
2079
|
+
var FRAMEWORK_VERSION_FROM_PACKAGE = true ? "0.3.2" : "0.0.0-dev";
|
|
2129
2080
|
var frameworkVersion = FRAMEWORK_VERSION_FROM_PACKAGE;
|
|
2130
2081
|
function getFrameworkVersion() {
|
|
2131
2082
|
return frameworkVersion;
|
|
@@ -2275,7 +2226,7 @@ function insertSortedByPriority(list, entry) {
|
|
|
2275
2226
|
list.sort((a, b) => a.priority - b.priority);
|
|
2276
2227
|
}
|
|
2277
2228
|
async function loadPluginConfig(pluginId) {
|
|
2278
|
-
const { getPluginConfig } = await import("./config-
|
|
2229
|
+
const { getPluginConfig } = await import("./config-O7QM2OQS.js");
|
|
2279
2230
|
const value = await getPluginConfig(pluginId);
|
|
2280
2231
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2281
2232
|
return value;
|
|
@@ -2755,8 +2706,6 @@ export {
|
|
|
2755
2706
|
buildSearchVector,
|
|
2756
2707
|
buildSearchVectorParts,
|
|
2757
2708
|
buildWeightedSearchVectorSql,
|
|
2758
|
-
buildZodSchema,
|
|
2759
|
-
getCollectionZodSchema,
|
|
2760
2709
|
isPluginEnabled,
|
|
2761
2710
|
invalidatePluginEnabled,
|
|
2762
2711
|
getFrameworkVersion,
|
|
@@ -2777,6 +2726,7 @@ export {
|
|
|
2777
2726
|
getRegisteredPluginSchedules,
|
|
2778
2727
|
runPluginScheduledTask,
|
|
2779
2728
|
resetPlugins,
|
|
2729
|
+
withDeferredPostCommit,
|
|
2780
2730
|
saveDocument,
|
|
2781
2731
|
updateMemberDocument,
|
|
2782
2732
|
createMemberDocument,
|
|
@@ -2787,4 +2737,4 @@ export {
|
|
|
2787
2737
|
findDocuments,
|
|
2788
2738
|
getDocumentById
|
|
2789
2739
|
};
|
|
2790
|
-
//# sourceMappingURL=chunk-
|
|
2740
|
+
//# sourceMappingURL=chunk-ZA3IRJUQ.js.map
|