farseer-cli 1.0.9 → 1.0.10
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/commands/app.js +344 -316
- package/dist/commands/apps.js +83 -103
- package/dist/commands/checkout.js +156 -134
- package/dist/commands/config.js +126 -124
- package/dist/commands/diff.js +194 -169
- package/dist/commands/dimensions.js +122 -137
- package/dist/commands/files.js +77 -88
- package/dist/commands/install.js +77 -74
- package/dist/commands/list.js +74 -89
- package/dist/commands/login.js +101 -126
- package/dist/commands/logout.js +42 -57
- package/dist/commands/mcp-server.js +24 -39
- package/dist/commands/model.js +176 -184
- package/dist/commands/pull.js +276 -248
- package/dist/commands/push.js +222 -200
- package/dist/commands/run.js +322 -274
- package/dist/commands/status.js +170 -147
- package/dist/commands/variables.js +192 -168
- package/dist/commands/whoami.js +45 -61
- package/dist/index.js +115 -117
- package/dist/mcp/index.js +17 -33
- package/dist/mcp/prompts/workflows.js +146 -191
- package/dist/mcp/resources/documentation.js +149 -158
- package/dist/mcp/server.js +34 -50
- package/dist/mcp/tools/appTools.js +278 -307
- package/dist/mcp/tools/authTools.js +123 -130
- package/dist/mcp/tools/dataTools.js +271 -275
- package/dist/mcp/tools/modelTools.js +233 -265
- package/dist/mcp/tools/runTools.js +205 -199
- package/dist/mcp/tools/syncTools.js +315 -341
- package/dist/mcp/utils/helpers.js +124 -117
- package/dist/services/appSyncService.js +438 -379
- package/dist/services/configService.js +144 -154
- package/dist/services/farseerApi.js +401 -401
- package/dist/services/farseerFactory.js +274 -208
- package/dist/services/farseerService.js +488 -455
- package/dist/services/syncService.js +732 -657
- package/dist/utils/constants.js +20 -45
- package/dist/utils/helpers.js +366 -333
- package/dist/utils/logger.js +43 -74
- package/package.json +8 -1
- package/dist/commands/app.js.map +0 -7
- package/dist/commands/apps.js.map +0 -7
- package/dist/commands/checkout.js.map +0 -7
- package/dist/commands/config.js.map +0 -7
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/dimensions.js.map +0 -7
- package/dist/commands/files.js.map +0 -7
- package/dist/commands/install.js.map +0 -7
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/logout.js.map +0 -7
- package/dist/commands/mcp-server.js.map +0 -7
- package/dist/commands/model.js.map +0 -7
- package/dist/commands/pull.js.map +0 -7
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/run.js.map +0 -7
- package/dist/commands/status.js.map +0 -7
- package/dist/commands/variables.js.map +0 -7
- package/dist/commands/whoami.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/mcp/index.js.map +0 -7
- package/dist/mcp/prompts/workflows.js.map +0 -7
- package/dist/mcp/resources/documentation.js.map +0 -7
- package/dist/mcp/server.js.map +0 -7
- package/dist/mcp/tools/appTools.js.map +0 -7
- package/dist/mcp/tools/authTools.js.map +0 -7
- package/dist/mcp/tools/dataTools.js.map +0 -7
- package/dist/mcp/tools/modelTools.js.map +0 -7
- package/dist/mcp/tools/runTools.js.map +0 -7
- package/dist/mcp/tools/syncTools.js.map +0 -7
- package/dist/mcp/utils/helpers.js.map +0 -7
- package/dist/services/appSyncService.js.map +0 -7
- package/dist/services/configService.js.map +0 -7
- package/dist/services/farseerApi.js.map +0 -7
- package/dist/services/farseerFactory.js.map +0 -7
- package/dist/services/farseerService.js.map +0 -7
- package/dist/services/syncService.js.map +0 -7
- package/dist/utils/constants.js.map +0 -7
- package/dist/utils/helpers.js.map +0 -7
- package/dist/utils/logger.js.map +0 -7
|
@@ -1,196 +1,186 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var configService_exports = {};
|
|
29
|
-
__export(configService_exports, {
|
|
30
|
-
clearCurrentTenant: () => clearCurrentTenant,
|
|
31
|
-
clearUserAuth: () => clearUserAuth,
|
|
32
|
-
generateBasePath: () => generateBasePath,
|
|
33
|
-
getCredential: () => getCredential,
|
|
34
|
-
getCurrentCheckout: () => getCurrentCheckout,
|
|
35
|
-
getCurrentOrganisation: () => getCurrentOrganisation,
|
|
36
|
-
getCurrentTenant: () => getCurrentTenant,
|
|
37
|
-
getTenantOrg: () => getTenantOrg,
|
|
38
|
-
getUserAuth: () => getUserAuth,
|
|
39
|
-
isUserAuthValid: () => isUserAuthValid,
|
|
40
|
-
listCredentials: () => listCredentials,
|
|
41
|
-
loadConfig: () => loadConfig,
|
|
42
|
-
removeCredential: () => removeCredential,
|
|
43
|
-
saveConfig: () => saveConfig,
|
|
44
|
-
saveTenantOrgMapping: () => saveTenantOrgMapping,
|
|
45
|
-
setCredential: () => setCredential,
|
|
46
|
-
setCurrentCheckout: () => setCurrentCheckout,
|
|
47
|
-
setCurrentTenant: () => setCurrentTenant,
|
|
48
|
-
setUserAuth: () => setUserAuth
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
49
17
|
});
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadConfig = loadConfig;
|
|
37
|
+
exports.saveConfig = saveConfig;
|
|
38
|
+
exports.getCredential = getCredential;
|
|
39
|
+
exports.setCredential = setCredential;
|
|
40
|
+
exports.removeCredential = removeCredential;
|
|
41
|
+
exports.listCredentials = listCredentials;
|
|
42
|
+
exports.getUserAuth = getUserAuth;
|
|
43
|
+
exports.setUserAuth = setUserAuth;
|
|
44
|
+
exports.clearUserAuth = clearUserAuth;
|
|
45
|
+
exports.isUserAuthValid = isUserAuthValid;
|
|
46
|
+
exports.generateBasePath = generateBasePath;
|
|
47
|
+
exports.getCurrentCheckout = getCurrentCheckout;
|
|
48
|
+
exports.getCurrentTenant = getCurrentTenant;
|
|
49
|
+
exports.getCurrentOrganisation = getCurrentOrganisation;
|
|
50
|
+
exports.setCurrentCheckout = setCurrentCheckout;
|
|
51
|
+
exports.setCurrentTenant = setCurrentTenant;
|
|
52
|
+
exports.clearCurrentTenant = clearCurrentTenant;
|
|
53
|
+
exports.saveTenantOrgMapping = saveTenantOrgMapping;
|
|
54
|
+
exports.getTenantOrg = getTenantOrg;
|
|
55
|
+
const fs = __importStar(require("fs"));
|
|
56
|
+
const path = __importStar(require("path"));
|
|
57
|
+
const os = __importStar(require("os"));
|
|
58
|
+
const CONFIG_DIR = path.join(os.homedir(), '.farseer');
|
|
59
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
56
60
|
function ensureConfigDir() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
62
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
function getDefaultConfig() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
return {
|
|
67
|
+
credentials: {},
|
|
68
|
+
userAuth: undefined,
|
|
69
|
+
};
|
|
66
70
|
}
|
|
67
71
|
function loadConfig() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
ensureConfigDir();
|
|
73
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
74
|
+
return getDefaultConfig();
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const content = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
78
|
+
return JSON.parse(content);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return getDefaultConfig();
|
|
82
|
+
}
|
|
78
83
|
}
|
|
79
84
|
function saveConfig(config) {
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
ensureConfigDir();
|
|
86
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), 'utf-8');
|
|
82
87
|
}
|
|
83
88
|
function getCredential(tenant) {
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
const config = loadConfig();
|
|
90
|
+
return config.credentials[tenant];
|
|
86
91
|
}
|
|
87
92
|
function setCredential(tenant, credential) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
const config = loadConfig();
|
|
94
|
+
config.credentials[tenant] = credential;
|
|
95
|
+
saveConfig(config);
|
|
91
96
|
}
|
|
92
97
|
function removeCredential(tenant) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const config = loadConfig();
|
|
99
|
+
if (config.credentials[tenant]) {
|
|
100
|
+
delete config.credentials[tenant];
|
|
101
|
+
saveConfig(config);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
100
105
|
}
|
|
101
106
|
function listCredentials() {
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
const config = loadConfig();
|
|
108
|
+
return config.credentials;
|
|
104
109
|
}
|
|
105
110
|
function getUserAuth() {
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
const config = loadConfig();
|
|
112
|
+
return config.userAuth;
|
|
108
113
|
}
|
|
109
114
|
function setUserAuth(auth) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
const config = loadConfig();
|
|
116
|
+
config.userAuth = auth;
|
|
117
|
+
saveConfig(config);
|
|
113
118
|
}
|
|
114
119
|
function clearUserAuth() {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
const config = loadConfig();
|
|
121
|
+
config.userAuth = undefined;
|
|
122
|
+
saveConfig(config);
|
|
118
123
|
}
|
|
119
124
|
function isUserAuthValid() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
const auth = getUserAuth();
|
|
126
|
+
if (!auth)
|
|
127
|
+
return false;
|
|
128
|
+
const expiresAt = new Date(auth.expiresAt);
|
|
129
|
+
// Add 10 second buffer to proactively refresh before actual expiry
|
|
130
|
+
// Note: Keycloak tokens typically last 60 seconds, so buffer must be small
|
|
131
|
+
const bufferMs = 10 * 1000;
|
|
132
|
+
return expiresAt.getTime() > Date.now() + bufferMs;
|
|
125
133
|
}
|
|
126
134
|
function generateBasePath(organisation) {
|
|
127
|
-
|
|
135
|
+
return `https://${organisation}.farseer.io/api/v3`;
|
|
128
136
|
}
|
|
137
|
+
// Current checkout management
|
|
129
138
|
function getCurrentCheckout() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
const config = loadConfig();
|
|
140
|
+
// Support both new and old format
|
|
141
|
+
if (config.currentCheckout) {
|
|
142
|
+
return config.currentCheckout;
|
|
143
|
+
}
|
|
144
|
+
// Fallback to old format (tenant only, assume same as org)
|
|
145
|
+
if (config.currentTenant) {
|
|
146
|
+
return { organisation: config.currentTenant, tenant: config.currentTenant };
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
138
149
|
}
|
|
139
150
|
function getCurrentTenant() {
|
|
140
|
-
|
|
141
|
-
|
|
151
|
+
const checkout = getCurrentCheckout();
|
|
152
|
+
return checkout?.tenant;
|
|
142
153
|
}
|
|
143
154
|
function getCurrentOrganisation() {
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
const checkout = getCurrentCheckout();
|
|
156
|
+
return checkout?.organisation;
|
|
146
157
|
}
|
|
147
158
|
function setCurrentCheckout(organisation, tenant) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
const config = loadConfig();
|
|
160
|
+
config.currentCheckout = { organisation, tenant };
|
|
161
|
+
config.currentTenant = tenant; // Keep for backward compatibility
|
|
162
|
+
saveConfig(config);
|
|
152
163
|
}
|
|
153
164
|
function setCurrentTenant(tenant) {
|
|
154
|
-
|
|
165
|
+
// Assume organisation = tenant when only tenant is specified
|
|
166
|
+
setCurrentCheckout(tenant, tenant);
|
|
155
167
|
}
|
|
156
168
|
function clearCurrentTenant() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
const config = loadConfig();
|
|
170
|
+
config.currentTenant = undefined;
|
|
171
|
+
config.currentCheckout = undefined;
|
|
172
|
+
saveConfig(config);
|
|
161
173
|
}
|
|
174
|
+
// Tenant-Organisation mapping
|
|
162
175
|
function saveTenantOrgMapping(tenant, organisation) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
176
|
+
const config = loadConfig();
|
|
177
|
+
if (!config.tenantOrgMapping) {
|
|
178
|
+
config.tenantOrgMapping = {};
|
|
179
|
+
}
|
|
180
|
+
config.tenantOrgMapping[tenant] = organisation;
|
|
181
|
+
saveConfig(config);
|
|
169
182
|
}
|
|
170
183
|
function getTenantOrg(tenant) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
175
|
-
0 && (module.exports = {
|
|
176
|
-
clearCurrentTenant,
|
|
177
|
-
clearUserAuth,
|
|
178
|
-
generateBasePath,
|
|
179
|
-
getCredential,
|
|
180
|
-
getCurrentCheckout,
|
|
181
|
-
getCurrentOrganisation,
|
|
182
|
-
getCurrentTenant,
|
|
183
|
-
getTenantOrg,
|
|
184
|
-
getUserAuth,
|
|
185
|
-
isUserAuthValid,
|
|
186
|
-
listCredentials,
|
|
187
|
-
loadConfig,
|
|
188
|
-
removeCredential,
|
|
189
|
-
saveConfig,
|
|
190
|
-
saveTenantOrgMapping,
|
|
191
|
-
setCredential,
|
|
192
|
-
setCurrentCheckout,
|
|
193
|
-
setCurrentTenant,
|
|
194
|
-
setUserAuth
|
|
195
|
-
});
|
|
196
|
-
//# sourceMappingURL=configService.js.map
|
|
184
|
+
const config = loadConfig();
|
|
185
|
+
return config.tenantOrgMapping?.[tenant];
|
|
186
|
+
}
|