@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.
- package/README.md +1 -1
- package/dist/cli.js +54506 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/application/identity.d.ts +90 -0
- package/dist/internal/application/incremental-build-coordinator.d.ts +1 -0
- package/dist/internal/application/publish.d.ts +28 -0
- package/dist/internal/application/workspace.d.ts +29 -0
- package/dist/internal/domain/content/vo/sort.d.ts +1 -0
- package/dist/internal/domain/identity/entity/user.d.ts +55 -0
- package/dist/internal/domain/identity/factory/user-factory.d.ts +153 -0
- package/dist/internal/domain/identity/index.d.ts +9 -0
- package/dist/internal/domain/identity/repository/index.d.ts +31 -0
- package/dist/internal/domain/identity/type.d.ts +19 -0
- package/dist/internal/domain/identity/value-object/device.d.ts +21 -0
- package/dist/internal/domain/identity/value-object/email.d.ts +12 -0
- package/dist/internal/domain/identity/value-object/license.d.ts +63 -0
- package/dist/internal/domain/identity/value-object/server-config.d.ts +21 -0
- package/dist/internal/domain/identity/value-object/token.d.ts +21 -0
- package/dist/internal/domain/publish/entity/publisher.d.ts +24 -0
- package/dist/internal/domain/publish/factory/publisher-factory.d.ts +13 -0
- package/dist/internal/domain/publish/index.d.ts +10 -0
- package/dist/internal/domain/publish/repository/http-client.d.ts +14 -0
- package/dist/internal/domain/publish/repository/manifest-repository.d.ts +7 -0
- package/dist/internal/domain/publish/type.d.ts +59 -0
- package/dist/internal/domain/publish/value-object/ftp-publisher.d.ts +22 -0
- package/dist/internal/domain/publish/value-object/mdfriday-publisher.d.ts +28 -0
- package/dist/internal/domain/publish/value-object/netlify-publisher.d.ts +28 -0
- package/dist/internal/domain/publish/value-object/publish-config.d.ts +36 -0
- package/dist/internal/domain/publish/value-object/publish-manifest.d.ts +38 -0
- package/dist/internal/domain/site/entity/page.d.ts +5 -0
- package/dist/internal/domain/site/entity/pagegraph.d.ts +1 -1
- package/dist/internal/domain/site/entity/site.d.ts +2 -0
- package/dist/internal/domain/site/service/html-link-processor.d.ts +1 -1
- package/dist/internal/domain/workspace/entity/authentication.d.ts +11 -0
- package/dist/internal/domain/workspace/entity/project.d.ts +77 -0
- package/dist/internal/domain/workspace/entity/workspace.d.ts +49 -0
- package/dist/internal/domain/workspace/factory/workspace-factory.d.ts +57 -0
- package/dist/internal/domain/workspace/index.d.ts +9 -0
- package/dist/internal/domain/workspace/repository/file-system.d.ts +55 -0
- package/dist/internal/domain/workspace/repository/index.d.ts +2 -0
- package/dist/internal/domain/workspace/repository.d.ts +52 -0
- package/dist/internal/domain/workspace/type.d.ts +41 -0
- package/dist/internal/domain/workspace/value-object/folder-structure.d.ts +27 -0
- package/dist/internal/domain/workspace/value-object/project-metadata.d.ts +62 -0
- package/dist/internal/domain/workspace/value-object/workspace-metadata.d.ts +61 -0
- package/dist/internal/infrastructure/http/netlify-http-client.d.ts +8 -0
- package/dist/internal/infrastructure/http/node-http-client.d.ts +7 -0
- package/dist/internal/infrastructure/index.d.ts +6 -0
- package/dist/internal/infrastructure/persistence/node-file-system.d.ts +30 -0
- package/dist/internal/infrastructure/persistence/node-manifest-repository.d.ts +11 -0
- package/dist/internal/infrastructure/persistence/node-snapshot-repository.d.ts +12 -0
- package/dist/internal/infrastructure/persistence/node-workspace-repository.d.ts +20 -0
- package/dist/internal/interfaces/cli/commands/auth.d.ts +121 -0
- package/dist/internal/interfaces/cli/commands/build.d.ts +10 -0
- package/dist/internal/interfaces/cli/commands/config.d.ts +42 -0
- package/dist/internal/interfaces/cli/commands/index.d.ts +6 -0
- package/dist/internal/interfaces/cli/commands/project.d.ts +36 -0
- package/dist/internal/interfaces/cli/commands/publish.d.ts +27 -0
- package/dist/internal/interfaces/cli/commands/serve.d.ts +16 -0
- package/dist/internal/interfaces/cli/commands/snapshot.d.ts +25 -0
- package/dist/internal/interfaces/cli/commands/workspace.d.ts +16 -0
- package/dist/internal/interfaces/cli/container.d.ts +7 -0
- package/dist/internal/interfaces/cli/index.d.ts +4 -0
- package/dist/internal/interfaces/cli/router.d.ts +27 -0
- package/dist/internal/interfaces/cli/types.d.ts +52 -0
- package/dist/internal/interfaces/obsidian/container.d.ts +4 -0
- package/dist/internal/interfaces/obsidian/index.d.ts +2 -0
- package/dist/internal/interfaces/obsidian/workspace.d.ts +38 -0
- package/dist/pkg/progress-bar.d.ts +20 -0
- package/dist/worker/pool-manager.js +1851 -3929
- package/dist/worker/worker-node.js +1851 -3929
- package/package.json +11 -3
- /package/dist/internal/domain/site/{vo → valueobject}/path.d.ts +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { UserFactory } from '@internal/domain/identity/factory/user-factory';
|
|
2
|
+
import { User } from '@internal/domain/identity/entity/user';
|
|
3
|
+
import { ServerConfig } from '@internal/domain/identity/value-object/server-config';
|
|
4
|
+
import { License } from '@internal/domain/identity/value-object/license';
|
|
5
|
+
import { Device } from '@internal/domain/identity/value-object/device';
|
|
6
|
+
export interface IdentityAppServiceOptions {
|
|
7
|
+
userFactory: UserFactory;
|
|
8
|
+
}
|
|
9
|
+
export declare class IdentityAppService {
|
|
10
|
+
private userFactory;
|
|
11
|
+
private currentUser;
|
|
12
|
+
constructor(options: IdentityAppServiceOptions);
|
|
13
|
+
initialize(): Promise<void>;
|
|
14
|
+
login(email: string, password: string): Promise<User>;
|
|
15
|
+
register(email: string, password: string): Promise<User>;
|
|
16
|
+
logout(): Promise<void>;
|
|
17
|
+
getCurrentUser(): User | null;
|
|
18
|
+
isAuthenticated(): boolean;
|
|
19
|
+
getToken(): string | null;
|
|
20
|
+
getStatus(): {
|
|
21
|
+
isAuthenticated: boolean;
|
|
22
|
+
email: string;
|
|
23
|
+
serverUrl: string;
|
|
24
|
+
tokenExpired: boolean;
|
|
25
|
+
hasToken: boolean;
|
|
26
|
+
hasLicense: boolean;
|
|
27
|
+
licenseValid: boolean;
|
|
28
|
+
isTrial: boolean;
|
|
29
|
+
licensePlan: import("@internal/domain/identity/value-object/license").LicensePlan | undefined;
|
|
30
|
+
licenseExpires: string | undefined;
|
|
31
|
+
licenseDaysRemaining: number | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
isAuthenticated: boolean;
|
|
34
|
+
email: undefined;
|
|
35
|
+
serverUrl: string;
|
|
36
|
+
tokenExpired: boolean;
|
|
37
|
+
hasToken: boolean;
|
|
38
|
+
};
|
|
39
|
+
getServerConfig(): ServerConfig;
|
|
40
|
+
updateServerConfig(updates: {
|
|
41
|
+
apiUrl?: string;
|
|
42
|
+
websiteUrl?: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
requestTrialLicense(email: string): Promise<import("@internal/domain/identity/factory/user-factory").TrialLicenseResponse>;
|
|
45
|
+
loginWithLicense(licenseKey: string): Promise<User>;
|
|
46
|
+
activateLicense(licenseKey: string, device?: Device): Promise<User>;
|
|
47
|
+
requestAndActivateTrial(email: string): Promise<User>;
|
|
48
|
+
getLicense(): License | null;
|
|
49
|
+
hasValidLicense(): boolean;
|
|
50
|
+
isTrialAccount(): boolean;
|
|
51
|
+
getLicenseDisplay(): {
|
|
52
|
+
key: string;
|
|
53
|
+
plan: string;
|
|
54
|
+
expires: string;
|
|
55
|
+
daysRemaining: number;
|
|
56
|
+
isValid: boolean;
|
|
57
|
+
isExpired: boolean;
|
|
58
|
+
isTrial: boolean;
|
|
59
|
+
features: import("@internal/domain/identity/value-object/license").LicenseFeatures;
|
|
60
|
+
} | null;
|
|
61
|
+
refreshTokenIfNeeded(): Promise<boolean>;
|
|
62
|
+
requestWithAutoRefresh<T>(requestFn: (tokenValue: string) => Promise<T>): Promise<T>;
|
|
63
|
+
getLicenseUsage(): Promise<import("@internal/domain/identity/factory/user-factory").LicenseUsageResponse | null>;
|
|
64
|
+
getLicenseInfo(licenseKey?: string): Promise<any>;
|
|
65
|
+
resetUsage(): Promise<{
|
|
66
|
+
success: boolean;
|
|
67
|
+
message?: string;
|
|
68
|
+
}>;
|
|
69
|
+
getDomains(): Promise<import("@internal/domain/identity/factory/user-factory").DomainInfo | null>;
|
|
70
|
+
checkSubdomainAvailability(subdomain: string): Promise<import("@internal/domain/identity/factory/user-factory").SubdomainCheckResponse | null>;
|
|
71
|
+
updateSubdomain(newSubdomain: string): Promise<import("@internal/domain/identity/factory/user-factory").SubdomainUpdateResponse | null>;
|
|
72
|
+
checkCustomDomain(domain: string): Promise<{
|
|
73
|
+
dns_valid: boolean;
|
|
74
|
+
ready: boolean;
|
|
75
|
+
message: string;
|
|
76
|
+
resolved_ips?: string[];
|
|
77
|
+
} | null>;
|
|
78
|
+
addCustomDomain(domain: string): Promise<{
|
|
79
|
+
domain: string;
|
|
80
|
+
status: string;
|
|
81
|
+
message: string;
|
|
82
|
+
} | null>;
|
|
83
|
+
checkCustomDomainHttpsStatus(domain: string): Promise<{
|
|
84
|
+
status: string;
|
|
85
|
+
tls_ready: boolean;
|
|
86
|
+
dns_valid: boolean;
|
|
87
|
+
message: string;
|
|
88
|
+
certificate?: any;
|
|
89
|
+
} | null>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PublisherFactory } from '@internal/domain/publish';
|
|
2
|
+
import { WorkspaceAppService } from './workspace';
|
|
3
|
+
import { Project } from '@internal/domain/workspace';
|
|
4
|
+
export interface PublishOptions {
|
|
5
|
+
force?: boolean;
|
|
6
|
+
incremental?: boolean;
|
|
7
|
+
config?: any;
|
|
8
|
+
}
|
|
9
|
+
export type PublishProgressCallback = (progress: {
|
|
10
|
+
phase: 'scanning' | 'uploading' | 'deploying' | 'complete';
|
|
11
|
+
percentage: number;
|
|
12
|
+
message: string;
|
|
13
|
+
currentFile?: string;
|
|
14
|
+
filesCompleted?: number;
|
|
15
|
+
filesTotal?: number;
|
|
16
|
+
bytesTransferred?: number;
|
|
17
|
+
}) => void;
|
|
18
|
+
export declare class PublishAppService {
|
|
19
|
+
private publisherFactory;
|
|
20
|
+
private workspaceService;
|
|
21
|
+
constructor(publisherFactory: PublisherFactory, workspaceService: WorkspaceAppService);
|
|
22
|
+
publish(project: Project, method: 'ftp' | 'netlify' | 'mdfriday', options?: PublishOptions, onProgress?: PublishProgressCallback): Promise<any>;
|
|
23
|
+
testConnection(project: Project, method: 'ftp' | 'netlify' | 'mdfriday'): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
}>;
|
|
27
|
+
private getMethodConfig;
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WorkspaceFactory, Workspace, Project } from '@internal/domain/workspace';
|
|
2
|
+
export interface WorkspaceAppServiceOptions {
|
|
3
|
+
workspaceFactory: WorkspaceFactory;
|
|
4
|
+
}
|
|
5
|
+
export declare class WorkspaceAppService {
|
|
6
|
+
private workspaceFactory;
|
|
7
|
+
constructor(options: WorkspaceAppServiceOptions);
|
|
8
|
+
loadWorkspace(path?: string): Promise<Workspace>;
|
|
9
|
+
createWorkspace(path: string, options?: Parameters<WorkspaceFactory['create']>[1]): Promise<Workspace>;
|
|
10
|
+
saveWorkspace(workspace: Workspace): Promise<void>;
|
|
11
|
+
findWorkspaceRoot(startPath?: string): Promise<string | null>;
|
|
12
|
+
createProject(workspace: Workspace, name: string, options?: Parameters<WorkspaceFactory['createProject']>[2]): Promise<Project>;
|
|
13
|
+
createProjectFromFolder(workspace: Workspace, name: string, sourceFolderPath: string, options?: Parameters<WorkspaceFactory['createProjectFromFolder']>[3]): Promise<Project>;
|
|
14
|
+
createProjectFromFile(workspace: Workspace, name: string, sourceFilePath: string, options?: Parameters<WorkspaceFactory['createProjectFromFile']>[3]): Promise<Project>;
|
|
15
|
+
deleteProject(workspace: Workspace, projectIdOrName: string, options?: Parameters<WorkspaceFactory['deleteProject']>[2]): Promise<void>;
|
|
16
|
+
loadWorkspaceAndProject(projectNameOrPath?: string, workspacePath?: string): Promise<{
|
|
17
|
+
workspace: Workspace;
|
|
18
|
+
project: Project;
|
|
19
|
+
}>;
|
|
20
|
+
createSnapshot(project: Project, snapshotName?: string): Promise<import("@internal/domain/workspace").SnapshotMetadata>;
|
|
21
|
+
listSnapshots(project: Project): Promise<import("@internal/domain/workspace").SnapshotMetadata[]>;
|
|
22
|
+
restoreSnapshot(project: Project, snapshotId: string, outputDir?: string): Promise<void>;
|
|
23
|
+
deleteSnapshot(project: Project, snapshotId: string): Promise<void>;
|
|
24
|
+
getSnapshot(project: Project, snapshotId: string): Promise<import("@internal/domain/workspace").SnapshotMetadata>;
|
|
25
|
+
loadProject(projectPath: string): Promise<Project>;
|
|
26
|
+
saveProject(project: Project): Promise<void>;
|
|
27
|
+
findProjectRoot(startPath: string): Promise<string | null>;
|
|
28
|
+
createIdentityStorage(workspace: Workspace): import("../domain/identity").IdentityStorageProvider;
|
|
29
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Pages } from '../type';
|
|
2
2
|
export declare function sortByDefault(pages: Pages): void;
|
|
3
|
+
export declare function sortByTitle(pages: Pages): void;
|
|
3
4
|
export declare function sortByWeight(pages: Pages): void;
|
|
4
5
|
export declare function sortByLanguage(pages: Pages): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Email } from '../value-object/email';
|
|
2
|
+
import { Token } from '../value-object/token';
|
|
3
|
+
import { ServerConfig } from '../value-object/server-config';
|
|
4
|
+
import { License } from '../value-object/license';
|
|
5
|
+
export declare class User {
|
|
6
|
+
private readonly email;
|
|
7
|
+
private token;
|
|
8
|
+
private serverConfig;
|
|
9
|
+
private license;
|
|
10
|
+
constructor(email: Email, token: Token | null, serverConfig: ServerConfig, license?: License | null);
|
|
11
|
+
getEmail(): Email;
|
|
12
|
+
getToken(): Token | null;
|
|
13
|
+
getServerConfig(): ServerConfig;
|
|
14
|
+
getLicense(): License | null;
|
|
15
|
+
setToken(token: Token): void;
|
|
16
|
+
clearToken(): void;
|
|
17
|
+
updateServerConfig(config: ServerConfig): void;
|
|
18
|
+
setLicense(license: License): void;
|
|
19
|
+
clearLicense(): void;
|
|
20
|
+
isAuthenticated(): boolean;
|
|
21
|
+
isTokenExpired(): boolean;
|
|
22
|
+
hasValidLicense(): boolean;
|
|
23
|
+
isTrialAccount(): boolean;
|
|
24
|
+
getStatus(): {
|
|
25
|
+
isAuthenticated: boolean;
|
|
26
|
+
email: string;
|
|
27
|
+
serverUrl: string;
|
|
28
|
+
tokenExpired: boolean;
|
|
29
|
+
hasToken: boolean;
|
|
30
|
+
hasLicense: boolean;
|
|
31
|
+
licenseValid: boolean;
|
|
32
|
+
isTrial: boolean;
|
|
33
|
+
licensePlan: import("../value-object/license").LicensePlan | undefined;
|
|
34
|
+
licenseExpires: string | undefined;
|
|
35
|
+
licenseDaysRemaining: number | undefined;
|
|
36
|
+
};
|
|
37
|
+
toJSON(): {
|
|
38
|
+
email: string;
|
|
39
|
+
token: {
|
|
40
|
+
token: string;
|
|
41
|
+
expiresAt?: number;
|
|
42
|
+
} | null;
|
|
43
|
+
serverConfig: {
|
|
44
|
+
apiUrl: string;
|
|
45
|
+
websiteUrl?: string;
|
|
46
|
+
};
|
|
47
|
+
license: {
|
|
48
|
+
key: string;
|
|
49
|
+
plan: import("../value-object/license").LicensePlan;
|
|
50
|
+
expiresAt: number;
|
|
51
|
+
features: import("../value-object/license").LicenseFeatures;
|
|
52
|
+
activatedAt: number;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { User } from '../entity/user';
|
|
2
|
+
import { ServerConfig } from '../value-object/server-config';
|
|
3
|
+
import { Device } from '../value-object/device';
|
|
4
|
+
import { HttpClient, IdentityStorageProvider } from '../repository/index';
|
|
5
|
+
export interface TrialLicenseResponse {
|
|
6
|
+
email: string;
|
|
7
|
+
license_key: string;
|
|
8
|
+
password: string;
|
|
9
|
+
message: string;
|
|
10
|
+
success: boolean;
|
|
11
|
+
validity_days: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LicenseActivationResponse {
|
|
14
|
+
activated: boolean;
|
|
15
|
+
first_time: boolean;
|
|
16
|
+
expires_at: number;
|
|
17
|
+
features: {
|
|
18
|
+
max_devices: number;
|
|
19
|
+
max_ips: number;
|
|
20
|
+
sync_enabled: boolean;
|
|
21
|
+
sync_quota: number;
|
|
22
|
+
publish_enabled: boolean;
|
|
23
|
+
max_sites: number;
|
|
24
|
+
max_storage: number;
|
|
25
|
+
custom_domain: boolean;
|
|
26
|
+
custom_sub_domain: boolean;
|
|
27
|
+
validity_days: number;
|
|
28
|
+
};
|
|
29
|
+
license_key: string;
|
|
30
|
+
plan: string;
|
|
31
|
+
success: boolean;
|
|
32
|
+
user: {
|
|
33
|
+
email: string;
|
|
34
|
+
user_dir: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface DomainInfo {
|
|
38
|
+
subdomain: string;
|
|
39
|
+
full_domain: string;
|
|
40
|
+
cus_domain: string;
|
|
41
|
+
folder: string;
|
|
42
|
+
created_at: number;
|
|
43
|
+
}
|
|
44
|
+
export interface SubdomainCheckResponse {
|
|
45
|
+
available: boolean;
|
|
46
|
+
message?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SubdomainUpdateResponse {
|
|
49
|
+
new_subdomain: string;
|
|
50
|
+
old_subdomain: string;
|
|
51
|
+
full_domain: string;
|
|
52
|
+
message: string;
|
|
53
|
+
}
|
|
54
|
+
export interface UserFactoryOptions {
|
|
55
|
+
httpClient: HttpClient;
|
|
56
|
+
storageProvider: IdentityStorageProvider;
|
|
57
|
+
}
|
|
58
|
+
export declare class UserFactory {
|
|
59
|
+
private httpClient;
|
|
60
|
+
private storageProvider;
|
|
61
|
+
constructor(options: UserFactoryOptions);
|
|
62
|
+
createAnonymous(serverConfig?: ServerConfig): User;
|
|
63
|
+
load(): Promise<User | null>;
|
|
64
|
+
save(user: User): Promise<void>;
|
|
65
|
+
loadServerConfig(): Promise<ServerConfig | null>;
|
|
66
|
+
login(email: string, password: string, serverConfig?: ServerConfig): Promise<User>;
|
|
67
|
+
register(email: string, password: string, serverConfig?: ServerConfig): Promise<User>;
|
|
68
|
+
logout(): Promise<void>;
|
|
69
|
+
updateServerConfig(user: User, updates: {
|
|
70
|
+
apiUrl?: string;
|
|
71
|
+
websiteUrl?: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
requestTrialLicense(email: string, serverConfig?: ServerConfig): Promise<TrialLicenseResponse>;
|
|
74
|
+
loginWithLicense(licenseKey: string, serverConfig?: ServerConfig): Promise<User>;
|
|
75
|
+
activateLicense(user: User, licenseKey: string, device?: Device): Promise<User>;
|
|
76
|
+
requestAndActivateTrial(email: string, serverConfig?: ServerConfig): Promise<User>;
|
|
77
|
+
refreshTokenIfNeeded(user: User): Promise<User>;
|
|
78
|
+
requestWithAutoRefresh<T>(user: User, requestFn: (tokenValue: string) => Promise<T>): Promise<T>;
|
|
79
|
+
getLicenseUsage(user: User): Promise<LicenseUsageResponse | null>;
|
|
80
|
+
getLicenseInfo(user: User, licenseKey?: string): Promise<any>;
|
|
81
|
+
resetUsage(user: User): Promise<{
|
|
82
|
+
success: boolean;
|
|
83
|
+
message?: string;
|
|
84
|
+
}>;
|
|
85
|
+
getDomains(user: User): Promise<DomainInfo | null>;
|
|
86
|
+
checkSubdomainAvailability(user: User, subdomain: string): Promise<SubdomainCheckResponse | null>;
|
|
87
|
+
updateSubdomain(user: User, newSubdomain: string): Promise<SubdomainUpdateResponse | null>;
|
|
88
|
+
checkCustomDomain(user: User, domain: string): Promise<{
|
|
89
|
+
dns_valid: boolean;
|
|
90
|
+
ready: boolean;
|
|
91
|
+
message: string;
|
|
92
|
+
resolved_ips?: string[];
|
|
93
|
+
} | null>;
|
|
94
|
+
addCustomDomain(user: User, domain: string): Promise<{
|
|
95
|
+
domain: string;
|
|
96
|
+
status: string;
|
|
97
|
+
message: string;
|
|
98
|
+
} | null>;
|
|
99
|
+
checkCustomDomainHttpsStatus(user: User, domain: string): Promise<{
|
|
100
|
+
status: string;
|
|
101
|
+
tls_ready: boolean;
|
|
102
|
+
dns_valid: boolean;
|
|
103
|
+
message: string;
|
|
104
|
+
certificate?: any;
|
|
105
|
+
} | null>;
|
|
106
|
+
}
|
|
107
|
+
export interface LicenseUsageResponse {
|
|
108
|
+
devices: {
|
|
109
|
+
count: number;
|
|
110
|
+
devices: Array<{
|
|
111
|
+
access_count: number;
|
|
112
|
+
device_id: string;
|
|
113
|
+
device_name: string;
|
|
114
|
+
device_type: string;
|
|
115
|
+
first_seen_at: number;
|
|
116
|
+
last_seen_at: number;
|
|
117
|
+
status: string;
|
|
118
|
+
}>;
|
|
119
|
+
};
|
|
120
|
+
disks: {
|
|
121
|
+
sync_disk_usage: string;
|
|
122
|
+
publish_disk_usage: string;
|
|
123
|
+
total_disk_usage: string;
|
|
124
|
+
unit: string;
|
|
125
|
+
};
|
|
126
|
+
features: {
|
|
127
|
+
max_devices: number;
|
|
128
|
+
max_ips: number;
|
|
129
|
+
sync_enabled: boolean;
|
|
130
|
+
sync_quota: number;
|
|
131
|
+
publish_enabled: boolean;
|
|
132
|
+
max_sites: number;
|
|
133
|
+
max_storage: number;
|
|
134
|
+
custom_domain: boolean;
|
|
135
|
+
custom_sub_domain: boolean;
|
|
136
|
+
validity_days: number;
|
|
137
|
+
};
|
|
138
|
+
ips: {
|
|
139
|
+
count: number;
|
|
140
|
+
ips: Array<{
|
|
141
|
+
access_count: number;
|
|
142
|
+
city: string;
|
|
143
|
+
country: string;
|
|
144
|
+
first_seen_at: number;
|
|
145
|
+
ip_address: string;
|
|
146
|
+
last_seen_at: number;
|
|
147
|
+
region: string;
|
|
148
|
+
status: string;
|
|
149
|
+
}>;
|
|
150
|
+
};
|
|
151
|
+
license_key: string;
|
|
152
|
+
plan: string;
|
|
153
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Email } from './value-object/email';
|
|
2
|
+
export { Token } from './value-object/token';
|
|
3
|
+
export { ServerConfig } from './value-object/server-config';
|
|
4
|
+
export { License, LicenseFeatures, LicensePlan } from './value-object/license';
|
|
5
|
+
export { Device, DeviceType } from './value-object/device';
|
|
6
|
+
export { User } from './entity/user';
|
|
7
|
+
export { UserFactory, UserFactoryOptions } from './factory/user-factory';
|
|
8
|
+
export type { IdentityStorageProvider, HttpClient, HttpResponse } from './repository/index';
|
|
9
|
+
export * from './type';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface HttpClient {
|
|
2
|
+
post(url: string, data: any, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
3
|
+
postForm(url: string, data: Record<string, string>): Promise<HttpResponse>;
|
|
4
|
+
postMultipart(url: string, data: Record<string, any>, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
5
|
+
get(url: string, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
6
|
+
}
|
|
7
|
+
export interface HttpResponse {
|
|
8
|
+
status: number;
|
|
9
|
+
data: any;
|
|
10
|
+
text(): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export interface IdentityStorageProvider {
|
|
13
|
+
saveUserData(data: {
|
|
14
|
+
token?: any;
|
|
15
|
+
license?: any;
|
|
16
|
+
serverConfig: any;
|
|
17
|
+
email?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
loadUserData(): Promise<{
|
|
20
|
+
token?: any;
|
|
21
|
+
license?: any;
|
|
22
|
+
serverConfig?: any;
|
|
23
|
+
email?: string;
|
|
24
|
+
} | null>;
|
|
25
|
+
clearUserData(): Promise<void>;
|
|
26
|
+
saveToken(token: any): Promise<void>;
|
|
27
|
+
loadToken(): Promise<any | null>;
|
|
28
|
+
clearToken(): Promise<void>;
|
|
29
|
+
saveServerConfig(config: any): Promise<void>;
|
|
30
|
+
loadServerConfig(): Promise<any | null>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UserCredentials {
|
|
2
|
+
email: string;
|
|
3
|
+
password: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UserProfile {
|
|
6
|
+
email: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LoginResponse {
|
|
11
|
+
token: string;
|
|
12
|
+
expiresAt?: number;
|
|
13
|
+
user?: UserProfile;
|
|
14
|
+
}
|
|
15
|
+
export interface RegisterResponse {
|
|
16
|
+
token: string;
|
|
17
|
+
expiresAt?: number;
|
|
18
|
+
user?: UserProfile;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type DeviceType = 'desktop' | 'mobile' | 'tablet';
|
|
2
|
+
export declare class Device {
|
|
3
|
+
private readonly id;
|
|
4
|
+
private readonly name;
|
|
5
|
+
private readonly type;
|
|
6
|
+
private constructor();
|
|
7
|
+
static create(id: string, name: string, type: DeviceType): Device;
|
|
8
|
+
static createFromEnvironment(): Promise<Device>;
|
|
9
|
+
private static generateFingerprint;
|
|
10
|
+
private static getDeviceName;
|
|
11
|
+
private static getDeviceType;
|
|
12
|
+
getId(): string;
|
|
13
|
+
getName(): string;
|
|
14
|
+
getType(): DeviceType;
|
|
15
|
+
equals(other: Device): boolean;
|
|
16
|
+
toJSON(): {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
type: DeviceType;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class Email {
|
|
2
|
+
private readonly value;
|
|
3
|
+
private constructor();
|
|
4
|
+
static create(email: string): Email;
|
|
5
|
+
static isValid(email: string): boolean;
|
|
6
|
+
getValue(): string;
|
|
7
|
+
getDomain(): string;
|
|
8
|
+
getLocalPart(): string;
|
|
9
|
+
equals(other: Email): boolean;
|
|
10
|
+
toString(): string;
|
|
11
|
+
toJSON(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface LicenseFeatures {
|
|
2
|
+
maxDevices: number;
|
|
3
|
+
maxIps: number;
|
|
4
|
+
syncEnabled: boolean;
|
|
5
|
+
syncQuota: number;
|
|
6
|
+
publishEnabled: boolean;
|
|
7
|
+
maxSites: number;
|
|
8
|
+
maxStorage: number;
|
|
9
|
+
customDomain: boolean;
|
|
10
|
+
customSubDomain: boolean;
|
|
11
|
+
validityDays: number;
|
|
12
|
+
}
|
|
13
|
+
export type LicensePlan = 'trial' | 'basic' | 'pro' | 'enterprise' | 'lifetime';
|
|
14
|
+
export declare class License {
|
|
15
|
+
private readonly key;
|
|
16
|
+
private readonly plan;
|
|
17
|
+
private readonly expiresAt;
|
|
18
|
+
private readonly features;
|
|
19
|
+
private readonly activatedAt;
|
|
20
|
+
private constructor();
|
|
21
|
+
static create(key: string, plan: LicensePlan, expiresAt: number, features: LicenseFeatures, activatedAt?: number): License;
|
|
22
|
+
static fromJSON(data: {
|
|
23
|
+
key: string;
|
|
24
|
+
plan: LicensePlan;
|
|
25
|
+
expiresAt: number;
|
|
26
|
+
features: LicenseFeatures;
|
|
27
|
+
activatedAt: number;
|
|
28
|
+
}): License;
|
|
29
|
+
static isValidFormat(key: string): boolean;
|
|
30
|
+
isExpired(): boolean;
|
|
31
|
+
isValid(): boolean;
|
|
32
|
+
getDaysRemaining(): number;
|
|
33
|
+
getEmail(): string;
|
|
34
|
+
getPassword(): string;
|
|
35
|
+
private manualBase64Encode;
|
|
36
|
+
getKey(): string;
|
|
37
|
+
getMaskedKey(): string;
|
|
38
|
+
getPlan(): LicensePlan;
|
|
39
|
+
getFormattedPlan(): string;
|
|
40
|
+
getExpiresAt(): number;
|
|
41
|
+
getFormattedExpiresAt(): string;
|
|
42
|
+
getFeatures(): LicenseFeatures;
|
|
43
|
+
getActivatedAt(): number;
|
|
44
|
+
isTrial(): boolean;
|
|
45
|
+
equals(other: License): boolean;
|
|
46
|
+
toJSON(): {
|
|
47
|
+
key: string;
|
|
48
|
+
plan: LicensePlan;
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
features: LicenseFeatures;
|
|
51
|
+
activatedAt: number;
|
|
52
|
+
};
|
|
53
|
+
toStorageFormat(): {
|
|
54
|
+
key: string;
|
|
55
|
+
maskedKey: string;
|
|
56
|
+
plan: string;
|
|
57
|
+
expiresAt: number;
|
|
58
|
+
features: LicenseFeatures;
|
|
59
|
+
activatedAt: number;
|
|
60
|
+
isValid: boolean;
|
|
61
|
+
daysRemaining: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class ServerConfig {
|
|
2
|
+
private readonly apiUrl;
|
|
3
|
+
private readonly websiteUrl;
|
|
4
|
+
private constructor();
|
|
5
|
+
static create(apiUrl: string, websiteUrl?: string): ServerConfig;
|
|
6
|
+
static fromJSON(data: {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
websiteUrl?: string;
|
|
9
|
+
}): ServerConfig;
|
|
10
|
+
static createDefault(): ServerConfig;
|
|
11
|
+
private static isValidUrl;
|
|
12
|
+
getApiUrl(): string;
|
|
13
|
+
getWebsiteUrl(): string | undefined;
|
|
14
|
+
withApiUrl(apiUrl: string): ServerConfig;
|
|
15
|
+
withWebsiteUrl(websiteUrl?: string): ServerConfig;
|
|
16
|
+
equals(other: ServerConfig): boolean;
|
|
17
|
+
toJSON(): {
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
websiteUrl?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class Token {
|
|
2
|
+
private readonly value;
|
|
3
|
+
private readonly expiresAt;
|
|
4
|
+
private constructor();
|
|
5
|
+
static create(value: string, expiresAt?: number): Token;
|
|
6
|
+
static fromJSON(data: {
|
|
7
|
+
token: string;
|
|
8
|
+
expiresAt?: number;
|
|
9
|
+
}): Token;
|
|
10
|
+
getValue(): string;
|
|
11
|
+
getExpiresAt(): number | undefined;
|
|
12
|
+
isExpired(): boolean;
|
|
13
|
+
isValid(): boolean;
|
|
14
|
+
getRemainingTime(): number | null;
|
|
15
|
+
equals(other: Token): boolean;
|
|
16
|
+
toString(): string;
|
|
17
|
+
toJSON(): {
|
|
18
|
+
token: string;
|
|
19
|
+
expiresAt?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Publisher, PublishType, AnyPublishConfig, PublishResult, PublishProgressCallback } from '../type';
|
|
2
|
+
import { ManifestRepository } from '../repository/manifest-repository';
|
|
3
|
+
export declare class PublisherAggregator implements Publisher {
|
|
4
|
+
private readonly projectId;
|
|
5
|
+
private readonly projectPath;
|
|
6
|
+
private readonly config;
|
|
7
|
+
private readonly strategy;
|
|
8
|
+
private readonly manifestRepo;
|
|
9
|
+
constructor(projectId: string, projectPath: string, config: AnyPublishConfig, strategy: Publisher, manifestRepo: ManifestRepository);
|
|
10
|
+
publish(sourceDir: string, options?: {
|
|
11
|
+
incremental?: boolean;
|
|
12
|
+
force?: boolean;
|
|
13
|
+
onProgress?: PublishProgressCallback;
|
|
14
|
+
}): Promise<PublishResult>;
|
|
15
|
+
testConnection(): Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
error?: string;
|
|
18
|
+
}>;
|
|
19
|
+
getConfig(): AnyPublishConfig;
|
|
20
|
+
getType(): PublishType;
|
|
21
|
+
getProjectId(): string;
|
|
22
|
+
getProjectPath(): string;
|
|
23
|
+
private getRemoteConfig;
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PublisherAggregator } from '../entity/publisher';
|
|
2
|
+
import { AnyPublishConfig } from '../type';
|
|
3
|
+
import { ManifestRepository } from '../repository/manifest-repository';
|
|
4
|
+
import { HttpClient } from '../repository/http-client';
|
|
5
|
+
export declare class PublisherFactory {
|
|
6
|
+
private readonly manifestRepo;
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
constructor(manifestRepo: ManifestRepository, httpClient: HttpClient);
|
|
9
|
+
create(projectId: string, projectPath: string, config: AnyPublishConfig): PublisherAggregator;
|
|
10
|
+
private createFtpPublisher;
|
|
11
|
+
private createNetlifyPublisher;
|
|
12
|
+
private createMDFridayPublisher;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './type';
|
|
2
|
+
export * from './entity/publisher';
|
|
3
|
+
export * from './value-object/publish-manifest';
|
|
4
|
+
export * from './value-object/publish-config';
|
|
5
|
+
export * from './value-object/ftp-publisher';
|
|
6
|
+
export * from './value-object/netlify-publisher';
|
|
7
|
+
export * from './value-object/mdfriday-publisher';
|
|
8
|
+
export * from './factory/publisher-factory';
|
|
9
|
+
export * from './repository/manifest-repository';
|
|
10
|
+
export * from './repository/http-client';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface HttpClient {
|
|
2
|
+
postJSON(url: string, data: any, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
3
|
+
postMultipart(url: string, formData: Record<string, any>, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
4
|
+
putBinary(url: string, data: Buffer | Uint8Array, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
5
|
+
get(url: string, headers?: Record<string, string>): Promise<HttpResponse>;
|
|
6
|
+
}
|
|
7
|
+
export interface HttpResponse {
|
|
8
|
+
status: number;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
statusText?: string;
|
|
11
|
+
data: any;
|
|
12
|
+
text(): Promise<string>;
|
|
13
|
+
json(): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PublishManifest } from '../value-object/publish-manifest';
|
|
2
|
+
export interface ManifestRepository {
|
|
3
|
+
loadManifest(projectPath: string, publishMethod: 'ftp' | 'netlify' | 'mdfriday'): Promise<PublishManifest | null>;
|
|
4
|
+
saveManifest(projectPath: string, manifest: PublishManifest): Promise<void>;
|
|
5
|
+
generateManifest(projectId: string, publicDir: string, publishMethod: 'ftp' | 'netlify' | 'mdfriday', remoteConfig?: any): Promise<PublishManifest>;
|
|
6
|
+
deleteManifest(projectPath: string, publishMethod: 'ftp' | 'netlify' | 'mdfriday'): Promise<boolean>;
|
|
7
|
+
}
|