@nexpress/core 0.2.2 → 0.3.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/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-5LCLS6VE.js → chunk-56ZK5PWM.js} +19 -19
- package/dist/{chunk-S37WWNBB.js → chunk-6IEYOY2L.js} +28 -121
- package/dist/chunk-6IEYOY2L.js.map +1 -0
- package/dist/{chunk-QYP6E5FP.js → chunk-6UV2P5MW.js} +63 -50
- package/dist/chunk-6UV2P5MW.js.map +1 -0
- package/dist/{chunk-26RYBFTF.js → chunk-AEKO4MXK.js} +21 -4
- package/dist/chunk-AEKO4MXK.js.map +1 -0
- package/dist/{chunk-L4F5RAQ5.js → chunk-DKOCKZVG.js} +9 -9
- package/dist/{chunk-KSUS4UNN.js → chunk-HUESWYZJ.js} +2 -2
- package/dist/{chunk-CTUHJHLH.js → chunk-HVHV3IHF.js} +2 -2
- 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-7GNVXRLG.js → chunk-UIQYA3Y7.js} +5 -5
- package/dist/{chunk-CKT4QZDC.js → chunk-WJJ5MBH5.js} +5 -5
- package/dist/community.d.ts +1 -1
- package/dist/community.js +20 -19
- package/dist/{config-65OBL4YH.js → config-44MFLLIX.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-55D6RX3U.js → host-DKOWZWKA.js} +6 -5
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.js +1 -1
- package/dist/{index-Ccw0AkXh.d.ts → index-BmR3Z8Y5.d.ts} +1 -1
- package/dist/{index-BWsQUGRZ.d.ts → index-C-jKU1St.d.ts} +2 -2
- package/dist/{index-D6Q7DOl7.d.ts → index-Ca-WUDH5.d.ts} +1 -1
- package/dist/{index-BpW3PGhP.d.ts → index-lACZ9sON.d.ts} +1 -1
- package/dist/index.d.ts +10 -12
- package/dist/index.js +189 -78
- 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-UC7O2HBQ.js → scheduled-VEOGI5EW.js} +7 -6
- 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-C-r01wmU.d.ts → types-BY1UmEiY.d.ts} +267 -2
- package/package.json +6 -1
- package/dist/chunk-26RYBFTF.js.map +0 -1
- package/dist/chunk-QYP6E5FP.js.map +0 -1
- package/dist/chunk-S37WWNBB.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-5LCLS6VE.js.map → chunk-56ZK5PWM.js.map} +0 -0
- /package/dist/{chunk-L4F5RAQ5.js.map → chunk-DKOCKZVG.js.map} +0 -0
- /package/dist/{chunk-KSUS4UNN.js.map → chunk-HUESWYZJ.js.map} +0 -0
- /package/dist/{chunk-CTUHJHLH.js.map → chunk-HVHV3IHF.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-7GNVXRLG.js.map → chunk-UIQYA3Y7.js.map} +0 -0
- /package/dist/{chunk-CKT4QZDC.js.map → chunk-WJJ5MBH5.js.map} +0 -0
- /package/dist/{config-65OBL4YH.js.map → config-44MFLLIX.js.map} +0 -0
- /package/dist/{host-55D6RX3U.js.map → fields.js.map} +0 -0
- /package/dist/{mentions-NCQR4B72.js.map → host-DKOWZWKA.js.map} +0 -0
- /package/dist/{mutes-FJSSU2JP.js.map → mentions-U4JACYI6.js.map} +0 -0
- /package/dist/{scheduled-UC7O2HBQ.js.map → mutes-MNQP6ACF.js.map} +0 -0
- /package/dist/{settings-JODDWMDB.js.map → scheduled-VEOGI5EW.js.map} +0 -0
package/dist/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as NpAccessFunction,
|
|
2
|
-
export {
|
|
1
|
+
import { p as NpAccessFunction, m as NpUserRole, e as NpAuthUser } from './types-BY1UmEiY.js';
|
|
2
|
+
export { H as NpPrincipal } from './types-BY1UmEiY.js';
|
|
3
3
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
4
4
|
import { Options } from '@node-rs/argon2';
|
|
5
5
|
|
|
@@ -72,6 +72,29 @@ declare function verifyToken(token: string, secret: string, expectedUse?: NpToke
|
|
|
72
72
|
*/
|
|
73
73
|
declare function isTokenVerificationError(err: unknown): boolean;
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Minimal public projection of a user row — `id` + `name` + `email`.
|
|
77
|
+
* Themes / plugins reach for this when they need to display a byline
|
|
78
|
+
* (post.author → user) without pulling in session machinery. Password
|
|
79
|
+
* hash + tokenVersion + reset state stay private to the auth module.
|
|
80
|
+
*/
|
|
81
|
+
interface NpUserBasic {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
email: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Look up a user by id. Returns `null` when the id doesn't exist
|
|
88
|
+
* (caller handles missing-author UI). UUID validation lives at the
|
|
89
|
+
* caller — Postgres rejects malformed ids inside `eq()` and the
|
|
90
|
+
* surfacing error is already informative.
|
|
91
|
+
*
|
|
92
|
+
* This is the supported entry point for theme code that needs to
|
|
93
|
+
* render a byline from `posts.author: relationTo("users")`. Direct
|
|
94
|
+
* drizzle reads against `np_users` are private to the framework.
|
|
95
|
+
*/
|
|
96
|
+
declare function getUserById(id: string): Promise<NpUserBasic | null>;
|
|
97
|
+
|
|
75
98
|
declare const ARGON2_OPTIONS: Options;
|
|
76
99
|
declare function hashPassword(password: string): Promise<string>;
|
|
77
100
|
declare function verifyPassword(passwordHash: string, password: string): Promise<boolean>;
|
|
@@ -637,4 +660,4 @@ interface NpConsumeMemberResetResult {
|
|
|
637
660
|
}
|
|
638
661
|
declare function consumeMemberPasswordReset(db: NodePgDatabase<Record<string, unknown>>, token: string, newPassword: string): Promise<NpConsumeMemberResetResult>;
|
|
639
662
|
|
|
640
|
-
export { ARGON2_OPTIONS, type ArcticLikeProvider, type ArcticLikeTokens, type FromArcticOptions, type IssuedOAuthState, type NpCapability, type NpConsumeMemberEmailVerifyResult, type NpConsumeMemberResetResult, type NpConsumeResetTokenOptions, type NpConsumeResetTokenResult, type NpCreateResetTokenOptions, type NpIssuedMemberToken, type NpIssuedResetToken, type NpMemberAuthRow, type NpMemberIdentityRow, type NpMemberResetRequestResult, type NpMemberTokenPayload, type NpPasswordResetPurpose, type NpResetRequestResult, type NpTokenPayload, type NpUserIdentityRow, type OAuthAuthorizeParams, type OAuthExchangeParams, type OAuthProfile, type OAuthProvider, type OAuthStatePayload, type ResolveMemberOAuthLoginInput, type ResolveMemberOAuthLoginResult, type ResolveOAuthLoginInput, type ResolveOAuthLoginResult, type ResolvedOAuthMember, type ResolvedOAuthUser, type VerifyOAuthStateResult, authenticated, can, consumeMemberEmailVerifyToken, consumeMemberPasswordReset, consumePasswordResetToken, createMemberEmailVerifyToken, createPasswordResetToken, fromArctic, getMemberFromTokenPayload, getOAuthProvider, hashPassword, invalidateAllMemberSessions, invalidateAllSessions, isAdmin, isEditorOrAbove, isOwnerOrAdmin, isTokenVerificationError, issueOAuthState, listMemberIdentities, listOAuthProviders, listUserIdentities, registerOAuthProvider, requestMemberPasswordReset, requestPasswordReset, resetOAuthProviders, resolveMemberOAuthLogin, resolveOAuthLogin, revokeMemberIdentity, revokeUserIdentity, sha256, signMemberToken, signToken, verifyCsrf, verifyMemberToken, verifyOAuthState, verifyPassword, verifyToken, verifyTokenFull };
|
|
663
|
+
export { ARGON2_OPTIONS, type ArcticLikeProvider, type ArcticLikeTokens, type FromArcticOptions, type IssuedOAuthState, type NpCapability, type NpConsumeMemberEmailVerifyResult, type NpConsumeMemberResetResult, type NpConsumeResetTokenOptions, type NpConsumeResetTokenResult, type NpCreateResetTokenOptions, type NpIssuedMemberToken, type NpIssuedResetToken, type NpMemberAuthRow, type NpMemberIdentityRow, type NpMemberResetRequestResult, type NpMemberTokenPayload, type NpPasswordResetPurpose, type NpResetRequestResult, type NpTokenPayload, type NpUserBasic, type NpUserIdentityRow, type OAuthAuthorizeParams, type OAuthExchangeParams, type OAuthProfile, type OAuthProvider, type OAuthStatePayload, type ResolveMemberOAuthLoginInput, type ResolveMemberOAuthLoginResult, type ResolveOAuthLoginInput, type ResolveOAuthLoginResult, type ResolvedOAuthMember, type ResolvedOAuthUser, type VerifyOAuthStateResult, authenticated, can, consumeMemberEmailVerifyToken, consumeMemberPasswordReset, consumePasswordResetToken, createMemberEmailVerifyToken, createPasswordResetToken, fromArctic, getMemberFromTokenPayload, getOAuthProvider, getUserById, hashPassword, invalidateAllMemberSessions, invalidateAllSessions, isAdmin, isEditorOrAbove, isOwnerOrAdmin, isTokenVerificationError, issueOAuthState, listMemberIdentities, listOAuthProviders, listUserIdentities, registerOAuthProvider, requestMemberPasswordReset, requestPasswordReset, resetOAuthProviders, resolveMemberOAuthLogin, resolveOAuthLogin, revokeMemberIdentity, revokeUserIdentity, sha256, signMemberToken, signToken, verifyCsrf, verifyMemberToken, verifyOAuthState, verifyPassword, verifyToken, verifyTokenFull };
|
package/dist/auth.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
fromArctic,
|
|
10
10
|
getMemberFromTokenPayload,
|
|
11
11
|
getOAuthProvider,
|
|
12
|
+
getUserById,
|
|
12
13
|
hashPassword,
|
|
13
14
|
invalidateAllMemberSessions,
|
|
14
15
|
invalidateAllSessions,
|
|
@@ -37,14 +38,14 @@ import {
|
|
|
37
38
|
verifyPassword,
|
|
38
39
|
verifyToken,
|
|
39
40
|
verifyTokenFull
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-6UV2P5MW.js";
|
|
41
42
|
import {
|
|
42
43
|
can
|
|
43
44
|
} from "./chunk-EQ2Z3KMD.js";
|
|
44
45
|
import "./chunk-ML2E3P3X.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-ZCINJSS4.js";
|
|
46
|
+
import "./chunk-RKM4GDWM.js";
|
|
47
47
|
import "./chunk-SBCVAC2Z.js";
|
|
48
|
+
import "./chunk-ZCINJSS4.js";
|
|
48
49
|
import "./chunk-OROPGO65.js";
|
|
49
50
|
import "./chunk-NFHS7CFV.js";
|
|
50
51
|
import "./chunk-XANPEOJC.js";
|
|
@@ -62,6 +63,7 @@ export {
|
|
|
62
63
|
fromArctic,
|
|
63
64
|
getMemberFromTokenPayload,
|
|
64
65
|
getOAuthProvider,
|
|
66
|
+
getUserById,
|
|
65
67
|
hashPassword,
|
|
66
68
|
invalidateAllMemberSessions,
|
|
67
69
|
invalidateAllSessions,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
isMemberBanned,
|
|
4
4
|
memberCan,
|
|
5
5
|
withMemberWrite
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RJ76SKWQ.js";
|
|
7
7
|
import "./chunk-U4QCCLAW.js";
|
|
8
|
-
import "./chunk-ZCINJSS4.js";
|
|
9
8
|
import "./chunk-SBCVAC2Z.js";
|
|
9
|
+
import "./chunk-ZCINJSS4.js";
|
|
10
10
|
import "./chunk-XANPEOJC.js";
|
|
11
11
|
import "./chunk-X7K5F2UI.js";
|
|
12
12
|
import "./chunk-PZ5AY32C.js";
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
memberCan,
|
|
17
17
|
withMemberWrite
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=can-
|
|
19
|
+
//# sourceMappingURL=can-UJ2NAOIR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getStorageAdapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VZZ7M26.js";
|
|
4
4
|
import {
|
|
5
5
|
getDb
|
|
6
6
|
} from "./chunk-XANPEOJC.js";
|
|
@@ -38,4 +38,4 @@ async function getMediaUrl(id, options = {}) {
|
|
|
38
38
|
export {
|
|
39
39
|
getMediaUrl
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-2N53KKIL.js.map
|
|
@@ -170,7 +170,7 @@ async function uploadMedia(file, uploader, folderId) {
|
|
|
170
170
|
return { id, status: "processing" };
|
|
171
171
|
}
|
|
172
172
|
async function assertMemberUploadQuota(memberId, txDb) {
|
|
173
|
-
const { getCommunitySettings } = await import("./settings-
|
|
173
|
+
const { getCommunitySettings } = await import("./settings-OZWM6L2K.js");
|
|
174
174
|
const { NpRateLimitError } = await import("./errors-5OS3S2J3.js");
|
|
175
175
|
const settings = await getCommunitySettings();
|
|
176
176
|
const { perDay, total } = settings.memberUploadQuota;
|
|
@@ -535,4 +535,4 @@ export {
|
|
|
535
535
|
listMedia,
|
|
536
536
|
cleanupDeletedMedia
|
|
537
537
|
};
|
|
538
|
-
//# sourceMappingURL=chunk-
|
|
538
|
+
//# sourceMappingURL=chunk-2VZZ7M26.js.map
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCommunityRole,
|
|
3
|
+
memberCan,
|
|
4
|
+
withMemberWrite
|
|
5
|
+
} from "./chunk-RJ76SKWQ.js";
|
|
1
6
|
import {
|
|
2
7
|
getMutedTargetIds
|
|
3
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WJJ5MBH5.js";
|
|
4
9
|
import {
|
|
5
10
|
createNotification,
|
|
6
11
|
extractMentionHandles,
|
|
7
12
|
fanOutMentionNotifications
|
|
8
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RDTTK27V.js";
|
|
9
14
|
import {
|
|
10
15
|
applyReputation
|
|
11
16
|
} from "./chunk-L6VG7IK6.js";
|
|
@@ -16,17 +21,18 @@ import {
|
|
|
16
21
|
getProfanityAdapter
|
|
17
22
|
} from "./chunk-KU5M27ZC.js";
|
|
18
23
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
withMemberWrite
|
|
22
|
-
} from "./chunk-PQBJWZ7D.js";
|
|
24
|
+
getMediaUrl
|
|
25
|
+
} from "./chunk-2N53KKIL.js";
|
|
23
26
|
import {
|
|
24
27
|
buildWeightedSearchVectorSql,
|
|
25
28
|
deleteDocument,
|
|
26
29
|
findDocuments,
|
|
27
30
|
getDocumentById,
|
|
28
31
|
saveDocument
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-6IEYOY2L.js";
|
|
33
|
+
import {
|
|
34
|
+
deleteMedia
|
|
35
|
+
} from "./chunk-2VZZ7M26.js";
|
|
30
36
|
import {
|
|
31
37
|
can
|
|
32
38
|
} from "./chunk-EQ2Z3KMD.js";
|
|
@@ -35,7 +41,7 @@ import {
|
|
|
35
41
|
} from "./chunk-ML2E3P3X.js";
|
|
36
42
|
import {
|
|
37
43
|
getCommunitySettings
|
|
38
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-RKM4GDWM.js";
|
|
39
45
|
import {
|
|
40
46
|
getI18nConfig
|
|
41
47
|
} from "./chunk-4ZLMEKFX.js";
|
|
@@ -46,22 +52,16 @@ import {
|
|
|
46
52
|
getCollectionRegistration,
|
|
47
53
|
getCollectionTable
|
|
48
54
|
} from "./chunk-U4QCCLAW.js";
|
|
55
|
+
import {
|
|
56
|
+
getCurrentSiteId,
|
|
57
|
+
requireSiteId
|
|
58
|
+
} from "./chunk-SBCVAC2Z.js";
|
|
49
59
|
import {
|
|
50
60
|
NpConflictError,
|
|
51
61
|
NpForbiddenError,
|
|
52
62
|
NpNotFoundError,
|
|
53
63
|
NpValidationError
|
|
54
64
|
} from "./chunk-ZCINJSS4.js";
|
|
55
|
-
import {
|
|
56
|
-
getCurrentSiteId,
|
|
57
|
-
requireSiteId
|
|
58
|
-
} from "./chunk-SBCVAC2Z.js";
|
|
59
|
-
import {
|
|
60
|
-
getMediaUrl
|
|
61
|
-
} from "./chunk-CHQJG4BB.js";
|
|
62
|
-
import {
|
|
63
|
-
deleteMedia
|
|
64
|
-
} from "./chunk-DWG3RZH2.js";
|
|
65
65
|
import {
|
|
66
66
|
getLogger
|
|
67
67
|
} from "./chunk-NFHS7CFV.js";
|
|
@@ -1956,4 +1956,4 @@ export {
|
|
|
1956
1956
|
revokeMemberRole,
|
|
1957
1957
|
purgeMemberContent
|
|
1958
1958
|
};
|
|
1959
|
-
//# sourceMappingURL=chunk-
|
|
1959
|
+
//# sourceMappingURL=chunk-56ZK5PWM.js.map
|
|
@@ -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
|
|
@@ -85,100 +88,6 @@ function applySlugField(config, data, originalDoc) {
|
|
|
85
88
|
data.slug = candidate;
|
|
86
89
|
}
|
|
87
90
|
|
|
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
91
|
// src/collections/search.ts
|
|
183
92
|
import { sql } from "drizzle-orm";
|
|
184
93
|
function buildSearchVector(config, data) {
|
|
@@ -318,7 +227,7 @@ async function updateMemberDocument(collection, docId, data, memberId, options)
|
|
|
318
227
|
if (authorId !== memberId) {
|
|
319
228
|
throw new NpForbiddenError(collection, "update");
|
|
320
229
|
}
|
|
321
|
-
const { assertNotBanned } = await import("./can-
|
|
230
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
322
231
|
await assertNotBanned(memberId);
|
|
323
232
|
const moderation = await runMemberDocModeration({
|
|
324
233
|
collection,
|
|
@@ -352,7 +261,7 @@ async function updateMemberDocument(collection, docId, data, memberId, options)
|
|
|
352
261
|
});
|
|
353
262
|
const resultStatus = result.doc.status;
|
|
354
263
|
if (resultStatus === "published") {
|
|
355
|
-
const { extractMentionHandlesFromDocData, fanOutMentionNotifications } = await import("./mentions-
|
|
264
|
+
const { extractMentionHandlesFromDocData, fanOutMentionNotifications } = await import("./mentions-U4JACYI6.js");
|
|
356
265
|
const previousHandles = new Set(extractMentionHandlesFromDocData(originalDoc));
|
|
357
266
|
await fanOutMentionNotifications({
|
|
358
267
|
actorMemberId: memberId,
|
|
@@ -372,7 +281,7 @@ async function createMemberDocument(collection, data, memberId, options) {
|
|
|
372
281
|
if (!config.community?.memberWrite?.create) {
|
|
373
282
|
throw new NpForbiddenError(collection, "create");
|
|
374
283
|
}
|
|
375
|
-
const { assertNotBanned } = await import("./can-
|
|
284
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
376
285
|
await assertNotBanned(memberId);
|
|
377
286
|
const defaultStatus = config.community?.memberWrite?.defaultStatus === "pending" ? "pending" : "published";
|
|
378
287
|
const moderation = await runMemberDocModeration({
|
|
@@ -416,7 +325,7 @@ async function createMemberDocument(collection, data, memberId, options) {
|
|
|
416
325
|
});
|
|
417
326
|
}
|
|
418
327
|
if (spamStatus === "published") {
|
|
419
|
-
const { fanOutMentionNotifications } = await import("./mentions-
|
|
328
|
+
const { fanOutMentionNotifications } = await import("./mentions-U4JACYI6.js");
|
|
420
329
|
await fanOutMentionNotifications({
|
|
421
330
|
actorMemberId: memberId,
|
|
422
331
|
kind: "document.mention",
|
|
@@ -502,7 +411,7 @@ async function initSaveContext(collection, docId, data, actor, options) {
|
|
|
502
411
|
const registration = getCollectionRegistration(collection);
|
|
503
412
|
const table = getCollectionTable(collection);
|
|
504
413
|
const db = getDb();
|
|
505
|
-
const validatedData = toRecord(getCollectionZodSchema(config).parse(data));
|
|
414
|
+
const validatedData = toRecord(getCollectionZodSchema(config, data).parse(data));
|
|
506
415
|
const operation = docId ? "update" : "create";
|
|
507
416
|
const originalDoc = docId ? await getDocumentByIdInternal(db, table, collection, docId) : null;
|
|
508
417
|
return {
|
|
@@ -533,7 +442,7 @@ async function validateActorAccess(ctx) {
|
|
|
533
442
|
);
|
|
534
443
|
return;
|
|
535
444
|
}
|
|
536
|
-
const { assertNotBanned } = await import("./can-
|
|
445
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
537
446
|
if (ctx.operation === "create") {
|
|
538
447
|
if (!ctx.config.community?.memberWrite?.create) {
|
|
539
448
|
throw new NpForbiddenError(ctx.collection, "create");
|
|
@@ -981,7 +890,7 @@ async function deleteDocumentImpl(collection, docId, actor) {
|
|
|
981
890
|
if (authorId !== actor.memberId) {
|
|
982
891
|
throw new NpForbiddenError(collection, "delete");
|
|
983
892
|
}
|
|
984
|
-
const { assertNotBanned } = await import("./can-
|
|
893
|
+
const { assertNotBanned } = await import("./can-UJ2NAOIR.js");
|
|
985
894
|
await assertNotBanned(actor.memberId);
|
|
986
895
|
}
|
|
987
896
|
const userForHooks = actorUserOrNull(actor);
|
|
@@ -1885,7 +1794,7 @@ function createPluginRuntimeContext(options) {
|
|
|
1885
1794
|
return row.value;
|
|
1886
1795
|
},
|
|
1887
1796
|
async getPlugin() {
|
|
1888
|
-
const { getPluginConfig } = await import("./config-
|
|
1797
|
+
const { getPluginConfig } = await import("./config-44MFLLIX.js");
|
|
1889
1798
|
const value = await getPluginConfig(pluginId);
|
|
1890
1799
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1891
1800
|
return value;
|
|
@@ -1893,8 +1802,8 @@ function createPluginRuntimeContext(options) {
|
|
|
1893
1802
|
return {};
|
|
1894
1803
|
},
|
|
1895
1804
|
async setPlugin(data) {
|
|
1896
|
-
const { setPluginConfig } = await import("./config-
|
|
1897
|
-
const { getPluginRegistration: getPluginRegistration2 } = await import("./host-
|
|
1805
|
+
const { setPluginConfig } = await import("./config-44MFLLIX.js");
|
|
1806
|
+
const { getPluginRegistration: getPluginRegistration2 } = await import("./host-DKOWZWKA.js");
|
|
1898
1807
|
const reg = getPluginRegistration2(pluginId);
|
|
1899
1808
|
if (reg?.configSchema) {
|
|
1900
1809
|
await setPluginConfig(pluginId, data, null);
|
|
@@ -2125,7 +2034,7 @@ function invalidatePluginEnabled(pluginId) {
|
|
|
2125
2034
|
var fetchOverride = null;
|
|
2126
2035
|
|
|
2127
2036
|
// src/plugins/compat.ts
|
|
2128
|
-
var FRAMEWORK_VERSION_FROM_PACKAGE = true ? "0.
|
|
2037
|
+
var FRAMEWORK_VERSION_FROM_PACKAGE = true ? "0.3.1" : "0.0.0-dev";
|
|
2129
2038
|
var frameworkVersion = FRAMEWORK_VERSION_FROM_PACKAGE;
|
|
2130
2039
|
function getFrameworkVersion() {
|
|
2131
2040
|
return frameworkVersion;
|
|
@@ -2275,7 +2184,7 @@ function insertSortedByPriority(list, entry) {
|
|
|
2275
2184
|
list.sort((a, b) => a.priority - b.priority);
|
|
2276
2185
|
}
|
|
2277
2186
|
async function loadPluginConfig(pluginId) {
|
|
2278
|
-
const { getPluginConfig } = await import("./config-
|
|
2187
|
+
const { getPluginConfig } = await import("./config-44MFLLIX.js");
|
|
2279
2188
|
const value = await getPluginConfig(pluginId);
|
|
2280
2189
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2281
2190
|
return value;
|
|
@@ -2755,8 +2664,6 @@ export {
|
|
|
2755
2664
|
buildSearchVector,
|
|
2756
2665
|
buildSearchVectorParts,
|
|
2757
2666
|
buildWeightedSearchVectorSql,
|
|
2758
|
-
buildZodSchema,
|
|
2759
|
-
getCollectionZodSchema,
|
|
2760
2667
|
isPluginEnabled,
|
|
2761
2668
|
invalidatePluginEnabled,
|
|
2762
2669
|
getFrameworkVersion,
|
|
@@ -2787,4 +2694,4 @@ export {
|
|
|
2787
2694
|
findDocuments,
|
|
2788
2695
|
getDocumentById
|
|
2789
2696
|
};
|
|
2790
|
-
//# sourceMappingURL=chunk-
|
|
2697
|
+
//# sourceMappingURL=chunk-6IEYOY2L.js.map
|