@mdfriday/foundry 26.2.12 → 26.3.1

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.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +54506 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -1
  5. package/dist/internal/application/identity.d.ts +90 -0
  6. package/dist/internal/application/incremental-build-coordinator.d.ts +1 -0
  7. package/dist/internal/application/publish.d.ts +28 -0
  8. package/dist/internal/application/workspace.d.ts +29 -0
  9. package/dist/internal/domain/content/vo/sort.d.ts +1 -0
  10. package/dist/internal/domain/identity/entity/user.d.ts +55 -0
  11. package/dist/internal/domain/identity/factory/user-factory.d.ts +153 -0
  12. package/dist/internal/domain/identity/index.d.ts +9 -0
  13. package/dist/internal/domain/identity/repository/index.d.ts +31 -0
  14. package/dist/internal/domain/identity/type.d.ts +19 -0
  15. package/dist/internal/domain/identity/value-object/device.d.ts +21 -0
  16. package/dist/internal/domain/identity/value-object/email.d.ts +12 -0
  17. package/dist/internal/domain/identity/value-object/license.d.ts +63 -0
  18. package/dist/internal/domain/identity/value-object/server-config.d.ts +21 -0
  19. package/dist/internal/domain/identity/value-object/token.d.ts +21 -0
  20. package/dist/internal/domain/publish/entity/publisher.d.ts +24 -0
  21. package/dist/internal/domain/publish/factory/publisher-factory.d.ts +13 -0
  22. package/dist/internal/domain/publish/index.d.ts +10 -0
  23. package/dist/internal/domain/publish/repository/http-client.d.ts +14 -0
  24. package/dist/internal/domain/publish/repository/manifest-repository.d.ts +7 -0
  25. package/dist/internal/domain/publish/type.d.ts +59 -0
  26. package/dist/internal/domain/publish/value-object/ftp-publisher.d.ts +22 -0
  27. package/dist/internal/domain/publish/value-object/mdfriday-publisher.d.ts +28 -0
  28. package/dist/internal/domain/publish/value-object/netlify-publisher.d.ts +28 -0
  29. package/dist/internal/domain/publish/value-object/publish-config.d.ts +36 -0
  30. package/dist/internal/domain/publish/value-object/publish-manifest.d.ts +38 -0
  31. package/dist/internal/domain/site/entity/page.d.ts +5 -0
  32. package/dist/internal/domain/site/entity/pagegraph.d.ts +1 -1
  33. package/dist/internal/domain/site/entity/site.d.ts +2 -0
  34. package/dist/internal/domain/site/service/html-link-processor.d.ts +1 -1
  35. package/dist/internal/domain/workspace/entity/authentication.d.ts +11 -0
  36. package/dist/internal/domain/workspace/entity/project.d.ts +77 -0
  37. package/dist/internal/domain/workspace/entity/workspace.d.ts +49 -0
  38. package/dist/internal/domain/workspace/factory/workspace-factory.d.ts +57 -0
  39. package/dist/internal/domain/workspace/index.d.ts +9 -0
  40. package/dist/internal/domain/workspace/repository/file-system.d.ts +55 -0
  41. package/dist/internal/domain/workspace/repository/index.d.ts +2 -0
  42. package/dist/internal/domain/workspace/repository.d.ts +52 -0
  43. package/dist/internal/domain/workspace/type.d.ts +41 -0
  44. package/dist/internal/domain/workspace/value-object/folder-structure.d.ts +27 -0
  45. package/dist/internal/domain/workspace/value-object/project-metadata.d.ts +62 -0
  46. package/dist/internal/domain/workspace/value-object/workspace-metadata.d.ts +61 -0
  47. package/dist/internal/infrastructure/http/netlify-http-client.d.ts +8 -0
  48. package/dist/internal/infrastructure/http/node-http-client.d.ts +7 -0
  49. package/dist/internal/infrastructure/index.d.ts +6 -0
  50. package/dist/internal/infrastructure/persistence/node-file-system.d.ts +30 -0
  51. package/dist/internal/infrastructure/persistence/node-manifest-repository.d.ts +11 -0
  52. package/dist/internal/infrastructure/persistence/node-snapshot-repository.d.ts +12 -0
  53. package/dist/internal/infrastructure/persistence/node-workspace-repository.d.ts +20 -0
  54. package/dist/internal/interfaces/cli/commands/auth.d.ts +121 -0
  55. package/dist/internal/interfaces/cli/commands/build.d.ts +10 -0
  56. package/dist/internal/interfaces/cli/commands/config.d.ts +42 -0
  57. package/dist/internal/interfaces/cli/commands/index.d.ts +6 -0
  58. package/dist/internal/interfaces/cli/commands/project.d.ts +36 -0
  59. package/dist/internal/interfaces/cli/commands/publish.d.ts +27 -0
  60. package/dist/internal/interfaces/cli/commands/serve.d.ts +16 -0
  61. package/dist/internal/interfaces/cli/commands/snapshot.d.ts +25 -0
  62. package/dist/internal/interfaces/cli/commands/workspace.d.ts +16 -0
  63. package/dist/internal/interfaces/cli/container.d.ts +7 -0
  64. package/dist/internal/interfaces/cli/index.d.ts +4 -0
  65. package/dist/internal/interfaces/cli/router.d.ts +27 -0
  66. package/dist/internal/interfaces/cli/types.d.ts +52 -0
  67. package/dist/internal/interfaces/obsidian/container.d.ts +4 -0
  68. package/dist/internal/interfaces/obsidian/index.d.ts +2 -0
  69. package/dist/internal/interfaces/obsidian/workspace.d.ts +38 -0
  70. package/dist/pkg/progress-bar.d.ts +20 -0
  71. package/dist/worker/pool-manager.js +1851 -3929
  72. package/dist/worker/worker-node.js +1851 -3929
  73. package/package.json +11 -3
  74. /package/dist/internal/domain/site/{vo → valueobject}/path.d.ts +0 -0
@@ -0,0 +1,59 @@
1
+ export type PublishType = 'ftp' | 'netlify' | 'mdfriday';
2
+ export interface PublishProgressInfo {
3
+ phase: 'scanning' | 'uploading' | 'deploying' | 'complete';
4
+ percentage: number;
5
+ message: string;
6
+ currentFile?: string;
7
+ filesCompleted?: number;
8
+ filesTotal?: number;
9
+ bytesTransferred?: number;
10
+ bytesTotal?: number;
11
+ }
12
+ export type PublishProgressCallback = (progress: PublishProgressInfo) => void;
13
+ export interface PublishResult {
14
+ success: boolean;
15
+ url?: string;
16
+ filesUploaded: number;
17
+ bytesTransferred: number;
18
+ duration: number;
19
+ error?: string;
20
+ }
21
+ export interface BasePublishConfig {
22
+ type: PublishType;
23
+ }
24
+ export interface FtpPublishConfig extends BasePublishConfig {
25
+ type: 'ftp';
26
+ host: string;
27
+ port: number;
28
+ username: string;
29
+ password: string;
30
+ remotePath: string;
31
+ secure: boolean;
32
+ }
33
+ export interface NetlifyPublishConfig extends BasePublishConfig {
34
+ type: 'netlify';
35
+ accessToken: string;
36
+ siteId: string;
37
+ }
38
+ export interface MDFridayPublishConfig extends BasePublishConfig {
39
+ type: 'mdfriday';
40
+ apiUrl?: string;
41
+ deploymentType: 'share' | 'sub' | 'custom' | 'enterprise';
42
+ enabled: boolean;
43
+ accessToken?: string;
44
+ licenseKey?: string;
45
+ }
46
+ export type AnyPublishConfig = FtpPublishConfig | NetlifyPublishConfig | MDFridayPublishConfig;
47
+ export interface Publisher {
48
+ publish(sourceDir: string, options?: {
49
+ incremental?: boolean;
50
+ force?: boolean;
51
+ onProgress?: PublishProgressCallback;
52
+ }): Promise<PublishResult>;
53
+ testConnection?(): Promise<{
54
+ success: boolean;
55
+ error?: string;
56
+ }>;
57
+ getConfig(): AnyPublishConfig;
58
+ getType(): PublishType;
59
+ }
@@ -0,0 +1,22 @@
1
+ import { Publisher, PublishType, FtpPublishConfig, PublishResult, PublishProgressCallback } from '../type';
2
+ import { ManifestRepository } from '../repository/manifest-repository';
3
+ export declare class FtpPublisher implements Publisher {
4
+ private readonly config;
5
+ private readonly manifestRepo;
6
+ private readonly projectId;
7
+ private readonly projectPath;
8
+ constructor(config: FtpPublishConfig, manifestRepo: ManifestRepository, projectId: string, projectPath: string);
9
+ publish(sourceDir: string, options?: {
10
+ incremental?: boolean;
11
+ onProgress?: PublishProgressCallback;
12
+ }): Promise<PublishResult>;
13
+ testConnection(): Promise<{
14
+ success: boolean;
15
+ error?: string;
16
+ }>;
17
+ getConfig(): FtpPublishConfig;
18
+ getType(): PublishType;
19
+ private connectWithFallback;
20
+ private uploadFileWithRetry;
21
+ private getFileLists;
22
+ }
@@ -0,0 +1,28 @@
1
+ import { Publisher, PublishType, MDFridayPublishConfig, PublishResult, PublishProgressCallback } from '../type';
2
+ import { ManifestRepository } from '../repository/manifest-repository';
3
+ import { HttpClient } from '../repository/http-client';
4
+ export declare class MDFridayPublisher implements Publisher {
5
+ private readonly config;
6
+ private readonly manifestRepo;
7
+ private readonly httpClient;
8
+ private readonly projectId;
9
+ private readonly projectPath;
10
+ constructor(config: MDFridayPublishConfig, manifestRepo: ManifestRepository, httpClient: HttpClient, projectId: string, projectPath: string);
11
+ publish(sourceDir: string, options?: {
12
+ incremental?: boolean;
13
+ onProgress?: PublishProgressCallback;
14
+ }): Promise<PublishResult>;
15
+ testConnection(): Promise<{
16
+ success: boolean;
17
+ error?: string;
18
+ }>;
19
+ getConfig(): MDFridayPublishConfig;
20
+ getType(): PublishType;
21
+ private createZipFromDirectory;
22
+ private uploadToMDFriday;
23
+ private deployPreview;
24
+ private buildFormData;
25
+ private getApiUrl;
26
+ private simulateUploadProgress;
27
+ private formatBytes;
28
+ }
@@ -0,0 +1,28 @@
1
+ import { Publisher, PublishType, NetlifyPublishConfig, PublishResult, PublishProgressCallback } from '../type';
2
+ import { ManifestRepository } from '../repository/manifest-repository';
3
+ import { HttpClient } from '../repository/http-client';
4
+ export declare class NetlifyPublisher implements Publisher {
5
+ private readonly config;
6
+ private readonly manifestRepo;
7
+ private readonly httpClient;
8
+ private readonly projectId;
9
+ private readonly projectPath;
10
+ constructor(config: NetlifyPublishConfig, manifestRepo: ManifestRepository, httpClient: HttpClient, projectId: string, projectPath: string);
11
+ publish(sourceDir: string, options?: {
12
+ incremental?: boolean;
13
+ onProgress?: PublishProgressCallback;
14
+ }): Promise<PublishResult>;
15
+ testConnection(): Promise<{
16
+ success: boolean;
17
+ error?: string;
18
+ }>;
19
+ getConfig(): NetlifyPublishConfig;
20
+ getType(): PublishType;
21
+ private getFileLists;
22
+ private createDeployWithDigests;
23
+ private uploadRequiredFiles;
24
+ private uploadFileWithRetry;
25
+ private waitForDeployment;
26
+ private getSiteUrl;
27
+ private formatBytes;
28
+ }
@@ -0,0 +1,36 @@
1
+ export interface FTPConfig {
2
+ host: string;
3
+ port: number;
4
+ username: string;
5
+ password: string;
6
+ remotePath: string;
7
+ secure: boolean;
8
+ }
9
+ export interface NetlifyConfig {
10
+ accessToken: string;
11
+ siteId: string;
12
+ }
13
+ export interface MDFridayConfig {
14
+ enabled: boolean;
15
+ type: 'share' | 'sub' | 'custom' | 'enterprise';
16
+ autoPublish: boolean;
17
+ licenseKey?: string;
18
+ }
19
+ export declare class WorkspacePublishConfig {
20
+ readonly ftp?: FTPConfig;
21
+ readonly netlify?: NetlifyConfig;
22
+ readonly mdfriday?: MDFridayConfig;
23
+ constructor(data: {
24
+ ftp?: FTPConfig;
25
+ netlify?: NetlifyConfig;
26
+ mdfriday?: MDFridayConfig;
27
+ });
28
+ hasFTP(): boolean;
29
+ hasNetlify(): boolean;
30
+ hasMDFriday(): boolean;
31
+ getFTPConfig(): FTPConfig | null;
32
+ getNetlifyConfig(): NetlifyConfig | null;
33
+ getMDFridayConfig(): MDFridayConfig | null;
34
+ static fromGlobalConfig(globalConfig: any): WorkspacePublishConfig;
35
+ merge(override: Partial<FTPConfig | NetlifyConfig | MDFridayConfig>, method: 'ftp' | 'netlify' | 'mdfriday'): WorkspacePublishConfig;
36
+ }
@@ -0,0 +1,38 @@
1
+ export interface ManifestFileEntry {
2
+ hash: string;
3
+ size: number;
4
+ mtime: number;
5
+ relativePath: string;
6
+ }
7
+ export declare class PublishManifest {
8
+ private readonly projectId;
9
+ private readonly publishMethod;
10
+ private readonly lastPublishTime;
11
+ private readonly files;
12
+ private readonly remoteConfig?;
13
+ constructor(data: {
14
+ projectId: string;
15
+ publishMethod: 'ftp' | 'netlify' | 'mdfriday';
16
+ lastPublishTime: number;
17
+ files: Map<string, ManifestFileEntry> | Record<string, ManifestFileEntry>;
18
+ remoteConfig?: any;
19
+ });
20
+ getProjectId(): string;
21
+ getPublishMethod(): string;
22
+ getLastPublishTime(): number;
23
+ getRemoteConfig(): any;
24
+ getAllFiles(): string[];
25
+ getFile(relativePath: string): ManifestFileEntry | undefined;
26
+ hasFile(relativePath: string): boolean;
27
+ getFileCount(): number;
28
+ getChangedFiles(newManifest: PublishManifest): string[];
29
+ getDeletedFiles(newManifest: PublishManifest): string[];
30
+ toJSON(): any;
31
+ static fromJSON(json: any): PublishManifest;
32
+ static create(data: {
33
+ projectId: string;
34
+ publishMethod: 'ftp' | 'netlify' | 'mdfriday';
35
+ files: Map<string, ManifestFileEntry> | Record<string, ManifestFileEntry>;
36
+ remoteConfig?: any;
37
+ }): PublishManifest;
38
+ }
@@ -14,7 +14,12 @@ export declare class Page implements ContentPage, PageMeta {
14
14
  private resources;
15
15
  private _paginator;
16
16
  private _processedContent;
17
+ private _precomputedData;
17
18
  constructor(tmplSvc: Template, langSvc: LanguageService, publisher: Publisher, contentPage: ContentPage, site: Site);
19
+ precomputeTemplateData(): Promise<void>;
20
+ private precomputeBacklinks;
21
+ private precomputeTableOfContents;
22
+ private precomputeSummary;
18
23
  processResources(pageSources: PageSource[]): Promise<void>;
19
24
  render(): Promise<void>;
20
25
  getPageOutput(): PageOutput;
@@ -1,4 +1,4 @@
1
- import { LinkStrategy } from '../vo/path';
1
+ import { LinkStrategy } from '../valueobject/path';
2
2
  export declare class PageGraph {
3
3
  private allSlugs;
4
4
  private outgoingLinks;
@@ -30,6 +30,7 @@ export declare class Site {
30
30
  private title;
31
31
  private home;
32
32
  private pageGraph;
33
+ private backlinksCache;
33
34
  get Title(): string;
34
35
  get Description(): string;
35
36
  get Compiler(): Compiler;
@@ -100,5 +101,6 @@ export declare class Site {
100
101
  ProcessWikilinks(srcSlug: string, html: string): Promise<string>;
101
102
  getPageGraph(): PageGraph | null;
102
103
  GetBacklinks(targetSlug: string): string[];
104
+ buildBacklinksCache(pages: ContentPage[]): Promise<void>;
103
105
  GetContentIndex(): Promise<Map<string, any>>;
104
106
  }
@@ -1,5 +1,5 @@
1
1
  import { PageGraph } from '../entity/pagegraph';
2
- import { LinkStrategy } from '../vo/path';
2
+ import { LinkStrategy } from '../valueobject/path';
3
3
  export interface LinkProcessorOptions {
4
4
  markdownLinkResolution: LinkStrategy;
5
5
  prettyLinks: boolean;
@@ -0,0 +1,11 @@
1
+ export declare class Authentication {
2
+ private workspacePath;
3
+ private hasAuthFile;
4
+ constructor(workspacePath: string, hasAuthFile?: boolean);
5
+ getWorkspacePath(): string;
6
+ hasAuth(): boolean;
7
+ markAuthExists(): void;
8
+ markAuthDeleted(): void;
9
+ getAuthFilePath(): string;
10
+ getServerConfigPath(): string;
11
+ }
@@ -0,0 +1,77 @@
1
+ import { ProjectMetadata } from '../value-object/project-metadata';
2
+ import { BuildHistoryEntry } from '../type';
3
+ export interface ProjectConfig {
4
+ baseURL?: string;
5
+ title?: string;
6
+ contentDir?: string;
7
+ publishDir?: string;
8
+ defaultContentLanguage?: string;
9
+ languages?: Record<string, {
10
+ contentDir?: string;
11
+ weight?: number;
12
+ }>;
13
+ [key: string]: any;
14
+ }
15
+ export declare class Project {
16
+ private metadata;
17
+ private projectPath;
18
+ private config;
19
+ constructor(projectPath: string, metadata: ProjectMetadata);
20
+ getPath(): string;
21
+ getMetadata(): ProjectMetadata;
22
+ getId(): string;
23
+ getName(): string;
24
+ getWorkspaceId(): string | undefined;
25
+ getBuildHistory(): BuildHistoryEntry[];
26
+ addBuildHistory(entry: BuildHistoryEntry): void;
27
+ getLastBuildTime(): number | undefined;
28
+ updateName(name: string): void;
29
+ loadConfig(): Promise<ProjectConfig>;
30
+ getConfig(): ProjectConfig | null;
31
+ getContentDirs(): Promise<string[]>;
32
+ getPublishDir(): Promise<string>;
33
+ getStaticDir(): string;
34
+ getDefaultLanguage(): Promise<string>;
35
+ getLanguages(): Promise<string[]>;
36
+ getConfigPath(): string;
37
+ getConfigValue(key: string): any;
38
+ setConfigValue(key: string, value: any): void;
39
+ unsetConfigValue(key: string): boolean;
40
+ saveConfig(): Promise<void>;
41
+ private getNestedValue;
42
+ private setNestedValue;
43
+ private deleteNestedValue;
44
+ getInfo(): {
45
+ id: string;
46
+ name: string;
47
+ path: string;
48
+ createdAt: Date;
49
+ updatedAt: Date;
50
+ lastBuild?: Date;
51
+ buildCount: number;
52
+ };
53
+ getSnapshotsDir(): string;
54
+ hasSourceLinks(): boolean;
55
+ getContentLinks(): Array<{
56
+ sourcePath: string;
57
+ languageCode: string;
58
+ weight: number;
59
+ }>;
60
+ getStaticLink(): {
61
+ sourcePath: string;
62
+ } | null;
63
+ setContentLinks(links: Array<{
64
+ sourcePath: string;
65
+ languageCode: string;
66
+ weight: number;
67
+ }>): void;
68
+ setStaticLink(link: {
69
+ sourcePath: string;
70
+ } | null): void;
71
+ addContentLink(sourcePath: string, languageCode: string, weight: number): void;
72
+ getDefaultContentSource(): string | null;
73
+ getAllContentSources(): string[];
74
+ getContentSourceByLanguage(languageCode: string): string | null;
75
+ getSupportedLanguagesFromLinks(): string[];
76
+ isLinkedProject(): boolean;
77
+ }
@@ -0,0 +1,49 @@
1
+ import { WorkspaceMetadata } from '../value-object/workspace-metadata';
2
+ import { ProjectRegistry } from '../type';
3
+ import { Project } from './project';
4
+ import { Authentication } from './authentication';
5
+ export declare class Workspace {
6
+ private readonly rootPath;
7
+ private metadata;
8
+ private projects;
9
+ private authentication;
10
+ constructor(rootPath: string, metadata: WorkspaceMetadata, projects: Map<string, Project>, authentication: Authentication);
11
+ getPath(): string;
12
+ getMetadata(): WorkspaceMetadata;
13
+ getId(): string;
14
+ getName(): string;
15
+ getModulesDir(): string;
16
+ getProjectsDir(): string;
17
+ updateMetadata(updates: Parameters<WorkspaceMetadata['update']>[0]): void;
18
+ updateName(name: string): void;
19
+ getProjects(): Project[];
20
+ getProject(projectId: string): Project | undefined;
21
+ getProjectByName(name: string): Project | undefined;
22
+ findProject(idOrName: string): Project | undefined;
23
+ hasProject(projectId: string): boolean;
24
+ addProject(project: Project): void;
25
+ removeProject(projectId: string): Project | null;
26
+ getProjectCount(): number;
27
+ getProjectRegistry(): ProjectRegistry;
28
+ getAuthentication(): Authentication;
29
+ hasAuthentication(): boolean;
30
+ getConfigPath(): string;
31
+ getConfig(key: string): Promise<any>;
32
+ getAllConfig(): Promise<any>;
33
+ setConfig(key: string, value: any): Promise<void>;
34
+ unsetConfig(key: string): Promise<boolean>;
35
+ private getNestedValue;
36
+ private setNestedValue;
37
+ private deleteNestedValue;
38
+ getInfo(): {
39
+ id: string;
40
+ name: string;
41
+ path: string;
42
+ createdAt: Date;
43
+ updatedAt: Date;
44
+ modulesDir: string;
45
+ projectsDir: string;
46
+ projectCount: number;
47
+ hasAuth: boolean;
48
+ };
49
+ }
@@ -0,0 +1,57 @@
1
+ import { Workspace } from '../entity/workspace';
2
+ import { Project } from '../entity/project';
3
+ import { WorkspaceRepository, ProjectRepository, SnapshotRepository, FileSystemRepository } from '../repository';
4
+ import { SnapshotMetadata } from '../type';
5
+ import type { IdentityStorageProvider } from '@internal/domain/identity/repository/index';
6
+ export interface WorkspaceFactoryOptions {
7
+ workspaceRepo: WorkspaceRepository;
8
+ projectRepo: ProjectRepository;
9
+ snapshotRepo: SnapshotRepository;
10
+ fileSystemRepo?: FileSystemRepository;
11
+ }
12
+ export declare class WorkspaceFactory {
13
+ private workspaceRepo;
14
+ private projectRepo;
15
+ private snapshotRepo;
16
+ private fileSystemRepo;
17
+ constructor(options: WorkspaceFactoryOptions);
18
+ load(rootPath: string): Promise<Workspace>;
19
+ private checkAuthFile;
20
+ create(rootPath: string, options?: {
21
+ name?: string;
22
+ modulesDir?: string;
23
+ projectsDir?: string;
24
+ }): Promise<Workspace>;
25
+ save(workspace: Workspace): Promise<void>;
26
+ findWorkspaceRoot(startPath: string): Promise<string | null>;
27
+ isWorkspace(workspacePath: string): Promise<boolean>;
28
+ loadOrFind(cwd?: string): Promise<Workspace>;
29
+ createProject(workspace: Workspace, name: string, options?: {
30
+ theme?: string;
31
+ language?: string;
32
+ contentDir?: string;
33
+ staticDir?: string;
34
+ publishDir?: string;
35
+ }): Promise<Project>;
36
+ deleteProject(workspace: Workspace, projectIdOrName: string, options?: {
37
+ deleteFiles?: boolean;
38
+ }): Promise<void>;
39
+ createProjectFromFolder(workspace: Workspace, name: string, sourceFolderPath: string, options?: {
40
+ theme?: string;
41
+ language?: string;
42
+ }): Promise<Project>;
43
+ createProjectFromFile(workspace: Workspace, name: string, sourceFilePath: string, options?: {
44
+ theme?: string;
45
+ language?: string;
46
+ }): Promise<Project>;
47
+ loadProject(projectPath: string): Promise<Project>;
48
+ saveProject(project: Project): Promise<void>;
49
+ findProjectRoot(startPath: string): Promise<string | null>;
50
+ createSnapshot(project: Project, snapshotName?: string): Promise<SnapshotMetadata>;
51
+ listSnapshots(project: Project): Promise<SnapshotMetadata[]>;
52
+ restoreSnapshot(project: Project, snapshotId: string, outputDir?: string): Promise<void>;
53
+ deleteSnapshot(project: Project, snapshotId: string): Promise<void>;
54
+ getSnapshot(project: Project, snapshotId: string): Promise<SnapshotMetadata>;
55
+ createIdentityStorage(workspace: Workspace): IdentityStorageProvider;
56
+ private createSampleContent;
57
+ }
@@ -0,0 +1,9 @@
1
+ export * from './type';
2
+ export { WorkspaceMetadata } from './value-object/workspace-metadata';
3
+ export { ProjectMetadata } from './value-object/project-metadata';
4
+ export { FolderStructure } from './value-object/folder-structure';
5
+ export * from './repository';
6
+ export { Workspace } from './entity/workspace';
7
+ export { Project, ProjectConfig } from './entity/project';
8
+ export { Authentication } from './entity/authentication';
9
+ export { WorkspaceFactory, WorkspaceFactoryOptions } from './factory/workspace-factory';
@@ -0,0 +1,55 @@
1
+ export interface FolderScanResult {
2
+ path: string;
3
+ name: string;
4
+ isDirectory: boolean;
5
+ isFile: boolean;
6
+ }
7
+ export interface ContentFolderInfo {
8
+ path: string;
9
+ languageCode: string;
10
+ weight: number;
11
+ }
12
+ export interface StaticFolderInfo {
13
+ path: string;
14
+ }
15
+ export interface FolderStructure {
16
+ rootPath: string;
17
+ contentFolders: ContentFolderInfo[];
18
+ staticFolder: StaticFolderInfo | null;
19
+ isStructured: boolean;
20
+ }
21
+ export interface SymlinkResult {
22
+ source: string;
23
+ target: string;
24
+ success: boolean;
25
+ error?: string;
26
+ }
27
+ export interface FileSystemRepository {
28
+ exists(path: string): Promise<boolean>;
29
+ isDirectory(path: string): Promise<boolean>;
30
+ isFile(path: string): Promise<boolean>;
31
+ readDirectory(path: string): Promise<FolderScanResult[]>;
32
+ scanFolderStructure(path: string): Promise<FolderStructure>;
33
+ createSymlink(source: string, target: string): Promise<SymlinkResult>;
34
+ createSymlinks(links: Array<{
35
+ source: string;
36
+ target: string;
37
+ }>): Promise<SymlinkResult[]>;
38
+ removeSymlink(path: string): Promise<void>;
39
+ isSymlink(path: string): Promise<boolean>;
40
+ readSymlink(path: string): Promise<string>;
41
+ createDirectory(path: string, recursive?: boolean): Promise<void>;
42
+ remove(path: string, recursive?: boolean): Promise<void>;
43
+ stat(path: string): Promise<{
44
+ isFile(): boolean;
45
+ isDirectory(): boolean;
46
+ isSymbolicLink(): boolean;
47
+ size: number;
48
+ mtime: Date;
49
+ }>;
50
+ copyFile(source: string, target: string): Promise<void>;
51
+ resolvePath(path: string): Promise<string>;
52
+ basename(path: string): string;
53
+ dirname(path: string): string;
54
+ join(...paths: string[]): string;
55
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../repository';
2
+ export * from './file-system';
@@ -0,0 +1,52 @@
1
+ import type { ProjectRegistry, SnapshotMetadata } from './type';
2
+ export * from './repository/file-system';
3
+ export type WorkspaceMetadataData = {
4
+ version: string;
5
+ id: string;
6
+ name: string;
7
+ createdAt: number;
8
+ updatedAt: number;
9
+ paths: {
10
+ modules: string;
11
+ projects: string;
12
+ };
13
+ defaults?: {
14
+ modulesDir?: string;
15
+ theme?: string;
16
+ language?: string;
17
+ };
18
+ };
19
+ export type ProjectMetadataData = {
20
+ id: string;
21
+ name: string;
22
+ workspaceId?: string;
23
+ createdAt: number;
24
+ updatedAt: number;
25
+ buildHistory?: any[];
26
+ previews?: any;
27
+ };
28
+ export interface WorkspaceRepository {
29
+ isWorkspace(path: string): Promise<boolean>;
30
+ initWorkspaceStructure(path: string, modulesDir: string, projectsDir: string): Promise<void>;
31
+ saveWorkspaceMetadata(path: string, metadata: WorkspaceMetadataData): Promise<void>;
32
+ loadWorkspaceMetadata(path: string): Promise<WorkspaceMetadataData>;
33
+ saveProjectRegistry(path: string, registry: ProjectRegistry): Promise<void>;
34
+ loadProjectRegistry(path: string): Promise<ProjectRegistry>;
35
+ }
36
+ export interface ProjectRepository {
37
+ isProject(path: string): Promise<boolean>;
38
+ initProjectStructure(path: string, contentDir: string, staticDir: string, publishDir: string): Promise<void>;
39
+ saveProjectMetadata(path: string, metadata: ProjectMetadataData): Promise<void>;
40
+ loadProjectMetadata(path: string): Promise<ProjectMetadataData>;
41
+ saveProjectConfig(path: string, config: any): Promise<void>;
42
+ createSampleContent(path: string, content: string): Promise<void>;
43
+ deleteProjectFiles(path: string): Promise<void>;
44
+ deleteProjectDirectory(path: string): Promise<void>;
45
+ }
46
+ export interface SnapshotRepository {
47
+ createSnapshot(projectPath: string, snapshotId: string, outputDir: string): Promise<SnapshotMetadata>;
48
+ listSnapshots(projectPath: string): Promise<SnapshotMetadata[]>;
49
+ getSnapshot(projectPath: string, snapshotId: string): Promise<SnapshotMetadata>;
50
+ restoreSnapshot(projectPath: string, snapshotId: string, outputDir: string): Promise<void>;
51
+ deleteSnapshot(projectPath: string, snapshotId: string): Promise<void>;
52
+ }
@@ -0,0 +1,41 @@
1
+ export interface ProjectEntry {
2
+ id: string;
3
+ name: string;
4
+ path: string;
5
+ absolutePath: string;
6
+ theme?: string;
7
+ createdAt: number;
8
+ updatedAt: number;
9
+ lastBuild?: number;
10
+ status: 'active' | 'archived';
11
+ }
12
+ export interface ProjectRegistry {
13
+ version: string;
14
+ projects: ProjectEntry[];
15
+ }
16
+ export interface BuildHistoryEntry {
17
+ timestamp: number;
18
+ type: 'build' | 'publish';
19
+ target?: string;
20
+ success: boolean;
21
+ previewId?: string;
22
+ duration?: number;
23
+ stats?: {
24
+ pages?: number;
25
+ size?: number;
26
+ };
27
+ }
28
+ export interface SnapshotMetadata {
29
+ id: string;
30
+ name: string;
31
+ timestamp: number;
32
+ outputDir: string;
33
+ storageDir: string;
34
+ size: number;
35
+ fileCount: number;
36
+ }
37
+ export interface PreviewsConfig {
38
+ autoSnapshot?: boolean;
39
+ retention?: number;
40
+ cleanupOlderThan?: number;
41
+ }
@@ -0,0 +1,27 @@
1
+ import type { FolderStructure as IFolderStructure, ContentFolderInfo, StaticFolderInfo } from '../repository/file-system';
2
+ export declare class FolderStructure {
3
+ private readonly rootPath;
4
+ private readonly contentFolders;
5
+ private readonly staticFolder;
6
+ private readonly isStructured;
7
+ private constructor();
8
+ static fromScanResult(result: IFolderStructure): FolderStructure;
9
+ static createEmpty(rootPath: string): FolderStructure;
10
+ static createSingleContent(rootPath: string, contentPath: string, languageCode?: string): FolderStructure;
11
+ getRootPath(): string;
12
+ getContentFolders(): ContentFolderInfo[];
13
+ getStaticFolder(): StaticFolderInfo | null;
14
+ getIsStructured(): boolean;
15
+ hasContentFolders(): boolean;
16
+ hasStaticFolder(): boolean;
17
+ getContentFolderCount(): number;
18
+ getDefaultContentFolder(): ContentFolderInfo | null;
19
+ getLanguageContentFolders(): ContentFolderInfo[];
20
+ getContentFolderByLanguage(languageCode: string): ContentFolderInfo | null;
21
+ getSupportedLanguages(): string[];
22
+ isValid(): boolean;
23
+ isMultilingual(): boolean;
24
+ getSummary(): string;
25
+ toJSON(): IFolderStructure;
26
+ static fromJSON(json: IFolderStructure): FolderStructure;
27
+ }