farseer-cli 1.0.3 → 1.0.4
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/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/server.js +2 -1
- package/dist/mcp/server.js.map +2 -2
- package/dist/utils/constants.js +3 -0
- package/dist/utils/constants.js.map +2 -2
- package/package.json +1 -1
- package/dist/commands/app.d.ts +0 -2
- package/dist/commands/apps.d.ts +0 -2
- package/dist/commands/checkout.d.ts +0 -2
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/diff.d.ts +0 -2
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/mcp-server.d.ts +0 -8
- package/dist/commands/model.d.ts +0 -2
- package/dist/commands/pull.d.ts +0 -2
- package/dist/commands/push.d.ts +0 -2
- package/dist/commands/run.d.ts +0 -2
- package/dist/commands/setup.d.ts +0 -2
- package/dist/commands/setup.js +0 -137
- package/dist/commands/status.d.ts +0 -2
- package/dist/commands/unsetup.d.ts +0 -2
- package/dist/commands/unsetup.js +0 -122
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/mcp/index.d.ts +0 -7
- package/dist/mcp/prompts/workflows.d.ts +0 -7
- package/dist/mcp/resources/documentation.d.ts +0 -8
- package/dist/mcp/server.d.ts +0 -7
- package/dist/mcp/tools/appTools.d.ts +0 -7
- package/dist/mcp/tools/authTools.d.ts +0 -7
- package/dist/mcp/tools/modelTools.d.ts +0 -7
- package/dist/mcp/tools/runTools.d.ts +0 -7
- package/dist/mcp/tools/syncTools.d.ts +0 -7
- package/dist/mcp/utils/helpers.d.ts +0 -69
- package/dist/services/appSyncService.d.ts +0 -75
- package/dist/services/configService.d.ts +0 -39
- package/dist/services/farseerApi.d.ts +0 -166
- package/dist/services/farseerFactory.d.ts +0 -88
- package/dist/services/farseerService.d.ts +0 -96
- package/dist/services/gitService.d.ts +0 -31
- package/dist/services/syncService.d.ts +0 -44
- package/dist/utils/constants.d.ts +0 -7
- package/dist/utils/helpers.d.ts +0 -69
- package/dist/utils/logger.d.ts +0 -14
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Utility Functions
|
|
3
|
-
*
|
|
4
|
-
* Helper functions for MCP tools including tenant resolution and response formatting.
|
|
5
|
-
*/
|
|
6
|
-
import { IFarseerClient } from '../../services/farseerFactory';
|
|
7
|
-
/**
|
|
8
|
-
* Resolve tenant from argument or checkout state
|
|
9
|
-
*/
|
|
10
|
-
export declare function resolveTenant(tenantArg?: string): string | null;
|
|
11
|
-
/**
|
|
12
|
-
* Resolve organisation from argument or checkout state
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveOrganisation(orgArg?: string, tenantArg?: string): string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Get authenticated Farseer client
|
|
17
|
-
*/
|
|
18
|
-
export declare function getClient(tenant: string, tenantId?: string): Promise<IFarseerClient | null>;
|
|
19
|
-
/**
|
|
20
|
-
* Create a success response
|
|
21
|
-
*/
|
|
22
|
-
export declare function successResponse(data: Record<string, unknown>): {
|
|
23
|
-
content: Array<{
|
|
24
|
-
type: 'text';
|
|
25
|
-
text: string;
|
|
26
|
-
}>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Create an error response
|
|
30
|
-
*/
|
|
31
|
-
export declare function errorResponse(message: string, errorCode?: 'AUTH_REQUIRED' | 'NOT_FOUND' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN'): {
|
|
32
|
-
content: Array<{
|
|
33
|
-
type: 'text';
|
|
34
|
-
text: string;
|
|
35
|
-
}>;
|
|
36
|
-
isError: true;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Create auth required error response
|
|
40
|
-
*/
|
|
41
|
-
export declare function authRequiredResponse(tenant?: string): {
|
|
42
|
-
content: Array<{
|
|
43
|
-
type: 'text';
|
|
44
|
-
text: string;
|
|
45
|
-
}>;
|
|
46
|
-
isError: true;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Create tenant required error response
|
|
50
|
-
*/
|
|
51
|
-
export declare function tenantRequiredResponse(): {
|
|
52
|
-
content: Array<{
|
|
53
|
-
type: 'text';
|
|
54
|
-
text: string;
|
|
55
|
-
}>;
|
|
56
|
-
isError: true;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Get auth status info
|
|
60
|
-
*/
|
|
61
|
-
export declare function getAuthStatus(): {
|
|
62
|
-
jwtValid: boolean;
|
|
63
|
-
jwtExpiresAt?: string;
|
|
64
|
-
currentCheckout?: {
|
|
65
|
-
organisation: string;
|
|
66
|
-
tenant: string;
|
|
67
|
-
};
|
|
68
|
-
configuredTenants: string[];
|
|
69
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { IFarseerClient } from './farseerFactory';
|
|
2
|
-
export interface LocalAppConfig {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
entrypoint: string | null;
|
|
6
|
-
scripts: string[];
|
|
7
|
-
arguments: {
|
|
8
|
-
name: string;
|
|
9
|
-
defaultValue: string;
|
|
10
|
-
}[];
|
|
11
|
-
_remote?: {
|
|
12
|
-
id: number;
|
|
13
|
-
reference: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface AppSyncResult {
|
|
17
|
-
created: string[];
|
|
18
|
-
updated: string[];
|
|
19
|
-
deleted: string[];
|
|
20
|
-
unchanged: string[];
|
|
21
|
-
}
|
|
22
|
-
export interface AppSyncStatus {
|
|
23
|
-
newLocal: string[];
|
|
24
|
-
newRemote: string[];
|
|
25
|
-
modified: string[];
|
|
26
|
-
synced: string[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Service for syncing app configurations between local JSON files and remote Farseer instance
|
|
30
|
-
*/
|
|
31
|
-
export declare class AppSyncService {
|
|
32
|
-
private api;
|
|
33
|
-
private appsDir;
|
|
34
|
-
constructor(tenant: string, api: IFarseerClient);
|
|
35
|
-
/**
|
|
36
|
-
* Get filename for an app (keep original name, just sanitize for filesystem)
|
|
37
|
-
*/
|
|
38
|
-
private getAppFilename;
|
|
39
|
-
/**
|
|
40
|
-
* Load all local app configs
|
|
41
|
-
*/
|
|
42
|
-
loadLocalApps(): Map<string, LocalAppConfig>;
|
|
43
|
-
/**
|
|
44
|
-
* Save a local app config
|
|
45
|
-
*/
|
|
46
|
-
saveLocalApp(config: LocalAppConfig): void;
|
|
47
|
-
/**
|
|
48
|
-
* Delete a local app config
|
|
49
|
-
*/
|
|
50
|
-
deleteLocalApp(name: string): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Convert remote app to local config format
|
|
53
|
-
*/
|
|
54
|
-
private remoteToLocal;
|
|
55
|
-
/**
|
|
56
|
-
* Check if local and remote app configs are equivalent
|
|
57
|
-
*/
|
|
58
|
-
private areAppsEqual;
|
|
59
|
-
/**
|
|
60
|
-
* Pull apps from remote and save locally
|
|
61
|
-
*/
|
|
62
|
-
pull(): Promise<AppSyncResult>;
|
|
63
|
-
/**
|
|
64
|
-
* Push local apps to remote
|
|
65
|
-
*/
|
|
66
|
-
push(): Promise<AppSyncResult>;
|
|
67
|
-
/**
|
|
68
|
-
* Build update payload for API
|
|
69
|
-
*/
|
|
70
|
-
private buildUpdatePayload;
|
|
71
|
-
/**
|
|
72
|
-
* Get sync status without making changes
|
|
73
|
-
*/
|
|
74
|
-
getStatus(): Promise<AppSyncStatus>;
|
|
75
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface ApiKeyCredential {
|
|
2
|
-
type: 'apiKey';
|
|
3
|
-
tenantId: string;
|
|
4
|
-
apiKey: string;
|
|
5
|
-
basePath: string;
|
|
6
|
-
}
|
|
7
|
-
export interface UserAuth {
|
|
8
|
-
accessToken: string;
|
|
9
|
-
refreshToken: string;
|
|
10
|
-
expiresAt: string;
|
|
11
|
-
tenant?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface CurrentCheckout {
|
|
14
|
-
organisation: string;
|
|
15
|
-
tenant: string;
|
|
16
|
-
}
|
|
17
|
-
export interface FarseerConfig {
|
|
18
|
-
credentials: Record<string, ApiKeyCredential>;
|
|
19
|
-
userAuth?: UserAuth;
|
|
20
|
-
currentTenant?: string;
|
|
21
|
-
currentCheckout?: CurrentCheckout;
|
|
22
|
-
}
|
|
23
|
-
export declare function loadConfig(): FarseerConfig;
|
|
24
|
-
export declare function saveConfig(config: FarseerConfig): void;
|
|
25
|
-
export declare function getCredential(tenant: string): ApiKeyCredential | undefined;
|
|
26
|
-
export declare function setCredential(tenant: string, credential: ApiKeyCredential): void;
|
|
27
|
-
export declare function removeCredential(tenant: string): boolean;
|
|
28
|
-
export declare function listCredentials(): Record<string, ApiKeyCredential>;
|
|
29
|
-
export declare function getUserAuth(): UserAuth | undefined;
|
|
30
|
-
export declare function setUserAuth(auth: UserAuth): void;
|
|
31
|
-
export declare function clearUserAuth(): void;
|
|
32
|
-
export declare function isUserAuthValid(): boolean;
|
|
33
|
-
export declare function generateBasePath(organisation: string): string;
|
|
34
|
-
export declare function getCurrentCheckout(): CurrentCheckout | undefined;
|
|
35
|
-
export declare function getCurrentTenant(): string | undefined;
|
|
36
|
-
export declare function getCurrentOrganisation(): string | undefined;
|
|
37
|
-
export declare function setCurrentCheckout(organisation: string, tenant: string): void;
|
|
38
|
-
export declare function setCurrentTenant(tenant: string): void;
|
|
39
|
-
export declare function clearCurrentTenant(): void;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FarseerApi - Direct HTTP API client using JWT Bearer token authentication
|
|
3
|
-
*
|
|
4
|
-
* This is an alternative to FarseerService that doesn't use farseer-client library.
|
|
5
|
-
* Use this when authenticating via browser login (Keycloak JWT token) instead of API key.
|
|
6
|
-
*/
|
|
7
|
-
export interface RemoteFile {
|
|
8
|
-
name: string;
|
|
9
|
-
path: string;
|
|
10
|
-
reference: string;
|
|
11
|
-
}
|
|
12
|
-
export interface AppArgument {
|
|
13
|
-
name: string;
|
|
14
|
-
type: 'variable';
|
|
15
|
-
defaultValue: string;
|
|
16
|
-
}
|
|
17
|
-
export interface AppScriptFile {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
}
|
|
21
|
-
export interface RemoteApp {
|
|
22
|
-
id: number;
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
expectedArguments: AppArgument[];
|
|
26
|
-
status: string;
|
|
27
|
-
lastHeartbeat: string;
|
|
28
|
-
mainScriptFileId: string | null;
|
|
29
|
-
scriptFiles: AppScriptFile[];
|
|
30
|
-
creationType: string;
|
|
31
|
-
predefinedActions: unknown[];
|
|
32
|
-
}
|
|
33
|
-
export interface AppListItem {
|
|
34
|
-
id: number;
|
|
35
|
-
name: string;
|
|
36
|
-
type: string;
|
|
37
|
-
reference: string;
|
|
38
|
-
}
|
|
39
|
-
export declare class FarseerApi {
|
|
40
|
-
private client;
|
|
41
|
-
private tenant;
|
|
42
|
-
private tenantId;
|
|
43
|
-
constructor(accessToken: string, tenant: string, tenantId?: string);
|
|
44
|
-
testConnection(): Promise<boolean>;
|
|
45
|
-
getFilesFolder(): Promise<{
|
|
46
|
-
id: number;
|
|
47
|
-
name: string;
|
|
48
|
-
type: string;
|
|
49
|
-
} | null>;
|
|
50
|
-
private listFolderItems;
|
|
51
|
-
private findFolderByName;
|
|
52
|
-
private getItemByPath;
|
|
53
|
-
listFiles(folderPath?: string[]): Promise<RemoteFile[]>;
|
|
54
|
-
getFileContent(reference: string): Promise<string>;
|
|
55
|
-
getFileContentAsBuffer(reference: string): Promise<Buffer>;
|
|
56
|
-
createFile(content: string | Buffer, fileName: string, folderPath?: string[]): Promise<void>;
|
|
57
|
-
updateFile(reference: string, content: string | Buffer, fileName: string): Promise<void>;
|
|
58
|
-
deleteFile(reference: string): Promise<void>;
|
|
59
|
-
private ensureFolderPath;
|
|
60
|
-
getFileByPath(filePath: string): Promise<RemoteFile | null>;
|
|
61
|
-
isTextFile(filename: string): boolean;
|
|
62
|
-
isBinaryFile(filename: string): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Get the Apps folder ID
|
|
65
|
-
*/
|
|
66
|
-
getAppsFolderId(): Promise<number | null>;
|
|
67
|
-
/**
|
|
68
|
-
* List all apps (Remote Jobs) on the tenant
|
|
69
|
-
*/
|
|
70
|
-
listApps(): Promise<AppListItem[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Get app details by reference ID
|
|
73
|
-
*/
|
|
74
|
-
getApp(referenceId: string): Promise<RemoteApp | null>;
|
|
75
|
-
/**
|
|
76
|
-
* Get app by name
|
|
77
|
-
*/
|
|
78
|
-
getAppByName(name: string): Promise<RemoteApp | null>;
|
|
79
|
-
/**
|
|
80
|
-
* Create a new app
|
|
81
|
-
*/
|
|
82
|
-
createApp(name: string): Promise<RemoteApp>;
|
|
83
|
-
/**
|
|
84
|
-
* Update an app
|
|
85
|
-
*/
|
|
86
|
-
updateApp(referenceId: string, update: {
|
|
87
|
-
name?: string;
|
|
88
|
-
description?: string;
|
|
89
|
-
expectedArguments?: AppArgument[];
|
|
90
|
-
mainScriptFileId?: string | null;
|
|
91
|
-
scriptFileIds?: string[];
|
|
92
|
-
}): Promise<RemoteApp>;
|
|
93
|
-
/**
|
|
94
|
-
* Delete an app
|
|
95
|
-
*/
|
|
96
|
-
deleteApp(referenceId: string): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* Run an app with arguments
|
|
99
|
-
*/
|
|
100
|
-
runApp(referenceId: string, args?: Record<string, string>): Promise<{
|
|
101
|
-
executionId: string;
|
|
102
|
-
}>;
|
|
103
|
-
/**
|
|
104
|
-
* Get script files available for apps (searches all .ts/.js files in Files folder)
|
|
105
|
-
*/
|
|
106
|
-
getScriptFiles(): Promise<AppScriptFile[]>;
|
|
107
|
-
/**
|
|
108
|
-
* Export the entire model structure - all dimension tables, variables, and configurations.
|
|
109
|
-
* Essential for understanding a tenant's data model.
|
|
110
|
-
*/
|
|
111
|
-
exportModel(): Promise<ModelExport>;
|
|
112
|
-
}
|
|
113
|
-
export interface ModelExport {
|
|
114
|
-
tables: ModelExportTable[];
|
|
115
|
-
variables: ModelExportVariable[];
|
|
116
|
-
dependencies: {
|
|
117
|
-
tables: string[];
|
|
118
|
-
members: string[];
|
|
119
|
-
variables: string[];
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
export interface ModelExportTable {
|
|
123
|
-
name: string;
|
|
124
|
-
columns: ModelExportColumn[];
|
|
125
|
-
defaultMember?: string | null;
|
|
126
|
-
folderPath?: string[];
|
|
127
|
-
rows: any[][];
|
|
128
|
-
autoIncrementTemplate?: string | null;
|
|
129
|
-
}
|
|
130
|
-
export interface ModelExportColumn {
|
|
131
|
-
name?: string;
|
|
132
|
-
type: string;
|
|
133
|
-
foreignKeyTableName?: string;
|
|
134
|
-
}
|
|
135
|
-
export interface ModelExportVariable {
|
|
136
|
-
name: string;
|
|
137
|
-
description?: string | null;
|
|
138
|
-
formula?: string | null;
|
|
139
|
-
tables: string[];
|
|
140
|
-
members: string[];
|
|
141
|
-
rollupType: string;
|
|
142
|
-
dataType: string;
|
|
143
|
-
numberFormat?: {
|
|
144
|
-
type: string;
|
|
145
|
-
custom?: boolean;
|
|
146
|
-
formatString?: string;
|
|
147
|
-
decimals?: number;
|
|
148
|
-
};
|
|
149
|
-
numberValidation?: {
|
|
150
|
-
min?: number | null;
|
|
151
|
-
max?: number | null;
|
|
152
|
-
};
|
|
153
|
-
topDownMapping?: string | null;
|
|
154
|
-
readonly: boolean;
|
|
155
|
-
calculateOnDemand: boolean;
|
|
156
|
-
zConstraint?: boolean;
|
|
157
|
-
active?: boolean;
|
|
158
|
-
optimizeCalculation?: boolean;
|
|
159
|
-
useHierarchy?: boolean;
|
|
160
|
-
folderPath?: string[];
|
|
161
|
-
cells?: ModelExportCell[];
|
|
162
|
-
}
|
|
163
|
-
export interface ModelExportCell {
|
|
164
|
-
value: number;
|
|
165
|
-
members: string[];
|
|
166
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Factory for creating Farseer API client based on available authentication
|
|
3
|
-
*
|
|
4
|
-
* Priority:
|
|
5
|
-
* 1. JWT token (from browser login) - try first
|
|
6
|
-
* 2. API key (from config) - fallback if JWT fails or unavailable
|
|
7
|
-
* 3. Prompt user to login - if nothing works
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Check if an error is an authentication error (401/403)
|
|
11
|
-
*/
|
|
12
|
-
export declare function isAuthError(error: unknown): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Show a consistent "please login" message
|
|
15
|
-
*/
|
|
16
|
-
export declare function showLoginPrompt(tenant?: string): void;
|
|
17
|
-
export interface RemoteFile {
|
|
18
|
-
name: string;
|
|
19
|
-
path: string;
|
|
20
|
-
reference: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const DEFAULT_SCRIPT_EXTENSIONS: string[];
|
|
23
|
-
import { AppArgument, AppListItem, RemoteApp, ModelExport } from './farseerApi';
|
|
24
|
-
export interface IFarseerClient {
|
|
25
|
-
testConnection(): Promise<boolean>;
|
|
26
|
-
getFilesFolder(): Promise<{
|
|
27
|
-
id: number;
|
|
28
|
-
name: string;
|
|
29
|
-
type: string;
|
|
30
|
-
} | null>;
|
|
31
|
-
listFiles(folderPath?: string[]): Promise<RemoteFile[]>;
|
|
32
|
-
getFileContent(reference: string): Promise<string>;
|
|
33
|
-
getFileContentAsBuffer(reference: string): Promise<Buffer>;
|
|
34
|
-
createFile(content: string | Buffer, fileName: string, folderPath?: string[]): Promise<void>;
|
|
35
|
-
updateFile(reference: string, content: string | Buffer, fileName: string): Promise<void>;
|
|
36
|
-
deleteFile(reference: string): Promise<void>;
|
|
37
|
-
getFileByPath(filePath: string): Promise<RemoteFile | null>;
|
|
38
|
-
isTextFile(filename: string): boolean;
|
|
39
|
-
isBinaryFile(filename: string): boolean;
|
|
40
|
-
listApps(): Promise<AppListItem[]>;
|
|
41
|
-
getApp(referenceId: string): Promise<RemoteApp | null>;
|
|
42
|
-
getAppByName(name: string): Promise<RemoteApp | null>;
|
|
43
|
-
createApp(name: string): Promise<RemoteApp>;
|
|
44
|
-
updateApp(referenceId: string, update: {
|
|
45
|
-
name?: string;
|
|
46
|
-
description?: string;
|
|
47
|
-
expectedArguments?: AppArgument[];
|
|
48
|
-
mainScriptFileId?: string | null;
|
|
49
|
-
scriptFileIds?: string[];
|
|
50
|
-
}): Promise<RemoteApp>;
|
|
51
|
-
deleteApp(referenceId: string): Promise<void>;
|
|
52
|
-
getScriptFiles(): Promise<{
|
|
53
|
-
id: string;
|
|
54
|
-
name: string;
|
|
55
|
-
}[]>;
|
|
56
|
-
exportModel(): Promise<ModelExport>;
|
|
57
|
-
}
|
|
58
|
-
export interface FarseerClientResult {
|
|
59
|
-
client: IFarseerClient;
|
|
60
|
-
authType: 'apiKey' | 'jwt';
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Get a Farseer client for the given tenant.
|
|
64
|
-
* Tries JWT token first (supports apps), then falls back to API key.
|
|
65
|
-
*
|
|
66
|
-
* @param tenant - The tenant hostname (e.g., "omnicom" for omnicom.farseer.io)
|
|
67
|
-
* @param tenantId - Optional tenant ID for x-tenant-id header (e.g., "omnicom-reporting")
|
|
68
|
-
* Only used with JWT auth. Defaults to tenant if not specified.
|
|
69
|
-
*/
|
|
70
|
-
export declare function getFarseerClient(tenant: string, tenantId?: string): Promise<FarseerClientResult | null>;
|
|
71
|
-
/**
|
|
72
|
-
* Check what authentication methods are available
|
|
73
|
-
*/
|
|
74
|
-
export declare function getAvailableAuth(tenant: string): {
|
|
75
|
-
hasApiKey: boolean;
|
|
76
|
-
hasJwt: boolean;
|
|
77
|
-
jwtValid: boolean;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Get a Farseer client with automatic fallback and connection testing.
|
|
81
|
-
* This is the recommended way to get a client for commands.
|
|
82
|
-
*
|
|
83
|
-
* Flow:
|
|
84
|
-
* 1. Try JWT if available and valid
|
|
85
|
-
* 2. If JWT fails or unavailable, try API key
|
|
86
|
-
* 3. If nothing works, return null (caller should show login prompt)
|
|
87
|
-
*/
|
|
88
|
-
export declare function getFarseerClientWithFallback(tenant: string, tenantId?: string): Promise<FarseerClientResult | null>;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ApiKeyCredential } from './configService';
|
|
2
|
-
import { AppArgument, AppListItem, RemoteApp } from './farseerApi';
|
|
3
|
-
export interface RemoteFile {
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
reference: string;
|
|
7
|
-
content?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface FolderItem {
|
|
10
|
-
id: number;
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
reference?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class FarseerService {
|
|
16
|
-
private client;
|
|
17
|
-
private credential;
|
|
18
|
-
constructor(credential: ApiKeyCredential);
|
|
19
|
-
static fromUserAuth(tenant: string, basePath: string): FarseerService | null;
|
|
20
|
-
testConnection(): Promise<boolean>;
|
|
21
|
-
getFilesFolder(): Promise<FolderItem | null>;
|
|
22
|
-
listFiles(folderPath?: string[]): Promise<RemoteFile[]>;
|
|
23
|
-
getFileContent(reference: string): Promise<string>;
|
|
24
|
-
createFile(content: string | Buffer, fileName: string, folderPath?: string[]): Promise<void>;
|
|
25
|
-
updateFile(reference: string, content: string | Buffer, fileName: string): Promise<void>;
|
|
26
|
-
deleteFile(reference: string): Promise<void>;
|
|
27
|
-
ensureFolderPath(folderPath: string[]): Promise<void>;
|
|
28
|
-
getFileByPath(filePath: string): Promise<RemoteFile | null>;
|
|
29
|
-
getFileContentAsBuffer(reference: string): Promise<Buffer>;
|
|
30
|
-
isTextFile(filename: string): boolean;
|
|
31
|
-
isBinaryFile(filename: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* List all apps (Remote Jobs) on the tenant
|
|
34
|
-
*/
|
|
35
|
-
listApps(): Promise<AppListItem[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Get app details by reference ID
|
|
38
|
-
*/
|
|
39
|
-
getApp(referenceId: string): Promise<RemoteApp | null>;
|
|
40
|
-
/**
|
|
41
|
-
* Get app by name
|
|
42
|
-
*/
|
|
43
|
-
getAppByName(name: string): Promise<RemoteApp | null>;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new app
|
|
46
|
-
*/
|
|
47
|
-
createApp(name: string): Promise<RemoteApp>;
|
|
48
|
-
/**
|
|
49
|
-
* Update an app
|
|
50
|
-
*/
|
|
51
|
-
updateApp(referenceId: string, update: {
|
|
52
|
-
name?: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
expectedArguments?: AppArgument[];
|
|
55
|
-
mainScriptFileId?: string | null;
|
|
56
|
-
scriptFileIds?: string[];
|
|
57
|
-
}): Promise<RemoteApp>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete an app
|
|
60
|
-
*/
|
|
61
|
-
deleteApp(referenceId: string): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Get script files available for apps
|
|
64
|
-
*/
|
|
65
|
-
getScriptFiles(): Promise<{
|
|
66
|
-
id: string;
|
|
67
|
-
name: string;
|
|
68
|
-
}[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Export the entire model structure
|
|
71
|
-
*/
|
|
72
|
-
exportModel(): Promise<import('./farseerApi').ModelExport>;
|
|
73
|
-
/**
|
|
74
|
-
* Get the Apps folder ID
|
|
75
|
-
*/
|
|
76
|
-
private getAppsFolderId;
|
|
77
|
-
/**
|
|
78
|
-
* Make a direct API request (for endpoints not in farseer-client)
|
|
79
|
-
*/
|
|
80
|
-
private apiRequest;
|
|
81
|
-
}
|
|
82
|
-
export declare function loginWithPassword(email: string, password: string): Promise<{
|
|
83
|
-
accessToken: string;
|
|
84
|
-
refreshToken: string;
|
|
85
|
-
expiresIn: number;
|
|
86
|
-
} | null>;
|
|
87
|
-
export declare function loginWithBrowser(): Promise<{
|
|
88
|
-
accessToken: string;
|
|
89
|
-
refreshToken: string;
|
|
90
|
-
expiresIn: number;
|
|
91
|
-
} | null>;
|
|
92
|
-
export declare function refreshAccessToken(refreshToken: string): Promise<{
|
|
93
|
-
accessToken: string;
|
|
94
|
-
refreshToken: string;
|
|
95
|
-
expiresIn: number;
|
|
96
|
-
} | null>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare class GitService {
|
|
2
|
-
private git;
|
|
3
|
-
private repoRoot;
|
|
4
|
-
constructor();
|
|
5
|
-
pull(): Promise<{
|
|
6
|
-
success: boolean;
|
|
7
|
-
message: string;
|
|
8
|
-
}>;
|
|
9
|
-
add(files: string[]): Promise<void>;
|
|
10
|
-
commit(message: string, author?: string): Promise<{
|
|
11
|
-
success: boolean;
|
|
12
|
-
commitHash?: string;
|
|
13
|
-
message: string;
|
|
14
|
-
}>;
|
|
15
|
-
push(): Promise<{
|
|
16
|
-
success: boolean;
|
|
17
|
-
message: string;
|
|
18
|
-
}>;
|
|
19
|
-
status(): Promise<{
|
|
20
|
-
isClean: boolean;
|
|
21
|
-
modified: string[];
|
|
22
|
-
added: string[];
|
|
23
|
-
deleted: string[];
|
|
24
|
-
untracked: string[];
|
|
25
|
-
}>;
|
|
26
|
-
hasUnpulledChanges(): Promise<boolean>;
|
|
27
|
-
hasUnpushedChanges(): Promise<boolean>;
|
|
28
|
-
getCurrentBranch(): Promise<string>;
|
|
29
|
-
getLastCommitMessage(): Promise<string>;
|
|
30
|
-
getRepoRoot(): string;
|
|
31
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { IFarseerClient } from './farseerFactory';
|
|
2
|
-
export interface SyncFileInfo {
|
|
3
|
-
localHash: string;
|
|
4
|
-
remoteHash: string;
|
|
5
|
-
}
|
|
6
|
-
export interface SyncState {
|
|
7
|
-
lastSync: string;
|
|
8
|
-
files: Record<string, SyncFileInfo>;
|
|
9
|
-
}
|
|
10
|
-
export interface SyncStatus {
|
|
11
|
-
modifiedLocally: string[];
|
|
12
|
-
modifiedRemotely: string[];
|
|
13
|
-
onlyLocal: string[];
|
|
14
|
-
onlyRemote: string[];
|
|
15
|
-
inSync: string[];
|
|
16
|
-
}
|
|
17
|
-
export declare class SyncService {
|
|
18
|
-
private tenant;
|
|
19
|
-
private farseerClient;
|
|
20
|
-
constructor(tenant: string, farseerClient: IFarseerClient);
|
|
21
|
-
loadSyncState(): SyncState;
|
|
22
|
-
saveSyncState(state: SyncState): void;
|
|
23
|
-
getStatus(options?: {
|
|
24
|
-
all?: boolean;
|
|
25
|
-
}): Promise<SyncStatus>;
|
|
26
|
-
pull(options?: {
|
|
27
|
-
all?: boolean;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
downloaded: string[];
|
|
30
|
-
deleted: string[];
|
|
31
|
-
unchanged: string[];
|
|
32
|
-
}>;
|
|
33
|
-
push(): Promise<{
|
|
34
|
-
uploaded: string[];
|
|
35
|
-
updated: string[];
|
|
36
|
-
deleted: string[];
|
|
37
|
-
unchanged: string[];
|
|
38
|
-
}>;
|
|
39
|
-
checkRemoteChanges(): Promise<boolean>;
|
|
40
|
-
getFileDiff(filePath: string): Promise<{
|
|
41
|
-
localContent: string | null;
|
|
42
|
-
remoteContent: string | null;
|
|
43
|
-
}>;
|
|
44
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const FARSEER_CLIENT_URL = "https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client/release-1.4.5.tar";
|
|
2
|
-
export declare const FARSEER_CLIENT_AXIOS_URL = "https://storage.googleapis.com/farseer-remote-jobs-results/farseer-client-axios/6898c0cb-5dca-4b2f-b325-119efc7f099e/v1.0.1.tar";
|
|
3
|
-
export declare const KEYCLOAK_TOKEN_URL = "https://login.farseer.io/auth/realms/master/protocol/openid-connect/token";
|
|
4
|
-
export declare const KEYCLOAK_CLIENT_ID = "security-admin-console";
|
|
5
|
-
export declare const SCRIPTS_FOLDER_PATH: string[];
|
|
6
|
-
export declare const SCRIPT_EXTENSIONS: string[];
|
|
7
|
-
export declare const CLI_GIT_AUTHOR = "Farseer CLI <cli@farseer.io>";
|
package/dist/utils/helpers.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export declare function calculateHash(content: string | Buffer): string;
|
|
2
|
-
export declare function getAppsDir(): string;
|
|
3
|
-
export declare function getTenantDir(tenant: string): string;
|
|
4
|
-
export declare function getTenantFilesDir(tenant: string): string;
|
|
5
|
-
export declare function getTenantSrcDir(tenant: string): string;
|
|
6
|
-
export declare function getSyncFilePath(tenant: string): string;
|
|
7
|
-
export declare function getTenantAppsDir(tenant: string): string;
|
|
8
|
-
export declare function ensureDirectoryExists(dirPath: string): void;
|
|
9
|
-
export declare function getRelativePath(fullPath: string, basePath: string): string;
|
|
10
|
-
export declare function getAllFiles(dirPath: string, basePath?: string): string[];
|
|
11
|
-
export declare function getAllFilesInDir(dirPath: string, basePath?: string): string[];
|
|
12
|
-
export declare function isScriptFile(filename: string): boolean;
|
|
13
|
-
export declare function isTextFile(filename: string): boolean;
|
|
14
|
-
export declare function formatFileSize(bytes: number): string;
|
|
15
|
-
export declare function formatDate(date: Date | string): string;
|
|
16
|
-
export declare function getCredentialsHint(tenant: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve tenant from argument or checkout.
|
|
19
|
-
* If tenant is provided, use it. Otherwise, use checked-out tenant.
|
|
20
|
-
* Returns null if no tenant is available.
|
|
21
|
-
*/
|
|
22
|
-
export interface ResolvedCheckout {
|
|
23
|
-
organisation: string;
|
|
24
|
-
tenant: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Resolve organisation and tenant from argument or checkout.
|
|
28
|
-
* When only tenant is provided, assumes organisation = tenant.
|
|
29
|
-
*/
|
|
30
|
-
export declare function resolveOrgAndTenant(tenantArg?: string): ResolvedCheckout | null;
|
|
31
|
-
export declare function resolveTenant(tenantArg?: string): string | null;
|
|
32
|
-
/**
|
|
33
|
-
* Resolve tenant or exit with error if not available.
|
|
34
|
-
*/
|
|
35
|
-
export declare function resolveTenantOrExit(tenantArg?: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve organisation and tenant or exit with error.
|
|
38
|
-
*/
|
|
39
|
-
export declare function resolveOrgAndTenantOrExit(tenantArg?: string): ResolvedCheckout;
|
|
40
|
-
/**
|
|
41
|
-
* Check if a string is a known tenant (has credentials configured).
|
|
42
|
-
*/
|
|
43
|
-
export declare function isKnownTenant(name: string): boolean;
|
|
44
|
-
export interface ParsedAppArgs {
|
|
45
|
-
organisation: string;
|
|
46
|
-
tenant: string;
|
|
47
|
-
appName: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Parse variadic arguments to extract tenant and app name.
|
|
51
|
-
* If first arg is a known tenant, use it as tenant and rest as app name.
|
|
52
|
-
* Otherwise, use checked-out tenant and all args as app name.
|
|
53
|
-
*
|
|
54
|
-
* @param args Array of arguments (from variadic command)
|
|
55
|
-
* @returns { organisation: string, tenant: string, appName: string }
|
|
56
|
-
*/
|
|
57
|
-
export declare function parseAppArgs(args: string[]): ParsedAppArgs;
|
|
58
|
-
interface CredentialConfig {
|
|
59
|
-
basePath: string;
|
|
60
|
-
tenantId: string;
|
|
61
|
-
apiKey: string;
|
|
62
|
-
}
|
|
63
|
-
export declare function injectCredentials(code: string, credential: CredentialConfig): string;
|
|
64
|
-
export declare function stripCredentials(code: string): string;
|
|
65
|
-
export declare function hasInjectedCredentials(code: string): boolean;
|
|
66
|
-
export declare function hasEmptyFarseerClient(code: string): boolean;
|
|
67
|
-
export declare function injectCredentialsInDir(srcDir: string, credential: CredentialConfig): number;
|
|
68
|
-
export declare function stripCredentialsInDir(srcDir: string): number;
|
|
69
|
-
export {};
|