@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
package/dist/jobs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DEFAULT_JOB_LOG_RETENTION_MS, L as ListJobLogsOptions, N as NpJobCountOptions, a as NpJobHandler, b as NpJobListOptions, c as NpJobListResult, d as NpJobLogEntry, e as NpJobQueue, f as NpJobState, g as NpJobStateCounts, h as NpJobSummary, i as NpJobsPauseState, j as NpPluginScheduleStats, k as NpReconcileSchedulesResult, l as NpScheduleSummary, m as NpWorkerHealthSummary, n as NpWorkerHeartbeat, P as PAUSE_SYNC_INTERVAL_MS, o as PgBossAdapter, S as SetJobsPauseStateInput, W as WORKER_HEARTBEAT_INTERVAL_MS, p as WORKER_STALE_THRESHOLD_MS, r as countAliveWorkers, s as countJobLogs, t as enqueueJob, u as getAllJobHandlers, v as getCurrentJobId, w as getJobHandler, x as getJobQueue, y as getJobsPauseState, z as getOptionalJobQueue, A as listJobLogs, B as listWorkerHealth, C as markWorkerStopped, E as pruneJobLogsOlderThan, F as purgeStaleWorkers, G as recordHeartbeat, H as recordJobLog, I as registerBuiltinHandlers, J as registerJobHandler, K as runInJobContext, M as setJobQueue, O as setJobsPauseState, Q as startProducer, R as startWorker, T as stopProducer, U as stopWorker } from './index-
|
|
2
|
-
import './types-
|
|
1
|
+
export { D as DEFAULT_JOB_LOG_RETENTION_MS, L as ListJobLogsOptions, N as NpJobCountOptions, a as NpJobHandler, b as NpJobListOptions, c as NpJobListResult, d as NpJobLogEntry, e as NpJobQueue, f as NpJobState, g as NpJobStateCounts, h as NpJobSummary, i as NpJobsPauseState, j as NpPluginScheduleStats, k as NpReconcileSchedulesResult, l as NpScheduleSummary, m as NpWorkerHealthSummary, n as NpWorkerHeartbeat, P as PAUSE_SYNC_INTERVAL_MS, o as PgBossAdapter, S as SetJobsPauseStateInput, W as WORKER_HEARTBEAT_INTERVAL_MS, p as WORKER_STALE_THRESHOLD_MS, r as countAliveWorkers, s as countJobLogs, t as enqueueJob, u as getAllJobHandlers, v as getCurrentJobId, w as getJobHandler, x as getJobQueue, y as getJobsPauseState, z as getOptionalJobQueue, A as listJobLogs, B as listWorkerHealth, C as markWorkerStopped, E as pruneJobLogsOlderThan, F as purgeStaleWorkers, G as recordHeartbeat, H as recordJobLog, I as registerBuiltinHandlers, J as registerJobHandler, K as runInJobContext, M as setJobQueue, O as setJobsPauseState, Q as startProducer, R as startWorker, T as stopProducer, U as stopWorker } from './index-UZn29S3i.js';
|
|
2
|
+
import './types-D31ppGJw.js';
|
|
3
3
|
import 'pg-boss';
|
|
4
4
|
import './logger-DqGaOU_j.js';
|
package/dist/jobs.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
startWorker,
|
|
19
19
|
stopProducer,
|
|
20
20
|
stopWorker
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ANZBCOEH.js";
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_JOB_LOG_RETENTION_MS,
|
|
24
24
|
countJobLogs,
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
runInJobContext
|
|
30
30
|
} from "./chunk-QBIJZZ5V.js";
|
|
31
31
|
import "./chunk-LSHHRDVR.js";
|
|
32
|
-
import "./chunk-WV272MPW.js";
|
|
33
32
|
import {
|
|
34
33
|
enqueueJob,
|
|
35
34
|
getJobQueue,
|
|
36
35
|
getOptionalJobQueue,
|
|
37
36
|
setJobQueue
|
|
38
37
|
} from "./chunk-V2UNHGAP.js";
|
|
38
|
+
import "./chunk-WV272MPW.js";
|
|
39
39
|
import "./chunk-OROPGO65.js";
|
|
40
40
|
import "./chunk-NFHS7CFV.js";
|
|
41
41
|
import "./chunk-XANPEOJC.js";
|
package/dist/media.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DEFAULT_IMAGE_SIZES, q as DrizzleTransactionLike, b as NpGetMediaUrlOptions, c as NpMediaUploader, d as NpMediaUploaderKindFilter, e as NpMediaVariantName, f as NpProcessedImageResult, r as NpProcessedImageSourceMetadata, g as NpProcessedImageVariant, h as cleanupDeletedMedia, i as deleteMedia, j as extractMediaIds, k as getMediaById, l as getMediaUrl, m as getStorageAdapter, n as listMedia, p as processImage, o as processMediaImage, s as setStorageAdapter, t as syncMediaRefs, u as uploadMedia } from './index-
|
|
2
|
-
import './types-
|
|
1
|
+
export { D as DEFAULT_IMAGE_SIZES, q as DrizzleTransactionLike, b as NpGetMediaUrlOptions, c as NpMediaUploader, d as NpMediaUploaderKindFilter, e as NpMediaVariantName, f as NpProcessedImageResult, r as NpProcessedImageSourceMetadata, g as NpProcessedImageVariant, h as cleanupDeletedMedia, i as deleteMedia, j as extractMediaIds, k as getMediaById, l as getMediaUrl, m as getStorageAdapter, n as listMedia, p as processImage, o as processMediaImage, s as setStorageAdapter, t as syncMediaRefs, u as uploadMedia } from './index-DymnczhP.js';
|
|
2
|
+
import './types-D31ppGJw.js';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'drizzle-orm/pg-core';
|
|
5
5
|
import 'node:stream/web';
|
package/dist/media.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-TETTWT56.js";
|
|
5
5
|
import {
|
|
6
6
|
getMediaUrl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2N53KKIL.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_IMAGE_SIZES,
|
|
10
10
|
cleanupDeletedMedia,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
processMediaImage,
|
|
17
17
|
setStorageAdapter,
|
|
18
18
|
uploadMedia
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2VZZ7M26.js";
|
|
20
20
|
import "./chunk-V2UNHGAP.js";
|
|
21
21
|
import "./chunk-OROPGO65.js";
|
|
22
22
|
import "./chunk-NFHS7CFV.js";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
extractMentionHandlesFromRichText,
|
|
6
6
|
fanOutMentionNotifications,
|
|
7
7
|
resolveMentionedMembers
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RDTTK27V.js";
|
|
9
9
|
import "./chunk-U4QCCLAW.js";
|
|
10
|
-
import "./chunk-ZCINJSS4.js";
|
|
11
10
|
import "./chunk-SBCVAC2Z.js";
|
|
11
|
+
import "./chunk-ZCINJSS4.js";
|
|
12
12
|
import "./chunk-XANPEOJC.js";
|
|
13
13
|
import "./chunk-X7K5F2UI.js";
|
|
14
14
|
import "./chunk-PZ5AY32C.js";
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
fanOutMentionNotifications,
|
|
21
21
|
resolveMentionedMembers
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=mentions-
|
|
23
|
+
//# sourceMappingURL=mentions-U4JACYI6.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
listMutes,
|
|
5
5
|
muteMember,
|
|
6
6
|
unmuteMember
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WJJ5MBH5.js";
|
|
8
8
|
import "./chunk-U4QCCLAW.js";
|
|
9
|
-
import "./chunk-ZCINJSS4.js";
|
|
10
9
|
import "./chunk-SBCVAC2Z.js";
|
|
10
|
+
import "./chunk-ZCINJSS4.js";
|
|
11
11
|
import "./chunk-XANPEOJC.js";
|
|
12
12
|
import "./chunk-X7K5F2UI.js";
|
|
13
13
|
import "./chunk-PZ5AY32C.js";
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
muteMember,
|
|
19
19
|
unmuteMember
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=mutes-
|
|
21
|
+
//# sourceMappingURL=mutes-MNQP6ACF.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
publishScheduledDocuments
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-54KUQF3S.js";
|
|
4
|
+
import "./chunk-ZA3IRJUQ.js";
|
|
5
|
+
import "./chunk-2VZZ7M26.js";
|
|
6
|
+
import "./chunk-P5WGQRSG.js";
|
|
5
7
|
import "./chunk-4ZLMEKFX.js";
|
|
6
8
|
import "./chunk-U4QCCLAW.js";
|
|
7
|
-
import "./chunk-ZCINJSS4.js";
|
|
8
9
|
import "./chunk-SBCVAC2Z.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-DWG3RZH2.js";
|
|
10
|
+
import "./chunk-ZCINJSS4.js";
|
|
11
11
|
import "./chunk-V2UNHGAP.js";
|
|
12
|
+
import "./chunk-WV272MPW.js";
|
|
12
13
|
import "./chunk-OROPGO65.js";
|
|
13
14
|
import "./chunk-NFHS7CFV.js";
|
|
14
15
|
import "./chunk-XANPEOJC.js";
|
|
@@ -17,4 +18,4 @@ import "./chunk-PZ5AY32C.js";
|
|
|
17
18
|
export {
|
|
18
19
|
publishScheduledDocuments
|
|
19
20
|
};
|
|
20
|
-
//# sourceMappingURL=scheduled-
|
|
21
|
+
//# sourceMappingURL=scheduled-BWJG35Z2.js.map
|
package/dist/seo.d.ts
CHANGED
|
@@ -150,11 +150,24 @@ interface NpPageMetadataInput {
|
|
|
150
150
|
*/
|
|
151
151
|
ogImage?: string | null;
|
|
152
152
|
/**
|
|
153
|
-
* Path of the current page (no origin).
|
|
154
|
-
*
|
|
155
|
-
*
|
|
153
|
+
* Path of the current page (no origin). Drives the OpenGraph
|
|
154
|
+
* `url` field (which represents "this resource"). Also serves
|
|
155
|
+
* as the default for `canonicalPath` when that's not set.
|
|
156
|
+
* Pass without trailing `/` — trailing slashes are normalized
|
|
157
|
+
* off — but query strings are preserved so paginated /
|
|
158
|
+
* filtered routes can identify themselves accurately.
|
|
156
159
|
*/
|
|
157
160
|
path?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Override the canonical URL path when the page represents
|
|
163
|
+
* one resource but search engines should treat a different
|
|
164
|
+
* URL as authoritative. Defaults to `path`. Use when /blog
|
|
165
|
+
* canonicalises to / on a theme that renders the same content
|
|
166
|
+
* at both, or when a paginated route should dedupe to its
|
|
167
|
+
* first page. Leaving this unset means "canonical = self",
|
|
168
|
+
* which is correct for most pages.
|
|
169
|
+
*/
|
|
170
|
+
canonicalPath?: string;
|
|
158
171
|
/** OpenGraph type. Default `"website"`; posts use `"article"`. */
|
|
159
172
|
ogType?: "website" | "article" | "profile";
|
|
160
173
|
/**
|
package/dist/seo.js
CHANGED
|
@@ -12,15 +12,16 @@ import {
|
|
|
12
12
|
renderSitemapIndexXml,
|
|
13
13
|
renderSitemapXml,
|
|
14
14
|
validateSeoSettingsPatch
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-YOFCLTBR.js";
|
|
16
|
+
import "./chunk-ZA3IRJUQ.js";
|
|
17
|
+
import "./chunk-2VZZ7M26.js";
|
|
18
|
+
import "./chunk-P5WGQRSG.js";
|
|
17
19
|
import "./chunk-4ZLMEKFX.js";
|
|
18
20
|
import "./chunk-U4QCCLAW.js";
|
|
19
|
-
import "./chunk-ZCINJSS4.js";
|
|
20
21
|
import "./chunk-SBCVAC2Z.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-DWG3RZH2.js";
|
|
22
|
+
import "./chunk-ZCINJSS4.js";
|
|
23
23
|
import "./chunk-V2UNHGAP.js";
|
|
24
|
+
import "./chunk-WV272MPW.js";
|
|
24
25
|
import "./chunk-OROPGO65.js";
|
|
25
26
|
import "./chunk-NFHS7CFV.js";
|
|
26
27
|
import "./chunk-XANPEOJC.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getCommunitySettings,
|
|
4
4
|
updateCommunitySettings,
|
|
5
5
|
validateCommunitySettingsPatch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RKM4GDWM.js";
|
|
7
7
|
import "./chunk-ZCINJSS4.js";
|
|
8
8
|
import "./chunk-XANPEOJC.js";
|
|
9
9
|
import "./chunk-X7K5F2UI.js";
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
updateCommunitySettings,
|
|
15
15
|
validateCommunitySettingsPatch
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=settings-
|
|
17
|
+
//# sourceMappingURL=settings-OZWM6L2K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/strings-4EWJYDOG.js
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
} from "./chunk-ELK6AVW5.js";
|
|
11
11
|
import "./chunk-4ZLMEKFX.js";
|
|
12
12
|
import "./chunk-U4QCCLAW.js";
|
|
13
|
-
import "./chunk-ZCINJSS4.js";
|
|
14
13
|
import "./chunk-SBCVAC2Z.js";
|
|
14
|
+
import "./chunk-ZCINJSS4.js";
|
|
15
15
|
import "./chunk-NFHS7CFV.js";
|
|
16
16
|
import "./chunk-XANPEOJC.js";
|
|
17
17
|
import "./chunk-X7K5F2UI.js";
|
|
@@ -32,7 +32,54 @@ type NpAccessFunction = (args: {
|
|
|
32
32
|
doc?: Record<string, unknown>;
|
|
33
33
|
data?: Record<string, unknown>;
|
|
34
34
|
}) => boolean | Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Free-form predicate. Server-only — functions don't survive the
|
|
37
|
+
* server→client boundary in Next.js (the framework's
|
|
38
|
+
* `toClientCollectionConfig` strips them). For conditions that
|
|
39
|
+
* need to run in the admin editor's browser-side renderer, use
|
|
40
|
+
* `NpFieldConditionExpr` (serializable JSON shape) instead.
|
|
41
|
+
*/
|
|
35
42
|
type NpFieldCondition = (data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Serializable condition predicate. Evaluated client-side (admin
|
|
45
|
+
* editor) AND server-side (pipeline validation) from the same
|
|
46
|
+
* declaration — survives the RSC serialization boundary because
|
|
47
|
+
* it's plain JSON.
|
|
48
|
+
*
|
|
49
|
+
* Examples:
|
|
50
|
+
* `{ when: "kind", equals: "doc" }`
|
|
51
|
+
* `{ when: "kind", notEquals: "doc" }`
|
|
52
|
+
* `{ when: "kind", in: ["doc", "page"] }`
|
|
53
|
+
* `{ when: "wpOriginalAuthor", exists: true }`
|
|
54
|
+
* `{ all: [{ when: "kind", equals: "doc" }, { when: "publishedAt", exists: true }] }`
|
|
55
|
+
* `{ any: [{ when: "kind", equals: "doc" }, { when: "kind", equals: "page" }] }`
|
|
56
|
+
*
|
|
57
|
+
* `exists: true` returns true when the value is defined, not null,
|
|
58
|
+
* not the empty string, and not an empty array. `exists: false`
|
|
59
|
+
* is the inverse. `equals` / `notEquals` use strict equality.
|
|
60
|
+
* `in` / `notIn` check membership against an unknown[] list.
|
|
61
|
+
* `all` / `any` are AND / OR over a list of nested expressions.
|
|
62
|
+
*/
|
|
63
|
+
type NpFieldConditionExpr = {
|
|
64
|
+
when: string;
|
|
65
|
+
equals: unknown;
|
|
66
|
+
} | {
|
|
67
|
+
when: string;
|
|
68
|
+
notEquals: unknown;
|
|
69
|
+
} | {
|
|
70
|
+
when: string;
|
|
71
|
+
in: unknown[];
|
|
72
|
+
} | {
|
|
73
|
+
when: string;
|
|
74
|
+
notIn: unknown[];
|
|
75
|
+
} | {
|
|
76
|
+
when: string;
|
|
77
|
+
exists: boolean;
|
|
78
|
+
} | {
|
|
79
|
+
all: NpFieldConditionExpr[];
|
|
80
|
+
} | {
|
|
81
|
+
any: NpFieldConditionExpr[];
|
|
82
|
+
};
|
|
36
83
|
type NpFieldValidator = (value: unknown, args: {
|
|
37
84
|
data: Record<string, unknown>;
|
|
38
85
|
siblingData: Record<string, unknown>;
|
|
@@ -51,7 +98,7 @@ interface NpFieldBase {
|
|
|
51
98
|
description?: string;
|
|
52
99
|
placeholder?: string;
|
|
53
100
|
readOnly?: boolean;
|
|
54
|
-
condition?: NpFieldCondition;
|
|
101
|
+
condition?: NpFieldCondition | NpFieldConditionExpr;
|
|
55
102
|
width?: string;
|
|
56
103
|
/**
|
|
57
104
|
* Optional override for the admin field renderer. The default
|
|
@@ -83,6 +130,35 @@ interface NpFieldBase {
|
|
|
83
130
|
* surfacing a date input in the primary column.
|
|
84
131
|
*/
|
|
85
132
|
position?: "main" | "sidebar";
|
|
133
|
+
/**
|
|
134
|
+
* Sidebar grouping label. Sidebar fields with the same
|
|
135
|
+
* `group` render together in one collapsible Card with the
|
|
136
|
+
* group name as the title. Fields with no group fall into
|
|
137
|
+
* the default "Publish" Card. Group order in the rendered
|
|
138
|
+
* sidebar follows first-seen order in the collection's
|
|
139
|
+
* `fields` array — operators control layout by ordering.
|
|
140
|
+
*
|
|
141
|
+
* Examples: `"Publish"`, `"Lead"`, `"Taxonomy"`, `"Author"`,
|
|
142
|
+
* `"Hierarchy"`, `"SEO"`. The group label is the visible
|
|
143
|
+
* Card title (not a slug), so it doesn't have to be
|
|
144
|
+
* machine-friendly.
|
|
145
|
+
*
|
|
146
|
+
* Only meaningful when `position: "sidebar"`. Main-column
|
|
147
|
+
* fields ignore this — they render in field-array order
|
|
148
|
+
* without grouping.
|
|
149
|
+
*/
|
|
150
|
+
group?: string;
|
|
151
|
+
/**
|
|
152
|
+
* The id of the theme whose `requires.collections.<slug>.fields`
|
|
153
|
+
* contributed this field. Stamped by `mergeThemeRequirements`;
|
|
154
|
+
* never set this from operator config. Same convention as
|
|
155
|
+
* `admin._themeOrigin` at the collection level and per-`kinds`
|
|
156
|
+
* entry: when an operator switches to a different active
|
|
157
|
+
* theme, the admin filters out fields whose origin doesn't
|
|
158
|
+
* match. Operator-declared fields carry no origin and always
|
|
159
|
+
* pass through.
|
|
160
|
+
*/
|
|
161
|
+
_themeOrigin?: string;
|
|
86
162
|
};
|
|
87
163
|
validate?: NpFieldValidator;
|
|
88
164
|
}
|
|
@@ -121,6 +197,22 @@ interface NpCheckboxField extends NpFieldBase {
|
|
|
121
197
|
}
|
|
122
198
|
interface NpDateField extends NpFieldBase {
|
|
123
199
|
type: "date";
|
|
200
|
+
/**
|
|
201
|
+
* Default value the Drizzle schema generator emits as a SQL
|
|
202
|
+
* `DEFAULT` clause. Accepted shapes:
|
|
203
|
+
*
|
|
204
|
+
* - `"now"` sentinel → `.defaultNow()` → `DEFAULT now()`
|
|
205
|
+
* - A `Date` instance → `.default(new Date("<iso>"))`
|
|
206
|
+
* - Any ISO 8601 string → parsed via `new Date(...)` and
|
|
207
|
+
* emitted identically to the Date case.
|
|
208
|
+
*
|
|
209
|
+
* Anything else is dropped silently at codegen time (mirroring
|
|
210
|
+
* the defensive shape used for other scalar fields). Required
|
|
211
|
+
* NOT NULL date columns paired with `defaultValue: "now"` let
|
|
212
|
+
* an `ALTER TABLE … ADD COLUMN` against a populated table
|
|
213
|
+
* succeed without a backfill step.
|
|
214
|
+
*/
|
|
215
|
+
defaultValue?: Date | string;
|
|
124
216
|
pickerOptions?: {
|
|
125
217
|
format?: string;
|
|
126
218
|
includeTime?: boolean;
|
|
@@ -379,6 +471,34 @@ interface NpCollectionConfig {
|
|
|
379
471
|
* before merge) keep this unset and always show.
|
|
380
472
|
*/
|
|
381
473
|
_themeOrigin?: string;
|
|
474
|
+
/**
|
|
475
|
+
* Framework-set. Stamped by `mergeThemeRequirements` from
|
|
476
|
+
* `theme.manifest.requires.collections.<slug>.kinds`,
|
|
477
|
+
* unioned across all registered themes. The admin sidebar
|
|
478
|
+
* walks this map to render per-kind entries under "Content"
|
|
479
|
+
* (universal-content-model #748).
|
|
480
|
+
*
|
|
481
|
+
* Keyed by the discriminator value declared on the
|
|
482
|
+
* `kind` field's options. Empty / missing → admin shows a
|
|
483
|
+
* single collection entry like before.
|
|
484
|
+
*/
|
|
485
|
+
kinds?: Record<string, NpThemeCollectionKind>;
|
|
486
|
+
/**
|
|
487
|
+
* Visual metadata for sidebar field groups. Keyed by the
|
|
488
|
+
* `admin.group` label used on individual fields. The editor's
|
|
489
|
+
* `SidebarGroupCard` reads this to render an icon next to
|
|
490
|
+
* the group title and optionally surface a description.
|
|
491
|
+
*
|
|
492
|
+
* Operator-declared collections set this directly. Themes
|
|
493
|
+
* contribute their own group icons via
|
|
494
|
+
* `requires.collections.<slug>.groupMeta` (merged through
|
|
495
|
+
* `mergeThemeRequirements`, unioned across themes with
|
|
496
|
+
* last-write-wins on per-key props).
|
|
497
|
+
*
|
|
498
|
+
* Groups without an entry render without an icon — same
|
|
499
|
+
* behavior as before this surface existed.
|
|
500
|
+
*/
|
|
501
|
+
groupMeta?: Record<string, NpAdminGroupMeta>;
|
|
382
502
|
};
|
|
383
503
|
upload?: NpUploadConfig;
|
|
384
504
|
}
|
|
@@ -641,6 +761,107 @@ interface NpThemeCollectionRequirement {
|
|
|
641
761
|
* slug is registered. Operator-authored collections of the
|
|
642
762
|
* same slug always take precedence. */
|
|
643
763
|
createIfAbsent?: boolean;
|
|
764
|
+
/**
|
|
765
|
+
* Per-kind metadata for the `kind` discriminator field
|
|
766
|
+
* (universal-content-model #748). Themes contribute one entry
|
|
767
|
+
* per kind they author content for; the framework's auto-merge
|
|
768
|
+
* unions entries across registered themes so the admin sidebar
|
|
769
|
+
* and the public-site router both see one canonical map.
|
|
770
|
+
*
|
|
771
|
+
* Keyed by the option value declared on `fields.kind.options`
|
|
772
|
+
* (e.g. `kinds.doc` matches the option whose `value: "doc"`).
|
|
773
|
+
* The collection slug remains `posts`; kinds are a presentation
|
|
774
|
+
* split, not a separate table.
|
|
775
|
+
*
|
|
776
|
+
* The `kind` field itself doesn't have to live on this
|
|
777
|
+
* collection's `fields` for the metadata to apply — themes that
|
|
778
|
+
* extend a single kind (`fields.kind.options: [{value:"doc"}]`
|
|
779
|
+
* + `kinds.doc: {...}`) ship both together and the merge unions
|
|
780
|
+
* them with whatever other themes declare. A `kinds` block on a
|
|
781
|
+
* collection without a corresponding select field is a no-op
|
|
782
|
+
* (the admin shows the regular collection list view).
|
|
783
|
+
*/
|
|
784
|
+
kinds?: Record<string, NpThemeCollectionKind>;
|
|
785
|
+
/**
|
|
786
|
+
* Sidebar group metadata the theme contributes. Keyed by the
|
|
787
|
+
* `admin.group` label the theme uses on its contributed fields
|
|
788
|
+
* (e.g. theme-magazine contributes `Magazine: { icon: "Newspaper" }`).
|
|
789
|
+
* Merged into the collection's `admin.groupMeta` via
|
|
790
|
+
* last-write-wins union — two themes claiming the same group
|
|
791
|
+
* label get the later theme's icon / description.
|
|
792
|
+
*
|
|
793
|
+
* Declaring a group key without contributing fields with the
|
|
794
|
+
* same `admin.group` is allowed (the entry is unused but
|
|
795
|
+
* harmless) — useful for overriding a framework default's
|
|
796
|
+
* icon without adding any new fields.
|
|
797
|
+
*/
|
|
798
|
+
groupMeta?: Record<string, NpAdminGroupMeta>;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* One kind entry — admin nav + public URL metadata for a single
|
|
802
|
+
* discriminator value on a `select` field (typically `posts.kind`).
|
|
803
|
+
*
|
|
804
|
+
* Field merge: two themes declaring the same kind value get
|
|
805
|
+
* last-wins on every property. Operators rarely need to redefine
|
|
806
|
+
* a kind their theme already ships.
|
|
807
|
+
*/
|
|
808
|
+
/**
|
|
809
|
+
* Per-group sidebar metadata. Resolves at runtime in the admin
|
|
810
|
+
* edit view; not codegen'd into the DB schema.
|
|
811
|
+
*/
|
|
812
|
+
interface NpAdminGroupMeta {
|
|
813
|
+
/**
|
|
814
|
+
* Lucide icon name (no `Icon` suffix) shown next to the
|
|
815
|
+
* group title in the editor sidebar. Examples: `"Calendar"`,
|
|
816
|
+
* `"BookOpen"`, `"Briefcase"`. Resolved client-side; unknown
|
|
817
|
+
* names render no icon (silent fallback, no warning).
|
|
818
|
+
*/
|
|
819
|
+
icon?: string;
|
|
820
|
+
/**
|
|
821
|
+
* One-line description shown beneath the group title. Useful
|
|
822
|
+
* for operator hints like "Search-result preview + social
|
|
823
|
+
* card." Truncated by the admin if it's long.
|
|
824
|
+
*/
|
|
825
|
+
description?: string;
|
|
826
|
+
}
|
|
827
|
+
interface NpThemeCollectionKind {
|
|
828
|
+
/** Singular human label — "Doc", "Project", "Article". */
|
|
829
|
+
label: string;
|
|
830
|
+
/** Plural label for the admin sidebar entry — "Documentation". */
|
|
831
|
+
labelPlural: string;
|
|
832
|
+
/** Lucide icon name (no `Icon` suffix) — "BookOpen", "Briefcase". */
|
|
833
|
+
icon?: string;
|
|
834
|
+
/**
|
|
835
|
+
* Public-site URL pattern. `:slug` is the only supported param;
|
|
836
|
+
* the catch-all router (`apps/web/src/app/(site)/[[...slug]]/page.tsx`)
|
|
837
|
+
* matches the path, extracts the slug, and queries the host
|
|
838
|
+
* collection with `where: { kind: "<this-key>", slug: "<match>" }`.
|
|
839
|
+
*
|
|
840
|
+
* Omit to fall back to the framework default (`/<collection-slug>/<slug>`,
|
|
841
|
+
* shared with the kind=null catch-all path). Two kinds declaring
|
|
842
|
+
* the same urlPattern collide and the first wins; the admin
|
|
843
|
+
* surfaces this via the requirements diff.
|
|
844
|
+
*/
|
|
845
|
+
urlPattern?: string;
|
|
846
|
+
/**
|
|
847
|
+
* True → admin's per-kind list view surfaces `parent` + `order`
|
|
848
|
+
* controls and renders rows as a tree. Themes with hierarchical
|
|
849
|
+
* content (docs, sections) opt in; flat kinds leave it false.
|
|
850
|
+
*/
|
|
851
|
+
hierarchical?: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Framework-set. Stamped by `mergeThemeRequirements` with the
|
|
854
|
+
* id of the theme whose `requires.collections.<slug>.kinds`
|
|
855
|
+
* contributed this entry. The admin sidebar reads it to gate
|
|
856
|
+
* per-kind nav entries on the active theme — the bundled-themes
|
|
857
|
+
* prebake unions every built-in's kinds onto the schema, but
|
|
858
|
+
* only the active theme's kinds deserve sidebar real estate.
|
|
859
|
+
*
|
|
860
|
+
* NEVER set this by hand from operator config. The underscore
|
|
861
|
+
* is intentional — same convention as `admin._themeOrigin` at
|
|
862
|
+
* the collection level.
|
|
863
|
+
*/
|
|
864
|
+
_themeOrigin?: string;
|
|
644
865
|
}
|
|
645
866
|
/**
|
|
646
867
|
* One field's requirement. The `type` matches an `NpFieldConfig`
|
|
@@ -660,6 +881,48 @@ interface NpThemeFieldRequirement {
|
|
|
660
881
|
* severity, and a future F.8 may treat it as opt-in patch.
|
|
661
882
|
*/
|
|
662
883
|
hard?: boolean;
|
|
884
|
+
/**
|
|
885
|
+
* For `select` only — extra options to union into the existing
|
|
886
|
+
* select field. Two themes can contribute disjoint option sets
|
|
887
|
+
* (e.g. theme-docs adds `kind="doc"`, theme-portfolio adds
|
|
888
|
+
* `kind="project"`); the merge dedupes on `value` and last-wins
|
|
889
|
+
* on `label`. Universal-content-model Phase U.1 (#748).
|
|
890
|
+
*
|
|
891
|
+
* Ignored when the merge can't find an existing select with the
|
|
892
|
+
* same `name`; theme authors that need a brand-new select can't
|
|
893
|
+
* synthesise one through requirements (`NpThemeFieldRequirement`
|
|
894
|
+
* doesn't carry enough to construct a valid `NpSelectField`).
|
|
895
|
+
*/
|
|
896
|
+
options?: Array<{
|
|
897
|
+
label: string;
|
|
898
|
+
value: string;
|
|
899
|
+
}>;
|
|
900
|
+
/**
|
|
901
|
+
* Optional admin hints forwarded onto the synthesised field's
|
|
902
|
+
* `admin` slot. Themes use these to bucket their contributed
|
|
903
|
+
* fields into the right sidebar group and hide fields when
|
|
904
|
+
* irrelevant to the active kind.
|
|
905
|
+
*
|
|
906
|
+
* `group` — sidebar Card grouping label
|
|
907
|
+
* (e.g. `"Media"`, `"SEO"`).
|
|
908
|
+
* `condition` — runtime visibility gate. Either a function
|
|
909
|
+
* (server-only — stripped at the RSC boundary)
|
|
910
|
+
* or a serializable expression (works in both
|
|
911
|
+
* environments). Prefer the expression form so
|
|
912
|
+
* the admin's client renderer can re-evaluate
|
|
913
|
+
* on live form values:
|
|
914
|
+
* `{ when: "kind", equals: "doc" }`
|
|
915
|
+
* `{ when: "kind", notEquals: "doc" }`
|
|
916
|
+
* `{ when: "kind", in: ["doc", "page"] }`
|
|
917
|
+
* `{ when: "wpOriginalAuthor", exists: true }`
|
|
918
|
+
* `position` — main vs sidebar column. Defaults to the
|
|
919
|
+
* framework's `isSidebarField` heuristic.
|
|
920
|
+
*/
|
|
921
|
+
admin?: {
|
|
922
|
+
group?: string;
|
|
923
|
+
condition?: NpFieldCondition | NpFieldConditionExpr;
|
|
924
|
+
position?: "main" | "sidebar";
|
|
925
|
+
};
|
|
663
926
|
}
|
|
664
927
|
interface NpRegisteredTheme {
|
|
665
928
|
manifest: NpThemeManifest;
|
|
@@ -805,6 +1068,14 @@ interface NpFindWhereSystemTokens {
|
|
|
805
1068
|
* a `locale` field (only i18n-enabled collections do).
|
|
806
1069
|
*/
|
|
807
1070
|
locale?: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* Lifecycle status filter. Every collection in the framework
|
|
1073
|
+
* carries a `status` column (codegen-enforced), so exposing it
|
|
1074
|
+
* here lets a typed `where` clause filter to published rows
|
|
1075
|
+
* without the doc type having to redeclare it. Accepts a
|
|
1076
|
+
* single value or an array (IN match).
|
|
1077
|
+
*/
|
|
1078
|
+
status?: NpDocumentStatus | NpDocumentStatus[];
|
|
808
1079
|
}
|
|
809
1080
|
/**
|
|
810
1081
|
* Strip `null` and unwrap arrays so a hasMany field like
|
|
@@ -875,6 +1146,27 @@ interface NpFindResult<T = Record<string, unknown>> {
|
|
|
875
1146
|
type NpDocumentStatus = "draft" | "scheduled" | "published" | "archived" | "pending";
|
|
876
1147
|
interface NpSaveOptions {
|
|
877
1148
|
status?: NpDocumentStatus;
|
|
1149
|
+
/**
|
|
1150
|
+
* Caller-owned Drizzle transaction handle. When provided, all
|
|
1151
|
+
* reads + writes in the save flow run against this transaction
|
|
1152
|
+
* instead of opening a private one — useful for batching many
|
|
1153
|
+
* saves (the seed loop) so a mid-batch failure rolls back the
|
|
1154
|
+
* pending writes as a unit.
|
|
1155
|
+
*
|
|
1156
|
+
* Typed as `unknown` here to avoid a circular import between
|
|
1157
|
+
* `config/types.ts` and `collections/pipeline.ts` (where the
|
|
1158
|
+
* structural type lives). Callers pass the `NpTransaction`
|
|
1159
|
+
* value exported from `@nexpress/core`; the pipeline narrows
|
|
1160
|
+
* with an internal cast at the boundary.
|
|
1161
|
+
*
|
|
1162
|
+
* Pre-write hooks still fire OUTSIDE the tx (they shouldn't see
|
|
1163
|
+
* pending state). Post-commit hooks (`content:afterSave` job,
|
|
1164
|
+
* plugin `content:afterCreate` / `content:afterUpdate`) fire
|
|
1165
|
+
* after the inner persist block but before the caller's outer
|
|
1166
|
+
* tx commits — their side effects can diverge from final DB
|
|
1167
|
+
* state on rollback. Same trade-off as `deleteDocument({ tx })`.
|
|
1168
|
+
*/
|
|
1169
|
+
tx?: unknown;
|
|
878
1170
|
}
|
|
879
1171
|
interface NpSaveResult {
|
|
880
1172
|
doc: Record<string, unknown>;
|
|
@@ -895,4 +1187,4 @@ interface NpSaveResult {
|
|
|
895
1187
|
*/
|
|
896
1188
|
declare const ROLE_HIERARCHY: Record<NpUserRole, number>;
|
|
897
1189
|
|
|
898
|
-
export { type
|
|
1190
|
+
export { ROLE_HIERARCHY as $, type NpEmailField as A, type NpFieldCondition as B, type NpFieldConditionExpr as C, type NpFieldValidator as D, type NpFindWhere as E, type NpFindWhereSystemTokens as F, type NpGroupField as G, type NpPrincipal as H, type NpI18nConfig as I, type NpImageSize as J, type NpJobType as K, type NpJsonField as L, type NpNumberField as M, type NpRichTextContent as N, type NpPluginContext as O, type NpRadioField as P, type NpRelationshipField as Q, type NpResolvedPluginLike as R, type NpRichTextField as S, type NpRowField as T, type NpSelectField as U, type NpTextField as V, type NpTextareaField as W, type NpThemeCollectionKind as X, type NpThemeCollectionRequirement as Y, type NpUploadConfig as Z, type NpUploadField as _, type NpNavItem as a, type NpBlockInstance as b, type NpConfig as c, type NpCollectionConfig as d, type NpAuthUser as e, type NpSaveOptions as f, type NpSaveResult as g, type NpFindOptions as h, type NpFindResult as i, type NpRegisteredTheme as j, type NpThemeFieldRequirement as k, type NpThemeManifest as l, type NpUserRole as m, type NpFieldConfig as n, type NpPluginConfig as o, type NpAccessFunction as p, type NpAdminGroupMeta as q, type NpArrayField as r, type NpBlockConfig as s, type NpBlocksField as t, type NpCheckboxField as u, type NpCollapsibleField as v, type NpCollectionHook as w, type NpDateField as x, type NpDocumentStatus as y, type NpEditorConfig as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexpress/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Server-side core for NexPress — collections pipeline, auth, jobs, media, plugins, observability.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nexpress",
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"import": "./dist/db.js",
|
|
49
49
|
"default": "./dist/db.js"
|
|
50
50
|
},
|
|
51
|
+
"./fields": {
|
|
52
|
+
"types": "./dist/fields.d.ts",
|
|
53
|
+
"import": "./dist/fields.js",
|
|
54
|
+
"default": "./dist/fields.js"
|
|
55
|
+
},
|
|
51
56
|
"./i18n": {
|
|
52
57
|
"types": "./dist/i18n.d.ts",
|
|
53
58
|
"import": "./dist/i18n.js",
|