import { I18NContentContext } from "@webiny/api-i18n-content/types" ; import { DbContext } from "@webiny/handler-db/types" ; import { SecurityContext , SecurityPermission } from "@webiny/api-security/types" ; import { TenancyContext } from "@webiny/api-tenancy/types" ; import { I18NContext } from "@webiny/api-i18n/types" ; import { ClientContext } from "@webiny/handler-client/types" ; import { Topic } from "@webiny/pubsub/types" ; import { Args as PsFlushParams } from "@webiny/api-prerendering-service/flush/types" ; import { Args as PsRenderParams } from "@webiny/api-prerendering-service/render/types" ; import { Args as PsQueueAddParams } from "@webiny/api-prerendering-service/queue/add/types" ; import { Category , Menu , Page , PageElement , PageSpecialType , Settings , System } from "~/types" ; import { PrerenderingServiceClientContext } from "@webiny/api-prerendering-service/client/types" ; import { FileManagerContext } from "@webiny/api-file-manager/types" ; export interface ListPagesParams { limit ? : number ; after ? : string | null ; where ? : { category ? : string ; status ? : string ; tags ? : { query : string [ ] ; rule ? : "any" | "all" ; } ; [ key ] : any ; } ; exclude ? : string [ ] ; search ? : { query ? : string ; } ; sort ? : string [ ] ; } export interface ListMeta { /**
     * A cursor for pagination.
     */ cursor : string ; /**
     * Is there more items to load?
     */ hasMoreItems : boolean ; /**
     * Total count of the items in the storage.
     */ totalCount : number ; } export interface ListLatestPagesOptions { auth ? : boolean ; } export interface GetPagesOptions { decompress ? : boolean ; } category export interface OnBeforePageCreateTopicParams < TPage extends Page = Page > { page : TPage ; } category export interface OnAfterPageCreateTopicParams { page : Page ; } category export interface OnBeforePageUpdateTopicParams { original : Page ; page : Page ; input : Record < string , any > ; } category export interface OnAfterPageUpdateTopicParams { original : Page ; page : Page ; input : Record < string , any > ; } category export interface OnBeforePageCreateFromTopicParams { original : Page ; page : Page ; } category export interface OnAfterPageCreateFromTopicParams { original : Page ; page : Page ; } category export interface OnBeforePageDeleteTopicParams { page : Page ; latestPage : Page ; publishedPage : Page ; } category export interface OnAfterPageDeleteTopicParams { page : Page ; latestPage : Page ; publishedPage : Page ; } category export interface OnBeforePagePublishTopicParams { page : Page ; latestPage : Page ; publishedPage ? : Page ; } category export interface OnAfterPagePublishTopicParams { page : Page ; latestPage : Page ; publishedPage ? : Page ; } category export interface OnBeforePageUnpublishTopicParams { page : Page ; latestPage : Page ; } category export interface OnAfterPageUnpublishTopicParams { page : Page ; latestPage : Page ; } category export interface OnBeforePageRequestReviewTopicParams { page : Page ; latestPage : Page ; } category export interface OnAfterPageRequestReviewTopicParams { page : Page ; latestPage : Page ; } category export interface OnBeforePageRequestChangesTopicParams { page : Page ; latestPage : Page ; } category export interface OnAfterPageRequestChangesTopicParams { page : Page ; latestPage : Page ; } category export interface PagesCrud { getPage < TPage extends Page = Page > ( id , options ? ) : Promise < TPage > ; listLatestPages < TPage extends Page = Page > ( args , options ? ) : Promise < [ TPage [ ] , ListMeta ] > ; listPublishedPages < TPage extends Page = Page > ( args ) : Promise < [ TPage [ ] , ListMeta ] > ; listPagesTags ( args ) : Promise < string [ ] > ; getPublishedPageById < TPage extends Page = Page > ( args ) : Promise < TPage > ; getPublishedPageByPath < TPage extends Page = Page > ( args ) : Promise < TPage > ; listPageRevisions < TPage extends Page = Page > ( id ) : Promise < TPage [ ] > ; createPage < TPage extends Page = Page > ( category ) : Promise < TPage > ; createPageFrom < TPage extends Page = Page > ( page ) : Promise < TPage > ; updatePage < TPage extends Page = Page > ( id , data ) : Promise < TPage > ; deletePage < TPage extends Page = Page > ( id ) : Promise < [ TPage , TPage ] > ; publishPage < TPage extends Page = Page > ( id ) : Promise < TPage > ; unpublishPage < TPage extends Page = Page > ( id ) : Promise < TPage > ; requestPageReview < TPage extends Page = Page > ( id ) : Promise < TPage > ; requestPageChanges < TPage extends Page = Page > ( id ) : Promise < TPage > ; prerendering : { render ( args ) : Promise < void > ; flush ( args ) : Promise < void > ; } ; /**
     * Lifecycle events
     */ onBeforePageCreate : Topic < OnBeforePageCreateTopicParams > ; onAfterPageCreate : Topic < OnAfterPageCreateTopicParams > ; onBeforePageCreateFrom : Topic < OnBeforePageCreateFromTopicParams > ; onAfterPageCreateFrom : Topic < OnAfterPageCreateFromTopicParams > ; onBeforePageUpdate : Topic < OnBeforePageUpdateTopicParams > ; onAfterPageUpdate : Topic < OnAfterPageUpdateTopicParams > ; onBeforePageDelete : Topic < OnBeforePageDeleteTopicParams > ; onAfterPageDelete : Topic < OnAfterPageDeleteTopicParams > ; onBeforePagePublish : Topic < OnBeforePagePublishTopicParams > ; onAfterPagePublish : Topic < OnAfterPagePublishTopicParams > ; onBeforePageUnpublish : Topic < OnBeforePageUnpublishTopicParams > ; onAfterPageUnpublish : Topic < OnAfterPageUnpublishTopicParams > ; onBeforePageRequestReview : Topic < OnBeforePageRequestReviewTopicParams > ; onAfterPageRequestReview : Topic < OnAfterPageRequestReviewTopicParams > ; onBeforePageRequestChanges : Topic < OnBeforePageRequestChangesTopicParams > ; onAfterPageRequestChanges : Topic < OnAfterPageRequestChangesTopicParams > ; } export interface ListPageElementsParams { sort ? : string [ ] ; } category export interface OnBeforePageElementCreateTopicParams { pageElement : PageElement ; } category export interface OnAfterPageElementCreateTopicParams { pageElement : PageElement ; } category export interface OnBeforePageElementUpdateTopicParams { original : PageElement ; pageElement : PageElement ; } category export interface OnAfterPageElementUpdateTopicParams { original : PageElement ; pageElement : PageElement ; } category export interface OnBeforePageElementDeleteTopicParams { pageElement : PageElement ; } category export interface OnAfterPageElementDeleteTopicParams { pageElement : PageElement ; } category export interface PageElementsCrud { getPageElement ( id ) : Promise < PageElement > ; listPageElements ( params ? ) : Promise < PageElement [ ] > ; createPageElement ( data ) : Promise < PageElement > ; updatePageElement ( id , data ) : Promise < PageElement > ; deletePageElement ( id ) : Promise < PageElement > ; /**
     * Lifecycle events
     */ onBeforePageElementCreate : Topic < OnBeforePageElementCreateTopicParams > ; onAfterPageElementCreate : Topic < OnAfterPageElementCreateTopicParams > ; onBeforePageElementUpdate : Topic < OnBeforePageElementUpdateTopicParams > ; onAfterPageElementUpdate : Topic < OnAfterPageElementUpdateTopicParams > ; onBeforePageElementDelete : Topic < OnBeforePageElementDeleteTopicParams > ; onAfterPageElementDelete : Topic < OnAfterPageElementDeleteTopicParams > ; } category export interface OnBeforeCategoryCreateTopicParams { category : Category ; } category export interface OnAfterCategoryCreateTopicParams { category : Category ; } category export interface OnBeforeCategoryUpdateTopicParams { original : Category ; category : Category ; } category export interface OnAfterCategoryUpdateTopicParams { original : Category ; category : Category ; } category export interface OnBeforeCategoryDeleteTopicParams { category : Category ; } category export interface OnAfterCategoryDeleteTopicParams { category : Category ; } category export interface CategoriesCrud { getCategory ( slug , options ? ) : Promise < Category > ; listCategories ( ) : Promise < Category [ ] > ; createCategory ( data ) : Promise < Category > ; updateCategory ( slug , data ) : Promise < Category > ; deleteCategory ( slug ) : Promise < Category > ; /**
     * Lifecycle events
     */ onBeforeCategoryCreate : Topic < OnBeforeCategoryCreateTopicParams > ; onAfterCategoryCreate : Topic < OnAfterCategoryCreateTopicParams > ; onBeforeCategoryUpdate : Topic < OnBeforeCategoryUpdateTopicParams > ; onAfterCategoryUpdate : Topic < OnAfterCategoryUpdateTopicParams > ; onBeforeCategoryDelete : Topic < OnBeforeCategoryDeleteTopicParams > ; onAfterCategoryDelete : Topic < OnAfterCategoryDeleteTopicParams > ; } export interface MenuGetOptions { auth ? : boolean ; } export interface ListMenuParams { sort ? : string [ ] ; } category export interface OnBeforeMenuCreateTopicParams { menu : Menu ; input : Record < string , any > ; } category export interface OnAfterMenuCreateTopicParams { menu : Menu ; input : Record < string , any > ; } category export interface OnBeforeMenuUpdateTopicParams { original : Menu ; menu : Menu ; } category export interface OnAfterMenuUpdateTopicParams { original : Menu ; menu : Menu ; } category export interface OnBeforeMenuDeleteTopicParams { menu : Menu ; } category export interface OnAfterMenuDeleteTopicParams { menu : Menu ; } category export interface MenusCrud { getMenu ( slug , options ? ) : Promise < Menu > ; getPublicMenu ( slug ) : Promise < Menu > ; listMenus ( params ? ) : Promise < Menu [ ] > ; createMenu ( data ) : Promise < Menu > ; updateMenu ( slug , data ) : Promise < Menu > ; deleteMenu ( slug ) : Promise < Menu > ; /**
     * Lifecycle events
     */ onBeforeMenuCreate : Topic < OnBeforeMenuCreateTopicParams > ; onAfterMenuCreate : Topic < OnAfterMenuCreateTopicParams > ; onBeforeMenuUpdate : Topic < OnBeforeMenuUpdateTopicParams > ; onAfterMenuUpdate : Topic < OnAfterMenuUpdateTopicParams > ; onBeforeMenuDelete : Topic < OnBeforeMenuDeleteTopicParams > ; onAfterMenuDelete : Topic < OnAfterMenuDeleteTopicParams > ; } /**
 * The options passed into the crud methods
 */ export interface DefaultSettingsCrudOptions { tenant : string | false ; locale : string | false ; } export interface SettingsUpdateTopicMetaParams { diff : { pages : Array < [ PageSpecialType , string , string , Page ] > ; } ; } category export interface OnBeforeSettingsUpdateTopicParams { original : Settings ; settings : Settings ; meta : SettingsUpdateTopicMetaParams ; } category export interface OnAfterSettingsUpdateTopicParams { original : Settings ; settings : Settings ; meta : SettingsUpdateTopicMetaParams ; } category export interface SettingsCrud { getCurrentSettings : ( ) => Promise < Settings > ; getSettings : ( options ? : DefaultSettingsCrudOptions ) => Promise < Settings > ; getDefaultSettings : ( options ? : Pick < DefaultSettingsCrudOptions , "tenant" > ) => Promise < Settings > ; updateSettings : ( data : Record < string , any > , options ? : { auth ? : boolean ; } & DefaultSettingsCrudOptions ) => Promise < Settings > ; getSettingsCacheKey : ( options ? : DefaultSettingsCrudOptions ) => string ; /**
     * Lifecycle events
     */ onBeforeSettingsUpdate : Topic < OnBeforeSettingsUpdateTopicParams > ; onAfterSettingsUpdate : Topic < OnAfterSettingsUpdateTopicParams > ; } category export interface OnBeforeInstallTopicParams { tenant : string ; } category export interface OnAfterInstallTopicParams { tenant : string ; } category export interface SystemCrud { getSystem : ( ) => Promise < System > ; getSystemVersion ( ) : Promise < string > ; setSystemVersion ( version ) : Promise < void > ; installSystem ( args ) : Promise < void > ; upgradeSystem ( version , data ? ) : Promise < boolean > ; /**
     * Lifecycle events
     */ onBeforeInstall : Topic < OnBeforeInstallTopicParams > ; onAfterInstall : Topic < OnBeforeInstallTopicParams > ; } export interface PageBuilderContextObject extends PagesCrud , PageElementsCrud , CategoriesCrud , MenusCrud , SettingsCrud , SystemCrud { setPrerenderingHandlers : ( configuration : PrerenderingHandlers ) => void ; getPrerenderingHandlers : ( ) => PrerenderingHandlers ; /**
     * Lifecycle events
     */ onPageBeforeRender : Topic < PageBeforeRenderEvent > ; onPageAfterRender : Topic < PageAfterRenderEvent > ; onPageBeforeFlush : Topic < PageBeforeFlushEvent > ; onPageAfterFlush : Topic < PageAfterFlushEvent > ; } export interface PbContext extends I18NContentContext , I18NContext , ClientContext , DbContext , SecurityContext , TenancyContext , FileManagerContext , PrerenderingServiceClientContext { pageBuilder : PageBuilderContextObject ; } export interface PbSecurityPermission extends SecurityPermission { own ? : boolean ; rwd ? : string ; } export interface MenuSecurityPermission extends PbSecurityPermission { name : "pb.menu" ; } export interface CategorySecurityPermission extends PbSecurityPermission { name : "pb.category" ; } export interface PageSecurityPermission extends PbSecurityPermission { name : "pb.page" ; pw : string ; } export interface PageBeforeRenderEvent extends Pick < RenderParams , "paths" | "tags" > { args : { render ? : PsRenderParams [ ] ; queue ? : PsQueueAddParams [ ] ; } ; } export interface PageAfterRenderEvent extends Pick < RenderParams , "paths" | "tags" > { args : { render ? : PsRenderParams [ ] ; queue ? : PsQueueAddParams [ ] ; } ; } export interface PageBeforeFlushEvent extends Pick < FlushParams , "paths" | "tags" > { args : { flush ? : PsFlushParams [ ] ; queue ? : PsQueueAddParams [ ] ; } ; } export interface PageAfterFlushEvent extends Pick < FlushParams , "paths" | "tags" > { args : { flush ? : PsFlushParams [ ] ; queue ? : PsQueueAddParams [ ] ; } ; } export interface Tag { key : string ; value ? : string ; } export interface TagItem { tag : Tag ; configuration ? : { meta ? : Record < string , any > ; storage ? : { folder ? : string ; name ? : string ; } ; } ; } export interface PathItem { path : string ; configuration ? : { db ? : { namespace : string ; } ; meta ? : Record < string , any > ; storage ? : { folder ? : string ; name ? : string ; } ; } ; } export interface RenderParams { queue ? : boolean ; context : PbContext ; tags ? : TagItem [ ] ; paths ? : PathItem [ ] ; } export interface FlushParams { context : PbContext ; tags ? : TagItem [ ] ; paths ? : PathItem [ ] ; } export interface PrerenderingHandlers { render ( args ) : Promise < void > ; flush ( args ) : Promise < void > ; }