growi-plugin.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type {
  2. GrowiPluginType,
  3. GrowiThemeMetadata,
  4. HasObjectId,
  5. } from '@growi/core';
  6. import type { TemplateSummary } from '@growi/pluginkit/dist/v4';
  7. export type IGrowiPluginOrigin = {
  8. url: string;
  9. ghBranch?: string;
  10. ghTag?: string;
  11. };
  12. export type IGrowiPlugin<M extends IGrowiPluginMeta = IGrowiPluginMeta> = {
  13. isEnabled: boolean;
  14. installedPath: string;
  15. organizationName: string;
  16. origin: IGrowiPluginOrigin;
  17. meta: M;
  18. };
  19. export type IGrowiPluginMeta = {
  20. name: string;
  21. types: GrowiPluginType[];
  22. desc?: string;
  23. author?: string;
  24. };
  25. export type IGrowiThemePluginMeta = IGrowiPluginMeta & {
  26. themes: GrowiThemeMetadata[];
  27. };
  28. export type IGrowiTemplatePluginMeta = IGrowiPluginMeta & {
  29. templateSummaries: TemplateSummary[];
  30. };
  31. export type IGrowiPluginMetaByType<T extends GrowiPluginType = any> =
  32. T extends 'theme'
  33. ? IGrowiThemePluginMeta
  34. : T extends 'template'
  35. ? IGrowiTemplatePluginMeta
  36. : IGrowiPluginMeta;
  37. export type IGrowiPluginHasId = IGrowiPlugin & HasObjectId;