@webiny/app-headless-cms 6.5.0-beta.3 → 6.5.0-beta.4
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/ContentEntriesModule.js +9 -2
- package/ContentEntriesModule.js.map +1 -1
- package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.d.ts +2 -0
- package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js +34 -0
- package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js.map +1 -0
- package/admin/components/ContentEntries/Table/Actions/index.d.ts +1 -0
- package/admin/components/ContentEntries/Table/Actions/index.js +1 -0
- package/admin/components/Dialogs/DuplicateEntryConfirmDialog.d.ts +2 -0
- package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js +22 -0
- package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js.map +1 -0
- package/features/contentEntry/CmsEntryError.d.ts +10 -0
- package/features/contentEntry/CmsEntryError.js +11 -0
- package/features/contentEntry/CmsEntryError.js.map +1 -0
- package/features/contentEntry/createEntry/CreateEntryGateway.js +2 -1
- package/features/contentEntry/createEntry/CreateEntryGateway.js.map +1 -1
- package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js +2 -1
- package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js.map +1 -1
- package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.d.ts +14 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js +43 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js.map +1 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.d.ts +15 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js +34 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js.map +1 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.d.ts +11 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js +18 -0
- package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js.map +1 -0
- package/features/contentEntry/duplicateEntry/abstractions.d.ts +26 -0
- package/features/contentEntry/duplicateEntry/abstractions.js +7 -0
- package/features/contentEntry/duplicateEntry/abstractions.js.map +1 -0
- package/features/contentEntry/duplicateEntry/feature.d.ts +3 -0
- package/features/contentEntry/duplicateEntry/feature.js +21 -0
- package/features/contentEntry/duplicateEntry/feature.js.map +1 -0
- package/features/contentEntry/feature.js +2 -0
- package/features/contentEntry/feature.js.map +1 -1
- package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js +2 -1
- package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js.map +1 -1
- package/features/contentEntry/updateEntry/UpdateEntryGateway.js +2 -1
- package/features/contentEntry/updateEntry/UpdateEntryGateway.js.map +1 -1
- package/features/formModel/CmsFormModelBuilder.d.ts +8 -0
- package/features/formModel/CmsFormModelBuilder.js +25 -2
- package/features/formModel/CmsFormModelBuilder.js.map +1 -1
- package/features/formModel/CmsFormModelBuilder.test.d.ts +1 -0
- package/features/formModel/CmsFormModelBuilder.test.js +111 -0
- package/features/formModel/CmsFormModelBuilder.test.js.map +1 -0
- package/package.json +20 -20
- package/presentation/contentEntries/form/ContentEntryFormPresenter.js +3 -1
- package/presentation/contentEntries/form/ContentEntryFormPresenter.js.map +1 -1
- package/presentation/contentEntries/form/toFormErrors.d.ts +7 -0
- package/presentation/contentEntries/form/toFormErrors.js +49 -0
- package/presentation/contentEntries/form/toFormErrors.js.map +1 -0
- package/presentation/contentEntries/form/toFormErrors.test.d.ts +1 -0
- package/presentation/contentEntries/form/toFormErrors.test.js +175 -0
- package/presentation/contentEntries/form/toFormErrors.test.js.map +1 -0
- package/presentation/contentEntries/list/ContentEntriesPresenter.d.ts +6 -2
- package/presentation/contentEntries/list/ContentEntriesPresenter.js +27 -2
- package/presentation/contentEntries/list/ContentEntriesPresenter.js.map +1 -1
- package/presentation/contentEntries/list/ContentEntriesPresenter.test.js +58 -1
- package/presentation/contentEntries/list/ContentEntriesPresenter.test.js.map +1 -1
- package/presentation/contentEntries/list/abstractions.d.ts +12 -0
- package/presentation/contentEntries/list/abstractions.js.map +1 -1
- package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js +3 -1
- package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js.map +1 -1
package/ContentEntriesModule.js
CHANGED
|
@@ -3,9 +3,9 @@ import { AdminConfig } from "@webiny/app-admin";
|
|
|
3
3
|
import { AdvancedSearchConfigs } from "@webiny/app-aco/components/AdvancedSearch/AdvancedSearchConfigs";
|
|
4
4
|
import { InternalContentEntryEditorConfig, InternalContentEntryListConfig } from "./admin/config/contentEntries/index.js";
|
|
5
5
|
import { ActionDelete, ActionMove, ActionPublish, ActionUnpublish } from "./admin/components/ContentEntries/BulkActions/index.js";
|
|
6
|
-
import { PUBLISH_ENTRY_DIALOG, TRASH_ENTRY_DIALOG, UNPUBLISH_ENTRY_DIALOG } from "./presentation/contentEntries/list/ContentEntriesPresenter.js";
|
|
6
|
+
import { DUPLICATE_ENTRY_DIALOG, PUBLISH_ENTRY_DIALOG, TRASH_ENTRY_DIALOG, UNPUBLISH_ENTRY_DIALOG } from "./presentation/contentEntries/list/ContentEntriesPresenter.js";
|
|
7
7
|
import { DeleteFolder, EditFolder, SetFolderPermissions } from "@webiny/app-aco";
|
|
8
|
-
import { ChangeEntryStatus, DeleteEntry, EditEntry, MoveEntry } from "./admin/components/ContentEntries/Table/Actions/index.js";
|
|
8
|
+
import { ChangeEntryStatus, DeleteEntry, DuplicateEntry, EditEntry, MoveEntry } from "./admin/components/ContentEntries/Table/Actions/index.js";
|
|
9
9
|
import { CellActions, CellAuthor, CellCreated, CellLive, CellModified, CellName, CellStatus } from "./admin/components/ContentEntries/Table/Cells/index.js";
|
|
10
10
|
import { IsModelPublishable } from "./admin/components/IsModelPublishable.js";
|
|
11
11
|
import { FilterByStatus } from "./admin/components/ContentEntries/FilterByStatus.js";
|
|
@@ -13,6 +13,7 @@ import { CmsTrashBin } from "./presentation/contentEntries/trashBin/CmsTrashBin.
|
|
|
13
13
|
import { TrashEntryConfirmDialog } from "./admin/components/Dialogs/TrashEntryConfirmDialog.js";
|
|
14
14
|
import { PublishEntryConfirmDialog } from "./admin/components/Dialogs/PublishEntryConfirmDialog.js";
|
|
15
15
|
import { UnpublishEntryConfirmDialog } from "./admin/components/Dialogs/UnpublishEntryConfirmDialog.js";
|
|
16
|
+
import { DuplicateEntryConfirmDialog } from "./admin/components/Dialogs/DuplicateEntryConfirmDialog.js";
|
|
16
17
|
import { DeleteRevisionConfirmDialog } from "./admin/components/Dialogs/DeleteRevisionConfirmDialog.js";
|
|
17
18
|
import { EditRevisionNoteDialog } from "./admin/components/Dialogs/EditRevisionNoteDialog.js";
|
|
18
19
|
import { DELETE_REVISION_DIALOG, EDIT_REVISION_NOTE_DIALOG } from "./presentation/contentEntries/revisionsList/RevisionsListPresenter.js";
|
|
@@ -35,6 +36,9 @@ const ContentEntriesModule = ()=>/*#__PURE__*/ react.createElement(react.Fragmen
|
|
|
35
36
|
}), /*#__PURE__*/ react.createElement(AdminConfig.Dialog, {
|
|
36
37
|
name: UNPUBLISH_ENTRY_DIALOG,
|
|
37
38
|
element: /*#__PURE__*/ react.createElement(UnpublishEntryConfirmDialog, null)
|
|
39
|
+
}), /*#__PURE__*/ react.createElement(AdminConfig.Dialog, {
|
|
40
|
+
name: DUPLICATE_ENTRY_DIALOG,
|
|
41
|
+
element: /*#__PURE__*/ react.createElement(DuplicateEntryConfirmDialog, null)
|
|
38
42
|
}), /*#__PURE__*/ react.createElement(AdminConfig.Dialog, {
|
|
39
43
|
name: DELETE_REVISION_DIALOG,
|
|
40
44
|
element: /*#__PURE__*/ react.createElement(DeleteRevisionConfirmDialog, null)
|
|
@@ -77,6 +81,9 @@ const ContentEntriesModule = ()=>/*#__PURE__*/ react.createElement(react.Fragmen
|
|
|
77
81
|
})), /*#__PURE__*/ react.createElement(Browser.Entry.Action, {
|
|
78
82
|
name: "move",
|
|
79
83
|
element: /*#__PURE__*/ react.createElement(MoveEntry, null)
|
|
84
|
+
}), /*#__PURE__*/ react.createElement(Browser.Entry.Action, {
|
|
85
|
+
name: "duplicate",
|
|
86
|
+
element: /*#__PURE__*/ react.createElement(DuplicateEntry, null)
|
|
80
87
|
}), /*#__PURE__*/ react.createElement(Browser.Entry.Action, {
|
|
81
88
|
name: "delete",
|
|
82
89
|
element: /*#__PURE__*/ react.createElement(DeleteEntry, null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEntriesModule.js","sources":["../src/ContentEntriesModule.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { AdvancedSearchConfigs } from \"@webiny/app-aco/components/AdvancedSearch/AdvancedSearchConfigs\";\nimport {\n InternalContentEntryEditorConfig,\n InternalContentEntryListConfig\n} from \"~/admin/config/contentEntries/index.js\";\n\nimport {\n ActionDelete,\n ActionMove,\n ActionPublish,\n ActionUnpublish\n} from \"~/admin/components/ContentEntries/BulkActions/index.js\";\n\nimport {\n TRASH_ENTRY_DIALOG,\n PUBLISH_ENTRY_DIALOG,\n UNPUBLISH_ENTRY_DIALOG\n} from \"~/presentation/contentEntries/list/ContentEntriesPresenter.js\";\nimport { DeleteFolder, EditFolder, SetFolderPermissions } from \"@webiny/app-aco\";\nimport {\n ChangeEntryStatus,\n DeleteEntry,\n EditEntry,\n MoveEntry\n} from \"~/admin/components/ContentEntries/Table/Actions/index.js\";\nimport {\n CellActions,\n CellAuthor,\n CellCreated,\n CellLive,\n CellModified,\n CellName,\n CellStatus\n} from \"~/admin/components/ContentEntries/Table/Cells/index.js\";\nimport { IsModelPublishable } from \"~/admin/components/IsModelPublishable.js\";\nimport { FilterByStatus } from \"~/admin/components/ContentEntries/FilterByStatus.js\";\nimport { CmsTrashBin } from \"~/presentation/contentEntries/trashBin/CmsTrashBin.js\";\nimport { TrashEntryConfirmDialog } from \"~/admin/components/Dialogs/TrashEntryConfirmDialog.js\";\nimport { PublishEntryConfirmDialog } from \"~/admin/components/Dialogs/PublishEntryConfirmDialog.js\";\nimport { UnpublishEntryConfirmDialog } from \"~/admin/components/Dialogs/UnpublishEntryConfirmDialog.js\";\nimport { DeleteRevisionConfirmDialog } from \"~/admin/components/Dialogs/DeleteRevisionConfirmDialog.js\";\nimport { EditRevisionNoteDialog } from \"~/admin/components/Dialogs/EditRevisionNoteDialog.js\";\nimport {\n DELETE_REVISION_DIALOG,\n EDIT_REVISION_NOTE_DIALOG\n} from \"~/presentation/contentEntries/revisionsList/RevisionsListPresenter.js\";\nimport { RevisionSelector } from \"~/presentation/contentEntries/views/actions/RevisionSelector.js\";\nimport { ContentFormOptionsMenu } from \"~/presentation/contentEntries/views/actions/ContentFormOptionsMenu.js\";\nimport { SaveContentButton } from \"~/presentation/contentEntries/views/actions/SaveContentButton.js\";\nimport { SaveAndPublishButton } from \"~/presentation/contentEntries/views/actions/SaveAndPublishButton.js\";\nimport { DeleteEntryMenuItem } from \"~/presentation/contentEntries/views/actions/DeleteEntryMenuItem.js\";\nimport { ShowRevisionListMenuItem } from \"~/presentation/contentEntries/views/actions/ShowRevisionListMenuItem.js\";\nimport { CreateNewRevisionButton } from \"~/presentation/contentEntries/views/actions/CreateNewRevisionButton.js\";\nimport { PublishOnlyButton } from \"~/presentation/contentEntries/views/actions/PublishOnlyButton.js\";\n\nconst { Browser } = InternalContentEntryListConfig;\nconst { Actions } = InternalContentEntryEditorConfig;\n\nexport const ContentEntriesModule = () => {\n return (\n <>\n <AdminConfig>\n <AdminConfig.Dialog\n name={TRASH_ENTRY_DIALOG}\n element={<TrashEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={PUBLISH_ENTRY_DIALOG}\n element={<PublishEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={UNPUBLISH_ENTRY_DIALOG}\n element={<UnpublishEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={DELETE_REVISION_DIALOG}\n element={<DeleteRevisionConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={EDIT_REVISION_NOTE_DIALOG}\n element={<EditRevisionNoteDialog />}\n />\n </AdminConfig>\n <InternalContentEntryListConfig>\n <AdvancedSearchConfigs />\n <IsModelPublishable>\n <Browser.Filter name={\"status\"} element={<FilterByStatus />} />\n <Browser.BulkAction name={\"publish\"} element={<ActionPublish />} />\n <Browser.BulkAction name={\"unpublish\"} element={<ActionUnpublish />} />\n </IsModelPublishable>\n <Browser.Sidebar.Footer name={\"trashBin\"} element={<CmsTrashBin />} />\n <Browser.BulkAction name={\"move\"} element={<ActionMove />} />\n <Browser.BulkAction name={\"delete\"} element={<ActionDelete />} />\n <Browser.Folder.Action name={\"edit\"} element={<EditFolder />} />\n <Browser.Folder.Action name={\"permissions\"} element={<SetFolderPermissions />} />\n <Browser.Folder.Action name={\"delete\"} element={<DeleteFolder />} />\n <Browser.Entry.Action name={\"edit\"} element={<EditEntry />} />\n <IsModelPublishable>\n <Browser.Entry.Action name={\"status\"} element={<ChangeEntryStatus />} />\n </IsModelPublishable>\n <Browser.Entry.Action name={\"move\"} element={<MoveEntry />} />\n <Browser.Entry.Action name={\"delete\"} element={<DeleteEntry />} after={\"$last\"} />\n <Browser.Table.Column\n name={\"name\"}\n header={\"Name\"}\n cell={<CellName />}\n sortable={true}\n hideable={false}\n size={200}\n />\n <Browser.Table.Column name={\"createdBy\"} header={\"Author\"} cell={<CellAuthor />} />\n <Browser.Table.Column\n name={\"createdOn\"}\n header={\"Created\"}\n cell={<CellCreated />}\n sortable={true}\n />\n <Browser.Table.Column\n name={\"savedOn\"}\n header={\"Modified\"}\n cell={<CellModified />}\n sortable={true}\n />\n <IsModelPublishable>\n <Browser.Table.Column\n name={\"status\"}\n header={\"Status\"}\n cell={<CellStatus />}\n truncate={false}\n />\n <Browser.Table.Column\n name={\"live\"}\n header={\"Live\"}\n truncate={false}\n sortable={true}\n cell={<CellLive />}\n />\n </IsModelPublishable>\n <Browser.Table.Column\n name={\"actions\"}\n header={\"\"}\n cell={<CellActions />}\n size={56}\n resizable={false}\n hideable={false}\n truncate={false}\n className={\"flex justify-center\"}\n />\n </InternalContentEntryListConfig>\n <InternalContentEntryEditorConfig>\n <IsModelPublishable>\n <Actions.ButtonAction\n name={\"revisionSelector\"}\n element={<RevisionSelector />}\n />\n </IsModelPublishable>\n <Actions.ButtonAction name={\"optionsMenu\"} element={<ContentFormOptionsMenu />} />\n <Actions.ButtonAction name={\"save\"} element={<SaveContentButton />} />\n <IsModelPublishable>\n <Actions.ButtonAction\n name={\"cms/createNewRevision\"}\n element={<CreateNewRevisionButton />}\n />\n <Actions.ButtonAction name={\"publish\"} element={<SaveAndPublishButton />} />\n <Actions.ButtonAction name={\"publishOnly\"} element={<PublishOnlyButton />} />\n </IsModelPublishable>\n <Actions.MenuItemAction\n name={\"delete\"}\n element={<DeleteEntryMenuItem />}\n after={\"$last\"}\n />\n <IsModelPublishable>\n <Actions.MenuItemAction\n name={\"showRevisionsList\"}\n element={<ShowRevisionListMenuItem />}\n />\n </IsModelPublishable>\n </InternalContentEntryEditorConfig>\n </>\n );\n};\n"],"names":["Browser","InternalContentEntryListConfig","Actions","InternalContentEntryEditorConfig","ContentEntriesModule","AdminConfig","TRASH_ENTRY_DIALOG","TrashEntryConfirmDialog","PUBLISH_ENTRY_DIALOG","PublishEntryConfirmDialog","UNPUBLISH_ENTRY_DIALOG","UnpublishEntryConfirmDialog","DELETE_REVISION_DIALOG","DeleteRevisionConfirmDialog","EDIT_REVISION_NOTE_DIALOG","EditRevisionNoteDialog","AdvancedSearchConfigs","IsModelPublishable","FilterByStatus","ActionPublish","ActionUnpublish","CmsTrashBin","ActionMove","ActionDelete","EditFolder","SetFolderPermissions","DeleteFolder","EditEntry","ChangeEntryStatus","MoveEntry","DeleteEntry","CellName","CellAuthor","CellCreated","CellModified","CellStatus","CellLive","CellActions","RevisionSelector","ContentFormOptionsMenu","SaveContentButton","CreateNewRevisionButton","SaveAndPublishButton","PublishOnlyButton","DeleteEntryMenuItem","ShowRevisionList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AAC,MAAM;QACjB,MAAM;QACN,QAAQ;QACR,oBAAM,oBAACqC,aAAWA;QAClB,MAAM;QACN,WAAW;QACX,UAAU;QACV,UAAU;QACV,WAAW;uBAGnB,oBAAClC,kCAAgCA,MAAAA,WAAAA,GAC7B,oBAACc,oBAAkBA,MAAAA,WAAAA,GACf,oBAACf,QAAQ,YAAY;QACjB,MAAM;QACN,uBAAS,oBAACoC,kBAAgBA;uBAGlC,oBAACpC,QAAQ,YAAY;QAAC,MAAM;QAAe,uBAAS,oBAACqC,wBAAsBA;sBAC3E,oBAACrC,QAAQ,YAAY;QAAC,MAAM;QAAQ,uBAAS,oBAACsC,mBAAiBA;sBAC/D,oBAACvB,oBAAkBA,MAAAA,WAAAA,GACf,oBAACf,QAAQ,YAAY;QACjB,MAAM;QACN,uBAAS,oBAACuC,yBAAuBA;sBAErC,oBAACvC,QAAQ,YAAY;QAAC,MAAM;QAAW,uBAAS,oBAACwC,sBAAoBA;sBACrE,oBAACxC,QAAQ,YAAY;QAAC,MAAM;QAAe,uBAAS,oBAACyC,mBAAiBA;uBAE1E,oBAACzC,QAAQ,cAAc;QACnB,MAAM;QACN,uBAAS,oBAAC0C,qBAAmBA;QAC7B,OAAO;sBAEX,oBAAC3B,oBAAkBA,MAAAA,WAAAA,GACf,oBAACf,QAAQ,cAAc;QACnB,MAAM;QACN,uBAAS,oBAAC2C,0BAAwBA"}
|
|
1
|
+
{"version":3,"file":"ContentEntriesModule.js","sources":["../src/ContentEntriesModule.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { AdvancedSearchConfigs } from \"@webiny/app-aco/components/AdvancedSearch/AdvancedSearchConfigs\";\nimport {\n InternalContentEntryEditorConfig,\n InternalContentEntryListConfig\n} from \"~/admin/config/contentEntries/index.js\";\n\nimport {\n ActionDelete,\n ActionMove,\n ActionPublish,\n ActionUnpublish\n} from \"~/admin/components/ContentEntries/BulkActions/index.js\";\n\nimport {\n TRASH_ENTRY_DIALOG,\n PUBLISH_ENTRY_DIALOG,\n UNPUBLISH_ENTRY_DIALOG,\n DUPLICATE_ENTRY_DIALOG\n} from \"~/presentation/contentEntries/list/ContentEntriesPresenter.js\";\nimport { DeleteFolder, EditFolder, SetFolderPermissions } from \"@webiny/app-aco\";\nimport {\n ChangeEntryStatus,\n DeleteEntry,\n DuplicateEntry,\n EditEntry,\n MoveEntry\n} from \"~/admin/components/ContentEntries/Table/Actions/index.js\";\nimport {\n CellActions,\n CellAuthor,\n CellCreated,\n CellLive,\n CellModified,\n CellName,\n CellStatus\n} from \"~/admin/components/ContentEntries/Table/Cells/index.js\";\nimport { IsModelPublishable } from \"~/admin/components/IsModelPublishable.js\";\nimport { FilterByStatus } from \"~/admin/components/ContentEntries/FilterByStatus.js\";\nimport { CmsTrashBin } from \"~/presentation/contentEntries/trashBin/CmsTrashBin.js\";\nimport { TrashEntryConfirmDialog } from \"~/admin/components/Dialogs/TrashEntryConfirmDialog.js\";\nimport { PublishEntryConfirmDialog } from \"~/admin/components/Dialogs/PublishEntryConfirmDialog.js\";\nimport { UnpublishEntryConfirmDialog } from \"~/admin/components/Dialogs/UnpublishEntryConfirmDialog.js\";\nimport { DuplicateEntryConfirmDialog } from \"~/admin/components/Dialogs/DuplicateEntryConfirmDialog.js\";\nimport { DeleteRevisionConfirmDialog } from \"~/admin/components/Dialogs/DeleteRevisionConfirmDialog.js\";\nimport { EditRevisionNoteDialog } from \"~/admin/components/Dialogs/EditRevisionNoteDialog.js\";\nimport {\n DELETE_REVISION_DIALOG,\n EDIT_REVISION_NOTE_DIALOG\n} from \"~/presentation/contentEntries/revisionsList/RevisionsListPresenter.js\";\nimport { RevisionSelector } from \"~/presentation/contentEntries/views/actions/RevisionSelector.js\";\nimport { ContentFormOptionsMenu } from \"~/presentation/contentEntries/views/actions/ContentFormOptionsMenu.js\";\nimport { SaveContentButton } from \"~/presentation/contentEntries/views/actions/SaveContentButton.js\";\nimport { SaveAndPublishButton } from \"~/presentation/contentEntries/views/actions/SaveAndPublishButton.js\";\nimport { DeleteEntryMenuItem } from \"~/presentation/contentEntries/views/actions/DeleteEntryMenuItem.js\";\nimport { ShowRevisionListMenuItem } from \"~/presentation/contentEntries/views/actions/ShowRevisionListMenuItem.js\";\nimport { CreateNewRevisionButton } from \"~/presentation/contentEntries/views/actions/CreateNewRevisionButton.js\";\nimport { PublishOnlyButton } from \"~/presentation/contentEntries/views/actions/PublishOnlyButton.js\";\n\nconst { Browser } = InternalContentEntryListConfig;\nconst { Actions } = InternalContentEntryEditorConfig;\n\nexport const ContentEntriesModule = () => {\n return (\n <>\n <AdminConfig>\n <AdminConfig.Dialog\n name={TRASH_ENTRY_DIALOG}\n element={<TrashEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={PUBLISH_ENTRY_DIALOG}\n element={<PublishEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={UNPUBLISH_ENTRY_DIALOG}\n element={<UnpublishEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={DUPLICATE_ENTRY_DIALOG}\n element={<DuplicateEntryConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={DELETE_REVISION_DIALOG}\n element={<DeleteRevisionConfirmDialog />}\n />\n <AdminConfig.Dialog\n name={EDIT_REVISION_NOTE_DIALOG}\n element={<EditRevisionNoteDialog />}\n />\n </AdminConfig>\n <InternalContentEntryListConfig>\n <AdvancedSearchConfigs />\n <IsModelPublishable>\n <Browser.Filter name={\"status\"} element={<FilterByStatus />} />\n <Browser.BulkAction name={\"publish\"} element={<ActionPublish />} />\n <Browser.BulkAction name={\"unpublish\"} element={<ActionUnpublish />} />\n </IsModelPublishable>\n <Browser.Sidebar.Footer name={\"trashBin\"} element={<CmsTrashBin />} />\n <Browser.BulkAction name={\"move\"} element={<ActionMove />} />\n <Browser.BulkAction name={\"delete\"} element={<ActionDelete />} />\n <Browser.Folder.Action name={\"edit\"} element={<EditFolder />} />\n <Browser.Folder.Action name={\"permissions\"} element={<SetFolderPermissions />} />\n <Browser.Folder.Action name={\"delete\"} element={<DeleteFolder />} />\n <Browser.Entry.Action name={\"edit\"} element={<EditEntry />} />\n <IsModelPublishable>\n <Browser.Entry.Action name={\"status\"} element={<ChangeEntryStatus />} />\n </IsModelPublishable>\n <Browser.Entry.Action name={\"move\"} element={<MoveEntry />} />\n <Browser.Entry.Action name={\"duplicate\"} element={<DuplicateEntry />} />\n <Browser.Entry.Action name={\"delete\"} element={<DeleteEntry />} after={\"$last\"} />\n <Browser.Table.Column\n name={\"name\"}\n header={\"Name\"}\n cell={<CellName />}\n sortable={true}\n hideable={false}\n size={200}\n />\n <Browser.Table.Column name={\"createdBy\"} header={\"Author\"} cell={<CellAuthor />} />\n <Browser.Table.Column\n name={\"createdOn\"}\n header={\"Created\"}\n cell={<CellCreated />}\n sortable={true}\n />\n <Browser.Table.Column\n name={\"savedOn\"}\n header={\"Modified\"}\n cell={<CellModified />}\n sortable={true}\n />\n <IsModelPublishable>\n <Browser.Table.Column\n name={\"status\"}\n header={\"Status\"}\n cell={<CellStatus />}\n truncate={false}\n />\n <Browser.Table.Column\n name={\"live\"}\n header={\"Live\"}\n truncate={false}\n sortable={true}\n cell={<CellLive />}\n />\n </IsModelPublishable>\n <Browser.Table.Column\n name={\"actions\"}\n header={\"\"}\n cell={<CellActions />}\n size={56}\n resizable={false}\n hideable={false}\n truncate={false}\n className={\"flex justify-center\"}\n />\n </InternalContentEntryListConfig>\n <InternalContentEntryEditorConfig>\n <IsModelPublishable>\n <Actions.ButtonAction\n name={\"revisionSelector\"}\n element={<RevisionSelector />}\n />\n </IsModelPublishable>\n <Actions.ButtonAction name={\"optionsMenu\"} element={<ContentFormOptionsMenu />} />\n <Actions.ButtonAction name={\"save\"} element={<SaveContentButton />} />\n <IsModelPublishable>\n <Actions.ButtonAction\n name={\"cms/createNewRevision\"}\n element={<CreateNewRevisionButton />}\n />\n <Actions.ButtonAction name={\"publish\"} element={<SaveAndPublishButton />} />\n <Actions.ButtonAction name={\"publishOnly\"} element={<PublishOnlyButton />} />\n </IsModelPublishable>\n <Actions.MenuItemAction\n name={\"delete\"}\n element={<DeleteEntryMenuItem />}\n after={\"$last\"}\n />\n <IsModelPublishable>\n <Actions.MenuItemAction\n name={\"showRevisionsList\"}\n element={<ShowRevisionListMenuItem />}\n />\n </IsModelPublishable>\n </InternalContentEntryEditorConfig>\n </>\n );\n};\n"],"names":["Browser","InternalContentEntryListConfig","Actions","InternalContentEntryEditorConfig","ContentEntriesModule","AdminConfig","TRASH_ENTRY_DIALOG","TrashEntryConfirmDialog","PUBLISH_ENTRY_DIALOG","PublishEntryConfirmDialog","UNPUBLISH_ENTRY_DIALOG","UnpublishEntryConfirmDialog","DUPLICATE_ENTRY_DIALOG","DuplicateEntryConfirmDialog","DELETE_REVISION_DIALOG","DeleteRevisionConfirmDialog","EDIT_REVISION_NOTE_DIALOG","EditRevisionNoteDialog","AdvancedSearchConfigs","IsModelPublishable","FilterByStatus","ActionPublish","ActionUnpublish","CmsTrashBin","ActionMove","ActionDelete","EditFolder","SetFolderPermissions","DeleteFolder","EditEntry","ChangeEntryStatus","MoveEntry","DuplicateEntry","DeleteEntry","CellName","CellAuthor","CellCreated","CellModified","CellStatus","CellLive","CellActions","RevisionSelector","ContentFormOptionsMenu","SaveContentButton","CreateNewRevisionButton","SaveAndPublishButton","PublishOnlyButton","DeleteEntryMenuItem","ShowRevisionListMenuItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,EAAEA,SAAAA,OAAO,EAAE,GAAGC;AACpB,MAAM,EAAEC,SAAAA,OAAO,EAAE,GAAGC;AAEb,MAAMC,uBAAuB,IACzB,WAAP,GACI,wDACI,oBAACC,aAAWA,MAAAA,WAAAA,GACR,oBAACA,YAAY,MAAM;QACf,MAAMC;QACN,uBAAS,oBAACC,yBAAuBA;sBAErC,oBAACF,YAAY,MAAM;QACf,MAAMG;QACN,uBAAS,oBAACC,2BAAyBA;sBAEvC,oBAACJ,YAAY,MAAM;QACf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Y;QACjB,MAAM;QACN,uBAAS,oBAACuC,kBAAgBA;uBAGlC,oBAACvC,QAAQ,YAAY;QAAC,MAAM;QAAe,uBAAS,oBAACwC,wBAAsBA;sBAC3E,oBAACxC,QAAQ,YAAY;QAAC,MAAM;QAAQ,uBAAS,oBAACyC,mBAAiBA;sBAC/D,oBAACxB,oBAAkBA,MAAAA,WAAAA,GACf,oBAACjB,QAAQ,YAAY;QACjB,MAAM;QACN,uBAAS,oBAAC0C,yBAAuBA;sBAErC,oBAAC1C,QAAQ,YAAY;QAAC,MAAM;QAAW,uBAAS,oBAAC2C,sBAAoBA;sBACrE,oBAAC3C,QAAQ,YAAY;QAAC,MAAM;QAAe,uBAAS,oBAAC4C,mBAAiBA;uBAE1E,oBAAC5C,QAAQ,cAAc;QACnB,MAAM;QACN,uBAAS,oBAAC6C,qBAAmBA;QAC7B,OAAO;sBAEX,oBAAC5B,oBAAkBA,MAAAA,WAAAA,GACf,oBAACjB,QAAQ,cAAc;QACnB,MAAM;QACN,uBAAS,oBAAC8C,0BAAwBA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ReactComponent } from "@webiny/icons/library_add.svg";
|
|
3
|
+
import { useToast } from "@webiny/admin-ui";
|
|
4
|
+
import { ContentEntryListConfig } from "../../../../config/contentEntries/index.js";
|
|
5
|
+
import { useEntry, usePermission } from "../../../../hooks/index.js";
|
|
6
|
+
import { useContentEntriesPresenter } from "../../../../../presentation/contentEntries/list/useContentEntriesPresenter.js";
|
|
7
|
+
const DuplicateEntry = ()=>{
|
|
8
|
+
const { entry } = useEntry();
|
|
9
|
+
const toast = useToast();
|
|
10
|
+
const { canCreate } = usePermission();
|
|
11
|
+
const presenter = useContentEntriesPresenter();
|
|
12
|
+
const { OptionsMenuItem } = ContentEntryListConfig.Browser.Entry.Action;
|
|
13
|
+
const handleDuplicate = async ()=>{
|
|
14
|
+
const result = await presenter.duplicateEntry(entry);
|
|
15
|
+
if (!result) return;
|
|
16
|
+
if (result.error) return void toast.showWarningToast({
|
|
17
|
+
title: `Could not duplicate ${entry.meta.title}.`,
|
|
18
|
+
description: result.error.message
|
|
19
|
+
});
|
|
20
|
+
toast.showSuccessToast({
|
|
21
|
+
title: `${entry.meta.title} was duplicated successfully!`
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
if (!canCreate("cms.contentEntry")) return null;
|
|
25
|
+
return /*#__PURE__*/ react.createElement(OptionsMenuItem, {
|
|
26
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
27
|
+
label: "Duplicate",
|
|
28
|
+
onAction: handleDuplicate,
|
|
29
|
+
"data-testid": "aco.actions.entry.duplicate"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { DuplicateEntry };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DuplicateEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/components/ContentEntries/Table/Actions/DuplicateEntry.js","sources":["../../../../../../src/admin/components/ContentEntries/Table/Actions/DuplicateEntry.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as DuplicateIcon } from \"@webiny/icons/library_add.svg\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries/index.js\";\nimport { useEntry, usePermission } from \"~/admin/hooks/index.js\";\nimport { useContentEntriesPresenter } from \"~/presentation/contentEntries/list/useContentEntriesPresenter.js\";\n\nexport const DuplicateEntry = () => {\n const { entry } = useEntry();\n const toast = useToast();\n const { canCreate } = usePermission();\n const presenter = useContentEntriesPresenter();\n const { OptionsMenuItem } = ContentEntryListConfig.Browser.Entry.Action;\n\n const handleDuplicate = async () => {\n const result = await presenter.duplicateEntry(entry);\n if (!result) {\n return;\n }\n if (result.error) {\n toast.showWarningToast({\n title: `Could not duplicate ${entry.meta.title}.`,\n description: result.error.message\n });\n return;\n }\n toast.showSuccessToast({\n title: `${entry.meta.title} was duplicated successfully!`\n });\n };\n\n if (!canCreate(\"cms.contentEntry\")) {\n return null;\n }\n\n return (\n <OptionsMenuItem\n icon={<DuplicateIcon />}\n label={\"Duplicate\"}\n onAction={handleDuplicate}\n data-testid={\"aco.actions.entry.duplicate\"}\n />\n );\n};\n"],"names":["DuplicateEntry","entry","useEntry","toast","useToast","canCreate","usePermission","presenter","useContentEntriesPresenter","OptionsMenuItem","ContentEntryListConfig","handleDuplicate","result","DuplicateIcon"],"mappings":";;;;;;AAOO,MAAMA,iBAAiB;IAC1B,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,QAAQC;IACd,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAMC,YAAYC;IAClB,MAAM,EAAEC,eAAe,EAAE,GAAGC,uBAAuB,OAAO,CAAC,KAAK,CAAC,MAAM;IAEvE,MAAMC,kBAAkB;QACpB,MAAMC,SAAS,MAAML,UAAU,cAAc,CAACN;QAC9C,IAAI,CAACW,QACD;QAEJ,IAAIA,OAAO,KAAK,EAAE,YACdT,MAAM,gBAAgB,CAAC;YACnB,OAAO,CAAC,oBAAoB,EAAEF,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACjD,aAAaW,OAAO,KAAK,CAAC,OAAO;QACrC;QAGJT,MAAM,gBAAgB,CAAC;YACnB,OAAO,GAAGF,MAAM,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC;QAC7D;IACJ;IAEA,IAAI,CAACI,UAAU,qBACX,OAAO;IAGX,OAAO,WAAP,GACI,oBAACI,iBAAAA;QACG,oBAAM,oBAACI,gBAAaA;QACpB,OAAO;QACP,UAAUF;QACV,eAAa;;AAGzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { ConfirmationDialog } from "@webiny/app-admin/components/ConfirmationDialog/index.js";
|
|
3
|
+
import { useNamedConfirmationDialog } from "@webiny/app-admin";
|
|
4
|
+
const DuplicateEntryConfirmDialog = ()=>{
|
|
5
|
+
const { onConfirm, onCancel, closeDialog, params } = useNamedConfirmationDialog();
|
|
6
|
+
return /*#__PURE__*/ react.createElement(ConfirmationDialog, {
|
|
7
|
+
title: "Duplicate entry",
|
|
8
|
+
confirmLabel: "Yes, duplicate!",
|
|
9
|
+
loadingLabel: "Duplicating...",
|
|
10
|
+
onConfirm: async ()=>{
|
|
11
|
+
await onConfirm();
|
|
12
|
+
closeDialog();
|
|
13
|
+
},
|
|
14
|
+
onCancel: ()=>{
|
|
15
|
+
onCancel();
|
|
16
|
+
closeDialog();
|
|
17
|
+
}
|
|
18
|
+
}, /*#__PURE__*/ react.createElement("p", null, "You are about to duplicate ", /*#__PURE__*/ react.createElement("strong", null, params.entry.meta.title), ". The copy will be created as a new draft entry. Are you sure you want to continue?"));
|
|
19
|
+
};
|
|
20
|
+
export { DuplicateEntryConfirmDialog };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=DuplicateEntryConfirmDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/components/Dialogs/DuplicateEntryConfirmDialog.js","sources":["../../../../src/admin/components/Dialogs/DuplicateEntryConfirmDialog.tsx"],"sourcesContent":["import React from \"react\";\nimport { ConfirmationDialog } from \"@webiny/app-admin/components/ConfirmationDialog/index.js\";\nimport { useNamedConfirmationDialog } from \"@webiny/app-admin\";\nimport type { CmsContentEntry } from \"@webiny/app-headless-cms-common/types/index.js\";\n\nexport const DuplicateEntryConfirmDialog = () => {\n const { onConfirm, onCancel, closeDialog, params } = useNamedConfirmationDialog<{\n entry: CmsContentEntry;\n }>();\n\n return (\n <ConfirmationDialog\n title=\"Duplicate entry\"\n confirmLabel=\"Yes, duplicate!\"\n loadingLabel=\"Duplicating...\"\n onConfirm={async () => {\n await onConfirm();\n closeDialog();\n }}\n onCancel={() => {\n onCancel();\n closeDialog();\n }}\n >\n <p>\n You are about to duplicate <strong>{params.entry.meta.title}</strong>. The copy will\n be created as a new draft entry. Are you sure you want to continue?\n </p>\n </ConfirmationDialog>\n );\n};\n"],"names":["DuplicateEntryConfirmDialog","onConfirm","onCancel","closeDialog","params","useNamedConfirmationDialog","ConfirmationDialog"],"mappings":";;;AAKO,MAAMA,8BAA8B;IACvC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGC;IAIrD,OAAO,WAAP,GACI,oBAACC,oBAAkBA;QACf,OAAM;QACN,cAAa;QACb,cAAa;QACb,WAAW;YACP,MAAML;YACNE;QACJ;QACA,UAAU;YACND;YACAC;QACJ;qBAEA,oBAAC,WAAE,6CAC4B,oBAAC,gBAAQC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,GAAU;AAKrF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CmsErrorResponse } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* An error returned by the CMS API. Keeps the error `code` and `data` (e.g. the per-field
|
|
4
|
+
* list of a `Cms/Entry/ValidationError`) so the form can show what was rejected.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CmsEntryError extends Error {
|
|
7
|
+
readonly code: string | undefined;
|
|
8
|
+
readonly data: CmsErrorResponse["data"];
|
|
9
|
+
constructor(error: CmsErrorResponse | null | undefined, fallbackMessage: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CmsEntryError extends Error {
|
|
2
|
+
constructor(error, fallbackMessage){
|
|
3
|
+
super(error?.message || fallbackMessage);
|
|
4
|
+
this.name = "CmsEntryError";
|
|
5
|
+
this.code = error?.code;
|
|
6
|
+
this.data = error?.data;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { CmsEntryError };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=CmsEntryError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/CmsEntryError.js","sources":["../../../src/features/contentEntry/CmsEntryError.ts"],"sourcesContent":["import type { CmsErrorResponse } from \"~/types.js\";\n\n/**\n * An error returned by the CMS API. Keeps the error `code` and `data` (e.g. the per-field\n * list of a `Cms/Entry/ValidationError`) so the form can show what was rejected.\n */\nexport class CmsEntryError extends Error {\n public readonly code: string | undefined;\n public readonly data: CmsErrorResponse[\"data\"];\n\n public constructor(error: CmsErrorResponse | null | undefined, fallbackMessage: string) {\n super(error?.message || fallbackMessage);\n this.name = \"CmsEntryError\";\n this.code = error?.code;\n this.data = error?.data;\n }\n}\n"],"names":["CmsEntryError","Error","error","fallbackMessage"],"mappings":"AAMO,MAAMA,sBAAsBC;IAI/B,YAAmBC,KAA0C,EAAEC,eAAuB,CAAE;QACpF,KAAK,CAACD,OAAO,WAAWC;QACxB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,IAAI,GAAGD,OAAO;QACnB,IAAI,CAAC,IAAI,GAAGA,OAAO;IACvB;AACJ"}
|
|
@@ -2,6 +2,7 @@ import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
|
|
|
2
2
|
import { EntryGraphQLFields } from "../abstractions.js";
|
|
3
3
|
import { CreateEntryGateway } from "./abstractions.js";
|
|
4
4
|
import { EntryDataPreparer } from "../valueTransformers/EntryDataPreparer.js";
|
|
5
|
+
import { CmsEntryError } from "../CmsEntryError.js";
|
|
5
6
|
function createMutation(model, fields) {
|
|
6
7
|
return `
|
|
7
8
|
mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {
|
|
@@ -31,7 +32,7 @@ class CreateEntryGatewayImpl {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
const { data: entry, error } = response.content;
|
|
34
|
-
if (!entry) throw new
|
|
35
|
+
if (!entry) throw new CmsEntryError(error, "Could not create entry");
|
|
35
36
|
return entry;
|
|
36
37
|
}
|
|
37
38
|
prepareData(data, fields) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentEntry/createEntry/CreateEntryGateway.js","sources":["../../../../src/features/contentEntry/createEntry/CreateEntryGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel, CmsModelField } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n CreateEntryGateway as GatewayAbstraction,\n type ICreateEntryGatewayParams\n} from \"./abstractions.js\";\nimport { EntryDataPreparer } from \"~/features/contentEntry/valueTransformers/EntryDataPreparer.js\";\n\ninterface CreateEntryResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }\n `;\n}\n\nclass CreateEntryGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private preparer: EntryDataPreparer.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, data, options }: ICreateEntryGatewayParams) {\n const preparedData = this.prepareData(data, model.fields);\n\n const response = await this.client.execute<CreateEntryResponse>({\n query: createMutation(model, this.fields),\n variables: { data: preparedData, options }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new
|
|
1
|
+
{"version":3,"file":"features/contentEntry/createEntry/CreateEntryGateway.js","sources":["../../../../src/features/contentEntry/createEntry/CreateEntryGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel, CmsModelField } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n CreateEntryGateway as GatewayAbstraction,\n type ICreateEntryGatewayParams\n} from \"./abstractions.js\";\nimport { EntryDataPreparer } from \"~/features/contentEntry/valueTransformers/EntryDataPreparer.js\";\nimport { CmsEntryError } from \"~/features/contentEntry/CmsEntryError.js\";\n\ninterface CreateEntryResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsEntriesCreate${model.singularApiName}($data: ${model.singularApiName}Input!, $options: CreateCmsEntryOptionsInput) {\n content: create${model.singularApiName}(data: $data, options: $options) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }\n `;\n}\n\nclass CreateEntryGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private preparer: EntryDataPreparer.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, data, options }: ICreateEntryGatewayParams) {\n const preparedData = this.prepareData(data, model.fields);\n\n const response = await this.client.execute<CreateEntryResponse>({\n query: createMutation(model, this.fields),\n variables: { data: preparedData, options }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new CmsEntryError(error, \"Could not create entry\");\n }\n\n return entry;\n }\n\n private prepareData(\n data: Record<string, unknown>,\n fields: CmsModelField[]\n ): Record<string, unknown> {\n const values = data.values;\n if (!values || typeof values !== \"object\") {\n return data;\n }\n return {\n ...data,\n values: this.preparer.prepare(values as Record<string, unknown>, fields)\n };\n }\n}\n\nexport const CreateEntryGateway = GatewayAbstraction.createImplementation({\n implementation: CreateEntryGatewayImpl,\n dependencies: [CmsGraphQLClient, EntryDataPreparer, EntryGraphQLFields]\n});\n"],"names":["createMutation","model","fields","CreateEntryGatewayImpl","client","preparer","data","options","preparedData","response","entry","error","CmsEntryError","values","CreateEntryGateway","GatewayAbstraction","CmsGraphQLClient","EntryDataPreparer","EntryGraphQLFields"],"mappings":";;;;;AA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QLClient/abstractions.js";
|
|
2
2
|
import { EntryGraphQLFields } from "../abstractions.js";
|
|
3
3
|
import { CreateRevisionFromGateway } from "./abstractions.js";
|
|
4
|
+
import { CmsEntryError } from "../CmsEntryError.js";
|
|
4
5
|
function createMutation(model, fields) {
|
|
5
6
|
return `
|
|
6
7
|
mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {
|
|
@@ -28,7 +29,7 @@ class CreateRevisionFromGatewayImpl {
|
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
const { data: entry, error } = response.content;
|
|
31
|
-
if (!entry) throw new
|
|
32
|
+
if (!entry) throw new CmsEntryError(error, "Could not create revision");
|
|
32
33
|
return entry;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js","sources":["../../../../src/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n CreateRevisionFromGateway as GatewayAbstraction,\n type ICreateRevisionFromParams\n} from \"./abstractions.js\";\n\ninterface CreateRevisionFromResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${model.singularApiName}From(revision: $revision, data: $data, options: $options) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }`;\n}\n\nclass CreateRevisionFromGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, revisionId, data, options }: ICreateRevisionFromParams) {\n const response = await this.client.execute<CreateRevisionFromResponse>({\n query: createMutation(model, this.fields),\n variables: { revision: revisionId, data, options }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new
|
|
1
|
+
{"version":3,"file":"features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js","sources":["../../../../src/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n CreateRevisionFromGateway as GatewayAbstraction,\n type ICreateRevisionFromParams\n} from \"./abstractions.js\";\nimport { CmsEntryError } from \"~/features/contentEntry/CmsEntryError.js\";\n\ninterface CreateRevisionFromResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsCreate${model.singularApiName}From($revision: ID!, $data: ${model.singularApiName}Input, $options: CreateRevisionCmsEntryOptionsInput) {\n content: create${model.singularApiName}From(revision: $revision, data: $data, options: $options) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }`;\n}\n\nclass CreateRevisionFromGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, revisionId, data, options }: ICreateRevisionFromParams) {\n const response = await this.client.execute<CreateRevisionFromResponse>({\n query: createMutation(model, this.fields),\n variables: { revision: revisionId, data, options }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new CmsEntryError(error, \"Could not create revision\");\n }\n\n return entry;\n }\n}\n\nexport const CreateRevisionFromGateway = GatewayAbstraction.createImplementation({\n implementation: CreateRevisionFromGatewayImpl,\n dependencies: [CmsGraphQLClient, EntryGraphQLFields]\n});\n"],"names":["createMutation","model","fields","CreateRevisionFromGatewayImpl","client","revisionId","data","options","response","entry","error","CmsEntryError","CreateRevisionFromGateway","GatewayAbstraction","CmsGraphQLClient","EntryGraphQLFields"],"mappings":";;;;AAgBA,SAASA,eAAeC,KAAe,EAAEC,MAAoC;IACzE,OAAqB,CAAC;0BACA,EAAED,MAAM,eAAe,CAAC,4BAA4B,EAAEA,MAAM,eAAe,CAAC;2BAC3E,EAAEA,MAAM,eAAe,CAAC;;oBAE/B,EAAEC,OAAO,eAAe,CAACD,OAAO;oBAChC,EAAEC,OAAO,cAAc,CAACD,OAAO;;;;SAI1C,CAAC;AACV;AAEA,MAAME;IACF,YACYC,MAAkC,EAClCF,MAAoC,CAC9C;aAFUE,MAAM,GAANA;aACAF,MAAM,GAANA;IACT;IAEH,MAAM,QAAQ,EAAED,KAAK,EAAEI,UAAU,EAAEC,IAAI,EAAEC,OAAO,EAA6B,EAAE;QAC3E,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6B;YACnE,OAAOR,eAAeC,OAAO,IAAI,CAAC,MAAM;YACxC,WAAW;gBAAE,UAAUI;gBAAYC;gBAAMC;YAAQ;QACrD;QAEA,MAAM,EAAE,MAAME,KAAK,EAAEC,KAAK,EAAE,GAAGF,SAAS,OAAO;QAE/C,IAAI,CAACC,OACD,MAAM,IAAIE,cAAcD,OAAO;QAGnC,OAAOD;IACX;AACJ;AAEO,MAAMG,sDAA4BC,0BAAAA,oBAAuC,CAAC;IAC7E,gBAAgBV;IAChB,cAAc;QAACW;QAAkBC;KAAmB;AACxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CmsGraphQLClient } from "../../../features/graphQLClient/abstractions.js";
|
|
2
|
+
import type { CmsContentEntry } from "../../../types.js";
|
|
3
|
+
import { EntryGraphQLFields } from "../abstractions.js";
|
|
4
|
+
import { DuplicateEntryGateway as GatewayAbstraction, type IDuplicateEntryParams } from "./abstractions.js";
|
|
5
|
+
declare class DuplicateEntryGatewayImpl implements GatewayAbstraction.Interface {
|
|
6
|
+
private client;
|
|
7
|
+
private fields;
|
|
8
|
+
constructor(client: CmsGraphQLClient.Interface, fields: EntryGraphQLFields.Interface);
|
|
9
|
+
execute({ model, revisionId }: IDuplicateEntryParams): Promise<CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DuplicateEntryGateway: typeof DuplicateEntryGatewayImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryGateway>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
|
|
2
|
+
import { EntryGraphQLFields } from "../abstractions.js";
|
|
3
|
+
import { DuplicateEntryGateway } from "./abstractions.js";
|
|
4
|
+
function createMutation(model, fields) {
|
|
5
|
+
return `
|
|
6
|
+
mutation CmsEntriesDuplicate${model.singularApiName}($revision: ID!) {
|
|
7
|
+
content: duplicate${model.singularApiName}(revision: $revision) {
|
|
8
|
+
data {
|
|
9
|
+
${fields.getSystemFields(model)}
|
|
10
|
+
${fields.getValuesBlock(model)}
|
|
11
|
+
}
|
|
12
|
+
error { message code data }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
class DuplicateEntryGatewayImpl {
|
|
18
|
+
constructor(client, fields){
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.fields = fields;
|
|
21
|
+
}
|
|
22
|
+
async execute({ model, revisionId }) {
|
|
23
|
+
const response = await this.client.execute({
|
|
24
|
+
query: createMutation(model, this.fields),
|
|
25
|
+
variables: {
|
|
26
|
+
revision: revisionId
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const { data: entry, error } = response.content;
|
|
30
|
+
if (!entry) throw new Error(error?.message || "Could not duplicate entry");
|
|
31
|
+
return entry;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const DuplicateEntryGateway_DuplicateEntryGateway = DuplicateEntryGateway.createImplementation({
|
|
35
|
+
implementation: DuplicateEntryGatewayImpl,
|
|
36
|
+
dependencies: [
|
|
37
|
+
CmsGraphQLClient,
|
|
38
|
+
EntryGraphQLFields
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
export { DuplicateEntryGateway_DuplicateEntryGateway as DuplicateEntryGateway };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=DuplicateEntryGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryGateway.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n DuplicateEntryGateway as GatewayAbstraction,\n type IDuplicateEntryParams\n} from \"./abstractions.js\";\n\ninterface DuplicateEntryResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsEntriesDuplicate${model.singularApiName}($revision: ID!) {\n content: duplicate${model.singularApiName}(revision: $revision) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }\n `;\n}\n\nclass DuplicateEntryGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, revisionId }: IDuplicateEntryParams) {\n const response = await this.client.execute<DuplicateEntryResponse>({\n query: createMutation(model, this.fields),\n variables: { revision: revisionId }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new Error(error?.message || \"Could not duplicate entry\");\n }\n\n return entry;\n }\n}\n\nexport const DuplicateEntryGateway = GatewayAbstraction.createImplementation({\n implementation: DuplicateEntryGatewayImpl,\n dependencies: [CmsGraphQLClient, EntryGraphQLFields]\n});\n"],"names":["createMutation","model","fields","DuplicateEntryGatewayImpl","client","revisionId","response","entry","error","Error","DuplicateEntryGateway","GatewayAbstraction","CmsGraphQLClient","EntryGraphQLFields"],"mappings":";;;AAeA,SAASA,eAAeC,KAAe,EAAEC,MAAoC;IACzE,OAAqB,CAAC;oCACU,EAAED,MAAM,eAAe,CAAC;8BAC9B,EAAEA,MAAM,eAAe,CAAC;;oBAElC,EAAEC,OAAO,eAAe,CAACD,OAAO;oBAChC,EAAEC,OAAO,cAAc,CAACD,OAAO;;;;;IAK/C,CAAC;AACL;AAEA,MAAME;IACF,YACYC,MAAkC,EAClCF,MAAoC,CAC9C;aAFUE,MAAM,GAANA;aACAF,MAAM,GAANA;IACT;IAEH,MAAM,QAAQ,EAAED,KAAK,EAAEI,UAAU,EAAyB,EAAE;QACxD,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YAC/D,OAAON,eAAeC,OAAO,IAAI,CAAC,MAAM;YACxC,WAAW;gBAAE,UAAUI;YAAW;QACtC;QAEA,MAAM,EAAE,MAAME,KAAK,EAAEC,KAAK,EAAE,GAAGF,SAAS,OAAO;QAE/C,IAAI,CAACC,OACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAMG,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBR;IAChB,cAAc;QAACS;QAAkBC;KAAmB;AACxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DuplicateEntryRepository as RepositoryAbstraction, DuplicateEntryGateway } from "./abstractions.js";
|
|
2
|
+
import type { IDuplicateEntryParams } from "./abstractions.js";
|
|
3
|
+
import { ContentEntriesCacheProvider } from "../../../features/contentEntry/abstractions.js";
|
|
4
|
+
import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
|
|
5
|
+
declare class DuplicateEntryRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
6
|
+
private cacheProvider;
|
|
7
|
+
private gateway;
|
|
8
|
+
private eventPublisher;
|
|
9
|
+
constructor(cacheProvider: ContentEntriesCacheProvider.Interface, gateway: DuplicateEntryGateway.Interface, eventPublisher: EventPublisher.Interface);
|
|
10
|
+
execute(params: IDuplicateEntryParams): Promise<import("@webiny/app-headless-cms-common/types/index.js").CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const DuplicateEntryRepository: typeof DuplicateEntryRepositoryImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryRepository>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DuplicateEntryGateway, DuplicateEntryRepository } from "./abstractions.js";
|
|
2
|
+
import { ContentEntriesCacheProvider } from "../abstractions.js";
|
|
3
|
+
import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
|
|
4
|
+
import { EntryAfterCreateEvent } from "../events/EntryAfterCreateEvent.js";
|
|
5
|
+
class DuplicateEntryRepositoryImpl {
|
|
6
|
+
constructor(cacheProvider, gateway, eventPublisher){
|
|
7
|
+
this.cacheProvider = cacheProvider;
|
|
8
|
+
this.gateway = gateway;
|
|
9
|
+
this.eventPublisher = eventPublisher;
|
|
10
|
+
}
|
|
11
|
+
async execute(params) {
|
|
12
|
+
const entry = await this.gateway.execute(params);
|
|
13
|
+
const cache = this.cacheProvider.get(params.model.modelId);
|
|
14
|
+
cache.addItems([
|
|
15
|
+
entry
|
|
16
|
+
]);
|
|
17
|
+
await this.eventPublisher.publish(new EntryAfterCreateEvent({
|
|
18
|
+
entry,
|
|
19
|
+
model: params.model
|
|
20
|
+
}));
|
|
21
|
+
return entry;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const DuplicateEntryRepository_DuplicateEntryRepository = DuplicateEntryRepository.createImplementation({
|
|
25
|
+
implementation: DuplicateEntryRepositoryImpl,
|
|
26
|
+
dependencies: [
|
|
27
|
+
ContentEntriesCacheProvider,
|
|
28
|
+
DuplicateEntryGateway,
|
|
29
|
+
EventPublisher
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { DuplicateEntryRepository_DuplicateEntryRepository as DuplicateEntryRepository };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DuplicateEntryRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryRepository.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryRepository.ts"],"sourcesContent":["import {\n DuplicateEntryRepository as RepositoryAbstraction,\n DuplicateEntryGateway\n} from \"./abstractions.js\";\nimport type { IDuplicateEntryParams } from \"./abstractions.js\";\nimport { ContentEntriesCacheProvider } from \"~/features/contentEntry/abstractions.js\";\nimport { EventPublisher } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { EntryAfterCreateEvent } from \"~/features/contentEntry/events/EntryAfterCreateEvent.js\";\n\nclass DuplicateEntryRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private cacheProvider: ContentEntriesCacheProvider.Interface,\n private gateway: DuplicateEntryGateway.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(params: IDuplicateEntryParams) {\n const entry = await this.gateway.execute(params);\n\n const cache = this.cacheProvider.get(params.model.modelId);\n cache.addItems([entry]);\n\n // Duplicating results in a brand-new entry, so we notify the same listeners as on create.\n await this.eventPublisher.publish(\n new EntryAfterCreateEvent({ entry, model: params.model })\n );\n\n return entry;\n }\n}\n\nexport const DuplicateEntryRepository = RepositoryAbstraction.createImplementation({\n implementation: DuplicateEntryRepositoryImpl,\n dependencies: [ContentEntriesCacheProvider, DuplicateEntryGateway, EventPublisher]\n});\n"],"names":["DuplicateEntryRepositoryImpl","cacheProvider","gateway","eventPublisher","params","entry","cache","EntryAfterCreateEvent","DuplicateEntryRepository","RepositoryAbstraction","ContentEntriesCacheProvider","DuplicateEntryGateway","EventPublisher"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,aAAoD,EACpDC,OAAwC,EACxCC,cAAwC,CAClD;aAHUF,aAAa,GAAbA;aACAC,OAAO,GAAPA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQC,MAA6B,EAAE;QACzC,MAAMC,QAAQ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACD;QAEzC,MAAME,QAAQ,IAAI,CAAC,aAAa,CAAC,GAAG,CAACF,OAAO,KAAK,CAAC,OAAO;QACzDE,MAAM,QAAQ,CAAC;YAACD;SAAM;QAGtB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIE,sBAAsB;YAAEF;YAAO,OAAOD,OAAO,KAAK;QAAC;QAG3D,OAAOC;IACX;AACJ;AAEO,MAAMG,oDAA2BC,yBAAAA,oBAA0C,CAAC;IAC/E,gBAAgBT;IAChB,cAAc;QAACU;QAA6BC;QAAuBC;KAAe;AACtF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DuplicateEntryUseCase as UseCaseAbstraction, DuplicateEntryRepository } from "./abstractions.js";
|
|
2
|
+
import type { IDuplicateEntryParams } from "./abstractions.js";
|
|
3
|
+
declare class DuplicateEntryUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
4
|
+
private repository;
|
|
5
|
+
constructor(repository: DuplicateEntryRepository.Interface);
|
|
6
|
+
execute(params: IDuplicateEntryParams): Promise<import("@webiny/app-headless-cms-common/types/index.js").CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const DuplicateEntryUseCase: typeof DuplicateEntryUseCaseImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryUseCase>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DuplicateEntryRepository, DuplicateEntryUseCase } from "./abstractions.js";
|
|
2
|
+
class DuplicateEntryUseCaseImpl {
|
|
3
|
+
constructor(repository){
|
|
4
|
+
this.repository = repository;
|
|
5
|
+
}
|
|
6
|
+
async execute(params) {
|
|
7
|
+
return this.repository.execute(params);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const DuplicateEntryUseCase_DuplicateEntryUseCase = DuplicateEntryUseCase.createImplementation({
|
|
11
|
+
implementation: DuplicateEntryUseCaseImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
DuplicateEntryRepository
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { DuplicateEntryUseCase_DuplicateEntryUseCase as DuplicateEntryUseCase };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=DuplicateEntryUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.ts"],"sourcesContent":["import {\n DuplicateEntryUseCase as UseCaseAbstraction,\n DuplicateEntryRepository\n} from \"./abstractions.js\";\nimport type { IDuplicateEntryParams } from \"./abstractions.js\";\n\nclass DuplicateEntryUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: DuplicateEntryRepository.Interface) {}\n\n async execute(params: IDuplicateEntryParams) {\n return this.repository.execute(params);\n }\n}\n\nexport const DuplicateEntryUseCase = UseCaseAbstraction.createImplementation({\n implementation: DuplicateEntryUseCaseImpl,\n dependencies: [DuplicateEntryRepository]\n});\n"],"names":["DuplicateEntryUseCaseImpl","repository","params","DuplicateEntryUseCase","UseCaseAbstraction","DuplicateEntryRepository"],"mappings":";AAMA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,QAAQC,MAA6B,EAAE;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA;IACnC;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBJ;IAChB,cAAc;QAACK;KAAyB;AAC5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CmsContentEntry, CmsModel } from "../../../types.js";
|
|
2
|
+
export interface IDuplicateEntryParams {
|
|
3
|
+
model: CmsModel;
|
|
4
|
+
revisionId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IDuplicateEntryGateway {
|
|
7
|
+
execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DuplicateEntryGateway: import("@webiny/di").Abstraction<IDuplicateEntryGateway>;
|
|
10
|
+
export declare namespace DuplicateEntryGateway {
|
|
11
|
+
type Interface = IDuplicateEntryGateway;
|
|
12
|
+
}
|
|
13
|
+
export interface IDuplicateEntryRepository {
|
|
14
|
+
execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
|
|
15
|
+
}
|
|
16
|
+
export declare const DuplicateEntryRepository: import("@webiny/di").Abstraction<IDuplicateEntryRepository>;
|
|
17
|
+
export declare namespace DuplicateEntryRepository {
|
|
18
|
+
type Interface = IDuplicateEntryRepository;
|
|
19
|
+
}
|
|
20
|
+
export interface IDuplicateEntryUseCase {
|
|
21
|
+
execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
|
|
22
|
+
}
|
|
23
|
+
export declare const DuplicateEntryUseCase: import("@webiny/di").Abstraction<IDuplicateEntryUseCase>;
|
|
24
|
+
export declare namespace DuplicateEntryUseCase {
|
|
25
|
+
type Interface = IDuplicateEntryUseCase;
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/admin";
|
|
2
|
+
const DuplicateEntryGateway = createAbstraction("DuplicateEntryGateway");
|
|
3
|
+
const DuplicateEntryRepository = createAbstraction("DuplicateEntryRepository");
|
|
4
|
+
const DuplicateEntryUseCase = createAbstraction("DuplicateEntryUseCase");
|
|
5
|
+
export { DuplicateEntryGateway, DuplicateEntryRepository, DuplicateEntryUseCase };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/duplicateEntry/abstractions.js","sources":["../../../../src/features/contentEntry/duplicateEntry/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { CmsContentEntry, CmsModel } from \"~/types.js\";\n\nexport interface IDuplicateEntryParams {\n model: CmsModel;\n revisionId: string;\n}\n\n// Gateway\n\nexport interface IDuplicateEntryGateway {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryGateway =\n createAbstraction<IDuplicateEntryGateway>(\"DuplicateEntryGateway\");\n\nexport namespace DuplicateEntryGateway {\n export type Interface = IDuplicateEntryGateway;\n}\n\n// Repository\n\nexport interface IDuplicateEntryRepository {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryRepository = createAbstraction<IDuplicateEntryRepository>(\n \"DuplicateEntryRepository\"\n);\n\nexport namespace DuplicateEntryRepository {\n export type Interface = IDuplicateEntryRepository;\n}\n\n// UseCase\n\nexport interface IDuplicateEntryUseCase {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryUseCase =\n createAbstraction<IDuplicateEntryUseCase>(\"DuplicateEntryUseCase\");\n\nexport namespace DuplicateEntryUseCase {\n export type Interface = IDuplicateEntryUseCase;\n}\n"],"names":["DuplicateEntryGateway","createAbstraction","DuplicateEntryRepository","DuplicateEntryUseCase"],"mappings":";AAcO,MAAMA,wBACTC,kBAA0C;AAYvC,MAAMC,2BAA2BD,kBACpC;AAaG,MAAME,wBACTF,kBAA0C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { DuplicateEntryUseCase } from "./abstractions.js";
|
|
3
|
+
import { DuplicateEntryUseCase as external_DuplicateEntryUseCase_js_DuplicateEntryUseCase } from "./DuplicateEntryUseCase.js";
|
|
4
|
+
import { DuplicateEntryRepository } from "./DuplicateEntryRepository.js";
|
|
5
|
+
import { DuplicateEntryGateway } from "./DuplicateEntryGateway.js";
|
|
6
|
+
const DuplicateEntryFeature = createFeature({
|
|
7
|
+
name: "CmsContentEntry/DuplicateEntry",
|
|
8
|
+
register (container) {
|
|
9
|
+
container.register(external_DuplicateEntryUseCase_js_DuplicateEntryUseCase);
|
|
10
|
+
container.register(DuplicateEntryRepository).inSingletonScope();
|
|
11
|
+
container.register(DuplicateEntryGateway).inSingletonScope();
|
|
12
|
+
},
|
|
13
|
+
resolve (container) {
|
|
14
|
+
return {
|
|
15
|
+
useCase: container.resolve(DuplicateEntryUseCase)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export { DuplicateEntryFeature };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/contentEntry/duplicateEntry/feature.js","sources":["../../../../src/features/contentEntry/duplicateEntry/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { DuplicateEntryUseCase as UseCase } from \"./abstractions.js\";\nimport { DuplicateEntryUseCase } from \"./DuplicateEntryUseCase.js\";\nimport { DuplicateEntryRepository } from \"./DuplicateEntryRepository.js\";\nimport { DuplicateEntryGateway } from \"./DuplicateEntryGateway.js\";\n\nexport const DuplicateEntryFeature = createFeature({\n name: \"CmsContentEntry/DuplicateEntry\",\n register(container) {\n container.register(DuplicateEntryUseCase);\n container.register(DuplicateEntryRepository).inSingletonScope();\n container.register(DuplicateEntryGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCase)\n };\n }\n});\n"],"names":["DuplicateEntryFeature","createFeature","container","DuplicateEntryUseCase","DuplicateEntryRepository","DuplicateEntryGateway","UseCase"],"mappings":";;;;;AAMO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,0BAA0B,gBAAgB;QAC7DF,UAAU,QAAQ,CAACG,uBAAuB,gBAAgB;IAC9D;IACA,SAAQH,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACI;QAC/B;IACJ;AACJ"}
|
|
@@ -3,6 +3,7 @@ import { ContentEntriesCacheProvider } from "./ContentEntriesCacheProvider.js";
|
|
|
3
3
|
import { GetEntryFeature } from "./getEntry/feature.js";
|
|
4
4
|
import { ListEntriesFeature } from "./listEntries/feature.js";
|
|
5
5
|
import { CreateEntryFeature } from "./createEntry/feature.js";
|
|
6
|
+
import { DuplicateEntryFeature } from "./duplicateEntry/feature.js";
|
|
6
7
|
import { UpdateEntryFeature } from "./updateEntry/feature.js";
|
|
7
8
|
import { PublishEntryFeature } from "./publishEntry/feature.js";
|
|
8
9
|
import { UnpublishEntryFeature } from "./unpublishEntry/feature.js";
|
|
@@ -30,6 +31,7 @@ const ContentEntryFeature = createFeature({
|
|
|
30
31
|
SearchContentEntriesFeature.register(container);
|
|
31
32
|
GetContentEntriesFeature.register(container);
|
|
32
33
|
CreateEntryFeature.register(container);
|
|
34
|
+
DuplicateEntryFeature.register(container);
|
|
33
35
|
UpdateEntryFeature.register(container);
|
|
34
36
|
PublishEntryFeature.register(container);
|
|
35
37
|
UnpublishEntryFeature.register(container);
|