{"version":3,"file":"growi-app-info.cjs","sources":["../../src/interfaces/growi-app-info.ts"],"sourcesContent":["import type * as os from 'node:os';\n\nimport type { GrowiDeploymentType, GrowiServiceType } from '../consts/system';\n\nexport const GrowiWikiType = { open: 'open', closed: 'closed' } as const;\ntype GrowiWikiType = (typeof GrowiWikiType)[keyof typeof GrowiWikiType];\n\n// Info options for additionalInfo selection\nexport interface GrowiInfoOptions {\n  includeAttachmentInfo?: boolean;\n  includeInstalledInfo?: boolean;\n  includeUserCountInfo?: boolean;\n  includePageCountInfo?: boolean;\n  // Future extensions can be added here\n}\n\ninterface IGrowiOSInfo {\n  type?: ReturnType<typeof os.type>;\n  platform?: ReturnType<typeof os.platform>;\n  arch?: ReturnType<typeof os.arch>;\n  totalmem?: ReturnType<typeof os.totalmem>;\n}\n\ninterface IAdditionalAttachmentInfo {\n  attachmentType: string;\n  activeExternalAccountTypes: string[];\n}\n\ninterface IAdditionalInstalledAtInfo {\n  installedAt: Date;\n  installedAtByOldestUser: Date | null;\n}\n\ninterface IAdditionalUserCountInfo {\n  currentUsersCount: number;\n  currentActiveUsersCount: number;\n}\n\ninterface IAdditionalPageCountInfo {\n  currentPagesCount: number;\n}\n\nexport interface IGrowiAdditionalInfo\n  extends IAdditionalInstalledAtInfo,\n    IAdditionalUserCountInfo,\n    IAdditionalPageCountInfo,\n    IAdditionalAttachmentInfo {}\n\n// Type mapping for flexible options\nexport type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> =\n  (T['includeAttachmentInfo'] extends true\n    ? IAdditionalAttachmentInfo\n    : Record<string, never>) &\n    (T['includeInstalledInfo'] extends true\n      ? IAdditionalInstalledAtInfo\n      : Record<string, never>) &\n    (T['includeUserCountInfo'] extends true\n      ? IAdditionalUserCountInfo\n      : Record<string, never>) &\n    (T['includePageCountInfo'] extends true\n      ? IAdditionalPageCountInfo\n      : Record<string, never>);\n\n// Helper type to check if any option is enabled\nexport type HasAnyOption<T extends GrowiInfoOptions> =\n  T['includeAttachmentInfo'] extends true\n    ? true\n    : T['includeInstalledInfo'] extends true\n      ? true\n      : T['includeUserCountInfo'] extends true\n        ? true\n        : T['includePageCountInfo'] extends true\n          ? true\n          : false;\n\n// Final result type based on options\nexport type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> =\n  HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;\n\nexport interface IGrowiInfo<A extends object | undefined = undefined> {\n  serviceInstanceId: string;\n  appSiteUrl: string;\n  osInfo: IGrowiOSInfo;\n  version: string;\n  type: GrowiServiceType;\n  wikiType: GrowiWikiType;\n  deploymentType: GrowiDeploymentType;\n  additionalInfo?: A;\n}\n"],"names":["GrowiWikiType"],"mappings":"gFAIO,MAAMA,EAAgB,CAAE,KAAM,OAAQ,OAAQ,QAAS"}