nextly 0.0.1 → 0.0.2-alpha.0
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/LICENSE +22 -0
- package/README.md +122 -0
- package/dist/_dts-chunks/collections-handler.d-DjgO74Wt.d.ts +20540 -0
- package/dist/_dts-chunks/config.d-DNwsDnjs.d.ts +2589 -0
- package/dist/_dts-chunks/define-component.d-BUgTHmt3.d.ts +1149 -0
- package/dist/_dts-chunks/image-processor.d-OO1PmMrv.d.ts +335 -0
- package/dist/_dts-chunks/index.d-axCAzZ7m.d.ts +17842 -0
- package/dist/_dts-chunks/media.d-DjDOZo4B.d.ts +117 -0
- package/dist/_dts-chunks/on-error.d-CHIKWNxd.d.ts +38 -0
- package/dist/_dts-chunks/storage.d-BUhQ2we_.d.ts +404 -0
- package/dist/actions/index.d.ts +239 -0
- package/dist/actions/index.mjs +281 -0
- package/dist/api/auth-state.d.ts +5 -0
- package/dist/api/auth-state.mjs +131 -0
- package/dist/api/collections-schema-detail.d.ts +56 -0
- package/dist/api/collections-schema-detail.mjs +244 -0
- package/dist/api/collections-schema-export.d.ts +56 -0
- package/dist/api/collections-schema-export.mjs +129 -0
- package/dist/api/collections-schema.d.ts +59 -0
- package/dist/api/collections-schema.mjs +207 -0
- package/dist/api/components-detail.d.ts +50 -0
- package/dist/api/components-detail.mjs +132 -0
- package/dist/api/components.d.ts +69 -0
- package/dist/api/components.mjs +144 -0
- package/dist/api/email-providers-default.d.ts +40 -0
- package/dist/api/email-providers-default.mjs +75 -0
- package/dist/api/email-providers-detail.d.ts +81 -0
- package/dist/api/email-providers-detail.mjs +109 -0
- package/dist/api/email-providers-test.d.ts +43 -0
- package/dist/api/email-providers-test.mjs +114 -0
- package/dist/api/email-providers.d.ts +69 -0
- package/dist/api/email-providers.mjs +110 -0
- package/dist/api/email-send-template.d.ts +41 -0
- package/dist/api/email-send-template.mjs +58 -0
- package/dist/api/email-send.d.ts +42 -0
- package/dist/api/email-send.mjs +58 -0
- package/dist/api/email-templates-detail.d.ts +74 -0
- package/dist/api/email-templates-detail.mjs +112 -0
- package/dist/api/email-templates-layout.d.ts +55 -0
- package/dist/api/email-templates-layout.mjs +92 -0
- package/dist/api/email-templates-preview.d.ts +48 -0
- package/dist/api/email-templates-preview.mjs +93 -0
- package/dist/api/email-templates.d.ts +61 -0
- package/dist/api/email-templates.mjs +118 -0
- package/dist/api/health.d.ts +68 -0
- package/dist/api/health.mjs +67 -0
- package/dist/api/index.d.ts +54 -0
- package/dist/api/index.mjs +16 -0
- package/dist/api/media-bulk.d.ts +74 -0
- package/dist/api/media-bulk.mjs +196 -0
- package/dist/api/media-folders.d.ts +112 -0
- package/dist/api/media-folders.mjs +187 -0
- package/dist/api/media-handlers.d.ts +102 -0
- package/dist/api/media-handlers.mjs +437 -0
- package/dist/api/media.d.ts +117 -0
- package/dist/api/media.mjs +242 -0
- package/dist/api/singles-detail.d.ts +87 -0
- package/dist/api/singles-detail.mjs +170 -0
- package/dist/api/singles-schema-detail.d.ts +54 -0
- package/dist/api/singles-schema-detail.mjs +182 -0
- package/dist/api/singles.d.ts +34 -0
- package/dist/api/singles.mjs +94 -0
- package/dist/api/storage-upload-url.d.ts +48 -0
- package/dist/api/storage-upload-url.mjs +202 -0
- package/dist/api/uploads.d.ts +109 -0
- package/dist/api/uploads.mjs +359 -0
- package/dist/auth/index.d.ts +425 -0
- package/dist/auth/index.mjs +199 -0
- package/dist/boot-apply-PQSYLDIN.mjs +7 -0
- package/dist/chunk-2OALJTK6.mjs +489 -0
- package/dist/chunk-2Q2SX2CS.mjs +365 -0
- package/dist/chunk-2TFX4ND3.mjs +13 -0
- package/dist/chunk-2TWPDSYD.mjs +87 -0
- package/dist/chunk-2W3DVD7S.mjs +647 -0
- package/dist/chunk-2ZFKXPQM.mjs +88 -0
- package/dist/chunk-3FA7FKAV.mjs +832 -0
- package/dist/chunk-3NZ2KMBL.mjs +58 -0
- package/dist/chunk-4MJLT6PZ.mjs +0 -0
- package/dist/chunk-56WO4WX7.mjs +0 -0
- package/dist/chunk-5APFUGAD.mjs +89 -0
- package/dist/chunk-5HMZ644B.mjs +108 -0
- package/dist/chunk-67GXH6PR.mjs +32 -0
- package/dist/chunk-6JNEPWRW.mjs +14368 -0
- package/dist/chunk-6NFHQIJD.mjs +45 -0
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/chunk-A3WPLSDT.mjs +1364 -0
- package/dist/chunk-AGJ6F2T3.mjs +144 -0
- package/dist/chunk-AK6Z23OX.mjs +1464 -0
- package/dist/chunk-APKKRD2G.mjs +102 -0
- package/dist/chunk-B2GV2BWH.mjs +73 -0
- package/dist/chunk-D5HQBNUB.mjs +74 -0
- package/dist/chunk-DNNG377Z.mjs +204 -0
- package/dist/chunk-DP3G27G5.mjs +135 -0
- package/dist/chunk-DV6WVX2Q.mjs +0 -0
- package/dist/chunk-DXGGXIUZ.mjs +57 -0
- package/dist/chunk-EGXBZCGC.mjs +943 -0
- package/dist/chunk-ERCNLX3V.mjs +176 -0
- package/dist/chunk-FQULBZ53.mjs +850 -0
- package/dist/chunk-G2AA4QLC.mjs +262 -0
- package/dist/chunk-GDBJ5JCU.mjs +488 -0
- package/dist/chunk-GJNSJU4S.mjs +19 -0
- package/dist/chunk-GZ6DCQKC.mjs +69 -0
- package/dist/chunk-H26B4FYG.mjs +167 -0
- package/dist/chunk-I4JMR3UR.mjs +21 -0
- package/dist/chunk-INV7QKLG.mjs +508 -0
- package/dist/chunk-IUDOC7N7.mjs +46 -0
- package/dist/chunk-IZWPRDC3.mjs +206 -0
- package/dist/chunk-KIMNCZGV.mjs +15 -0
- package/dist/chunk-L6HW2DA7.mjs +15 -0
- package/dist/chunk-LAZXX4HR.mjs +100 -0
- package/dist/chunk-LDKCUMHK.mjs +95 -0
- package/dist/chunk-LRXMECUA.mjs +0 -0
- package/dist/chunk-M52VMPGA.mjs +119 -0
- package/dist/chunk-MGUWEEI6.mjs +160 -0
- package/dist/chunk-NRUWQ5Z7.mjs +419 -0
- package/dist/chunk-NSEFNNU4.mjs +25360 -0
- package/dist/chunk-NTHVDFGO.mjs +138 -0
- package/dist/chunk-O3QHXMOX.mjs +3166 -0
- package/dist/chunk-P7NH2OSC.mjs +2605 -0
- package/dist/chunk-PKMABBB5.mjs +184 -0
- package/dist/chunk-PWS6XGJK.mjs +76 -0
- package/dist/chunk-R6JJQHFC.mjs +20 -0
- package/dist/chunk-RJLLGGPG.mjs +0 -0
- package/dist/chunk-SBACDPNX.mjs +689 -0
- package/dist/chunk-TO5AFLVQ.mjs +124 -0
- package/dist/chunk-TS7GHTG2.mjs +5436 -0
- package/dist/chunk-UJ2IMJ4W.mjs +133 -0
- package/dist/chunk-UOP63Q54.mjs +102 -0
- package/dist/chunk-UUOFWCM6.mjs +78 -0
- package/dist/chunk-V4EQTOA4.mjs +893 -0
- package/dist/chunk-VJ66NCL4.mjs +193 -0
- package/dist/chunk-VQJQHVEV.mjs +29 -0
- package/dist/chunk-VTJADRO3.mjs +141 -0
- package/dist/chunk-VWF3JO32.mjs +0 -0
- package/dist/chunk-W4MGXIRR.mjs +27 -0
- package/dist/chunk-W5KKPZT5.mjs +1204 -0
- package/dist/chunk-WD34YQ6T.mjs +381 -0
- package/dist/chunk-WZBYMYVW.mjs +14 -0
- package/dist/chunk-X23WKS3Z.mjs +50 -0
- package/dist/chunk-X7TXCYYN.mjs +6496 -0
- package/dist/chunk-XGI4EMS3.mjs +140 -0
- package/dist/chunk-XZKLBMN6.mjs +1153 -0
- package/dist/chunk-YB7INWPY.mjs +0 -0
- package/dist/chunk-YV4Y7SDL.mjs +83 -0
- package/dist/chunk-YZNBLFIW.mjs +1688 -0
- package/dist/chunk-YZZCTONM.mjs +263 -0
- package/dist/chunk-ZE6A3FYH.mjs +289 -0
- package/dist/cli/nextly.mjs +68 -0
- package/dist/cli/utils/index.d.ts +449 -0
- package/dist/cli/utils/index.mjs +49 -0
- package/dist/component-schema-service-5577KVW6.mjs +11 -0
- package/dist/config-loader-23YEMC3Z.mjs +23 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.mjs +109 -0
- package/dist/container-ORGFGYSZ.mjs +9 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.mjs +40 -0
- package/dist/database/seeders/index.d.ts +93 -0
- package/dist/database/seeders/index.mjs +47 -0
- package/dist/db-sync-demote-LJGKLB3S.mjs +117 -0
- package/dist/db-sync-promote-B26VSYQF.mjs +113 -0
- package/dist/dev-reload-broadcaster-B73IQ53V.mjs +25 -0
- package/dist/dist-M2NOU37V.mjs +19 -0
- package/dist/drizzle-kit-lazy-D2M2PXR2.mjs +13 -0
- package/dist/dynamic-collection-schema-service-IEXTPIZ7.mjs +8 -0
- package/dist/errors/index.d.ts +159 -0
- package/dist/errors/index.mjs +10 -0
- package/dist/factory-IWMBKUJM.mjs +15 -0
- package/dist/first-run-QIVKWJIF.mjs +63 -0
- package/dist/fresh-push-NR67DC3R.mjs +8 -0
- package/dist/index.d.ts +4175 -0
- package/dist/index.mjs +1336 -0
- package/dist/local-plugin-PTET4NAT.mjs +7 -0
- package/dist/logger-NU46DXNY.mjs +15 -0
- package/dist/logger-YE4TC7ZN.mjs +9 -0
- package/dist/migration-journal-EP532Y4L.mjs +139 -0
- package/dist/migrations/mysql/0000_eager_sentry.sql +174 -0
- package/dist/migrations/mysql/0001_soft_giant_girl.sql +27 -0
- package/dist/migrations/mysql/0002_media_table.sql +24 -0
- package/dist/migrations/mysql/0003_dynamic_singles.sql +37 -0
- package/dist/migrations/mysql/0004_dynamic_components.sql +35 -0
- package/dist/migrations/mysql/0005_user_management_tables.sql +92 -0
- package/dist/migrations/mysql/0006_api_keys.sql +36 -0
- package/dist/migrations/mysql/0007_general_settings.sql +20 -0
- package/dist/migrations/mysql/0008_site_settings_logo_url.sql +9 -0
- package/dist/migrations/mysql/0009_activity_log.sql +30 -0
- package/dist/migrations/mysql/0010_site_settings_sidebar.sql +13 -0
- package/dist/migrations/mysql/0011_missing_tables_and_columns.sql +54 -0
- package/dist/migrations/mysql/0012_image_sizes_and_focal_point.sql +30 -0
- package/dist/migrations/mysql/0012_media_folders.sql +43 -0
- package/dist/migrations/mysql/0013_user_brute_force_protection.sql +31 -0
- package/dist/migrations/mysql/0014_email_template_attachments.sql +12 -0
- package/dist/migrations/mysql/0015_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/mysql/20260429_000000_000_initial_journal.sql +22 -0
- package/dist/migrations/mysql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/mysql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/mysql/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/mysql/meta/0000_snapshot.json +1005 -0
- package/dist/migrations/mysql/meta/0001_snapshot.json +1099 -0
- package/dist/migrations/mysql/meta/_journal.json +41 -0
- package/dist/migrations/postgresql/0000_misty_king_bedlam.sql +169 -0
- package/dist/migrations/postgresql/0001_perpetual_captain_marvel.sql +8 -0
- package/dist/migrations/postgresql/0002_sad_spectrum.sql +16 -0
- package/dist/migrations/postgresql/0003_hesitant_ultron.sql +17 -0
- package/dist/migrations/postgresql/0004_media_table.sql +24 -0
- package/dist/migrations/postgresql/0005_media_folders.sql +36 -0
- package/dist/migrations/postgresql/0006_dynamic_collections_update.sql +50 -0
- package/dist/migrations/postgresql/0007_dynamic_singles.sql +38 -0
- package/dist/migrations/postgresql/0008_dynamic_components.sql +37 -0
- package/dist/migrations/postgresql/0009_user_management_tables.sql +95 -0
- package/dist/migrations/postgresql/0010_api_keys.sql +34 -0
- package/dist/migrations/postgresql/0011_general_settings.sql +20 -0
- package/dist/migrations/postgresql/0012_site_settings_logo_url.sql +9 -0
- package/dist/migrations/postgresql/0013_activity_log.sql +29 -0
- package/dist/migrations/postgresql/0014_image_sizes_and_focal_point.sql +33 -0
- package/dist/migrations/postgresql/0014_site_settings_sidebar.sql +13 -0
- package/dist/migrations/postgresql/0015_user_brute_force_protection.sql +29 -0
- package/dist/migrations/postgresql/0016_email_template_attachments.sql +12 -0
- package/dist/migrations/postgresql/0017_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/postgresql/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/postgresql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/postgresql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/postgresql/20260504_000000_nextly_meta.sql +22 -0
- package/dist/migrations/postgresql/meta/0000_snapshot.json +1286 -0
- package/dist/migrations/postgresql/meta/0001_snapshot.json +1407 -0
- package/dist/migrations/postgresql/meta/0002_snapshot.json +1552 -0
- package/dist/migrations/postgresql/meta/0003_snapshot.json +1695 -0
- package/dist/migrations/postgresql/meta/0010_snapshot.json +2345 -0
- package/dist/migrations/postgresql/meta/_journal.json +90 -0
- package/dist/migrations/sqlite/0000_api_keys.sql +34 -0
- package/dist/migrations/sqlite/0001_general_settings.sql +20 -0
- package/dist/migrations/sqlite/0002_site_settings_logo_url.sql +9 -0
- package/dist/migrations/sqlite/0003_activity_log.sql +29 -0
- package/dist/migrations/sqlite/0004_image_sizes_and_focal_point.sql +29 -0
- package/dist/migrations/sqlite/0004_site_settings_sidebar.sql +11 -0
- package/dist/migrations/sqlite/0005_user_brute_force_protection.sql +29 -0
- package/dist/migrations/sqlite/0006_email_template_attachments.sql +12 -0
- package/dist/migrations/sqlite/0007_media_uploaded_by_nullable.sql +111 -0
- package/dist/migrations/sqlite/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/sqlite/20260501_000000_journal_batch.sql +19 -0
- package/dist/migrations/sqlite/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/sqlite/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/sqlite/20260505_000000_user_management_tables.sql +77 -0
- package/dist/next.d.ts +57 -0
- package/dist/next.mjs +55 -0
- package/dist/observability/index.d.ts +87 -0
- package/dist/observability/index.mjs +57 -0
- package/dist/permissions-3DZZQZMI.mjs +39 -0
- package/dist/pipeline-YOML7SWF.mjs +29 -0
- package/dist/preview-ZZTR3QGS.mjs +9 -0
- package/dist/program-PW6UB2ZC.mjs +5934 -0
- package/dist/reconcile-single-tables-7ENVXJGB.mjs +7 -0
- package/dist/register-SF6E6FVU.mjs +49 -0
- package/dist/reload-config-HWQ4G5MM.mjs +23 -0
- package/dist/resolve-single-table-name-JSOMUB3R.mjs +7 -0
- package/dist/routeHandler-UNMMJIBM.mjs +77 -0
- package/dist/runtime-schema-generator-NRA6A6Z6.mjs +8 -0
- package/dist/runtime.d.ts +120 -0
- package/dist/runtime.mjs +73 -0
- package/dist/schema-hash-FMMG6VPJ.mjs +13 -0
- package/dist/schema-registry-EQ36FZDP.mjs +7 -0
- package/dist/scripts/load-env.mjs +42 -0
- package/dist/storage/index.d.ts +566 -0
- package/dist/storage/index.mjs +45 -0
- package/dist/super-admin-G5ZK5F4T.mjs +39 -0
- package/dist/system-table-service-WGSRVEGT.mjs +17 -0
- package/dist/users-7KELGRYJ.mjs +38 -0
- package/package.json +308 -9
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1336 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyDesiredSchema,
|
|
3
|
+
buildDesiredSchemaFromRegistry,
|
|
4
|
+
buildDesiredSchemaFromRegistryAsync
|
|
5
|
+
} from "./chunk-XGI4EMS3.mjs";
|
|
6
|
+
import {
|
|
7
|
+
RESERVED_SINGLE_SLUGS,
|
|
8
|
+
array,
|
|
9
|
+
assertValidSingleConfig,
|
|
10
|
+
checkbox,
|
|
11
|
+
chips,
|
|
12
|
+
code,
|
|
13
|
+
component,
|
|
14
|
+
date,
|
|
15
|
+
defineCollection,
|
|
16
|
+
defineComponent,
|
|
17
|
+
defineSingle,
|
|
18
|
+
email,
|
|
19
|
+
group,
|
|
20
|
+
json,
|
|
21
|
+
number,
|
|
22
|
+
option,
|
|
23
|
+
password,
|
|
24
|
+
radio,
|
|
25
|
+
relationship,
|
|
26
|
+
repeater,
|
|
27
|
+
richText,
|
|
28
|
+
select,
|
|
29
|
+
text,
|
|
30
|
+
textarea,
|
|
31
|
+
upload,
|
|
32
|
+
validateSingleConfig
|
|
33
|
+
} from "./chunk-WD34YQ6T.mjs";
|
|
34
|
+
import {
|
|
35
|
+
ALLOWED_USER_FIELD_TYPES,
|
|
36
|
+
RESERVED_USER_FIELD_NAMES,
|
|
37
|
+
assertValidUserConfig,
|
|
38
|
+
defineConfig,
|
|
39
|
+
validateUserConfig
|
|
40
|
+
} from "./chunk-GDBJ5JCU.mjs";
|
|
41
|
+
import {
|
|
42
|
+
ApiKeyTokenTypeSchema,
|
|
43
|
+
CreateApiKeySchema,
|
|
44
|
+
ExpiresInSchema,
|
|
45
|
+
UpdateApiKeySchema
|
|
46
|
+
} from "./chunk-YZZCTONM.mjs";
|
|
47
|
+
import {
|
|
48
|
+
InMemoryRateLimitStore,
|
|
49
|
+
createRateLimitHeaders,
|
|
50
|
+
createRateLimiter
|
|
51
|
+
} from "./chunk-ERCNLX3V.mjs";
|
|
52
|
+
import {
|
|
53
|
+
getTrustedClientIp,
|
|
54
|
+
parseTrustedProxyIpsEnv
|
|
55
|
+
} from "./chunk-APKKRD2G.mjs";
|
|
56
|
+
import "./chunk-VWF3JO32.mjs";
|
|
57
|
+
import {
|
|
58
|
+
createRegister,
|
|
59
|
+
getCachedNextly,
|
|
60
|
+
getNextly,
|
|
61
|
+
nextly,
|
|
62
|
+
shutdownNextly
|
|
63
|
+
} from "./chunk-P7NH2OSC.mjs";
|
|
64
|
+
import "./chunk-2OALJTK6.mjs";
|
|
65
|
+
import "./chunk-VJ66NCL4.mjs";
|
|
66
|
+
import "./chunk-R6JJQHFC.mjs";
|
|
67
|
+
import "./chunk-X23WKS3Z.mjs";
|
|
68
|
+
import {
|
|
69
|
+
ExternalUrlError,
|
|
70
|
+
clearServices,
|
|
71
|
+
createPluginContext,
|
|
72
|
+
definePlugin,
|
|
73
|
+
getService,
|
|
74
|
+
isServicesRegistered,
|
|
75
|
+
registerServices,
|
|
76
|
+
safeFetch,
|
|
77
|
+
shutdownServices,
|
|
78
|
+
validateExternalUrl
|
|
79
|
+
} from "./chunk-X7TXCYYN.mjs";
|
|
80
|
+
import "./chunk-YZNBLFIW.mjs";
|
|
81
|
+
import {
|
|
82
|
+
MAX_COMPONENT_NESTING_DEPTH,
|
|
83
|
+
RESERVED_COMPONENT_SLUGS,
|
|
84
|
+
RESERVED_SLUGS,
|
|
85
|
+
SQL_RESERVED_KEYWORDS,
|
|
86
|
+
assertValidCollectionConfig,
|
|
87
|
+
assertValidComponentConfig,
|
|
88
|
+
validateCollectionConfig,
|
|
89
|
+
validateComponentConfig
|
|
90
|
+
} from "./chunk-FQULBZ53.mjs";
|
|
91
|
+
import {
|
|
92
|
+
AssignPermissionToRoleSchema,
|
|
93
|
+
AssignRoleToUserSchema,
|
|
94
|
+
CheckUserPermissionSchema,
|
|
95
|
+
CollectionFileManager,
|
|
96
|
+
CollectionService,
|
|
97
|
+
CollectionsHandler,
|
|
98
|
+
CreateLocalUserSchema,
|
|
99
|
+
CreatePermissionSchema,
|
|
100
|
+
CreateRoleInheritanceSchema,
|
|
101
|
+
CreateRoleSchema,
|
|
102
|
+
CreateUserWithPasswordSchema,
|
|
103
|
+
DeletePermissionSchema,
|
|
104
|
+
DeleteRoleInheritanceSchema,
|
|
105
|
+
DeleteRoleSchema,
|
|
106
|
+
DeleteUserAccountSchema,
|
|
107
|
+
DeleteUserResponseSchema,
|
|
108
|
+
DeleteUserSchema,
|
|
109
|
+
DynamicCollectionService,
|
|
110
|
+
GetPermissionByIdSchema,
|
|
111
|
+
GetRoleByIdSchema,
|
|
112
|
+
GetRolePermissionsSchema,
|
|
113
|
+
GetUserByIdSchema,
|
|
114
|
+
GetUserPermissionsSchema,
|
|
115
|
+
GetUserRolesSchema,
|
|
116
|
+
HookRegistry,
|
|
117
|
+
IdSchema,
|
|
118
|
+
ListUsersSchema,
|
|
119
|
+
MediaService2 as MediaService,
|
|
120
|
+
MinimalUserSchema,
|
|
121
|
+
PAGINATION_DEFAULTS,
|
|
122
|
+
PermissionActionSchema,
|
|
123
|
+
PermissionCheckResponseSchema,
|
|
124
|
+
PermissionListResponseSchema,
|
|
125
|
+
PermissionResourceSchema,
|
|
126
|
+
PermissionSchema,
|
|
127
|
+
RemovePermissionFromRoleSchema,
|
|
128
|
+
RemoveRoleFromUserSchema,
|
|
129
|
+
RoleInheritanceSchema,
|
|
130
|
+
RoleListResponseSchema,
|
|
131
|
+
RolePermissionListResponseSchema,
|
|
132
|
+
RolePermissionSchema,
|
|
133
|
+
RoleSchema,
|
|
134
|
+
SYSTEM_CONTEXT,
|
|
135
|
+
SYSTEM_RESOURCES,
|
|
136
|
+
ServiceContainer,
|
|
137
|
+
ServiceDispatcher,
|
|
138
|
+
UnlinkAccountResponseSchema,
|
|
139
|
+
UnlinkAccountSchema,
|
|
140
|
+
UpdatePasswordSchema,
|
|
141
|
+
UpdatePermissionSchema,
|
|
142
|
+
UpdateRoleSchema,
|
|
143
|
+
UpdateUserSchema,
|
|
144
|
+
UserAccountSchema,
|
|
145
|
+
UserIdSchema,
|
|
146
|
+
UserListResponseSchema,
|
|
147
|
+
UserResponseSchema,
|
|
148
|
+
UserRoleListResponseSchema,
|
|
149
|
+
UserRoleSchema,
|
|
150
|
+
UserService,
|
|
151
|
+
buildPaginatedResponse,
|
|
152
|
+
calculateOffset,
|
|
153
|
+
clampLimit,
|
|
154
|
+
consoleLogger,
|
|
155
|
+
getHookRegistry,
|
|
156
|
+
isSystemResource,
|
|
157
|
+
isValidResource,
|
|
158
|
+
resetHookRegistry
|
|
159
|
+
} from "./chunk-NSEFNNU4.mjs";
|
|
160
|
+
import "./chunk-3FA7FKAV.mjs";
|
|
161
|
+
import "./chunk-AGJ6F2T3.mjs";
|
|
162
|
+
import "./chunk-KIMNCZGV.mjs";
|
|
163
|
+
import "./chunk-AK6Z23OX.mjs";
|
|
164
|
+
import "./chunk-INV7QKLG.mjs";
|
|
165
|
+
import "./chunk-GZ6DCQKC.mjs";
|
|
166
|
+
import "./chunk-SBACDPNX.mjs";
|
|
167
|
+
import "./chunk-RJLLGGPG.mjs";
|
|
168
|
+
import "./chunk-V4EQTOA4.mjs";
|
|
169
|
+
import "./chunk-I4JMR3UR.mjs";
|
|
170
|
+
import "./chunk-XZKLBMN6.mjs";
|
|
171
|
+
import "./chunk-IZWPRDC3.mjs";
|
|
172
|
+
import "./chunk-DNNG377Z.mjs";
|
|
173
|
+
import "./chunk-5HMZ644B.mjs";
|
|
174
|
+
import {
|
|
175
|
+
BulkOperationResponseSchema,
|
|
176
|
+
BulkOperationSchema,
|
|
177
|
+
DateRangeSchema,
|
|
178
|
+
EmailSchema,
|
|
179
|
+
ErrorResponseSchema,
|
|
180
|
+
FileUploadSchema,
|
|
181
|
+
ImageUploadSchema,
|
|
182
|
+
PaginatedResponseSchema,
|
|
183
|
+
PaginationSchema,
|
|
184
|
+
PasswordSchema,
|
|
185
|
+
PhoneSchema,
|
|
186
|
+
SearchSchema,
|
|
187
|
+
SortOrderSchema,
|
|
188
|
+
SortSchema,
|
|
189
|
+
SuccessResponseSchema,
|
|
190
|
+
UrlSchema,
|
|
191
|
+
ValidationErrorSchema
|
|
192
|
+
} from "./chunk-W5KKPZT5.mjs";
|
|
193
|
+
import "./chunk-56WO4WX7.mjs";
|
|
194
|
+
import "./chunk-2W3DVD7S.mjs";
|
|
195
|
+
import {
|
|
196
|
+
dynamicComponentsMysql,
|
|
197
|
+
dynamicComponentsPg,
|
|
198
|
+
dynamicComponentsSqlite,
|
|
199
|
+
getDialectTables,
|
|
200
|
+
schema_exports,
|
|
201
|
+
withDbErrors
|
|
202
|
+
} from "./chunk-TS7GHTG2.mjs";
|
|
203
|
+
import "./chunk-H26B4FYG.mjs";
|
|
204
|
+
import {
|
|
205
|
+
checkAdapterHealth,
|
|
206
|
+
createAdapter,
|
|
207
|
+
createAdapterFromEnv,
|
|
208
|
+
validateDatabaseEnv
|
|
209
|
+
} from "./chunk-DP3G27G5.mjs";
|
|
210
|
+
import "./chunk-DV6WVX2Q.mjs";
|
|
211
|
+
import {
|
|
212
|
+
env
|
|
213
|
+
} from "./chunk-UJ2IMJ4W.mjs";
|
|
214
|
+
import "./chunk-EGXBZCGC.mjs";
|
|
215
|
+
import "./chunk-G2AA4QLC.mjs";
|
|
216
|
+
import "./chunk-4MJLT6PZ.mjs";
|
|
217
|
+
import "./chunk-IUDOC7N7.mjs";
|
|
218
|
+
import {
|
|
219
|
+
healthCheck
|
|
220
|
+
} from "./chunk-LAZXX4HR.mjs";
|
|
221
|
+
import {
|
|
222
|
+
Container,
|
|
223
|
+
container
|
|
224
|
+
} from "./chunk-D5HQBNUB.mjs";
|
|
225
|
+
import {
|
|
226
|
+
DbError,
|
|
227
|
+
NextlyError,
|
|
228
|
+
isDbError,
|
|
229
|
+
toDbError
|
|
230
|
+
} from "./chunk-NRUWQ5Z7.mjs";
|
|
231
|
+
import "./chunk-VTJADRO3.mjs";
|
|
232
|
+
import {
|
|
233
|
+
ALL_FIELD_TYPES,
|
|
234
|
+
DATA_FIELD_TYPES,
|
|
235
|
+
VIRTUAL_FIELD_TYPES,
|
|
236
|
+
hasNestedFields,
|
|
237
|
+
isCheckboxField,
|
|
238
|
+
isChipsField,
|
|
239
|
+
isCodeField,
|
|
240
|
+
isComponentField,
|
|
241
|
+
isDataField,
|
|
242
|
+
isDateField,
|
|
243
|
+
isEmailField,
|
|
244
|
+
isGroupField,
|
|
245
|
+
isJSONField,
|
|
246
|
+
isNumberField,
|
|
247
|
+
isPasswordField,
|
|
248
|
+
isRadioField,
|
|
249
|
+
isRelationalField,
|
|
250
|
+
isRelationshipField,
|
|
251
|
+
isRepeaterField,
|
|
252
|
+
isRichTextField,
|
|
253
|
+
isSelectField,
|
|
254
|
+
isTextField,
|
|
255
|
+
isTextareaField,
|
|
256
|
+
isUploadField
|
|
257
|
+
} from "./chunk-5APFUGAD.mjs";
|
|
258
|
+
import "./chunk-7P6ASYW6.mjs";
|
|
259
|
+
|
|
260
|
+
// src/schemas/dynamic-collections.ts
|
|
261
|
+
import {
|
|
262
|
+
pgTable,
|
|
263
|
+
uuid,
|
|
264
|
+
varchar,
|
|
265
|
+
text as text2,
|
|
266
|
+
jsonb,
|
|
267
|
+
timestamp
|
|
268
|
+
} from "drizzle-orm/pg-core";
|
|
269
|
+
var dynamicCollections = pgTable("dynamic_collections", {
|
|
270
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
271
|
+
name: varchar("name", { length: 255 }).unique().notNull(),
|
|
272
|
+
label: varchar("label", { length: 255 }).notNull(),
|
|
273
|
+
tableName: varchar("table_name", { length: 255 }).unique().notNull(),
|
|
274
|
+
description: text2("description"),
|
|
275
|
+
icon: varchar("icon", { length: 50 }),
|
|
276
|
+
schemaDefinition: jsonb("schema_definition").$type().notNull(),
|
|
277
|
+
createdBy: uuid("created_by"),
|
|
278
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
279
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// src/schemas/dynamic-components/types.ts
|
|
283
|
+
var COMPONENT_SOURCE_TYPES = [
|
|
284
|
+
"code",
|
|
285
|
+
"ui"
|
|
286
|
+
];
|
|
287
|
+
var COMPONENT_MIGRATION_STATUSES = ["synced", "pending", "generated", "applied", "failed"];
|
|
288
|
+
|
|
289
|
+
// src/schemas/migrations/postgres.ts
|
|
290
|
+
import { sql } from "drizzle-orm";
|
|
291
|
+
import {
|
|
292
|
+
pgTable as pgTable2,
|
|
293
|
+
uuid as uuid2,
|
|
294
|
+
text as text3,
|
|
295
|
+
char,
|
|
296
|
+
integer,
|
|
297
|
+
timestamp as timestamp2,
|
|
298
|
+
jsonb as jsonb2,
|
|
299
|
+
index,
|
|
300
|
+
check
|
|
301
|
+
} from "drizzle-orm/pg-core";
|
|
302
|
+
var nextlyMigrationsPg = pgTable2(
|
|
303
|
+
"nextly_migrations",
|
|
304
|
+
{
|
|
305
|
+
/** UUID v4, generated server-side. */
|
|
306
|
+
id: uuid2("id").primaryKey().defaultRandom(),
|
|
307
|
+
/**
|
|
308
|
+
* Migration filename (without directory). Unique.
|
|
309
|
+
*
|
|
310
|
+
* @example "20260429_154500_123_add_excerpt.sql"
|
|
311
|
+
*/
|
|
312
|
+
filename: text3("filename").notNull().unique(),
|
|
313
|
+
/**
|
|
314
|
+
* SHA-256 of the .sql file content as written. 64 hex chars.
|
|
315
|
+
* Used by `nextly migrate` to detect tampering on subsequent runs
|
|
316
|
+
* and by `nextly migrate:check` (via the paired snapshot file).
|
|
317
|
+
*/
|
|
318
|
+
sha256: char("sha256", { length: 64 }).notNull(),
|
|
319
|
+
/**
|
|
320
|
+
* When the migration was applied to this database. Timezone-aware
|
|
321
|
+
* for cross-region operator clarity.
|
|
322
|
+
*/
|
|
323
|
+
appliedAt: timestamp2("applied_at", { withTimezone: true }).notNull().defaultNow(),
|
|
324
|
+
/**
|
|
325
|
+
* Who/what ran the migration. Resolved by the CLI from
|
|
326
|
+
* `NEXTLY_APPLIED_BY` → `GITHUB_ACTOR` → `USER` → hostname.
|
|
327
|
+
*/
|
|
328
|
+
appliedBy: text3("applied_by"),
|
|
329
|
+
/** Wall-clock duration of the apply, in milliseconds. */
|
|
330
|
+
durationMs: integer("duration_ms"),
|
|
331
|
+
/**
|
|
332
|
+
* Apply outcome. Only `'applied'` or `'failed'`; rows are inserted
|
|
333
|
+
* only after the attempt completes. CHECK constraint enforces this.
|
|
334
|
+
*/
|
|
335
|
+
status: text3("status").notNull().$type(),
|
|
336
|
+
/**
|
|
337
|
+
* Structured error info on failure. Shape:
|
|
338
|
+
* `{ sqlState?: string; statement?: string; message: string }`.
|
|
339
|
+
* NULL on success.
|
|
340
|
+
*/
|
|
341
|
+
errorJson: jsonb2("error_json"),
|
|
342
|
+
/**
|
|
343
|
+
* Reserved for v2 corrective-rollback feature. Always NULL in v1.
|
|
344
|
+
* Column exists so future ALTER TABLE ADDs from F15 don't conflict.
|
|
345
|
+
*/
|
|
346
|
+
rollbackSql: text3("rollback_sql")
|
|
347
|
+
},
|
|
348
|
+
(table) => [
|
|
349
|
+
/** Most-recent-first queries on the operator dashboard. */
|
|
350
|
+
index("nextly_migrations_applied_at_idx").on(table.appliedAt),
|
|
351
|
+
/** Enforce the two-state lifecycle at the DB level. */
|
|
352
|
+
check(
|
|
353
|
+
"nextly_migrations_status_check",
|
|
354
|
+
sql`${table.status} IN ('applied', 'failed')`
|
|
355
|
+
)
|
|
356
|
+
]
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
// src/schemas/migrations/mysql.ts
|
|
360
|
+
import { sql as sql2 } from "drizzle-orm";
|
|
361
|
+
import {
|
|
362
|
+
mysqlTable,
|
|
363
|
+
varchar as varchar2,
|
|
364
|
+
char as char2,
|
|
365
|
+
int,
|
|
366
|
+
datetime,
|
|
367
|
+
text as text4,
|
|
368
|
+
json as json2,
|
|
369
|
+
index as index2,
|
|
370
|
+
check as check2
|
|
371
|
+
} from "drizzle-orm/mysql-core";
|
|
372
|
+
var nextlyMigrationsMysql = mysqlTable(
|
|
373
|
+
"nextly_migrations",
|
|
374
|
+
{
|
|
375
|
+
/** UUID v4, generated client-side for cross-dialect parity. */
|
|
376
|
+
id: varchar2("id", { length: 36 }).primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
377
|
+
/**
|
|
378
|
+
* Migration filename (without directory). Unique.
|
|
379
|
+
*
|
|
380
|
+
* @example "20260429_154500_123_add_excerpt.sql"
|
|
381
|
+
*/
|
|
382
|
+
filename: varchar2("filename", { length: 512 }).notNull().unique(),
|
|
383
|
+
/** SHA-256 of the .sql file content. 64 hex chars. */
|
|
384
|
+
sha256: char2("sha256", { length: 64 }).notNull(),
|
|
385
|
+
/**
|
|
386
|
+
* When the migration was applied. Stored as DATETIME (UTC by app
|
|
387
|
+
* convention; MySQL has no native timestamptz).
|
|
388
|
+
*/
|
|
389
|
+
appliedAt: datetime("applied_at").notNull().$defaultFn(() => /* @__PURE__ */ new Date()),
|
|
390
|
+
/** Resolved CLI actor (NEXTLY_APPLIED_BY / GITHUB_ACTOR / USER / host). */
|
|
391
|
+
appliedBy: varchar2("applied_by", { length: 255 }),
|
|
392
|
+
/** Wall-clock apply duration in milliseconds. */
|
|
393
|
+
durationMs: int("duration_ms"),
|
|
394
|
+
/**
|
|
395
|
+
* Apply outcome. CHECK constraint enforces two-state lifecycle
|
|
396
|
+
* on MySQL 8.0.16+.
|
|
397
|
+
*/
|
|
398
|
+
status: varchar2("status", { length: 20 }).notNull().$type(),
|
|
399
|
+
/**
|
|
400
|
+
* Structured error JSON on failure. Shape:
|
|
401
|
+
* `{ sqlState?: string; statement?: string; message: string }`.
|
|
402
|
+
*/
|
|
403
|
+
errorJson: json2("error_json"),
|
|
404
|
+
/** Reserved for v2 corrective-rollback feature. Always NULL in v1. */
|
|
405
|
+
rollbackSql: text4("rollback_sql")
|
|
406
|
+
},
|
|
407
|
+
(table) => [
|
|
408
|
+
index2("nextly_migrations_applied_at_idx").on(table.appliedAt),
|
|
409
|
+
check2(
|
|
410
|
+
"nextly_migrations_status_check",
|
|
411
|
+
sql2`${table.status} IN ('applied', 'failed')`
|
|
412
|
+
)
|
|
413
|
+
]
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
// src/schemas/migrations/sqlite.ts
|
|
417
|
+
import { sql as sql3 } from "drizzle-orm";
|
|
418
|
+
import {
|
|
419
|
+
sqliteTable,
|
|
420
|
+
text as text5,
|
|
421
|
+
integer as integer2,
|
|
422
|
+
index as index3,
|
|
423
|
+
check as check3
|
|
424
|
+
} from "drizzle-orm/sqlite-core";
|
|
425
|
+
var nextlyMigrationsSqlite = sqliteTable(
|
|
426
|
+
"nextly_migrations",
|
|
427
|
+
{
|
|
428
|
+
/** UUID v4, generated client-side. */
|
|
429
|
+
id: text5("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
|
|
430
|
+
/**
|
|
431
|
+
* Migration filename (without directory). Unique.
|
|
432
|
+
*
|
|
433
|
+
* @example "20260429_154500_123_add_excerpt.sql"
|
|
434
|
+
*/
|
|
435
|
+
filename: text5("filename").notNull().unique(),
|
|
436
|
+
/** SHA-256 of the .sql file content. 64 hex chars. */
|
|
437
|
+
sha256: text5("sha256").notNull(),
|
|
438
|
+
/**
|
|
439
|
+
* When the migration was applied. Stored as INTEGER (ms-since-epoch)
|
|
440
|
+
* for sub-second precision and easy ordering.
|
|
441
|
+
*/
|
|
442
|
+
appliedAt: integer2("applied_at", { mode: "timestamp_ms" }).notNull().$defaultFn(() => /* @__PURE__ */ new Date()),
|
|
443
|
+
/** Resolved CLI actor. */
|
|
444
|
+
appliedBy: text5("applied_by"),
|
|
445
|
+
/** Wall-clock apply duration in milliseconds. */
|
|
446
|
+
durationMs: integer2("duration_ms"),
|
|
447
|
+
/**
|
|
448
|
+
* Apply outcome. CHECK constraint enforces two-state lifecycle.
|
|
449
|
+
*/
|
|
450
|
+
status: text5("status").notNull().$type(),
|
|
451
|
+
/**
|
|
452
|
+
* Structured error JSON on failure (stored as TEXT; JSON.parse
|
|
453
|
+
* on read). Shape:
|
|
454
|
+
* `{ sqlState?: string; statement?: string; message: string }`.
|
|
455
|
+
*/
|
|
456
|
+
errorJson: text5("error_json"),
|
|
457
|
+
/** Reserved for v2 corrective-rollback feature. Always NULL in v1. */
|
|
458
|
+
rollbackSql: text5("rollback_sql")
|
|
459
|
+
},
|
|
460
|
+
(table) => [
|
|
461
|
+
index3("nextly_migrations_applied_at_idx").on(table.appliedAt),
|
|
462
|
+
check3(
|
|
463
|
+
"nextly_migrations_status_check",
|
|
464
|
+
sql3`${table.status} IN ('applied', 'failed')`
|
|
465
|
+
)
|
|
466
|
+
]
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
// src/schemas/security-config.ts
|
|
470
|
+
import { z } from "zod";
|
|
471
|
+
var SecurityHeadersConfigSchema = z.object({
|
|
472
|
+
/**
|
|
473
|
+
* Default is a restrictive policy that still lets
|
|
474
|
+
* a self-hosted admin SPA run. See `SecurityHeadersConfig.contentSecurityPolicy`
|
|
475
|
+
* in `middleware/security-headers.ts` for the full default + override docs.
|
|
476
|
+
*/
|
|
477
|
+
contentSecurityPolicy: z.union([z.string(), z.literal(false)]).optional(),
|
|
478
|
+
/** @default "nosniff" */
|
|
479
|
+
xContentTypeOptions: z.union([z.string(), z.literal(false)]).optional(),
|
|
480
|
+
/** @default "DENY" */
|
|
481
|
+
xFrameOptions: z.union([z.string(), z.literal(false)]).optional(),
|
|
482
|
+
/** @default "max-age=31536000; includeSubDomains" (production only) */
|
|
483
|
+
strictTransportSecurity: z.union([z.string(), z.literal(false)]).optional(),
|
|
484
|
+
/** @default "strict-origin-when-cross-origin" */
|
|
485
|
+
referrerPolicy: z.union([z.string(), z.literal(false)]).optional(),
|
|
486
|
+
/** @default "camera=(), microphone=(), geolocation=()" */
|
|
487
|
+
permissionsPolicy: z.union([z.string(), z.literal(false)]).optional()
|
|
488
|
+
});
|
|
489
|
+
var CorsConfigSchema = z.object({
|
|
490
|
+
/**
|
|
491
|
+
* Allowed origins. Empty array = same-origin only.
|
|
492
|
+
* Use `['*']` for wide-open access (development only).
|
|
493
|
+
* @default []
|
|
494
|
+
*/
|
|
495
|
+
origin: z.array(z.string()).optional(),
|
|
496
|
+
/**
|
|
497
|
+
* Allowed HTTP methods.
|
|
498
|
+
* @default ["GET", "POST", "PATCH", "DELETE", "OPTIONS"]
|
|
499
|
+
*/
|
|
500
|
+
methods: z.array(z.string()).optional(),
|
|
501
|
+
/**
|
|
502
|
+
* Headers the client is allowed to send.
|
|
503
|
+
* @default ["Content-Type", "Authorization"]
|
|
504
|
+
*/
|
|
505
|
+
allowedHeaders: z.array(z.string()).optional(),
|
|
506
|
+
/**
|
|
507
|
+
* Headers exposed to the client in the response.
|
|
508
|
+
* @default ["X-RateLimit-Limit", "X-RateLimit-Remaining", "X-RateLimit-Reset"]
|
|
509
|
+
*/
|
|
510
|
+
exposedHeaders: z.array(z.string()).optional(),
|
|
511
|
+
/**
|
|
512
|
+
* Whether to include credentials (cookies, Authorization header).
|
|
513
|
+
* Ignored when origin is `['*']` (CORS spec prohibits credentials with wildcard).
|
|
514
|
+
* @default true
|
|
515
|
+
*/
|
|
516
|
+
credentials: z.boolean().optional(),
|
|
517
|
+
/**
|
|
518
|
+
* Preflight cache duration in seconds.
|
|
519
|
+
* @default 86400 (24 hours)
|
|
520
|
+
*/
|
|
521
|
+
maxAge: z.number().int().nonnegative().optional()
|
|
522
|
+
});
|
|
523
|
+
var UploadSecurityConfigSchema = z.object({
|
|
524
|
+
/**
|
|
525
|
+
* Additional MIME types to allow beyond the defaults. Merged with the
|
|
526
|
+
* default allowlist. Use with caution.
|
|
527
|
+
*/
|
|
528
|
+
additionalMimeTypes: z.array(z.string()).optional(),
|
|
529
|
+
/**
|
|
530
|
+
* Override the default MIME allowlist entirely. Blocked types
|
|
531
|
+
* (HTML, JS) are still rejected regardless of this setting.
|
|
532
|
+
*/
|
|
533
|
+
allowedMimeTypes: z.array(z.string()).optional(),
|
|
534
|
+
/**
|
|
535
|
+
* Serve SVG files with a restrictive CSP (`script-src 'none'`).
|
|
536
|
+
* @default true
|
|
537
|
+
*/
|
|
538
|
+
svgCsp: z.boolean().optional()
|
|
539
|
+
});
|
|
540
|
+
var SanitizationConfigSchema = z.object({
|
|
541
|
+
/**
|
|
542
|
+
* Master toggle for the sanitization hook.
|
|
543
|
+
* @default true
|
|
544
|
+
*/
|
|
545
|
+
enabled: z.boolean().optional(),
|
|
546
|
+
/**
|
|
547
|
+
* Strip HTML tags from plain-text fields (text, textarea, email).
|
|
548
|
+
* @default true
|
|
549
|
+
*/
|
|
550
|
+
stripHtmlFromText: z.boolean().optional(),
|
|
551
|
+
/**
|
|
552
|
+
* Validate CSS values in rich text (bgColor, textColor, inline styles).
|
|
553
|
+
* @default true
|
|
554
|
+
*/
|
|
555
|
+
validateCssValues: z.boolean().optional(),
|
|
556
|
+
/**
|
|
557
|
+
* Block dangerous URL protocols (javascript:, data:, vbscript:) in rich text.
|
|
558
|
+
* @default true
|
|
559
|
+
*/
|
|
560
|
+
validateUrlProtocols: z.boolean().optional()
|
|
561
|
+
});
|
|
562
|
+
var SecurityLimitsConfigSchema = z.object({
|
|
563
|
+
/** Max `application/json` body size. @default "1mb" */
|
|
564
|
+
json: z.union([z.string(), z.number().int().positive()]).optional(),
|
|
565
|
+
/** Max total `multipart/form-data` body size. @default "50mb" */
|
|
566
|
+
multipart: z.union([z.string(), z.number().int().positive()]).optional(),
|
|
567
|
+
/** Per-file size cap inside multipart uploads. @default "10mb" */
|
|
568
|
+
fileSize: z.union([z.string(), z.number().int().positive()]).optional(),
|
|
569
|
+
/** Max files per multipart request. @default 10 */
|
|
570
|
+
fileCount: z.number().int().positive().optional(),
|
|
571
|
+
/** Max non-file form fields per request. @default 50 */
|
|
572
|
+
fieldCount: z.number().int().positive().optional(),
|
|
573
|
+
/** Max size of a single non-file form field. @default "100kb" */
|
|
574
|
+
fieldSize: z.union([z.string(), z.number().int().positive()]).optional()
|
|
575
|
+
});
|
|
576
|
+
var AuthRateLimitConfigSchema = z.object({
|
|
577
|
+
/** Max auth-write requests per IP per window. Set to `0` to disable. @default 30 */
|
|
578
|
+
requestsPerHour: z.number().int().nonnegative().optional(),
|
|
579
|
+
/** Sliding window duration in ms. @default 3_600_000 (1 hour) */
|
|
580
|
+
windowMs: z.number().int().positive().optional()
|
|
581
|
+
});
|
|
582
|
+
var SecurityConfigSchema = z.object({
|
|
583
|
+
headers: SecurityHeadersConfigSchema.optional(),
|
|
584
|
+
cors: CorsConfigSchema.optional(),
|
|
585
|
+
uploads: UploadSecurityConfigSchema.optional(),
|
|
586
|
+
sanitization: SanitizationConfigSchema.optional(),
|
|
587
|
+
limits: SecurityLimitsConfigSchema.optional(),
|
|
588
|
+
authRateLimit: AuthRateLimitConfigSchema.optional(),
|
|
589
|
+
/**
|
|
590
|
+
* When the application sits behind a reverse proxy (Vercel, Cloudflare,
|
|
591
|
+
* Nginx, ALB, etc.), set this to `true` so client-IP resolution honors
|
|
592
|
+
* `X-Forwarded-For`. Pair with the `TRUSTED_PROXY_IPS` env var (a
|
|
593
|
+
* comma-separated CIDR list of your proxy fleet) so the framework
|
|
594
|
+
* can identify which hops in the chain are proxies vs the real client.
|
|
595
|
+
*
|
|
596
|
+
* When `false` (default), proxy headers are ignored entirely. Use
|
|
597
|
+
* this when the application is exposed directly to clients with no
|
|
598
|
+
* trusted intermediary, or during local development.
|
|
599
|
+
*
|
|
600
|
+
* Audit: closes C4 (XFF blindly trusted across rate-limit / auth flows).
|
|
601
|
+
*
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
trustProxy: z.boolean().optional()
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
// src/index.ts
|
|
608
|
+
import { DrizzleAdapter } from "@nextlyhq/adapter-drizzle";
|
|
609
|
+
|
|
610
|
+
// src/hooks.ts
|
|
611
|
+
function registerHook(hookType, collection, handler) {
|
|
612
|
+
const registry = getHookRegistry();
|
|
613
|
+
registry.register(hookType, collection, handler);
|
|
614
|
+
}
|
|
615
|
+
function unregisterHook(hookType, collection, handler) {
|
|
616
|
+
const registry = getHookRegistry();
|
|
617
|
+
registry.unregister(hookType, collection, handler);
|
|
618
|
+
}
|
|
619
|
+
function clearAllHooks() {
|
|
620
|
+
const registry = getHookRegistry();
|
|
621
|
+
registry.clear();
|
|
622
|
+
}
|
|
623
|
+
function hasHooks(hookType, collection) {
|
|
624
|
+
const registry = getHookRegistry();
|
|
625
|
+
return registry.hasHooks(hookType, collection);
|
|
626
|
+
}
|
|
627
|
+
function getHookCount(hookType, collection) {
|
|
628
|
+
const registry = getHookRegistry();
|
|
629
|
+
return registry.getHookCount(hookType, collection);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// src/hooks/register-collection-hooks.ts
|
|
633
|
+
var HOOK_TYPE_MAPPINGS = {
|
|
634
|
+
beforeOperation: ["beforeOperation"],
|
|
635
|
+
beforeValidate: ["beforeCreate", "beforeUpdate"],
|
|
636
|
+
// Validate runs before create/update
|
|
637
|
+
beforeChange: ["beforeCreate", "beforeUpdate"],
|
|
638
|
+
afterChange: ["afterCreate", "afterUpdate"],
|
|
639
|
+
beforeRead: ["beforeRead"],
|
|
640
|
+
afterRead: ["afterRead"],
|
|
641
|
+
beforeDelete: ["beforeDelete"],
|
|
642
|
+
afterDelete: ["afterDelete"]
|
|
643
|
+
};
|
|
644
|
+
function registerCollectionHooks(collections, registry = getHookRegistry()) {
|
|
645
|
+
const result = {
|
|
646
|
+
collections: [],
|
|
647
|
+
totalHooks: 0,
|
|
648
|
+
details: []
|
|
649
|
+
};
|
|
650
|
+
for (const collection of collections) {
|
|
651
|
+
if (!collection.hooks) {
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
const collectionDetails = {
|
|
655
|
+
collection: collection.slug,
|
|
656
|
+
hooks: []
|
|
657
|
+
};
|
|
658
|
+
let collectionHookCount = 0;
|
|
659
|
+
for (const [hookKey, handlers] of Object.entries(collection.hooks)) {
|
|
660
|
+
if (!handlers || !Array.isArray(handlers) || handlers.length === 0) {
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
const hookTypes = HOOK_TYPE_MAPPINGS[hookKey];
|
|
664
|
+
if (!hookTypes) {
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
for (const hookType of hookTypes) {
|
|
668
|
+
for (const handler of handlers) {
|
|
669
|
+
registry.register(hookType, collection.slug, handler);
|
|
670
|
+
collectionHookCount++;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
collectionDetails.hooks.push({
|
|
674
|
+
type: hookKey,
|
|
675
|
+
count: handlers.length
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
if (collectionHookCount > 0) {
|
|
679
|
+
result.collections.push(collection.slug);
|
|
680
|
+
result.totalHooks += collectionHookCount;
|
|
681
|
+
result.details.push(collectionDetails);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return result;
|
|
685
|
+
}
|
|
686
|
+
function clearCollectionHooks(collectionSlug, registry = getHookRegistry()) {
|
|
687
|
+
registry.clearCollection(collectionSlug);
|
|
688
|
+
}
|
|
689
|
+
function reregisterCollectionHooks(collections, registry = getHookRegistry()) {
|
|
690
|
+
for (const collection of collections) {
|
|
691
|
+
registry.clearCollection(collection.slug);
|
|
692
|
+
}
|
|
693
|
+
return registerCollectionHooks(collections, registry);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// src/validation/types.ts
|
|
697
|
+
var VALIDATION_ERROR_CODES = [
|
|
698
|
+
"required",
|
|
699
|
+
"type_error",
|
|
700
|
+
"invalid_type",
|
|
701
|
+
"min_length",
|
|
702
|
+
"max_length",
|
|
703
|
+
"too_short",
|
|
704
|
+
"too_long",
|
|
705
|
+
"pattern",
|
|
706
|
+
"min_value",
|
|
707
|
+
"max_value",
|
|
708
|
+
"too_small",
|
|
709
|
+
"too_big",
|
|
710
|
+
"not_integer",
|
|
711
|
+
"not_finite",
|
|
712
|
+
"invalid_email",
|
|
713
|
+
"invalid_url",
|
|
714
|
+
"invalid_uuid",
|
|
715
|
+
"invalid_date",
|
|
716
|
+
"invalid_format",
|
|
717
|
+
"invalid_option",
|
|
718
|
+
"invalid_reference",
|
|
719
|
+
"invalid_enum",
|
|
720
|
+
"unique",
|
|
721
|
+
"duplicate",
|
|
722
|
+
"min_items",
|
|
723
|
+
"max_items",
|
|
724
|
+
"invalid_array",
|
|
725
|
+
"invalid_object",
|
|
726
|
+
"unknown_key",
|
|
727
|
+
"invalid_file_type",
|
|
728
|
+
"file_too_large",
|
|
729
|
+
"custom"
|
|
730
|
+
];
|
|
731
|
+
function isValidationErrorCode(code2) {
|
|
732
|
+
return VALIDATION_ERROR_CODES.includes(code2);
|
|
733
|
+
}
|
|
734
|
+
function isValidationError(obj) {
|
|
735
|
+
if (typeof obj !== "object" || obj === null) {
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
const error = obj;
|
|
739
|
+
return typeof error.path === "string" && typeof error.message === "string" && typeof error.code === "string" && isValidationErrorCode(error.code);
|
|
740
|
+
}
|
|
741
|
+
function isValidationResult(obj) {
|
|
742
|
+
if (typeof obj !== "object" || obj === null) {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
const result = obj;
|
|
746
|
+
return typeof result.valid === "boolean" && Array.isArray(result.errors) && result.errors.every(isValidationError);
|
|
747
|
+
}
|
|
748
|
+
function createValidationError(path, code2, message, value) {
|
|
749
|
+
const error = {
|
|
750
|
+
path,
|
|
751
|
+
code: code2,
|
|
752
|
+
message
|
|
753
|
+
};
|
|
754
|
+
if (value !== void 0) {
|
|
755
|
+
error.value = value;
|
|
756
|
+
}
|
|
757
|
+
return error;
|
|
758
|
+
}
|
|
759
|
+
function validResult() {
|
|
760
|
+
return {
|
|
761
|
+
valid: true,
|
|
762
|
+
errors: []
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
function invalidResult(errors) {
|
|
766
|
+
return {
|
|
767
|
+
valid: false,
|
|
768
|
+
errors
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
function createValidationErrorResponse(errors, message = "Validation failed") {
|
|
772
|
+
return {
|
|
773
|
+
error: {
|
|
774
|
+
code: "VALIDATION_ERROR",
|
|
775
|
+
message,
|
|
776
|
+
details: errors
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// src/validation/error-formatter.ts
|
|
782
|
+
function getStringProp(obj, key) {
|
|
783
|
+
if (typeof obj === "object" && obj !== null && key in obj) {
|
|
784
|
+
const value = obj[key];
|
|
785
|
+
return typeof value === "string" ? value : void 0;
|
|
786
|
+
}
|
|
787
|
+
return void 0;
|
|
788
|
+
}
|
|
789
|
+
function mapZodCodeToValidationCode(issue) {
|
|
790
|
+
const code2 = issue.code;
|
|
791
|
+
switch (code2) {
|
|
792
|
+
// Type mismatch
|
|
793
|
+
case "invalid_type":
|
|
794
|
+
return "invalid_type";
|
|
795
|
+
// Size constraints - map based on the origin (type of value)
|
|
796
|
+
case "too_small": {
|
|
797
|
+
const origin = getStringProp(issue, "origin");
|
|
798
|
+
switch (origin) {
|
|
799
|
+
case "string":
|
|
800
|
+
return "min_length";
|
|
801
|
+
case "number":
|
|
802
|
+
case "bigint":
|
|
803
|
+
return "min_value";
|
|
804
|
+
case "repeater":
|
|
805
|
+
case "set":
|
|
806
|
+
return "min_items";
|
|
807
|
+
case "date":
|
|
808
|
+
return "invalid_date";
|
|
809
|
+
default:
|
|
810
|
+
return "too_small";
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
case "too_big": {
|
|
814
|
+
const origin = getStringProp(issue, "origin");
|
|
815
|
+
switch (origin) {
|
|
816
|
+
case "string":
|
|
817
|
+
return "max_length";
|
|
818
|
+
case "number":
|
|
819
|
+
case "bigint":
|
|
820
|
+
return "max_value";
|
|
821
|
+
case "repeater":
|
|
822
|
+
case "set":
|
|
823
|
+
return "max_items";
|
|
824
|
+
case "date":
|
|
825
|
+
return "invalid_date";
|
|
826
|
+
default:
|
|
827
|
+
return "too_big";
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
// String format validation - map based on the format type
|
|
831
|
+
case "invalid_format": {
|
|
832
|
+
const format = getStringProp(issue, "format");
|
|
833
|
+
switch (format) {
|
|
834
|
+
case "email":
|
|
835
|
+
return "invalid_email";
|
|
836
|
+
case "url":
|
|
837
|
+
return "invalid_url";
|
|
838
|
+
case "uuid":
|
|
839
|
+
return "invalid_uuid";
|
|
840
|
+
case "regex":
|
|
841
|
+
return "pattern";
|
|
842
|
+
case "datetime":
|
|
843
|
+
case "date":
|
|
844
|
+
case "time":
|
|
845
|
+
return "invalid_date";
|
|
846
|
+
default:
|
|
847
|
+
return "invalid_format";
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
// Invalid value (merged from literal and enum in v4)
|
|
851
|
+
case "invalid_value":
|
|
852
|
+
return "invalid_option";
|
|
853
|
+
// Union validation
|
|
854
|
+
case "invalid_union":
|
|
855
|
+
return "type_error";
|
|
856
|
+
// Object validation
|
|
857
|
+
case "unrecognized_keys":
|
|
858
|
+
return "unknown_key";
|
|
859
|
+
// Number validation
|
|
860
|
+
case "not_multiple_of":
|
|
861
|
+
return "custom";
|
|
862
|
+
// Record/Map key validation
|
|
863
|
+
case "invalid_key":
|
|
864
|
+
return "custom";
|
|
865
|
+
// Map/Set element validation
|
|
866
|
+
case "invalid_element":
|
|
867
|
+
return "custom";
|
|
868
|
+
// Custom validation
|
|
869
|
+
case "custom":
|
|
870
|
+
return "custom";
|
|
871
|
+
// Fallback for any unknown codes
|
|
872
|
+
default:
|
|
873
|
+
return "custom";
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
function formatZodError(error) {
|
|
877
|
+
return {
|
|
878
|
+
valid: false,
|
|
879
|
+
errors: error.issues.map(
|
|
880
|
+
(issue) => ({
|
|
881
|
+
path: issue.path.join("."),
|
|
882
|
+
message: issue.message,
|
|
883
|
+
code: mapZodCodeToValidationCode(issue)
|
|
884
|
+
// Note: value is intentionally omitted for security reasons
|
|
885
|
+
// Zod v4 has 'input' on issues but we don't expose it
|
|
886
|
+
})
|
|
887
|
+
)
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
function mergeValidationResults(...results) {
|
|
891
|
+
const errors = results.flatMap((r) => r.errors);
|
|
892
|
+
return {
|
|
893
|
+
valid: errors.length === 0,
|
|
894
|
+
errors
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
function toApiResponse(result) {
|
|
898
|
+
return {
|
|
899
|
+
error: {
|
|
900
|
+
code: "VALIDATION_ERROR",
|
|
901
|
+
message: `Validation failed with ${result.errors.length} error(s)`,
|
|
902
|
+
details: result.errors
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// src/plugins/admin-placement.ts
|
|
908
|
+
var AdminPlacement = {
|
|
909
|
+
/** Plugin items appear in the Collections sidebar section */
|
|
910
|
+
COLLECTIONS: "collections",
|
|
911
|
+
/** Plugin items appear in the Singles sidebar section */
|
|
912
|
+
SINGLES: "singles",
|
|
913
|
+
/** Plugin items appear in the Users inner sidebar (alongside Users, User Fields, Roles) */
|
|
914
|
+
USERS: "users",
|
|
915
|
+
/** Plugin items appear in the Settings inner sidebar (alongside General, API Keys, etc.) */
|
|
916
|
+
SETTINGS: "settings",
|
|
917
|
+
/** Plugin items appear in the dedicated Plugins sidebar section (default) */
|
|
918
|
+
PLUGINS: "plugins",
|
|
919
|
+
/** Plugin gets its own top-level icon in the sidebar (requires appearance.icon) */
|
|
920
|
+
STANDALONE: "standalone"
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
// src/collections/fields/validators/code-validators.ts
|
|
924
|
+
function validateJSON(value) {
|
|
925
|
+
if (!value || value.trim() === "") return true;
|
|
926
|
+
try {
|
|
927
|
+
JSON.parse(value);
|
|
928
|
+
return true;
|
|
929
|
+
} catch (error) {
|
|
930
|
+
if (error instanceof SyntaxError) {
|
|
931
|
+
const match = error.message.match(/position (\d+)/);
|
|
932
|
+
if (match) {
|
|
933
|
+
const position = parseInt(match[1]);
|
|
934
|
+
const lines = value.substring(0, position).split("\n");
|
|
935
|
+
const line = lines.length;
|
|
936
|
+
const column = lines[lines.length - 1].length + 1;
|
|
937
|
+
return `Invalid JSON at line ${line}, column ${column}: ${error.message}`;
|
|
938
|
+
}
|
|
939
|
+
return `Invalid JSON syntax: ${error.message}`;
|
|
940
|
+
}
|
|
941
|
+
return "Invalid JSON: Unable to parse";
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
function validateXML(value) {
|
|
945
|
+
if (!value || value.trim() === "") return true;
|
|
946
|
+
const tagStack = [];
|
|
947
|
+
const selfClosingTags = /* @__PURE__ */ new Set([
|
|
948
|
+
"br",
|
|
949
|
+
"hr",
|
|
950
|
+
"img",
|
|
951
|
+
"input",
|
|
952
|
+
"meta",
|
|
953
|
+
"link",
|
|
954
|
+
"area",
|
|
955
|
+
"base",
|
|
956
|
+
"col",
|
|
957
|
+
"embed",
|
|
958
|
+
"param",
|
|
959
|
+
"source",
|
|
960
|
+
"track",
|
|
961
|
+
"wbr"
|
|
962
|
+
]);
|
|
963
|
+
const tagRegex = /<\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*\/?>/g;
|
|
964
|
+
let match;
|
|
965
|
+
while ((match = tagRegex.exec(value)) !== null) {
|
|
966
|
+
const fullTag = match[0];
|
|
967
|
+
const tagName = match[1].toLowerCase();
|
|
968
|
+
if (fullTag.endsWith("/>") || selfClosingTags.has(tagName)) {
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
if (fullTag.startsWith("</")) {
|
|
972
|
+
if (tagStack.length === 0) {
|
|
973
|
+
return `Unexpected closing tag: </${tagName}>`;
|
|
974
|
+
}
|
|
975
|
+
const lastTag = tagStack.pop();
|
|
976
|
+
if (lastTag !== tagName) {
|
|
977
|
+
return `Mismatched tags: expected </${lastTag}>, found </${tagName}>`;
|
|
978
|
+
}
|
|
979
|
+
} else {
|
|
980
|
+
tagStack.push(tagName);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
if (tagStack.length > 0) {
|
|
984
|
+
return `Unclosed tags: ${tagStack.map((t) => `<${t}>`).join(", ")}`;
|
|
985
|
+
}
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
function validateJavaScript(value) {
|
|
989
|
+
if (!value || value.trim() === "") return true;
|
|
990
|
+
try {
|
|
991
|
+
new Function(value);
|
|
992
|
+
return true;
|
|
993
|
+
} catch (error) {
|
|
994
|
+
if (error instanceof SyntaxError) {
|
|
995
|
+
return `JavaScript syntax error: ${error.message}`;
|
|
996
|
+
}
|
|
997
|
+
return "Invalid JavaScript code";
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
function createSQLValidator(options = {}) {
|
|
1001
|
+
const {
|
|
1002
|
+
forbiddenCommands = [
|
|
1003
|
+
"DROP TABLE",
|
|
1004
|
+
"DROP DATABASE",
|
|
1005
|
+
"TRUNCATE",
|
|
1006
|
+
"DELETE FROM",
|
|
1007
|
+
"ALTER TABLE"
|
|
1008
|
+
],
|
|
1009
|
+
allowEmpty = true
|
|
1010
|
+
} = options;
|
|
1011
|
+
return (value) => {
|
|
1012
|
+
if (!value || value.trim() === "") {
|
|
1013
|
+
return allowEmpty ? true : "SQL query is required";
|
|
1014
|
+
}
|
|
1015
|
+
const upperValue = value.toUpperCase();
|
|
1016
|
+
for (const command of forbiddenCommands) {
|
|
1017
|
+
if (upperValue.includes(command.toUpperCase())) {
|
|
1018
|
+
return `Forbidden SQL command: ${command}`;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
const keywords = ["SELECT", "INSERT", "UPDATE", "CREATE", "ALTER"];
|
|
1022
|
+
const hasKeyword = keywords.some((keyword) => upperValue.includes(keyword));
|
|
1023
|
+
if (!hasKeyword) {
|
|
1024
|
+
return "SQL query must contain a valid SQL command (SELECT, INSERT, UPDATE, etc.)";
|
|
1025
|
+
}
|
|
1026
|
+
return true;
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function validateCSS(value) {
|
|
1030
|
+
if (!value || value.trim() === "") return true;
|
|
1031
|
+
let braceCount = 0;
|
|
1032
|
+
for (const char3 of value) {
|
|
1033
|
+
if (char3 === "{") braceCount++;
|
|
1034
|
+
if (char3 === "}") braceCount--;
|
|
1035
|
+
if (braceCount < 0) {
|
|
1036
|
+
return "Unbalanced braces: unexpected closing brace }";
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
if (braceCount > 0) {
|
|
1040
|
+
return `Unbalanced braces: ${braceCount} unclosed brace(s)`;
|
|
1041
|
+
}
|
|
1042
|
+
const ruleRegex = /[^}]*\{[^}]*\}/g;
|
|
1043
|
+
const rules = value.match(ruleRegex);
|
|
1044
|
+
if (rules) {
|
|
1045
|
+
for (const rule of rules) {
|
|
1046
|
+
const content = rule.substring(
|
|
1047
|
+
rule.indexOf("{") + 1,
|
|
1048
|
+
rule.lastIndexOf("}")
|
|
1049
|
+
);
|
|
1050
|
+
if (content.trim() && !content.includes(":")) {
|
|
1051
|
+
return "Invalid CSS: missing colon in property-value pair";
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
var codeValidators = {
|
|
1058
|
+
json: validateJSON,
|
|
1059
|
+
xml: validateXML,
|
|
1060
|
+
html: validateXML,
|
|
1061
|
+
// HTML uses same validator as XML
|
|
1062
|
+
javascript: validateJavaScript,
|
|
1063
|
+
typescript: validateJavaScript,
|
|
1064
|
+
// TS uses same validator as JS
|
|
1065
|
+
css: validateCSS,
|
|
1066
|
+
sql: createSQLValidator
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
// src/lib/media-variant.ts
|
|
1070
|
+
function getMediaVariant(media, name, options = {}) {
|
|
1071
|
+
if (!media) return void 0;
|
|
1072
|
+
const { fallback, preferThumbnail = true } = options;
|
|
1073
|
+
const sizes = media.sizes ?? null;
|
|
1074
|
+
if (sizes) {
|
|
1075
|
+
const direct = sizes[name];
|
|
1076
|
+
if (direct?.url) return direct.url;
|
|
1077
|
+
if (fallback) {
|
|
1078
|
+
const fb = sizes[fallback];
|
|
1079
|
+
if (fb?.url) return fb.url;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if (preferThumbnail && media.thumbnailUrl) return media.thumbnailUrl;
|
|
1083
|
+
return media.url;
|
|
1084
|
+
}
|
|
1085
|
+
function getSmallestMediaVariant(media) {
|
|
1086
|
+
if (!media) return void 0;
|
|
1087
|
+
const sizes = media.sizes ?? null;
|
|
1088
|
+
if (sizes) {
|
|
1089
|
+
const entries = Object.values(sizes).filter(
|
|
1090
|
+
(v) => v?.url && v.width && v.height
|
|
1091
|
+
);
|
|
1092
|
+
if (entries.length > 0) {
|
|
1093
|
+
const smallest = entries.reduce(
|
|
1094
|
+
(acc, cur) => (cur.width ?? 0) * (cur.height ?? 0) < (acc.width ?? 0) * (acc.height ?? 0) ? cur : acc
|
|
1095
|
+
);
|
|
1096
|
+
return smallest.url;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return media.thumbnailUrl ?? media.url;
|
|
1100
|
+
}
|
|
1101
|
+
export {
|
|
1102
|
+
ALLOWED_USER_FIELD_TYPES,
|
|
1103
|
+
ALL_FIELD_TYPES,
|
|
1104
|
+
AdminPlacement,
|
|
1105
|
+
ApiKeyTokenTypeSchema,
|
|
1106
|
+
AssignPermissionToRoleSchema,
|
|
1107
|
+
AssignRoleToUserSchema,
|
|
1108
|
+
AuthRateLimitConfigSchema,
|
|
1109
|
+
BulkOperationResponseSchema,
|
|
1110
|
+
BulkOperationSchema,
|
|
1111
|
+
COMPONENT_MIGRATION_STATUSES,
|
|
1112
|
+
COMPONENT_SOURCE_TYPES,
|
|
1113
|
+
CheckUserPermissionSchema,
|
|
1114
|
+
CollectionFileManager,
|
|
1115
|
+
CollectionService,
|
|
1116
|
+
CollectionsHandler,
|
|
1117
|
+
Container,
|
|
1118
|
+
CorsConfigSchema,
|
|
1119
|
+
CreateApiKeySchema,
|
|
1120
|
+
CreateLocalUserSchema,
|
|
1121
|
+
CreatePermissionSchema,
|
|
1122
|
+
CreateRoleInheritanceSchema,
|
|
1123
|
+
CreateRoleSchema,
|
|
1124
|
+
CreateUserWithPasswordSchema,
|
|
1125
|
+
DATA_FIELD_TYPES,
|
|
1126
|
+
DateRangeSchema,
|
|
1127
|
+
DbError,
|
|
1128
|
+
DeletePermissionSchema,
|
|
1129
|
+
DeleteRoleInheritanceSchema,
|
|
1130
|
+
DeleteRoleSchema,
|
|
1131
|
+
DeleteUserAccountSchema,
|
|
1132
|
+
DeleteUserResponseSchema,
|
|
1133
|
+
DeleteUserSchema,
|
|
1134
|
+
DrizzleAdapter,
|
|
1135
|
+
DynamicCollectionService,
|
|
1136
|
+
EmailSchema,
|
|
1137
|
+
ErrorResponseSchema,
|
|
1138
|
+
ExpiresInSchema,
|
|
1139
|
+
ExternalUrlError,
|
|
1140
|
+
FileUploadSchema,
|
|
1141
|
+
GetPermissionByIdSchema,
|
|
1142
|
+
GetRoleByIdSchema,
|
|
1143
|
+
GetRolePermissionsSchema,
|
|
1144
|
+
GetUserByIdSchema,
|
|
1145
|
+
GetUserPermissionsSchema,
|
|
1146
|
+
GetUserRolesSchema,
|
|
1147
|
+
HookRegistry,
|
|
1148
|
+
IdSchema,
|
|
1149
|
+
ImageUploadSchema,
|
|
1150
|
+
InMemoryRateLimitStore,
|
|
1151
|
+
ListUsersSchema,
|
|
1152
|
+
MAX_COMPONENT_NESTING_DEPTH,
|
|
1153
|
+
MediaService,
|
|
1154
|
+
MinimalUserSchema,
|
|
1155
|
+
NextlyError,
|
|
1156
|
+
PAGINATION_DEFAULTS,
|
|
1157
|
+
PaginatedResponseSchema,
|
|
1158
|
+
PaginationSchema,
|
|
1159
|
+
PasswordSchema,
|
|
1160
|
+
PermissionActionSchema,
|
|
1161
|
+
PermissionCheckResponseSchema,
|
|
1162
|
+
PermissionListResponseSchema,
|
|
1163
|
+
PermissionResourceSchema,
|
|
1164
|
+
PermissionSchema,
|
|
1165
|
+
PhoneSchema,
|
|
1166
|
+
RESERVED_COMPONENT_SLUGS,
|
|
1167
|
+
RESERVED_SINGLE_SLUGS,
|
|
1168
|
+
RESERVED_SLUGS,
|
|
1169
|
+
RESERVED_USER_FIELD_NAMES,
|
|
1170
|
+
RemovePermissionFromRoleSchema,
|
|
1171
|
+
RemoveRoleFromUserSchema,
|
|
1172
|
+
RoleInheritanceSchema,
|
|
1173
|
+
RoleListResponseSchema,
|
|
1174
|
+
RolePermissionListResponseSchema,
|
|
1175
|
+
RolePermissionSchema,
|
|
1176
|
+
RoleSchema,
|
|
1177
|
+
SQL_RESERVED_KEYWORDS,
|
|
1178
|
+
SYSTEM_CONTEXT,
|
|
1179
|
+
SYSTEM_RESOURCES,
|
|
1180
|
+
SanitizationConfigSchema,
|
|
1181
|
+
SearchSchema,
|
|
1182
|
+
SecurityConfigSchema,
|
|
1183
|
+
SecurityHeadersConfigSchema,
|
|
1184
|
+
SecurityLimitsConfigSchema,
|
|
1185
|
+
ServiceContainer,
|
|
1186
|
+
ServiceDispatcher,
|
|
1187
|
+
SortOrderSchema,
|
|
1188
|
+
SortSchema,
|
|
1189
|
+
SuccessResponseSchema,
|
|
1190
|
+
UnlinkAccountResponseSchema,
|
|
1191
|
+
UnlinkAccountSchema,
|
|
1192
|
+
UpdateApiKeySchema,
|
|
1193
|
+
UpdatePasswordSchema,
|
|
1194
|
+
UpdatePermissionSchema,
|
|
1195
|
+
UpdateRoleSchema,
|
|
1196
|
+
UpdateUserSchema,
|
|
1197
|
+
UploadSecurityConfigSchema,
|
|
1198
|
+
UrlSchema,
|
|
1199
|
+
UserAccountSchema,
|
|
1200
|
+
UserIdSchema,
|
|
1201
|
+
UserListResponseSchema,
|
|
1202
|
+
UserResponseSchema,
|
|
1203
|
+
UserRoleListResponseSchema,
|
|
1204
|
+
UserRoleSchema,
|
|
1205
|
+
UserService,
|
|
1206
|
+
VALIDATION_ERROR_CODES,
|
|
1207
|
+
VIRTUAL_FIELD_TYPES,
|
|
1208
|
+
ValidationErrorSchema,
|
|
1209
|
+
applyDesiredSchema,
|
|
1210
|
+
array,
|
|
1211
|
+
assertValidCollectionConfig,
|
|
1212
|
+
assertValidComponentConfig,
|
|
1213
|
+
assertValidSingleConfig,
|
|
1214
|
+
assertValidUserConfig,
|
|
1215
|
+
buildDesiredSchemaFromRegistry,
|
|
1216
|
+
buildDesiredSchemaFromRegistryAsync,
|
|
1217
|
+
buildPaginatedResponse,
|
|
1218
|
+
calculateOffset,
|
|
1219
|
+
checkAdapterHealth,
|
|
1220
|
+
checkbox,
|
|
1221
|
+
chips,
|
|
1222
|
+
clampLimit,
|
|
1223
|
+
clearAllHooks,
|
|
1224
|
+
clearCollectionHooks,
|
|
1225
|
+
clearServices,
|
|
1226
|
+
code,
|
|
1227
|
+
codeValidators,
|
|
1228
|
+
component,
|
|
1229
|
+
consoleLogger,
|
|
1230
|
+
container,
|
|
1231
|
+
createAdapter,
|
|
1232
|
+
createAdapterFromEnv,
|
|
1233
|
+
createPluginContext,
|
|
1234
|
+
createRateLimitHeaders,
|
|
1235
|
+
createRateLimiter,
|
|
1236
|
+
createRegister,
|
|
1237
|
+
createSQLValidator,
|
|
1238
|
+
createValidationError,
|
|
1239
|
+
createValidationErrorResponse,
|
|
1240
|
+
date,
|
|
1241
|
+
defineCollection,
|
|
1242
|
+
defineComponent,
|
|
1243
|
+
defineConfig,
|
|
1244
|
+
definePlugin,
|
|
1245
|
+
defineSingle,
|
|
1246
|
+
dynamicCollections,
|
|
1247
|
+
dynamicComponentsMysql,
|
|
1248
|
+
dynamicComponentsPg,
|
|
1249
|
+
dynamicComponentsSqlite,
|
|
1250
|
+
email,
|
|
1251
|
+
env,
|
|
1252
|
+
formatZodError,
|
|
1253
|
+
getCachedNextly,
|
|
1254
|
+
getDialectTables,
|
|
1255
|
+
getHookCount,
|
|
1256
|
+
getHookRegistry,
|
|
1257
|
+
getMediaVariant,
|
|
1258
|
+
getNextly,
|
|
1259
|
+
getService,
|
|
1260
|
+
getSmallestMediaVariant,
|
|
1261
|
+
getTrustedClientIp,
|
|
1262
|
+
group,
|
|
1263
|
+
hasHooks,
|
|
1264
|
+
hasNestedFields,
|
|
1265
|
+
healthCheck,
|
|
1266
|
+
invalidResult,
|
|
1267
|
+
isCheckboxField,
|
|
1268
|
+
isChipsField,
|
|
1269
|
+
isCodeField,
|
|
1270
|
+
isComponentField,
|
|
1271
|
+
isDataField,
|
|
1272
|
+
isDateField,
|
|
1273
|
+
isDbError,
|
|
1274
|
+
isEmailField,
|
|
1275
|
+
isGroupField,
|
|
1276
|
+
isJSONField,
|
|
1277
|
+
isNumberField,
|
|
1278
|
+
isPasswordField,
|
|
1279
|
+
isRadioField,
|
|
1280
|
+
isRelationalField,
|
|
1281
|
+
isRelationshipField,
|
|
1282
|
+
isRepeaterField,
|
|
1283
|
+
isRichTextField,
|
|
1284
|
+
isSelectField,
|
|
1285
|
+
isServicesRegistered,
|
|
1286
|
+
isSystemResource,
|
|
1287
|
+
isTextField,
|
|
1288
|
+
isTextareaField,
|
|
1289
|
+
isUploadField,
|
|
1290
|
+
isValidResource,
|
|
1291
|
+
isValidationError,
|
|
1292
|
+
isValidationErrorCode,
|
|
1293
|
+
isValidationResult,
|
|
1294
|
+
json,
|
|
1295
|
+
mergeValidationResults,
|
|
1296
|
+
nextly,
|
|
1297
|
+
nextlyMigrationsMysql,
|
|
1298
|
+
nextlyMigrationsPg,
|
|
1299
|
+
nextlyMigrationsSqlite,
|
|
1300
|
+
number,
|
|
1301
|
+
option,
|
|
1302
|
+
parseTrustedProxyIpsEnv,
|
|
1303
|
+
password,
|
|
1304
|
+
radio,
|
|
1305
|
+
registerCollectionHooks,
|
|
1306
|
+
registerHook,
|
|
1307
|
+
registerServices,
|
|
1308
|
+
relationship,
|
|
1309
|
+
repeater,
|
|
1310
|
+
reregisterCollectionHooks,
|
|
1311
|
+
resetHookRegistry,
|
|
1312
|
+
richText,
|
|
1313
|
+
safeFetch,
|
|
1314
|
+
schema_exports as schema,
|
|
1315
|
+
select,
|
|
1316
|
+
shutdownNextly,
|
|
1317
|
+
shutdownServices,
|
|
1318
|
+
text,
|
|
1319
|
+
textarea,
|
|
1320
|
+
toApiResponse,
|
|
1321
|
+
toDbError,
|
|
1322
|
+
unregisterHook,
|
|
1323
|
+
upload,
|
|
1324
|
+
validResult,
|
|
1325
|
+
validateCSS,
|
|
1326
|
+
validateCollectionConfig,
|
|
1327
|
+
validateComponentConfig,
|
|
1328
|
+
validateDatabaseEnv,
|
|
1329
|
+
validateExternalUrl,
|
|
1330
|
+
validateJSON,
|
|
1331
|
+
validateJavaScript,
|
|
1332
|
+
validateSingleConfig,
|
|
1333
|
+
validateUserConfig,
|
|
1334
|
+
validateXML,
|
|
1335
|
+
withDbErrors
|
|
1336
|
+
};
|