@payloadcms/next 3.0.0-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/dist/bin/index.d.ts +2 -0
- package/dist/bin/index.d.ts.map +1 -0
- package/dist/bin/index.js +37 -0
- package/dist/bin/install.d.ts +4 -0
- package/dist/bin/install.d.ts.map +1 -0
- package/dist/bin/install.js +77 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +13 -0
- package/dist/elements/LeaveWithoutSaving/index.d.ts +4 -0
- package/dist/elements/LeaveWithoutSaving/index.d.ts.map +1 -0
- package/dist/elements/LeaveWithoutSaving/index.js +122 -0
- package/dist/elements/LeaveWithoutSaving/index.scss +36 -0
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts +8 -0
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -0
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +132 -0
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.d.ts.map +1 -0
- package/dist/exports/index.js +13 -0
- package/dist/graphql/registerSchema.d.ts +2 -0
- package/dist/graphql/registerSchema.d.ts.map +1 -0
- package/dist/graphql/registerSchema.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/layouts/Admin/index.d.ts +12 -0
- package/dist/layouts/Admin/index.d.ts.map +1 -0
- package/dist/layouts/Admin/index.js +44 -0
- package/dist/layouts/Document/index.d.ts +14 -0
- package/dist/layouts/Document/index.d.ts.map +1 -0
- package/dist/layouts/Document/index.js +82 -0
- package/dist/layouts/Root/index.d.ts +12 -0
- package/dist/layouts/Root/index.d.ts.map +1 -0
- package/dist/layouts/Root/index.js +92 -0
- package/dist/next-fileupload/fileFactory.d.ts +16 -0
- package/dist/next-fileupload/fileFactory.d.ts.map +1 -0
- package/dist/next-fileupload/fileFactory.js +53 -0
- package/dist/next-fileupload/handlers.d.ts +15 -0
- package/dist/next-fileupload/handlers.d.ts.map +1 -0
- package/dist/next-fileupload/handlers.js +150 -0
- package/dist/next-fileupload/index.d.ts +135 -0
- package/dist/next-fileupload/index.d.ts.map +1 -0
- package/dist/next-fileupload/index.js +58 -0
- package/dist/next-fileupload/isEligibleRequest.d.ts +2 -0
- package/dist/next-fileupload/isEligibleRequest.d.ts.map +1 -0
- package/dist/next-fileupload/isEligibleRequest.js +36 -0
- package/dist/next-fileupload/processMultipart.d.ts +8 -0
- package/dist/next-fileupload/processMultipart.d.ts.map +1 -0
- package/dist/next-fileupload/processMultipart.js +146 -0
- package/dist/next-fileupload/processNested.d.ts +2 -0
- package/dist/next-fileupload/processNested.d.ts.map +1 -0
- package/dist/next-fileupload/processNested.js +34 -0
- package/dist/next-fileupload/uploadTimer.d.ts +7 -0
- package/dist/next-fileupload/uploadTimer.d.ts.map +1 -0
- package/dist/next-fileupload/uploadTimer.js +29 -0
- package/dist/next-fileupload/utilities.d.ts +65 -0
- package/dist/next-fileupload/utilities.d.ts.map +1 -0
- package/dist/next-fileupload/utilities.js +252 -0
- package/dist/next-stream-file/index.d.ts +2 -0
- package/dist/next-stream-file/index.d.ts.map +1 -0
- package/dist/next-stream-file/index.js +40 -0
- package/dist/pages/API/RenderJSON/index.d.ts +12 -0
- package/dist/pages/API/RenderJSON/index.d.ts.map +1 -0
- package/dist/pages/API/RenderJSON/index.js +142 -0
- package/dist/pages/API/RenderJSON/index.scss +90 -0
- package/dist/pages/API/index.client.d.ts +5 -0
- package/dist/pages/API/index.client.d.ts.map +1 -0
- package/dist/pages/API/index.client.js +241 -0
- package/dist/pages/API/index.d.ts +4 -0
- package/dist/pages/API/index.d.ts.map +1 -0
- package/dist/pages/API/index.js +27 -0
- package/dist/pages/API/index.scss +124 -0
- package/dist/pages/API/meta.d.ts +3 -0
- package/dist/pages/API/meta.d.ts.map +1 -0
- package/dist/pages/API/meta.js +21 -0
- package/dist/pages/Account/Settings/index.d.ts +6 -0
- package/dist/pages/Account/Settings/index.d.ts.map +1 -0
- package/dist/pages/Account/Settings/index.js +45 -0
- package/dist/pages/Account/Settings/index.scss +46 -0
- package/dist/pages/Account/ToggleTheme/index.d.ts +3 -0
- package/dist/pages/Account/ToggleTheme/index.d.ts.map +1 -0
- package/dist/pages/Account/ToggleTheme/index.js +87 -0
- package/dist/pages/Account/index.d.ts +13 -0
- package/dist/pages/Account/index.d.ts.map +1 -0
- package/dist/pages/Account/index.js +171 -0
- package/dist/pages/CreateFirstUser/index.client.d.ts +5 -0
- package/dist/pages/CreateFirstUser/index.client.d.ts.map +1 -0
- package/dist/pages/CreateFirstUser/index.client.js +29 -0
- package/dist/pages/CreateFirstUser/index.d.ts +11 -0
- package/dist/pages/CreateFirstUser/index.d.ts.map +1 -0
- package/dist/pages/CreateFirstUser/index.js +91 -0
- package/dist/pages/CreateFirstUser/index.scss +15 -0
- package/dist/pages/Dashboard/Default/index.client.d.ts +8 -0
- package/dist/pages/Dashboard/Default/index.client.d.ts.map +1 -0
- package/dist/pages/Dashboard/Default/index.client.js +154 -0
- package/dist/pages/Dashboard/Default/index.d.ts +11 -0
- package/dist/pages/Dashboard/Default/index.d.ts.map +1 -0
- package/dist/pages/Dashboard/Default/index.js +44 -0
- package/dist/pages/Dashboard/Default/index.scss +58 -0
- package/dist/pages/Dashboard/index.d.ts +13 -0
- package/dist/pages/Dashboard/index.d.ts.map +1 -0
- package/dist/pages/Dashboard/index.js +128 -0
- package/dist/pages/Document/getCustomViewByKey.d.ts +4 -0
- package/dist/pages/Document/getCustomViewByKey.d.ts.map +1 -0
- package/dist/pages/Document/getCustomViewByKey.js +15 -0
- package/dist/pages/Document/getCustomViewByPath.d.ts +4 -0
- package/dist/pages/Document/getCustomViewByPath.d.ts.map +1 -0
- package/dist/pages/Document/getCustomViewByPath.js +26 -0
- package/dist/pages/Document/getMetaBySegment.d.ts +20 -0
- package/dist/pages/Document/getMetaBySegment.d.ts.map +1 -0
- package/dist/pages/Document/getMetaBySegment.js +124 -0
- package/dist/pages/Document/getViewsFromConfig.d.ts +15 -0
- package/dist/pages/Document/getViewsFromConfig.d.ts.map +1 -0
- package/dist/pages/Document/getViewsFromConfig.js +224 -0
- package/dist/pages/Document/index.d.ts +23 -0
- package/dist/pages/Document/index.d.ts.map +1 -0
- package/dist/pages/Document/index.js +237 -0
- package/dist/pages/Edit/Default/Auth/APIKey.d.ts +6 -0
- package/dist/pages/Edit/Default/Auth/APIKey.d.ts.map +1 -0
- package/dist/pages/Edit/Default/Auth/APIKey.js +140 -0
- package/dist/pages/Edit/Default/Auth/index.d.ts +6 -0
- package/dist/pages/Edit/Default/Auth/index.d.ts.map +1 -0
- package/dist/pages/Edit/Default/Auth/index.js +180 -0
- package/dist/pages/Edit/Default/Auth/index.scss +61 -0
- package/dist/pages/Edit/Default/Auth/types.d.ts +14 -0
- package/dist/pages/Edit/Default/Auth/types.d.ts.map +1 -0
- package/dist/pages/Edit/Default/Auth/types.js +6 -0
- package/dist/pages/Edit/Default/RenderCustomView.d.ts +2 -0
- package/dist/pages/Edit/Default/RenderCustomView.d.ts.map +1 -0
- package/dist/pages/Edit/Default/RenderCustomView.js +3 -0
- package/dist/pages/Edit/Default/SetDocumentTitle/index.d.ts +8 -0
- package/dist/pages/Edit/Default/SetDocumentTitle/index.d.ts.map +1 -0
- package/dist/pages/Edit/Default/SetDocumentTitle/index.js +50 -0
- package/dist/pages/Edit/Default/SetStepNav/index.d.ts +13 -0
- package/dist/pages/Edit/Default/SetStepNav/index.d.ts.map +1 -0
- package/dist/pages/Edit/Default/SetStepNav/index.js +70 -0
- package/dist/pages/Edit/Default/index.d.ts +4 -0
- package/dist/pages/Edit/Default/index.d.ts.map +1 -0
- package/dist/pages/Edit/Default/index.js +202 -0
- package/dist/pages/Edit/Default/index.scss +21 -0
- package/dist/pages/Edit/Default/types.d.ts +6 -0
- package/dist/pages/Edit/Default/types.d.ts.map +1 -0
- package/dist/pages/Edit/Default/types.js +6 -0
- package/dist/pages/Edit/index.client.d.ts +4 -0
- package/dist/pages/Edit/index.client.d.ts.map +1 -0
- package/dist/pages/Edit/index.client.js +99 -0
- package/dist/pages/Edit/index.d.ts +4 -0
- package/dist/pages/Edit/index.d.ts.map +1 -0
- package/dist/pages/Edit/index.js +27 -0
- package/dist/pages/Edit/meta.d.ts +3 -0
- package/dist/pages/Edit/meta.d.ts.map +1 -0
- package/dist/pages/Edit/meta.js +36 -0
- package/dist/pages/Edit/sanitizeEditViewProps.d.ts +4 -0
- package/dist/pages/Edit/sanitizeEditViewProps.d.ts.map +1 -0
- package/dist/pages/Edit/sanitizeEditViewProps.js +24 -0
- package/dist/pages/Edit/types.d.js +7 -0
- package/dist/pages/Edit/types.d.ts +37 -0
- package/dist/pages/Edit/types.d.ts.map +1 -0
- package/dist/pages/Edit/types.js +6 -0
- package/dist/pages/ForgotPassword/index.d.ts +10 -0
- package/dist/pages/ForgotPassword/index.d.ts.map +1 -0
- package/dist/pages/ForgotPassword/index.js +101 -0
- package/dist/pages/List/Default/Cell/cellTypes.spec.js +234 -0
- package/dist/pages/List/Default/Cell/fields/Array/index.d.ts +7 -0
- package/dist/pages/List/Default/Cell/fields/Array/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Array/index.js +27 -0
- package/dist/pages/List/Default/Cell/fields/Blocks/index.d.ts +8 -0
- package/dist/pages/List/Default/Cell/fields/Blocks/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Blocks/index.js +45 -0
- package/dist/pages/List/Default/Cell/fields/Checkbox/index.d.ts +5 -0
- package/dist/pages/List/Default/Cell/fields/Checkbox/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Checkbox/index.js +23 -0
- package/dist/pages/List/Default/Cell/fields/Checkbox/index.scss +22 -0
- package/dist/pages/List/Default/Cell/fields/Code/index.d.ts +8 -0
- package/dist/pages/List/Default/Cell/fields/Code/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Code/index.js +29 -0
- package/dist/pages/List/Default/Cell/fields/Code/index.scss +27 -0
- package/dist/pages/List/Default/Cell/fields/Date/index.d.ts +7 -0
- package/dist/pages/List/Default/Cell/fields/Date/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Date/index.js +26 -0
- package/dist/pages/List/Default/Cell/fields/File/index.d.ts +7 -0
- package/dist/pages/List/Default/Cell/fields/File/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/File/index.js +39 -0
- package/dist/pages/List/Default/Cell/fields/File/index.scss +23 -0
- package/dist/pages/List/Default/Cell/fields/JSON/index.d.ts +5 -0
- package/dist/pages/List/Default/Cell/fields/JSON/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/JSON/index.js +26 -0
- package/dist/pages/List/Default/Cell/fields/JSON/index.scss +22 -0
- package/dist/pages/List/Default/Cell/fields/Relationship/index.d.ts +9 -0
- package/dist/pages/List/Default/Cell/fields/Relationship/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Relationship/index.js +121 -0
- package/dist/pages/List/Default/Cell/fields/Relationship/index.scss +3 -0
- package/dist/pages/List/Default/Cell/fields/Richtext/index.d.ts +2 -0
- package/dist/pages/List/Default/Cell/fields/Richtext/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Richtext/index.js +3 -0
- package/dist/pages/List/Default/Cell/fields/Select/index.d.ts +7 -0
- package/dist/pages/List/Default/Cell/fields/Select/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Select/index.js +40 -0
- package/dist/pages/List/Default/Cell/fields/Textarea/index.d.ts +4 -0
- package/dist/pages/List/Default/Cell/fields/Textarea/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/Textarea/index.js +23 -0
- package/dist/pages/List/Default/Cell/fields/index.d.ts +17 -0
- package/dist/pages/List/Default/Cell/fields/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/fields/index.js +36 -0
- package/dist/pages/List/Default/Cell/index.d.ts +4 -0
- package/dist/pages/List/Default/Cell/index.d.ts.map +1 -0
- package/dist/pages/List/Default/Cell/index.js +87 -0
- package/dist/pages/List/Default/RelationshipProvider/index.d.ts +20 -0
- package/dist/pages/List/Default/RelationshipProvider/index.d.ts.map +1 -0
- package/dist/pages/List/Default/RelationshipProvider/index.js +153 -0
- package/dist/pages/List/Default/RelationshipProvider/reducer.d.ts +19 -0
- package/dist/pages/List/Default/RelationshipProvider/reducer.d.ts.map +1 -0
- package/dist/pages/List/Default/RelationshipProvider/reducer.js +55 -0
- package/dist/pages/List/Default/index.d.ts +4 -0
- package/dist/pages/List/Default/index.d.ts.map +1 -0
- package/dist/pages/List/Default/index.js +182 -0
- package/dist/pages/List/Default/index.scss +195 -0
- package/dist/pages/List/Default/types.d.ts +14 -0
- package/dist/pages/List/Default/types.d.ts.map +1 -0
- package/dist/pages/List/Default/types.js +6 -0
- package/dist/pages/List/index.d.ts +18 -0
- package/dist/pages/List/index.d.ts.map +1 -0
- package/dist/pages/List/index.js +158 -0
- package/dist/pages/LivePreview/Context/collisionDetection.d.ts +3 -0
- package/dist/pages/LivePreview/Context/collisionDetection.d.ts.map +1 -0
- package/dist/pages/LivePreview/Context/collisionDetection.js +34 -0
- package/dist/pages/LivePreview/Context/context.d.ts +50 -0
- package/dist/pages/LivePreview/Context/context.d.ts.map +1 -0
- package/dist/pages/LivePreview/Context/context.js +58 -0
- package/dist/pages/LivePreview/Context/index.d.ts +18 -0
- package/dist/pages/LivePreview/Context/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Context/index.js +208 -0
- package/dist/pages/LivePreview/Context/sizeReducer.d.ts +20 -0
- package/dist/pages/LivePreview/Context/sizeReducer.d.ts.map +1 -0
- package/dist/pages/LivePreview/Context/sizeReducer.js +41 -0
- package/dist/pages/LivePreview/Device/index.d.ts +5 -0
- package/dist/pages/LivePreview/Device/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Device/index.js +102 -0
- package/dist/pages/LivePreview/DeviceContainer/index.d.ts +5 -0
- package/dist/pages/LivePreview/DeviceContainer/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/DeviceContainer/index.js +44 -0
- package/dist/pages/LivePreview/IFrame/index.d.ts +8 -0
- package/dist/pages/LivePreview/IFrame/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/IFrame/index.js +74 -0
- package/dist/pages/LivePreview/IFrame/index.scss +7 -0
- package/dist/pages/LivePreview/Preview/index.d.ts +5 -0
- package/dist/pages/LivePreview/Preview/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Preview/index.js +127 -0
- package/dist/pages/LivePreview/Preview/index.scss +41 -0
- package/dist/pages/LivePreview/Toolbar/Controls/index.d.ts +5 -0
- package/dist/pages/LivePreview/Toolbar/Controls/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Toolbar/Controls/index.js +96 -0
- package/dist/pages/LivePreview/Toolbar/Controls/index.scss +59 -0
- package/dist/pages/LivePreview/Toolbar/SizeInput/index.d.ts +6 -0
- package/dist/pages/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Toolbar/SizeInput/index.js +112 -0
- package/dist/pages/LivePreview/Toolbar/SizeInput/index.scss +10 -0
- package/dist/pages/LivePreview/Toolbar/index.d.ts +7 -0
- package/dist/pages/LivePreview/Toolbar/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/Toolbar/index.js +65 -0
- package/dist/pages/LivePreview/Toolbar/index.scss +41 -0
- package/dist/pages/LivePreview/ToolbarArea/index.d.ts +6 -0
- package/dist/pages/LivePreview/ToolbarArea/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/ToolbarArea/index.js +32 -0
- package/dist/pages/LivePreview/ToolbarArea/index.scss +4 -0
- package/dist/pages/LivePreview/index.client.d.ts +11 -0
- package/dist/pages/LivePreview/index.client.d.ts.map +1 -0
- package/dist/pages/LivePreview/index.client.js +195 -0
- package/dist/pages/LivePreview/index.d.ts +5 -0
- package/dist/pages/LivePreview/index.d.ts.map +1 -0
- package/dist/pages/LivePreview/index.js +59 -0
- package/dist/pages/LivePreview/index.scss +66 -0
- package/dist/pages/LivePreview/meta.d.ts +3 -0
- package/dist/pages/LivePreview/meta.d.ts.map +1 -0
- package/dist/pages/LivePreview/meta.js +36 -0
- package/dist/pages/LivePreview/usePopupWindow.d.ts +19 -0
- package/dist/pages/LivePreview/usePopupWindow.d.ts.map +1 -0
- package/dist/pages/LivePreview/usePopupWindow.js +112 -0
- package/dist/pages/Login/LoginForm/index.d.ts +8 -0
- package/dist/pages/Login/LoginForm/index.d.ts.map +1 -0
- package/dist/pages/Login/LoginForm/index.js +67 -0
- package/dist/pages/Login/LoginForm/index.scss +8 -0
- package/dist/pages/Login/index.d.ts +14 -0
- package/dist/pages/Login/index.d.ts.map +1 -0
- package/dist/pages/Login/index.js +108 -0
- package/dist/pages/Login/index.scss +38 -0
- package/dist/pages/Logout/LogoutClient.d.ts +7 -0
- package/dist/pages/Logout/LogoutClient.d.ts.map +1 -0
- package/dist/pages/Logout/LogoutClient.js +88 -0
- package/dist/pages/Logout/index.d.ts +16 -0
- package/dist/pages/Logout/index.d.ts.map +1 -0
- package/dist/pages/Logout/index.js +61 -0
- package/dist/pages/Logout/index.scss +20 -0
- package/dist/pages/NotFound/index.d.ts +7 -0
- package/dist/pages/NotFound/index.d.ts.map +1 -0
- package/dist/pages/NotFound/index.js +48 -0
- package/dist/pages/NotFound/index.scss +36 -0
- package/dist/pages/ResetPassword/index.d.ts +12 -0
- package/dist/pages/ResetPassword/index.d.ts.map +1 -0
- package/dist/pages/ResetPassword/index.js +99 -0
- package/dist/pages/ResetPassword/index.scss +15 -0
- package/dist/pages/Root/index.d.ts +5 -0
- package/dist/pages/Root/index.d.ts.map +1 -0
- package/dist/pages/Root/index.js +17 -0
- package/dist/pages/Unauthorized/UnauthorizedClient.d.ts +5 -0
- package/dist/pages/Unauthorized/UnauthorizedClient.d.ts.map +1 -0
- package/dist/pages/Unauthorized/UnauthorizedClient.js +27 -0
- package/dist/pages/Unauthorized/index.d.ts +10 -0
- package/dist/pages/Unauthorized/index.d.ts.map +1 -0
- package/dist/pages/Unauthorized/index.js +51 -0
- package/dist/pages/Verify/index.d.ts +13 -0
- package/dist/pages/Verify/index.d.ts.map +1 -0
- package/dist/pages/Verify/index.js +90 -0
- package/dist/pages/Verify/index.scss +14 -0
- package/dist/pages/Version/Default/SetStepNav.d.ts +13 -0
- package/dist/pages/Version/Default/SetStepNav.d.ts.map +1 -0
- package/dist/pages/Version/Default/SetStepNav.js +92 -0
- package/dist/pages/Version/Default/index.d.ts +5 -0
- package/dist/pages/Version/Default/index.d.ts.map +1 -0
- package/dist/pages/Version/Default/index.js +157 -0
- package/dist/pages/Version/Default/index.scss +70 -0
- package/dist/pages/Version/Default/types.d.ts +24 -0
- package/dist/pages/Version/Default/types.d.ts.map +1 -0
- package/dist/pages/Version/Default/types.js +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/Label/index.d.ts +7 -0
- package/dist/pages/Version/RenderFieldsToDiff/Label/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/Label/index.js +24 -0
- package/dist/pages/Version/RenderFieldsToDiff/Label/index.scss +4 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Iterable/index.js +80 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Iterable/index.scss +34 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Nested/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Nested/index.js +44 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Nested/index.scss +12 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Relationship/index.js +89 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Relationship/index.scss +13 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts +9 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +72 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/index.js +54 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Select/index.scss +13 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts +5 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Tabs/index.js +54 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts +9 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +72 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/index.js +46 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/Text/index.scss +13 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/diffMethods.d.ts +7 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/diffMethods.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/diffMethods.js +18 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/index.d.ts +25 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/index.js +44 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/styles.d.ts +27 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/styles.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/styles.js +38 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/types.d.ts +21 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/fields/types.js +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/index.d.ts +6 -0
- package/dist/pages/Version/RenderFieldsToDiff/index.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/index.js +115 -0
- package/dist/pages/Version/RenderFieldsToDiff/index.scss +18 -0
- package/dist/pages/Version/RenderFieldsToDiff/types.d.ts +20 -0
- package/dist/pages/Version/RenderFieldsToDiff/types.d.ts.map +1 -0
- package/dist/pages/Version/RenderFieldsToDiff/types.js +6 -0
- package/dist/pages/Version/Restore/index.d.ts +6 -0
- package/dist/pages/Version/Restore/index.d.ts.map +1 -0
- package/dist/pages/Version/Restore/index.js +121 -0
- package/dist/pages/Version/Restore/index.scss +28 -0
- package/dist/pages/Version/Restore/types.d.ts +11 -0
- package/dist/pages/Version/Restore/types.d.ts.map +1 -0
- package/dist/pages/Version/Restore/types.js +6 -0
- package/dist/pages/Version/SelectComparison/index.d.ts +5 -0
- package/dist/pages/Version/SelectComparison/index.d.ts.map +1 -0
- package/dist/pages/Version/SelectComparison/index.js +167 -0
- package/dist/pages/Version/SelectComparison/index.scss +13 -0
- package/dist/pages/Version/SelectComparison/types.d.ts +27 -0
- package/dist/pages/Version/SelectComparison/types.d.ts.map +1 -0
- package/dist/pages/Version/SelectComparison/types.js +6 -0
- package/dist/pages/Version/SelectLocales/index.d.ts +5 -0
- package/dist/pages/Version/SelectLocales/index.d.ts.map +1 -0
- package/dist/pages/Version/SelectLocales/index.js +47 -0
- package/dist/pages/Version/SelectLocales/index.scss +7 -0
- package/dist/pages/Version/SelectLocales/types.d.ts +7 -0
- package/dist/pages/Version/SelectLocales/types.d.ts.map +1 -0
- package/dist/pages/Version/SelectLocales/types.js +6 -0
- package/dist/pages/Version/index.d.ts +4 -0
- package/dist/pages/Version/index.d.ts.map +1 -0
- package/dist/pages/Version/index.js +111 -0
- package/dist/pages/Version/meta.d.ts +3 -0
- package/dist/pages/Version/meta.d.ts.map +1 -0
- package/dist/pages/Version/meta.js +47 -0
- package/dist/pages/Version/shared.d.ts +9 -0
- package/dist/pages/Version/shared.d.ts.map +1 -0
- package/dist/pages/Version/shared.js +28 -0
- package/dist/pages/Versions/buildColumns.d.ts +11 -0
- package/dist/pages/Versions/buildColumns.d.ts.map +1 -0
- package/dist/pages/Versions/buildColumns.js +69 -0
- package/dist/pages/Versions/cells/AutosaveCell/index.d.ts +3 -0
- package/dist/pages/Versions/cells/AutosaveCell/index.d.ts.map +1 -0
- package/dist/pages/Versions/cells/AutosaveCell/index.js +63 -0
- package/dist/pages/Versions/cells/CreatedAt/index.d.ts +9 -0
- package/dist/pages/Versions/cells/CreatedAt/index.d.ts.map +1 -0
- package/dist/pages/Versions/cells/CreatedAt/index.js +33 -0
- package/dist/pages/Versions/cells/ID/index.d.ts +3 -0
- package/dist/pages/Versions/cells/ID/index.d.ts.map +1 -0
- package/dist/pages/Versions/cells/ID/index.js +60 -0
- package/dist/pages/Versions/index.client.d.ts +15 -0
- package/dist/pages/Versions/index.client.d.ts.map +1 -0
- package/dist/pages/Versions/index.client.js +142 -0
- package/dist/pages/Versions/index.d.ts +6 -0
- package/dist/pages/Versions/index.d.ts.map +1 -0
- package/dist/pages/Versions/index.js +125 -0
- package/dist/pages/Versions/index.scss +108 -0
- package/dist/pages/Versions/meta.d.ts +3 -0
- package/dist/pages/Versions/meta.d.ts.map +1 -0
- package/dist/pages/Versions/meta.js +43 -0
- package/dist/pages/Versions/types.d.ts +19 -0
- package/dist/pages/Versions/types.d.ts.map +1 -0
- package/dist/pages/Versions/types.js +6 -0
- package/dist/routes/graphql/handler.d.ts +4 -0
- package/dist/routes/graphql/handler.d.ts.map +1 -0
- package/dist/routes/graphql/handler.js +128 -0
- package/dist/routes/graphql/index.d.ts +3 -0
- package/dist/routes/graphql/index.d.ts.map +1 -0
- package/dist/routes/graphql/index.js +22 -0
- package/dist/routes/graphql/playground.d.ts +3 -0
- package/dist/routes/graphql/playground.d.ts.map +1 -0
- package/dist/routes/graphql/playground.js +37 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +38 -0
- package/dist/routes/rest/RouteError.d.ts +13 -0
- package/dist/routes/rest/RouteError.d.ts.map +1 -0
- package/dist/routes/rest/RouteError.js +104 -0
- package/dist/routes/rest/[collection]/file/[filename]/route.d.ts +8 -0
- package/dist/routes/rest/[collection]/file/[filename]/route.d.ts.map +1 -0
- package/dist/routes/rest/[collection]/file/[filename]/route.js +116 -0
- package/dist/routes/rest/auth/access.d.ts +3 -0
- package/dist/routes/rest/auth/access.d.ts.map +1 -0
- package/dist/routes/rest/auth/access.js +27 -0
- package/dist/routes/rest/auth/forgotPassword.d.ts +3 -0
- package/dist/routes/rest/auth/forgotPassword.d.ts.map +1 -0
- package/dist/routes/rest/auth/forgotPassword.js +36 -0
- package/dist/routes/rest/auth/init.d.ts +3 -0
- package/dist/routes/rest/auth/init.d.ts.map +1 -0
- package/dist/routes/rest/auth/init.js +22 -0
- package/dist/routes/rest/auth/login.d.ts +3 -0
- package/dist/routes/rest/auth/login.d.ts.map +1 -0
- package/dist/routes/rest/auth/login.js +52 -0
- package/dist/routes/rest/auth/logout.d.ts +3 -0
- package/dist/routes/rest/auth/logout.d.ts.map +1 -0
- package/dist/routes/rest/auth/logout.js +46 -0
- package/dist/routes/rest/auth/me.d.ts +3 -0
- package/dist/routes/rest/auth/me.d.ts.map +1 -0
- package/dist/routes/rest/auth/me.js +37 -0
- package/dist/routes/rest/auth/refresh.d.ts +3 -0
- package/dist/routes/rest/auth/refresh.d.ts.map +1 -0
- package/dist/routes/rest/auth/refresh.js +54 -0
- package/dist/routes/rest/auth/registerFirstUser.d.ts +3 -0
- package/dist/routes/rest/auth/registerFirstUser.d.ts.map +1 -0
- package/dist/routes/rest/auth/registerFirstUser.js +47 -0
- package/dist/routes/rest/auth/resetPassword.d.ts +3 -0
- package/dist/routes/rest/auth/resetPassword.d.ts.map +1 -0
- package/dist/routes/rest/auth/resetPassword.js +51 -0
- package/dist/routes/rest/auth/unlock.d.ts +3 -0
- package/dist/routes/rest/auth/unlock.d.ts.map +1 -0
- package/dist/routes/rest/auth/unlock.js +34 -0
- package/dist/routes/rest/auth/verifyEmail.d.ts +3 -0
- package/dist/routes/rest/auth/verifyEmail.d.ts.map +1 -0
- package/dist/routes/rest/auth/verifyEmail.js +32 -0
- package/dist/routes/rest/buildFormState.d.ts +7 -0
- package/dist/routes/rest/buildFormState.d.ts.map +1 -0
- package/dist/routes/rest/buildFormState.js +96 -0
- package/dist/routes/rest/checkEndpoints.d.ts +5 -0
- package/dist/routes/rest/checkEndpoints.d.ts.map +1 -0
- package/dist/routes/rest/checkEndpoints.js +27 -0
- package/dist/routes/rest/collections/create.d.ts +3 -0
- package/dist/routes/rest/collections/create.d.ts.map +1 -0
- package/dist/routes/rest/collections/create.js +42 -0
- package/dist/routes/rest/collections/delete.d.ts +3 -0
- package/dist/routes/rest/collections/delete.d.ts.map +1 -0
- package/dist/routes/rest/collections/delete.js +57 -0
- package/dist/routes/rest/collections/deleteByID.d.ts +3 -0
- package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -0
- package/dist/routes/rest/collections/deleteByID.js +43 -0
- package/dist/routes/rest/collections/docAccess.d.ts +3 -0
- package/dist/routes/rest/collections/docAccess.d.ts.map +1 -0
- package/dist/routes/rest/collections/docAccess.js +29 -0
- package/dist/routes/rest/collections/find.d.ts +3 -0
- package/dist/routes/rest/collections/find.d.ts.map +1 -0
- package/dist/routes/rest/collections/find.js +39 -0
- package/dist/routes/rest/collections/findByID.d.ts +3 -0
- package/dist/routes/rest/collections/findByID.d.ts.map +1 -0
- package/dist/routes/rest/collections/findByID.js +34 -0
- package/dist/routes/rest/collections/findVersionByID.d.ts +3 -0
- package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -0
- package/dist/routes/rest/collections/findVersionByID.js +33 -0
- package/dist/routes/rest/collections/findVersions.d.ts +3 -0
- package/dist/routes/rest/collections/findVersions.d.ts.map +1 -0
- package/dist/routes/rest/collections/findVersions.js +38 -0
- package/dist/routes/rest/collections/restoreVersion.d.ts +3 -0
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -0
- package/dist/routes/rest/collections/restoreVersion.js +36 -0
- package/dist/routes/rest/collections/update.d.ts +3 -0
- package/dist/routes/rest/collections/update.d.ts.map +1 -0
- package/dist/routes/rest/collections/update.js +59 -0
- package/dist/routes/rest/collections/updateByID.d.ts +3 -0
- package/dist/routes/rest/collections/updateByID.d.ts.map +1 -0
- package/dist/routes/rest/collections/updateByID.js +44 -0
- package/dist/routes/rest/globals/docAccess.d.ts +3 -0
- package/dist/routes/rest/globals/docAccess.d.ts.map +1 -0
- package/dist/routes/rest/globals/docAccess.js +28 -0
- package/dist/routes/rest/globals/findOne.d.ts +3 -0
- package/dist/routes/rest/globals/findOne.d.ts.map +1 -0
- package/dist/routes/rest/globals/findOne.js +34 -0
- package/dist/routes/rest/globals/findVersionByID.d.ts +3 -0
- package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -0
- package/dist/routes/rest/globals/findVersionByID.js +33 -0
- package/dist/routes/rest/globals/findVersions.d.ts +3 -0
- package/dist/routes/rest/globals/findVersions.d.ts.map +1 -0
- package/dist/routes/rest/globals/findVersions.js +38 -0
- package/dist/routes/rest/globals/restoreVersion.d.ts +3 -0
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -0
- package/dist/routes/rest/globals/restoreVersion.js +36 -0
- package/dist/routes/rest/globals/update.d.ts +3 -0
- package/dist/routes/rest/globals/update.d.ts.map +1 -0
- package/dist/routes/rest/globals/update.js +44 -0
- package/dist/routes/rest/index.d.ts +22 -0
- package/dist/routes/rest/index.d.ts.map +1 -0
- package/dist/routes/rest/index.js +546 -0
- package/dist/routes/rest/types.d.ts +23 -0
- package/dist/routes/rest/types.d.ts.map +1 -0
- package/dist/routes/rest/types.js +6 -0
- package/dist/scss/app.scss +209 -0
- package/dist/scss/colors.scss +269 -0
- package/dist/scss/custom.css +1 -0
- package/dist/scss/fonts.scss +75 -0
- package/dist/scss/queries.scss +27 -0
- package/dist/scss/resets.scss +17 -0
- package/dist/scss/styles.scss +11 -0
- package/dist/scss/svg.scss +10 -0
- package/dist/scss/toastify.scss +59 -0
- package/dist/scss/type.scss +117 -0
- package/dist/scss/vars.scss +220 -0
- package/dist/scss/z-index.scss +9 -0
- package/dist/utilities/auth.d.ts +10 -0
- package/dist/utilities/auth.d.ts.map +1 -0
- package/dist/utilities/auth.js +42 -0
- package/dist/utilities/createClientConfig.d.ts +5 -0
- package/dist/utilities/createClientConfig.d.ts.map +1 -0
- package/dist/utilities/createClientConfig.js +120 -0
- package/dist/utilities/createPayloadRequest.d.ts +11 -0
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -0
- package/dist/utilities/createPayloadRequest.js +95 -0
- package/dist/utilities/getDataAndFile.d.ts +12 -0
- package/dist/utilities/getDataAndFile.d.ts.map +1 -0
- package/dist/utilities/getDataAndFile.js +74 -0
- package/dist/utilities/getNextI18n.d.ts +7 -0
- package/dist/utilities/getNextI18n.d.ts.map +1 -0
- package/dist/utilities/getNextI18n.js +28 -0
- package/dist/utilities/getNextT.d.ts +7 -0
- package/dist/utilities/getNextT.d.ts.map +1 -0
- package/dist/utilities/getNextT.js +28 -0
- package/dist/utilities/getRequestLanguage.d.ts +9 -0
- package/dist/utilities/getRequestLanguage.d.ts.map +1 -0
- package/dist/utilities/getRequestLanguage.js +19 -0
- package/dist/utilities/getRequestLocales.d.ts +12 -0
- package/dist/utilities/getRequestLocales.d.ts.map +1 -0
- package/dist/utilities/getRequestLocales.js +38 -0
- package/dist/utilities/initPage.d.ts +21 -0
- package/dist/utilities/initPage.d.ts.map +1 -0
- package/dist/utilities/initPage.js +79 -0
- package/dist/utilities/meta.d.ts +9 -0
- package/dist/utilities/meta.d.ts.map +1 -0
- package/dist/utilities/meta.js +45 -0
- package/dist/withPayload.d.ts +3 -0
- package/dist/withPayload.d.ts.map +1 -0
- package/dist/withPayload.js +77 -0
- package/package.json +83 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
DocumentLayout: function() {
|
|
13
|
+
return DocumentLayout;
|
|
14
|
+
},
|
|
15
|
+
metadata: function() {
|
|
16
|
+
return metadata;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _ui = require("@payloadcms/ui");
|
|
20
|
+
require("@payloadcms/ui/scss/app.scss");
|
|
21
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
22
|
+
const _initPage = require("../../utilities/initPage");
|
|
23
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
24
|
+
if (typeof WeakMap !== "function") return null;
|
|
25
|
+
var cacheBabelInterop = new WeakMap();
|
|
26
|
+
var cacheNodeInterop = new WeakMap();
|
|
27
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
28
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
29
|
+
})(nodeInterop);
|
|
30
|
+
}
|
|
31
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
32
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
36
|
+
return {
|
|
37
|
+
default: obj
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
41
|
+
if (cache && cache.has(obj)) {
|
|
42
|
+
return cache.get(obj);
|
|
43
|
+
}
|
|
44
|
+
var newObj = {
|
|
45
|
+
__proto__: null
|
|
46
|
+
};
|
|
47
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
|
+
for(var key in obj){
|
|
49
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
50
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
51
|
+
if (desc && (desc.get || desc.set)) {
|
|
52
|
+
Object.defineProperty(newObj, key, desc);
|
|
53
|
+
} else {
|
|
54
|
+
newObj[key] = obj[key];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
newObj.default = obj;
|
|
59
|
+
if (cache) {
|
|
60
|
+
cache.set(obj, newObj);
|
|
61
|
+
}
|
|
62
|
+
return newObj;
|
|
63
|
+
}
|
|
64
|
+
const metadata = {
|
|
65
|
+
description: 'Generated by Next.js',
|
|
66
|
+
title: 'Next.js'
|
|
67
|
+
};
|
|
68
|
+
const DocumentLayout = async ({ children, collectionSlug, config: configPromise, globalSlug })=>{
|
|
69
|
+
const { collectionConfig, globalConfig, req } = await (0, _initPage.initPage)({
|
|
70
|
+
collectionSlug,
|
|
71
|
+
config: configPromise,
|
|
72
|
+
globalSlug
|
|
73
|
+
});
|
|
74
|
+
return /*#__PURE__*/ _react.default.createElement(_react.Fragment, null, /*#__PURE__*/ _react.default.createElement(_ui.DocumentHeader, {
|
|
75
|
+
collectionConfig: collectionConfig,
|
|
76
|
+
config: req.payload.config,
|
|
77
|
+
globalConfig: globalConfig,
|
|
78
|
+
i18n: req.i18n
|
|
79
|
+
}), children);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9sYXlvdXRzL0RvY3VtZW50L2luZGV4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFNhbml0aXplZENvbmZpZyB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IERvY3VtZW50SGVhZGVyIH0gZnJvbSAnQHBheWxvYWRjbXMvdWknXG5pbXBvcnQgJ0BwYXlsb2FkY21zL3VpL3Njc3MvYXBwLnNjc3MnXG5pbXBvcnQgUmVhY3QsIHsgRnJhZ21lbnQgfSBmcm9tICdyZWFjdCdcblxuaW1wb3J0IHsgaW5pdFBhZ2UgfSBmcm9tICcuLi8uLi91dGlsaXRpZXMvaW5pdFBhZ2UnXG5cbmV4cG9ydCBjb25zdCBtZXRhZGF0YSA9IHtcbiAgZGVzY3JpcHRpb246ICdHZW5lcmF0ZWQgYnkgTmV4dC5qcycsXG4gIHRpdGxlOiAnTmV4dC5qcycsXG59XG5cbmV4cG9ydCBjb25zdCBEb2N1bWVudExheW91dCA9IGFzeW5jICh7XG4gIGNoaWxkcmVuLFxuICBjb2xsZWN0aW9uU2x1ZyxcbiAgY29uZmlnOiBjb25maWdQcm9taXNlLFxuICBnbG9iYWxTbHVnLFxufToge1xuICBjaGlsZHJlbjogUmVhY3QuUmVhY3ROb2RlXG4gIGNvbGxlY3Rpb25TbHVnPzogc3RyaW5nXG4gIGNvbmZpZzogUHJvbWlzZTxTYW5pdGl6ZWRDb25maWc+XG4gIGdsb2JhbFNsdWc/OiBzdHJpbmdcbn0pID0+IHtcbiAgY29uc3QgeyBjb2xsZWN0aW9uQ29uZmlnLCBnbG9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MsUUFBUUMsYUFBYSxFQUNyQkMsVUFBVSxFQU1YO0lBQ0MsTUFBTSxFQUFFQyxnQkFBZ0IsRUFBRUMsWUFBWSxFQUFFQyxHQUFHLEVBQUUsR0FBRyxNQUFNQyxJQUFBQSxrQkFBUSxFQUFDO1FBQzdEUDtRQUNBQyxRQUFRQztRQUNSQztJQUNGO0lBRUEscUJBQ0UsNkJBQUNLLGVBQVEsc0JBQ1AsNkJBQUNDLGtCQUFjO1FBQ2JMLGtCQUFrQkE7UUFDbEJILFFBQVFLLElBQUlJLE9BQU8sQ0FBQ1QsTUFBTTtRQUMxQkksY0FBY0E7UUFDZE0sTUFBTUwsSUFBSUssSUFBSTtRQUVmWjtBQUdQIn0=
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SanitizedConfig } from 'payload/types';
|
|
2
|
+
import '@payloadcms/ui/scss/app.scss';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare const metadata: {
|
|
5
|
+
description: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const RootLayout: ({ children, config: configPromise, }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
config: Promise<SanitizedConfig>;
|
|
11
|
+
}) => Promise<React.JSX.Element>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAKpD,OAAO,8BAA8B,CAAA;AAIrC,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AAID,eAAO,MAAM,UAAU;cAIX,MAAM,SAAS;YACjB,QAAQ,eAAe,CAAC;gCAkDjC,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
RootLayout: function() {
|
|
13
|
+
return RootLayout;
|
|
14
|
+
},
|
|
15
|
+
metadata: function() {
|
|
16
|
+
return metadata;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _auth = require("@payloadcms/next/utilities/auth");
|
|
20
|
+
const _client = require("@payloadcms/translations/client");
|
|
21
|
+
const _ui = require("@payloadcms/ui");
|
|
22
|
+
require("@payloadcms/ui/scss/app.scss");
|
|
23
|
+
const _headers = require("next/headers");
|
|
24
|
+
const _config = require("payload/config");
|
|
25
|
+
const _utilities = require("payload/utilities");
|
|
26
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
27
|
+
const _Default = require("../../pages/Edit/Default");
|
|
28
|
+
const _Default1 = require("../../pages/List/Default");
|
|
29
|
+
const _Cell = require("../../pages/List/Default/Cell");
|
|
30
|
+
const _getRequestLanguage = require("../../utilities/getRequestLanguage");
|
|
31
|
+
function _interop_require_default(obj) {
|
|
32
|
+
return obj && obj.__esModule ? obj : {
|
|
33
|
+
default: obj
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const metadata = {
|
|
37
|
+
description: 'Generated by Next.js',
|
|
38
|
+
title: 'Next.js'
|
|
39
|
+
};
|
|
40
|
+
const rtlLanguages = [
|
|
41
|
+
'ar',
|
|
42
|
+
'fa',
|
|
43
|
+
'ha',
|
|
44
|
+
'ku',
|
|
45
|
+
'ur',
|
|
46
|
+
'ps',
|
|
47
|
+
'dv',
|
|
48
|
+
'ks',
|
|
49
|
+
'khw',
|
|
50
|
+
'he',
|
|
51
|
+
'yi'
|
|
52
|
+
];
|
|
53
|
+
const RootLayout = async ({ children, config: configPromise })=>{
|
|
54
|
+
const config = await configPromise;
|
|
55
|
+
const clientConfig = await (0, _config.createClientConfig)(config);
|
|
56
|
+
const headers = (0, _headers.headers)();
|
|
57
|
+
const { cookies, user } = await (0, _auth.auth)({
|
|
58
|
+
config: configPromise,
|
|
59
|
+
headers
|
|
60
|
+
});
|
|
61
|
+
const lang = (0, _getRequestLanguage.getRequestLanguage)({
|
|
62
|
+
cookies,
|
|
63
|
+
headers
|
|
64
|
+
}) ?? clientConfig.i18n.fallbackLanguage;
|
|
65
|
+
const dir = rtlLanguages.includes(lang) ? 'RTL' : 'LTR';
|
|
66
|
+
const mergedTranslations = (0, _utilities.deepMerge)(_client.translations, clientConfig.i18n.translations);
|
|
67
|
+
const languageOptions = Object.entries(_client.translations || {}).map(([language, translations])=>({
|
|
68
|
+
label: translations.general.thisLanguage,
|
|
69
|
+
value: language
|
|
70
|
+
}));
|
|
71
|
+
const componentMap = (0, _ui.buildComponentMap)({
|
|
72
|
+
DefaultCell: _Cell.DefaultCell,
|
|
73
|
+
DefaultEditView: _Default.DefaultEditView,
|
|
74
|
+
DefaultListView: _Default1.DefaultListView,
|
|
75
|
+
config
|
|
76
|
+
});
|
|
77
|
+
return /*#__PURE__*/ _react.default.createElement("html", {
|
|
78
|
+
dir: dir,
|
|
79
|
+
lang: lang
|
|
80
|
+
}, /*#__PURE__*/ _react.default.createElement("body", null, /*#__PURE__*/ _react.default.createElement(_ui.RootProvider, {
|
|
81
|
+
componentMap: componentMap,
|
|
82
|
+
config: clientConfig,
|
|
83
|
+
fallbackLang: clientConfig.i18n.fallbackLanguage,
|
|
84
|
+
lang: lang,
|
|
85
|
+
languageOptions: languageOptions,
|
|
86
|
+
translations: mergedTranslations[lang]
|
|
87
|
+
}, children), /*#__PURE__*/ _react.default.createElement("div", {
|
|
88
|
+
id: "portal"
|
|
89
|
+
})));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9u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QzQixRQUFRRTtRQUNSaUMsY0FBY2pDLGFBQWFTLElBQUksQ0FBQ0MsZ0JBQWdCO1FBQ2hESCxNQUFNQTtRQUNOUyxpQkFBaUJBO1FBQ2pCRCxjQUFjRixrQkFBa0IsQ0FBQ04sS0FBSztPQUVyQ1YseUJBRUgsNkJBQUNxQztRQUFJQyxJQUFHOztBQUloQiJ9
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { FileShape, NextFileUploadOptions } from '.';
|
|
3
|
+
type FileFactoryOptions = {
|
|
4
|
+
buffer: Buffer;
|
|
5
|
+
encoding: string;
|
|
6
|
+
hash: Buffer | string;
|
|
7
|
+
mimetype: string;
|
|
8
|
+
name: string;
|
|
9
|
+
size: number;
|
|
10
|
+
tempFilePath: string;
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
};
|
|
13
|
+
type FileFactory = (options: FileFactoryOptions, fileUploadOptions: NextFileUploadOptions) => FileShape;
|
|
14
|
+
export declare const fileFactory: FileFactory;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=fileFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileFactory.d.ts","sourceRoot":"","sources":["../../src/next-fileupload/fileFactory.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,GAAG,CAAA;AAmCzD,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AACD,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,kBAAkB,EAC3B,iBAAiB,EAAE,qBAAqB,KACrC,SAAS,CAAA;AACd,eAAO,MAAM,WAAW,EAAE,WA4BzB,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "fileFactory", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return fileFactory;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _utilities = require("./utilities");
|
|
12
|
+
/**
|
|
13
|
+
* Returns Local function that moves the file to a different location on the filesystem
|
|
14
|
+
* which takes two function arguments to make it compatible w/ Promise or Callback APIs
|
|
15
|
+
*/ const moveFromTemp = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
|
|
16
|
+
(0, _utilities.debugLog)(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`);
|
|
17
|
+
(0, _utilities.moveFile)(options.tempFilePath, filePath, (0, _utilities.promiseCallback)(resolve, reject));
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns Local function that moves the file from buffer to a different location on the filesystem
|
|
21
|
+
* which takes two function arguments to make it compatible w/ Promise or Callback APIs
|
|
22
|
+
*/ const moveFromBuffer = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
|
|
23
|
+
(0, _utilities.debugLog)(fileUploadOptions, `Moving uploaded buffer to ${filePath}`);
|
|
24
|
+
(0, _utilities.saveBufferToFile)(options.buffer, filePath, (0, _utilities.promiseCallback)(resolve, reject));
|
|
25
|
+
};
|
|
26
|
+
const fileFactory = (options, fileUploadOptions)=>{
|
|
27
|
+
// see: https://github.com/richardgirges/express-fileupload/issues/14
|
|
28
|
+
// firefox uploads empty file in case of cache miss when f5ing page.
|
|
29
|
+
// resulting in unexpected behavior. if there is no file data, the file is invalid.
|
|
30
|
+
// if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
|
|
31
|
+
// Create and return file object.
|
|
32
|
+
return {
|
|
33
|
+
name: options.name,
|
|
34
|
+
data: options.buffer,
|
|
35
|
+
encoding: options.encoding,
|
|
36
|
+
md5: options.hash,
|
|
37
|
+
mimetype: options.mimetype,
|
|
38
|
+
mv: (filePath, callback)=>{
|
|
39
|
+
// Define a proper move function.
|
|
40
|
+
const moveFunc = fileUploadOptions.useTempFiles ? moveFromTemp(filePath, options, fileUploadOptions) : moveFromBuffer(filePath, options, fileUploadOptions);
|
|
41
|
+
// Create a folder for a file.
|
|
42
|
+
(0, _utilities.checkAndMakeDir)(fileUploadOptions, filePath);
|
|
43
|
+
// If callback is passed in, use the callback API, otherwise return a promise.
|
|
44
|
+
const defaultReject = ()=>undefined;
|
|
45
|
+
return (0, _utilities.isFunc)(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc);
|
|
46
|
+
},
|
|
47
|
+
size: options.size,
|
|
48
|
+
tempFilePath: options.tempFilePath,
|
|
49
|
+
truncated: options.truncated
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9uZXh0LWZpbGV1cGxvYWQvZmlsZUZhY3RvcnkudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBGaWxlU2hhcGUsIE5leHRGaWxlVXBsb2FkT3B0aW9ucyB9IGZyb20gJy4nXG5cbmltcG9ydCB7XG4gIGNoZWNrQW5kTWFrZURpcixcbiAgZGVidWdMb2csXG4gIGlzRnVuYyxcbiAgbW92ZUZpbGUsXG4gIHByb21pc2VDYWxsYmFjayxcbiAgc2F2ZUJ1ZmZlclRvRmlsZSxcbn0gZnJvbSAnLi91dGlsaXRpZXMnXG5cbnR5cGUgTW92ZUZpbGUgPSAoXG4gIGZpbGVQYXRoOiBzdHJpbmcsXG4gIG9wdGlvbnM6IEZpbGVGYWN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SUcsUUFBUU47UUFDNUU7UUFDQU8sTUFBTTFCLFFBQVEwQixJQUFJO1FBQ2xCckIsY0FBY0wsUUFBUUssWUFBWTtRQUNsQ3NCLFdBQVczQixRQUFRMkIsU0FBUztJQUM5QjtBQUNGIn0=
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { NextFileUploadOptions } from '.';
|
|
3
|
+
type Handler = (options: NextFileUploadOptions, fieldname: string, filename: string) => {
|
|
4
|
+
cleanup: () => void;
|
|
5
|
+
complete: () => Buffer;
|
|
6
|
+
dataHandler: (data: Buffer) => void;
|
|
7
|
+
getFilePath: () => string;
|
|
8
|
+
getFileSize: () => number;
|
|
9
|
+
getHash: () => string;
|
|
10
|
+
getWritePromise: () => Promise<boolean>;
|
|
11
|
+
};
|
|
12
|
+
export declare const tempFileHandler: Handler;
|
|
13
|
+
export declare const memHandler: Handler;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/next-fileupload/handlers.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,GAAG,CAAA;AAI9C,KAAK,OAAO,GAAG,CACb,OAAO,EAAE,qBAAqB,EAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACb;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAsD7B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,OAgCxB,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
memHandler: function() {
|
|
13
|
+
return memHandler;
|
|
14
|
+
},
|
|
15
|
+
tempFileHandler: function() {
|
|
16
|
+
return tempFileHandler;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
20
|
+
const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
21
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
22
|
+
const _utilities = require("./utilities");
|
|
23
|
+
function _interop_require_default(obj) {
|
|
24
|
+
return obj && obj.__esModule ? obj : {
|
|
25
|
+
default: obj
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
29
|
+
if (typeof WeakMap !== "function") return null;
|
|
30
|
+
var cacheBabelInterop = new WeakMap();
|
|
31
|
+
var cacheNodeInterop = new WeakMap();
|
|
32
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
33
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
34
|
+
})(nodeInterop);
|
|
35
|
+
}
|
|
36
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
37
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
41
|
+
return {
|
|
42
|
+
default: obj
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
46
|
+
if (cache && cache.has(obj)) {
|
|
47
|
+
return cache.get(obj);
|
|
48
|
+
}
|
|
49
|
+
var newObj = {
|
|
50
|
+
__proto__: null
|
|
51
|
+
};
|
|
52
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
|
+
for(var key in obj){
|
|
54
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
55
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
56
|
+
if (desc && (desc.get || desc.set)) {
|
|
57
|
+
Object.defineProperty(newObj, key, desc);
|
|
58
|
+
} else {
|
|
59
|
+
newObj[key] = obj[key];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
newObj.default = obj;
|
|
64
|
+
if (cache) {
|
|
65
|
+
cache.set(obj, newObj);
|
|
66
|
+
}
|
|
67
|
+
return newObj;
|
|
68
|
+
}
|
|
69
|
+
const tempFileHandler = (options, fieldname, filename)=>{
|
|
70
|
+
const dir = _path.default.normalize(options.tempFileDir);
|
|
71
|
+
const tempFilePath = _path.default.join(process.cwd(), dir, (0, _utilities.getTempFilename)());
|
|
72
|
+
(0, _utilities.checkAndMakeDir)({
|
|
73
|
+
createParentPath: true
|
|
74
|
+
}, tempFilePath);
|
|
75
|
+
(0, _utilities.debugLog)(options, `Temporary file path is ${tempFilePath}`);
|
|
76
|
+
const hash = _crypto.default.createHash('md5');
|
|
77
|
+
let fileSize = 0;
|
|
78
|
+
let completed = false;
|
|
79
|
+
(0, _utilities.debugLog)(options, `Opening write stream for ${fieldname}->${filename}...`);
|
|
80
|
+
const writeStream = _fs.default.createWriteStream(tempFilePath);
|
|
81
|
+
const writePromise = new Promise((resolve, reject)=>{
|
|
82
|
+
writeStream.on('finish', ()=>resolve(true));
|
|
83
|
+
writeStream.on('error', (err)=>{
|
|
84
|
+
(0, _utilities.debugLog)(options, `Error write temp file: ${err}`);
|
|
85
|
+
reject(err);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
cleanup: ()=>{
|
|
90
|
+
completed = true;
|
|
91
|
+
(0, _utilities.debugLog)(options, `Cleaning up temporary file ${tempFilePath}...`);
|
|
92
|
+
writeStream.end();
|
|
93
|
+
(0, _utilities.deleteFile)(tempFilePath, (err)=>err ? (0, _utilities.debugLog)(options, `Cleaning up temporary file ${tempFilePath} failed: ${err}`) : (0, _utilities.debugLog)(options, `Cleaning up temporary file ${tempFilePath} done.`));
|
|
94
|
+
},
|
|
95
|
+
complete: ()=>{
|
|
96
|
+
completed = true;
|
|
97
|
+
(0, _utilities.debugLog)(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
|
|
98
|
+
if (writeStream instanceof _fs.WriteStream) writeStream.end();
|
|
99
|
+
// Return empty buff since data was uploaded into a temp file.
|
|
100
|
+
return Buffer.concat([]);
|
|
101
|
+
},
|
|
102
|
+
dataHandler: (data)=>{
|
|
103
|
+
if (completed === true) {
|
|
104
|
+
(0, _utilities.debugLog)(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
writeStream.write(data);
|
|
108
|
+
hash.update(data);
|
|
109
|
+
fileSize += data.length;
|
|
110
|
+
(0, _utilities.debugLog)(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
|
|
111
|
+
},
|
|
112
|
+
getFilePath: ()=>tempFilePath,
|
|
113
|
+
getFileSize: ()=>fileSize,
|
|
114
|
+
getHash: ()=>hash.digest('hex'),
|
|
115
|
+
getWritePromise: ()=>writePromise
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
const memHandler = (options, fieldname, filename)=>{
|
|
119
|
+
const buffers = [];
|
|
120
|
+
const hash = _crypto.default.createHash('md5');
|
|
121
|
+
let fileSize = 0;
|
|
122
|
+
let completed = false;
|
|
123
|
+
const getBuffer = ()=>Buffer.concat(buffers, fileSize);
|
|
124
|
+
return {
|
|
125
|
+
cleanup: ()=>{
|
|
126
|
+
completed = true;
|
|
127
|
+
},
|
|
128
|
+
complete: ()=>{
|
|
129
|
+
(0, _utilities.debugLog)(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
|
|
130
|
+
completed = true;
|
|
131
|
+
return getBuffer();
|
|
132
|
+
},
|
|
133
|
+
dataHandler: (data)=>{
|
|
134
|
+
if (completed === true) {
|
|
135
|
+
(0, _utilities.debugLog)(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
buffers.push(data);
|
|
139
|
+
hash.update(data);
|
|
140
|
+
fileSize += data.length;
|
|
141
|
+
(0, _utilities.debugLog)(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
|
|
142
|
+
},
|
|
143
|
+
getFilePath: ()=>'',
|
|
144
|
+
getFileSize: ()=>fileSize,
|
|
145
|
+
getHash: ()=>hash.digest('hex'),
|
|
146
|
+
getWritePromise: ()=>Promise.resolve(true)
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9uZXh0LWZpbGV1cGxvYWQvaGFuZGxlcnMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNyeXB0byBmcm9tICdjcnlwdG8nXG5pbXBvcnQgZnMsIHsgV3JpdGVTdHJlYW0gfSBmcm9tICdmcydcbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnXG5cbmltcG9ydCB0eXBlIHsgTmV4dEZpbGVVcGxvYWRPcHRpb25zIH0gZnJvbSAnLidcblxuaW1wb3J0IHsgY2hlY2tBbmRNYWtlRGlyLCBkZWJ1Z0xvZywgZGVsZXRlRmlsZSwgZ2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yxRQUFRLEVBQUVnQixTQUFTLEdBQUcsQ0FBQztRQUMvRTtRQUNBdUIsYUFBYSxJQUFNO1FBQ25CQyxhQUFhLElBQU14QjtRQUNuQnlCLFNBQVMsSUFBTTVCLEtBQUs2QixNQUFNLENBQUM7UUFDM0JDLGlCQUFpQixJQUFNckIsUUFBUUMsT0FBTyxDQUFDO0lBQ3pDO0FBQ0YifQ==
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { BusboyConfig } from 'busboy';
|
|
3
|
+
export type FileShape = {
|
|
4
|
+
data: Buffer;
|
|
5
|
+
encoding: string;
|
|
6
|
+
md5: Buffer | string;
|
|
7
|
+
mimetype: string;
|
|
8
|
+
mv: (filePath: string, callback: () => void) => Promise<void> | void;
|
|
9
|
+
name: string;
|
|
10
|
+
size: number;
|
|
11
|
+
tempFilePath: string;
|
|
12
|
+
truncated: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type NextFileUploadOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Returns a HTTP 413 when the file is bigger than the size limit if `true`.
|
|
17
|
+
* Otherwise, it will add a `truncated = true` to the resulting file structure.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
abortOnLimit?: boolean | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Automatically creates the directory path specified in `.mv(filePathName)`
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
createParentPath?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Turn on/off upload process logging. Can be useful for troubleshooting.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
debug?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* User defined limit handler which will be invoked if the file is bigger than configured limits.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
limitHandler?: ((args: {
|
|
36
|
+
request: Request;
|
|
37
|
+
size: number;
|
|
38
|
+
}) => void) | boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* By default, `req.body` and `req.files` are flattened like this:
|
|
41
|
+
* `{'name': 'John', 'hobbies[0]': 'Cinema', 'hobbies[1]': 'Bike'}
|
|
42
|
+
*
|
|
43
|
+
* When this option is enabled they are parsed in order to be nested like this:
|
|
44
|
+
* `{'name': 'John', 'hobbies': ['Cinema', 'Bike']}`
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
parseNested?: boolean | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Preserves filename extension when using `safeFileNames` option.
|
|
50
|
+
* If set to `true`, will default to an extension length of `3`.
|
|
51
|
+
* If set to `number`, this will be the max allowable extension length.
|
|
52
|
+
* If an extension is smaller than the extension length, it remains untouched. If the extension is longer,
|
|
53
|
+
* it is shifted.
|
|
54
|
+
* @default false
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // true
|
|
58
|
+
* app.use(fileUpload({ safeFileNames: true, preserveExtension: true }));
|
|
59
|
+
* // myFileName.ext --> myFileName.ext
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // max extension length 2, extension shifted
|
|
63
|
+
* app.use(fileUpload({ safeFileNames: true, preserveExtension: 2 }));
|
|
64
|
+
* // myFileName.ext --> myFileNamee.xt
|
|
65
|
+
*/
|
|
66
|
+
preserveExtension?: boolean | number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Response which will be send to client if file size limit exceeded when `abortOnLimit` set to `true`.
|
|
69
|
+
* @default 'File size limit has been reached'
|
|
70
|
+
*/
|
|
71
|
+
responseOnLimit?: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Strips characters from the upload's filename.
|
|
74
|
+
* You can use custom regex to determine what to strip.
|
|
75
|
+
* If set to `true`, non-alphanumeric characters _except_ dashes and underscores will be stripped.
|
|
76
|
+
* This option is off by default.
|
|
77
|
+
* @default false
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // strip slashes from file names
|
|
81
|
+
* app.use(fileUpload({ safeFileNames: /\\/g }))
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* app.use(fileUpload({ safeFileNames: true }))
|
|
85
|
+
*/
|
|
86
|
+
safeFileNames?: RegExp | boolean | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Path to store temporary files.
|
|
89
|
+
* Used along with the `useTempFiles` option. By default this module uses `'tmp'` folder
|
|
90
|
+
* in the current working directory.
|
|
91
|
+
* You can use trailing slash, but it is not necessary.
|
|
92
|
+
* @default './tmp'
|
|
93
|
+
*/
|
|
94
|
+
tempFileDir?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* This defines how long to wait for data before aborting. Set to `0` if you want to turn off timeout checks.
|
|
97
|
+
* @default 60_000
|
|
98
|
+
*/
|
|
99
|
+
uploadTimeout?: number | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Applies uri decoding to file names if set `true`.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
uriDecodeFileNames?: boolean | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* By default this module uploads files into RAM.
|
|
107
|
+
* Setting this option to `true` turns on using temporary files instead of utilising RAM.
|
|
108
|
+
* This avoids memory overflow issues when uploading large files or in case of uploading
|
|
109
|
+
* lots of files at same time.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
useTempFiles?: boolean | undefined;
|
|
113
|
+
} & Partial<BusboyConfig>;
|
|
114
|
+
type NextFileUploadResponseFile = {
|
|
115
|
+
data: Buffer;
|
|
116
|
+
mimetype: string;
|
|
117
|
+
name: string;
|
|
118
|
+
size: number;
|
|
119
|
+
tempFilePath?: string;
|
|
120
|
+
};
|
|
121
|
+
export type NextFileUploadResponse = {
|
|
122
|
+
error?: {
|
|
123
|
+
code: number;
|
|
124
|
+
message: string;
|
|
125
|
+
};
|
|
126
|
+
fields: Record<string, string>;
|
|
127
|
+
files: Record<string, NextFileUploadResponseFile>;
|
|
128
|
+
};
|
|
129
|
+
type NextFileUpload = (args: {
|
|
130
|
+
options?: NextFileUploadOptions;
|
|
131
|
+
request: Request;
|
|
132
|
+
}) => Promise<NextFileUploadResponse>;
|
|
133
|
+
export declare const nextFileUpload: NextFileUpload;
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next-fileupload/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAwB1C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,SAAS,CAAA;IACzF;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,S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