farseer-cli 1.0.10 → 1.1.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 +19 -0
- package/dist/commands/app.js +348 -344
- package/dist/commands/app.js.map +7 -0
- package/dist/commands/apps.js +110 -82
- package/dist/commands/apps.js.map +7 -0
- package/dist/commands/cells.js +161 -0
- package/dist/commands/cells.js.map +7 -0
- package/dist/commands/checkout.js +140 -155
- package/dist/commands/checkout.js.map +7 -0
- package/dist/commands/config.js +128 -126
- package/dist/commands/config.js.map +7 -0
- package/dist/commands/dashboards.js +130 -0
- package/dist/commands/dashboards.js.map +7 -0
- package/dist/commands/diff.js +171 -193
- package/dist/commands/diff.js.map +7 -0
- package/dist/commands/dimensions.js +222 -119
- package/dist/commands/dimensions.js.map +7 -0
- package/dist/commands/files.js +96 -77
- package/dist/commands/files.js.map +7 -0
- package/dist/commands/formula.js +116 -0
- package/dist/commands/formula.js.map +7 -0
- package/dist/commands/install.js +74 -76
- package/dist/commands/install.js.map +7 -0
- package/dist/commands/list.js +91 -73
- package/dist/commands/list.js.map +7 -0
- package/dist/commands/login.js +137 -98
- package/dist/commands/login.js.map +7 -0
- package/dist/commands/logout.js +59 -41
- package/dist/commands/logout.js.map +7 -0
- package/dist/commands/mcp-server.js +36 -23
- package/dist/commands/mcp-server.js.map +7 -0
- package/dist/commands/model.js +186 -175
- package/dist/commands/model.js.map +7 -0
- package/dist/commands/pull.js +264 -274
- package/dist/commands/pull.js.map +7 -0
- package/dist/commands/push.js +209 -221
- package/dist/commands/push.js.map +7 -0
- package/dist/commands/run.js +276 -321
- package/dist/commands/run.js.map +7 -0
- package/dist/commands/sheets.js +200 -0
- package/dist/commands/sheets.js.map +7 -0
- package/dist/commands/status.js +149 -169
- package/dist/commands/status.js.map +7 -0
- package/dist/commands/variables.js +247 -188
- package/dist/commands/variables.js.map +7 -0
- package/dist/commands/whoami.js +65 -44
- package/dist/commands/whoami.js.map +7 -0
- package/dist/index.js +179 -115
- package/dist/index.js.map +7 -0
- package/dist/mcp/index.js +33 -16
- package/dist/mcp/index.js.map +7 -0
- package/dist/mcp/prompts/workflows.js +191 -145
- package/dist/mcp/prompts/workflows.js.map +7 -0
- package/dist/mcp/resources/documentation.js +158 -148
- package/dist/mcp/resources/documentation.js.map +7 -0
- package/dist/mcp/server.js +56 -33
- package/dist/mcp/server.js.map +7 -0
- package/dist/mcp/tools/appTools.js +309 -277
- package/dist/mcp/tools/appTools.js.map +7 -0
- package/dist/mcp/tools/authTools.js +130 -121
- package/dist/mcp/tools/authTools.js.map +7 -0
- package/dist/mcp/tools/cellTools.js +148 -0
- package/dist/mcp/tools/cellTools.js.map +7 -0
- package/dist/mcp/tools/dashboardTools.js +133 -0
- package/dist/mcp/tools/dashboardTools.js.map +7 -0
- package/dist/mcp/tools/dataTools.js +270 -267
- package/dist/mcp/tools/dataTools.js.map +7 -0
- package/dist/mcp/tools/modelTools.js +575 -229
- package/dist/mcp/tools/modelTools.js.map +7 -0
- package/dist/mcp/tools/runTools.js +201 -203
- package/dist/mcp/tools/runTools.js.map +7 -0
- package/dist/mcp/tools/sheetTools.js +240 -0
- package/dist/mcp/tools/sheetTools.js.map +7 -0
- package/dist/mcp/tools/syncTools.js +335 -314
- package/dist/mcp/tools/syncTools.js.map +7 -0
- package/dist/mcp/utils/helpers.js +117 -123
- package/dist/mcp/utils/helpers.js.map +7 -0
- package/dist/services/appSyncService.js +381 -437
- package/dist/services/appSyncService.js.map +7 -0
- package/dist/services/configService.js +154 -143
- package/dist/services/configService.js.map +7 -0
- package/dist/services/farseerApi.js +422 -399
- package/dist/services/farseerApi.js.map +7 -0
- package/dist/services/farseerFactory.js +208 -273
- package/dist/services/farseerFactory.js.map +7 -0
- package/dist/services/farseerService.js +467 -486
- package/dist/services/farseerService.js.map +7 -0
- package/dist/services/syncService.js +661 -731
- package/dist/services/syncService.js.map +7 -0
- package/dist/utils/constants.js +52 -19
- package/dist/utils/constants.js.map +7 -0
- package/dist/utils/entityResolver.js +78 -0
- package/dist/utils/entityResolver.js.map +7 -0
- package/dist/utils/helpers.js +331 -365
- package/dist/utils/helpers.js.map +7 -0
- package/dist/utils/logger.js +74 -42
- package/dist/utils/logger.js.map +7 -0
- package/package.json +3 -2
|
@@ -1,55 +1,105 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var modelTools_exports = {};
|
|
20
|
+
__export(modelTools_exports, {
|
|
21
|
+
registerModelTools: () => registerModelTools
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(modelTools_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
var import_farseerFactory = require("../../services/farseerFactory");
|
|
26
|
+
var import_helpers = require("../utils/helpers");
|
|
27
|
+
var import_farseer_client = require("farseer-client");
|
|
28
|
+
async function extractErrorMessage(error) {
|
|
29
|
+
if (error instanceof Error) return error.message;
|
|
30
|
+
if (error && typeof error === "object" && "status" in error && "statusText" in error) {
|
|
31
|
+
const resp = error;
|
|
32
|
+
const body = resp.text ? await resp.text() : "";
|
|
33
|
+
return `HTTP ${resp.status} ${resp.statusText}${body ? ": " + body : ""}`;
|
|
34
|
+
}
|
|
35
|
+
return String(error);
|
|
36
|
+
}
|
|
37
|
+
const evaluateFormulaSchema = {
|
|
38
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
39
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
40
|
+
formula: import_zod.z.string().describe("Formula expression to evaluate (e.g., variable name or calculation)"),
|
|
41
|
+
filters: import_zod.z.array(import_zod.z.array(import_zod.z.string()).length(2)).optional().describe('Dimension filters as [tableName, memberName] pairs (e.g., [["Years","2024"],["Months","Jan"]])')
|
|
42
|
+
};
|
|
43
|
+
const listDimensionMembersSchema = {
|
|
44
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
45
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
46
|
+
tableName: import_zod.z.string().describe("Dimension table name"),
|
|
47
|
+
limit: import_zod.z.number().optional().describe("Maximum number of members to return")
|
|
48
|
+
};
|
|
49
|
+
const manageDimensionMembersSchema = {
|
|
50
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
51
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
52
|
+
action: import_zod.z.enum(["create", "delete"]).describe("Action to perform"),
|
|
53
|
+
tableName: import_zod.z.string().describe("Dimension table name"),
|
|
54
|
+
memberName: import_zod.z.string().describe("Member name to create or delete"),
|
|
55
|
+
parentMemberName: import_zod.z.string().optional().describe("Parent member name (for create with hierarchy)")
|
|
56
|
+
};
|
|
57
|
+
const createVariableSchema = {
|
|
58
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
59
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
60
|
+
name: import_zod.z.string().describe("Variable name"),
|
|
61
|
+
dimensions: import_zod.z.array(import_zod.z.string()).optional().describe("Dimension table names this variable spans"),
|
|
62
|
+
formula: import_zod.z.string().optional().describe("Formula expression"),
|
|
63
|
+
rollupType: import_zod.z.string().optional().describe("Rollup type (Sum, Average, Min, Max, Last, First, Count)"),
|
|
64
|
+
dataType: import_zod.z.string().optional().describe("Data type (Decimal, Integer, Text)"),
|
|
65
|
+
description: import_zod.z.string().optional().describe("Variable description"),
|
|
66
|
+
readonly: import_zod.z.boolean().optional().describe("Whether the variable is read-only")
|
|
67
|
+
};
|
|
68
|
+
const updateVariableSchema = {
|
|
69
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
70
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
71
|
+
name: import_zod.z.string().describe("Variable name to update"),
|
|
72
|
+
formula: import_zod.z.string().optional().describe("New formula expression"),
|
|
73
|
+
rollupType: import_zod.z.string().optional().describe("New rollup type"),
|
|
74
|
+
description: import_zod.z.string().optional().describe("New description"),
|
|
75
|
+
readonly: import_zod.z.boolean().optional().describe("Set read-only status")
|
|
76
|
+
};
|
|
13
77
|
const exportModelSchema = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.string()
|
|
17
|
-
.optional()
|
|
18
|
-
.describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),
|
|
78
|
+
tenant: import_zod.z.string().optional().describe('Tenant ID (e.g. "salvus-prodaja"). Uses checked-out tenant if omitted.'),
|
|
79
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.")
|
|
19
80
|
};
|
|
20
81
|
const listTablesSchema = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.string()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),
|
|
82
|
+
tenant: import_zod.z.string().optional().describe('Tenant ID (e.g. "salvus-prodaja"). Uses checked-out tenant if omitted.'),
|
|
83
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.")
|
|
26
84
|
};
|
|
27
85
|
const listVariablesSchema = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.string()
|
|
31
|
-
.optional()
|
|
32
|
-
.describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),
|
|
86
|
+
tenant: import_zod.z.string().optional().describe('Tenant ID (e.g. "salvus-prodaja"). Uses checked-out tenant if omitted.'),
|
|
87
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.")
|
|
33
88
|
};
|
|
34
89
|
const getTableSchema = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),
|
|
39
|
-
tenant: zod_1.z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),
|
|
40
|
-
tableName: zod_1.z.string().describe('Name of the dimension table'),
|
|
90
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
91
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
92
|
+
tableName: import_zod.z.string().describe("Name of the dimension table")
|
|
41
93
|
};
|
|
42
94
|
const getVariableSchema = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.describe('Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping.'),
|
|
47
|
-
tenant: zod_1.z.string().optional().describe('Tenant ID. Uses checked-out tenant if omitted.'),
|
|
48
|
-
variableName: zod_1.z.string().describe('Name of the variable'),
|
|
95
|
+
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
96
|
+
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
97
|
+
variableName: import_zod.z.string().describe("Name of the variable")
|
|
49
98
|
};
|
|
50
99
|
function registerModelTools(server) {
|
|
51
|
-
|
|
52
|
-
|
|
100
|
+
server.tool(
|
|
101
|
+
"farseer_export_model",
|
|
102
|
+
`Export the complete data model structure from a Farseer tenant.
|
|
53
103
|
|
|
54
104
|
Returns:
|
|
55
105
|
- All dimension tables with member counts and foreign key relationships
|
|
@@ -60,57 +110,61 @@ This is essential for understanding a tenant's data structure before writing imp
|
|
|
60
110
|
The model export can be large for complex tenants. Use farseer_list_tables or
|
|
61
111
|
farseer_list_variables for a summary view.
|
|
62
112
|
|
|
63
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
114
|
+
exportModelSchema,
|
|
115
|
+
async (params) => {
|
|
116
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
117
|
+
if (!resolved) {
|
|
118
|
+
return (0, import_helpers.tenantRequiredResponse)();
|
|
119
|
+
}
|
|
120
|
+
const { organisation, tenant } = resolved;
|
|
121
|
+
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
122
|
+
if (!clientResult) {
|
|
123
|
+
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
const model = await clientResult.client.exportModel();
|
|
127
|
+
const tables = model.tables.map((t) => ({
|
|
128
|
+
name: t.name,
|
|
129
|
+
memberCount: t.rows?.length || 0,
|
|
130
|
+
columns: t.columns.map((c) => ({
|
|
131
|
+
type: c.type,
|
|
132
|
+
name: c.name,
|
|
133
|
+
foreignKeyTable: c.foreignKeyTableName
|
|
134
|
+
})),
|
|
135
|
+
foreignKeys: t.columns.filter((c) => c.type === "FOREIGN_KEY").map((c) => c.foreignKeyTableName),
|
|
136
|
+
folderPath: t.folderPath
|
|
137
|
+
}));
|
|
138
|
+
const variables = model.variables.map((v) => ({
|
|
139
|
+
name: v.name,
|
|
140
|
+
dimensions: v.tables || [],
|
|
141
|
+
formula: v.formula || void 0,
|
|
142
|
+
rollupType: v.rollupType,
|
|
143
|
+
numberFormat: v.numberFormat,
|
|
144
|
+
readonly: v.readonly,
|
|
145
|
+
calculateOnDemand: v.calculateOnDemand,
|
|
146
|
+
folderPath: v.folderPath
|
|
147
|
+
}));
|
|
148
|
+
return (0, import_helpers.successResponse)({
|
|
149
|
+
tenant,
|
|
150
|
+
summary: {
|
|
151
|
+
tableCount: tables.length,
|
|
152
|
+
variableCount: variables.length
|
|
153
|
+
},
|
|
154
|
+
tables,
|
|
155
|
+
variables
|
|
156
|
+
});
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return (0, import_helpers.errorResponse)(
|
|
159
|
+
`Export model failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
160
|
+
"NETWORK_ERROR"
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
server.tool(
|
|
166
|
+
"farseer_list_tables",
|
|
167
|
+
`List all dimension tables in a Farseer tenant model.
|
|
114
168
|
|
|
115
169
|
Dimension tables define the structure of data:
|
|
116
170
|
- Product, Region, Customer (business dimensions)
|
|
@@ -119,37 +173,42 @@ Dimension tables define the structure of data:
|
|
|
119
173
|
|
|
120
174
|
Returns table names, member counts, and foreign key relationships.
|
|
121
175
|
|
|
122
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
176
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
177
|
+
listTablesSchema,
|
|
178
|
+
async (params) => {
|
|
179
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
180
|
+
if (!resolved) {
|
|
181
|
+
return (0, import_helpers.tenantRequiredResponse)();
|
|
182
|
+
}
|
|
183
|
+
const { organisation, tenant } = resolved;
|
|
184
|
+
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
185
|
+
if (!clientResult) {
|
|
186
|
+
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const model = await clientResult.client.exportModel();
|
|
190
|
+
const tables = model.tables.map((t) => ({
|
|
191
|
+
name: t.name,
|
|
192
|
+
memberCount: t.rows?.length || 0,
|
|
193
|
+
foreignKeys: t.columns.filter((c) => c.type === "FOREIGN_KEY").map((c) => c.foreignKeyTableName)
|
|
194
|
+
}));
|
|
195
|
+
tables.sort((a, b) => a.name.localeCompare(b.name));
|
|
196
|
+
return (0, import_helpers.successResponse)({
|
|
197
|
+
tenant,
|
|
198
|
+
totalTables: tables.length,
|
|
199
|
+
tables
|
|
200
|
+
});
|
|
201
|
+
} catch (error) {
|
|
202
|
+
return (0, import_helpers.errorResponse)(
|
|
203
|
+
`List tables failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
204
|
+
"NETWORK_ERROR"
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
server.tool(
|
|
210
|
+
"farseer_list_variables",
|
|
211
|
+
`List all variables defined in a Farseer tenant model.
|
|
153
212
|
|
|
154
213
|
Variables store data and calculations - they are the core of the data model.
|
|
155
214
|
|
|
@@ -158,39 +217,44 @@ Each variable has:
|
|
|
158
217
|
- Optional formula for calculated values
|
|
159
218
|
- Roll-up type (how values aggregate up hierarchies)
|
|
160
219
|
|
|
161
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
220
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
221
|
+
listVariablesSchema,
|
|
222
|
+
async (params) => {
|
|
223
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
224
|
+
if (!resolved) {
|
|
225
|
+
return (0, import_helpers.tenantRequiredResponse)();
|
|
226
|
+
}
|
|
227
|
+
const { organisation, tenant } = resolved;
|
|
228
|
+
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
229
|
+
if (!clientResult) {
|
|
230
|
+
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const model = await clientResult.client.exportModel();
|
|
234
|
+
const variables = model.variables.map((v) => ({
|
|
235
|
+
name: v.name,
|
|
236
|
+
dimensions: v.tables || [],
|
|
237
|
+
hasFormula: !!v.formula,
|
|
238
|
+
rollupType: v.rollupType,
|
|
239
|
+
readonly: v.readonly
|
|
240
|
+
}));
|
|
241
|
+
variables.sort((a, b) => a.name.localeCompare(b.name));
|
|
242
|
+
return (0, import_helpers.successResponse)({
|
|
243
|
+
tenant,
|
|
244
|
+
totalVariables: variables.length,
|
|
245
|
+
variables
|
|
246
|
+
});
|
|
247
|
+
} catch (error) {
|
|
248
|
+
return (0, import_helpers.errorResponse)(
|
|
249
|
+
`List variables failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
250
|
+
"NETWORK_ERROR"
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
server.tool(
|
|
256
|
+
"farseer_get_table",
|
|
257
|
+
`Get detailed information about a specific dimension table.
|
|
194
258
|
|
|
195
259
|
Returns:
|
|
196
260
|
- Table columns with their types
|
|
@@ -200,50 +264,55 @@ Returns:
|
|
|
200
264
|
|
|
201
265
|
This helps understand the structure needed for import scripts.
|
|
202
266
|
|
|
203
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
267
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
268
|
+
getTableSchema,
|
|
269
|
+
async (params) => {
|
|
270
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
271
|
+
if (!resolved) {
|
|
272
|
+
return (0, import_helpers.tenantRequiredResponse)();
|
|
273
|
+
}
|
|
274
|
+
const { organisation, tenant } = resolved;
|
|
275
|
+
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
276
|
+
if (!clientResult) {
|
|
277
|
+
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
const model = await clientResult.client.exportModel();
|
|
281
|
+
const table = model.tables.find((t) => t.name.toLowerCase() === params.tableName.toLowerCase());
|
|
282
|
+
if (!table) {
|
|
283
|
+
return (0, import_helpers.errorResponse)(`Table "${params.tableName}" not found`, "NOT_FOUND");
|
|
212
284
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
// Get sample members (first column is usually the primary key / name)
|
|
220
|
-
const primaryKeyColumn = table.columns.find((c) => c.type === 'PRIMARY_KEY');
|
|
221
|
-
let sampleMembers = [];
|
|
222
|
-
if (table.rows && table.rows.length > 0) {
|
|
223
|
-
const pkIndex = primaryKeyColumn ? table.columns.indexOf(primaryKeyColumn) : 0;
|
|
224
|
-
sampleMembers = table.rows.slice(0, 20).map((row) => String(row[pkIndex]));
|
|
225
|
-
}
|
|
226
|
-
return (0, helpers_1.successResponse)({
|
|
227
|
-
tenant,
|
|
228
|
-
table: {
|
|
229
|
-
name: table.name,
|
|
230
|
-
columns: table.columns.map((c) => ({
|
|
231
|
-
type: c.type,
|
|
232
|
-
name: c.name,
|
|
233
|
-
foreignKeyTable: c.foreignKeyTableName,
|
|
234
|
-
})),
|
|
235
|
-
memberCount: table.rows?.length || 0,
|
|
236
|
-
sampleMembers,
|
|
237
|
-
folderPath: table.folderPath,
|
|
238
|
-
},
|
|
239
|
-
});
|
|
285
|
+
const primaryKeyColumn = table.columns.find((c) => c.type === "PRIMARY_KEY");
|
|
286
|
+
let sampleMembers = [];
|
|
287
|
+
if (table.rows && table.rows.length > 0) {
|
|
288
|
+
const pkIndex = primaryKeyColumn ? table.columns.indexOf(primaryKeyColumn) : 0;
|
|
289
|
+
sampleMembers = table.rows.slice(0, 20).map((row) => String(row[pkIndex]));
|
|
240
290
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
291
|
+
return (0, import_helpers.successResponse)({
|
|
292
|
+
tenant,
|
|
293
|
+
table: {
|
|
294
|
+
name: table.name,
|
|
295
|
+
columns: table.columns.map((c) => ({
|
|
296
|
+
type: c.type,
|
|
297
|
+
name: c.name,
|
|
298
|
+
foreignKeyTable: c.foreignKeyTableName
|
|
299
|
+
})),
|
|
300
|
+
memberCount: table.rows?.length || 0,
|
|
301
|
+
sampleMembers,
|
|
302
|
+
folderPath: table.folderPath
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
} catch (error) {
|
|
306
|
+
return (0, import_helpers.errorResponse)(
|
|
307
|
+
`Get table failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
308
|
+
"NETWORK_ERROR"
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
server.tool(
|
|
314
|
+
"farseer_get_variable",
|
|
315
|
+
`Get detailed information about a specific variable.
|
|
247
316
|
|
|
248
317
|
Returns:
|
|
249
318
|
- Dimensions the variable spans
|
|
@@ -254,40 +323,317 @@ Returns:
|
|
|
254
323
|
|
|
255
324
|
This is essential for understanding what dimensions and values are needed for imports.
|
|
256
325
|
|
|
257
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
326
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
327
|
+
getVariableSchema,
|
|
328
|
+
async (params) => {
|
|
329
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
330
|
+
if (!resolved) {
|
|
331
|
+
return (0, import_helpers.tenantRequiredResponse)();
|
|
332
|
+
}
|
|
333
|
+
const { organisation, tenant } = resolved;
|
|
334
|
+
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
335
|
+
if (!clientResult) {
|
|
336
|
+
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
const model = await clientResult.client.exportModel();
|
|
340
|
+
const variable = model.variables.find(
|
|
341
|
+
(v) => v.name.toLowerCase() === params.variableName.toLowerCase()
|
|
342
|
+
);
|
|
343
|
+
if (!variable) {
|
|
344
|
+
return (0, import_helpers.errorResponse)(`Variable "${params.variableName}" not found`, "NOT_FOUND");
|
|
266
345
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
346
|
+
return (0, import_helpers.successResponse)({
|
|
347
|
+
tenant,
|
|
348
|
+
variable: {
|
|
349
|
+
name: variable.name,
|
|
350
|
+
description: variable.description,
|
|
351
|
+
formula: variable.formula,
|
|
352
|
+
dimensions: variable.tables || [],
|
|
353
|
+
rollupType: variable.rollupType,
|
|
354
|
+
dataType: variable.dataType,
|
|
355
|
+
numberFormat: variable.numberFormat,
|
|
356
|
+
readonly: variable.readonly,
|
|
357
|
+
calculateOnDemand: variable.calculateOnDemand,
|
|
358
|
+
folderPath: variable.folderPath
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
} catch (error) {
|
|
362
|
+
return (0, import_helpers.errorResponse)(
|
|
363
|
+
`Get variable failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
364
|
+
"NETWORK_ERROR"
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
server.tool(
|
|
370
|
+
"farseer_evaluate_formula",
|
|
371
|
+
`Evaluate a formula expression in a Farseer tenant.
|
|
372
|
+
|
|
373
|
+
The formula can be a variable name or a calculation expression.
|
|
374
|
+
Filters narrow the evaluation to specific dimension members.
|
|
375
|
+
|
|
376
|
+
Example: evaluate "Revenue" with filters [["Years","2024"],["Months","Jan"]]
|
|
377
|
+
|
|
378
|
+
Returns the computed value along with cell metadata (readonly, calculated, frozen).
|
|
379
|
+
|
|
380
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
381
|
+
evaluateFormulaSchema,
|
|
382
|
+
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
383
|
+
async (params) => {
|
|
384
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
385
|
+
if (!resolved) return (0, import_helpers.tenantRequiredResponse)();
|
|
386
|
+
const { organisation, tenant } = resolved;
|
|
387
|
+
const nativeClient = await (0, import_farseerFactory.getNativeFarseerClient)(organisation, tenant);
|
|
388
|
+
if (!nativeClient) return (0, import_helpers.authRequiredResponse)(tenant);
|
|
389
|
+
try {
|
|
390
|
+
const evaluateRequest = {
|
|
391
|
+
filters: params.filters || [],
|
|
392
|
+
cellQueries: [{ type: "VARIABLE", formula: params.formula }]
|
|
393
|
+
};
|
|
394
|
+
const results = await nativeClient.evaluator.evaluate(evaluateRequest);
|
|
395
|
+
return (0, import_helpers.successResponse)({
|
|
396
|
+
tenant,
|
|
397
|
+
formula: params.formula,
|
|
398
|
+
filters: params.filters || [],
|
|
399
|
+
results: results.map((r) => ({
|
|
400
|
+
value: r.value,
|
|
401
|
+
readonly: r.readonly,
|
|
402
|
+
calculated: r.calculated,
|
|
403
|
+
frozen: r.frozen,
|
|
404
|
+
goal: r.goal
|
|
405
|
+
}))
|
|
406
|
+
});
|
|
407
|
+
} catch (error) {
|
|
408
|
+
return (0, import_helpers.errorResponse)(`Evaluate formula failed: ${await extractErrorMessage(error)}`, "NETWORK_ERROR");
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
server.tool(
|
|
413
|
+
"farseer_list_dimension_members",
|
|
414
|
+
`List all members of a specific dimension table.
|
|
415
|
+
|
|
416
|
+
Uses initTagMap() to load the model's tag map, then retrieves members for the specified table.
|
|
417
|
+
Returns member IDs, names, and parent relationships.
|
|
418
|
+
|
|
419
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
420
|
+
listDimensionMembersSchema,
|
|
421
|
+
async (params) => {
|
|
422
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
423
|
+
if (!resolved) return (0, import_helpers.tenantRequiredResponse)();
|
|
424
|
+
const { organisation, tenant } = resolved;
|
|
425
|
+
const nativeClient = await (0, import_farseerFactory.getNativeFarseerClient)(organisation, tenant);
|
|
426
|
+
if (!nativeClient) return (0, import_helpers.authRequiredResponse)(tenant);
|
|
427
|
+
try {
|
|
428
|
+
await nativeClient.initTagMap();
|
|
429
|
+
const members = await nativeClient.getDimensionMembersForTable(params.tableName);
|
|
430
|
+
const limit = params.limit || members.length;
|
|
431
|
+
const result = members.slice(0, limit).map((m) => ({
|
|
432
|
+
id: m.id,
|
|
433
|
+
name: m.name,
|
|
434
|
+
parentId: m.ParentId
|
|
435
|
+
}));
|
|
436
|
+
return (0, import_helpers.successResponse)({
|
|
437
|
+
tenant,
|
|
438
|
+
tableName: params.tableName,
|
|
439
|
+
totalMembers: members.length,
|
|
440
|
+
returned: result.length,
|
|
441
|
+
members: result
|
|
442
|
+
});
|
|
443
|
+
} catch (error) {
|
|
444
|
+
return (0, import_helpers.errorResponse)(
|
|
445
|
+
`List dimension members failed: ${await extractErrorMessage(error)}`,
|
|
446
|
+
"NETWORK_ERROR"
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
server.tool(
|
|
452
|
+
"farseer_manage_dimension_members",
|
|
453
|
+
`Create or delete a dimension member in a Farseer tenant.
|
|
454
|
+
|
|
455
|
+
Actions:
|
|
456
|
+
- "create": Creates a new member in the specified dimension table.
|
|
457
|
+
Optionally set a parent member for hierarchical tables.
|
|
458
|
+
- "delete": Deletes an existing member by name from the specified table.
|
|
459
|
+
|
|
460
|
+
WARNING: Delete is destructive and may affect data. Use with caution.
|
|
461
|
+
|
|
462
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
463
|
+
manageDimensionMembersSchema,
|
|
464
|
+
async (params) => {
|
|
465
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
466
|
+
if (!resolved) return (0, import_helpers.tenantRequiredResponse)();
|
|
467
|
+
const { organisation, tenant } = resolved;
|
|
468
|
+
const nativeClient = await (0, import_farseerFactory.getNativeFarseerClient)(organisation, tenant);
|
|
469
|
+
if (!nativeClient) return (0, import_helpers.authRequiredResponse)(tenant);
|
|
470
|
+
try {
|
|
471
|
+
await nativeClient.initTagMap();
|
|
472
|
+
if (params.action === "create") {
|
|
473
|
+
const table = await nativeClient.getDimensionTable(params.tableName);
|
|
474
|
+
const createEntity = {
|
|
475
|
+
type: import_farseer_client.EntityType.DimensionMember,
|
|
476
|
+
meta: { name: params.memberName },
|
|
477
|
+
relations: {
|
|
478
|
+
parent: { id: table.id }
|
|
272
479
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
480
|
+
};
|
|
481
|
+
if (params.parentMemberName) {
|
|
482
|
+
const parentMember = await nativeClient.getDimensionMember(
|
|
483
|
+
params.tableName,
|
|
484
|
+
params.parentMemberName
|
|
485
|
+
);
|
|
486
|
+
createEntity.relations.parent = { id: parentMember.id };
|
|
487
|
+
}
|
|
488
|
+
const result = await nativeClient.entities.mutate({ created: [createEntity] });
|
|
489
|
+
return (0, import_helpers.successResponse)({
|
|
490
|
+
tenant,
|
|
491
|
+
action: "created",
|
|
492
|
+
tableName: params.tableName,
|
|
493
|
+
memberName: params.memberName,
|
|
494
|
+
parentMemberName: params.parentMemberName || null,
|
|
495
|
+
result
|
|
496
|
+
});
|
|
497
|
+
} else {
|
|
498
|
+
const member = await nativeClient.getDimensionMember(params.tableName, params.memberName);
|
|
499
|
+
await nativeClient.entities.mutate({
|
|
500
|
+
deleted: [{ id: member.id, type: import_farseer_client.EntityType.DimensionMember }]
|
|
501
|
+
});
|
|
502
|
+
return (0, import_helpers.successResponse)({
|
|
503
|
+
tenant,
|
|
504
|
+
action: "deleted",
|
|
505
|
+
tableName: params.tableName,
|
|
506
|
+
memberName: params.memberName,
|
|
507
|
+
memberId: member.id
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
} catch (error) {
|
|
511
|
+
return (0, import_helpers.errorResponse)(
|
|
512
|
+
`Manage dimension member failed: ${await extractErrorMessage(error)}`,
|
|
513
|
+
"NETWORK_ERROR"
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
server.tool(
|
|
519
|
+
"farseer_create_variable",
|
|
520
|
+
`Create a new variable in a Farseer tenant.
|
|
521
|
+
|
|
522
|
+
Creates a variable with the specified name, dimension tables, formula, rollup type, and data type.
|
|
523
|
+
Dimension table names are resolved to their internal IDs automatically.
|
|
524
|
+
|
|
525
|
+
Example:
|
|
526
|
+
{
|
|
527
|
+
"name": "Revenue Forecast",
|
|
528
|
+
"dimensions": ["Product", "Years", "Months"],
|
|
529
|
+
"formula": "Revenue * 1.1",
|
|
530
|
+
"rollupType": "Sum",
|
|
531
|
+
"dataType": "Decimal"
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
535
|
+
createVariableSchema,
|
|
536
|
+
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
537
|
+
async (params) => {
|
|
538
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
539
|
+
if (!resolved) return (0, import_helpers.tenantRequiredResponse)();
|
|
540
|
+
const { organisation, tenant } = resolved;
|
|
541
|
+
const nativeClient = await (0, import_farseerFactory.getNativeFarseerClient)(organisation, tenant);
|
|
542
|
+
if (!nativeClient) return (0, import_helpers.authRequiredResponse)(tenant);
|
|
543
|
+
try {
|
|
544
|
+
await nativeClient.initTagMap();
|
|
545
|
+
const tableGids = [];
|
|
546
|
+
if (params.dimensions) {
|
|
547
|
+
for (const tableName of params.dimensions) {
|
|
548
|
+
const table = await nativeClient.getDimensionTable(tableName);
|
|
549
|
+
tableGids.push(table.id);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
const createEntity = {
|
|
553
|
+
type: import_farseer_client.EntityType.Variable,
|
|
554
|
+
meta: {
|
|
555
|
+
name: params.name,
|
|
556
|
+
description: params.description || null
|
|
557
|
+
},
|
|
558
|
+
variable: {
|
|
559
|
+
tableGids,
|
|
560
|
+
rollupType: params.rollupType || "Sum",
|
|
561
|
+
dataType: params.dataType || "Decimal",
|
|
562
|
+
readonly: params.readonly || false
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
if (params.formula) {
|
|
566
|
+
createEntity.calculation = { formula: params.formula };
|
|
567
|
+
}
|
|
568
|
+
const result = await nativeClient.entities.mutate({ created: [createEntity] });
|
|
569
|
+
return (0, import_helpers.successResponse)({
|
|
570
|
+
tenant,
|
|
571
|
+
action: "created",
|
|
572
|
+
variable: params.name,
|
|
573
|
+
dimensions: params.dimensions || [],
|
|
574
|
+
result
|
|
575
|
+
});
|
|
576
|
+
} catch (error) {
|
|
577
|
+
return (0, import_helpers.errorResponse)(`Create variable failed: ${await extractErrorMessage(error)}`, "NETWORK_ERROR");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
server.tool(
|
|
582
|
+
"farseer_update_variable",
|
|
583
|
+
`Update an existing variable in a Farseer tenant.
|
|
584
|
+
|
|
585
|
+
Resolves the variable by name and updates the specified fields.
|
|
586
|
+
Only provided fields are updated; omitted fields remain unchanged.
|
|
587
|
+
|
|
588
|
+
Updatable fields:
|
|
589
|
+
- formula: Change the calculation formula
|
|
590
|
+
- rollupType: Change aggregation method (Sum, Average, Min, Max, etc.)
|
|
591
|
+
- description: Change the variable description
|
|
592
|
+
- readonly: Set or clear read-only status
|
|
593
|
+
|
|
594
|
+
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
595
|
+
updateVariableSchema,
|
|
596
|
+
async (params) => {
|
|
597
|
+
const resolved = (0, import_helpers.resolveOrgAndTenant)(params);
|
|
598
|
+
if (!resolved) return (0, import_helpers.tenantRequiredResponse)();
|
|
599
|
+
const { organisation, tenant } = resolved;
|
|
600
|
+
const nativeClient = await (0, import_farseerFactory.getNativeFarseerClient)(organisation, tenant);
|
|
601
|
+
if (!nativeClient) return (0, import_helpers.authRequiredResponse)(tenant);
|
|
602
|
+
try {
|
|
603
|
+
await nativeClient.initTagMap();
|
|
604
|
+
const variable = await nativeClient.getVariable(params.name);
|
|
605
|
+
const updateEntity = {
|
|
606
|
+
id: variable.id,
|
|
607
|
+
type: import_farseer_client.EntityType.Variable
|
|
608
|
+
};
|
|
609
|
+
if (params.description !== void 0) {
|
|
610
|
+
updateEntity.meta = { name: variable.name, description: params.description };
|
|
611
|
+
}
|
|
612
|
+
const variableUpdate = {};
|
|
613
|
+
if (params.rollupType) variableUpdate.rollupType = params.rollupType;
|
|
614
|
+
if (params.readonly !== void 0) variableUpdate.readonly = params.readonly;
|
|
615
|
+
if (Object.keys(variableUpdate).length > 0) {
|
|
616
|
+
updateEntity.variable = variableUpdate;
|
|
288
617
|
}
|
|
289
|
-
|
|
290
|
-
|
|
618
|
+
if (params.formula !== void 0) {
|
|
619
|
+
updateEntity.calculation = { formula: params.formula };
|
|
291
620
|
}
|
|
292
|
-
|
|
621
|
+
const result = await nativeClient.entities.mutate({ updated: [updateEntity] });
|
|
622
|
+
return (0, import_helpers.successResponse)({
|
|
623
|
+
tenant,
|
|
624
|
+
action: "updated",
|
|
625
|
+
variable: params.name,
|
|
626
|
+
variableId: variable.id,
|
|
627
|
+
result
|
|
628
|
+
});
|
|
629
|
+
} catch (error) {
|
|
630
|
+
return (0, import_helpers.errorResponse)(`Update variable failed: ${await extractErrorMessage(error)}`, "NETWORK_ERROR");
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
);
|
|
293
634
|
}
|
|
635
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
636
|
+
0 && (module.exports = {
|
|
637
|
+
registerModelTools
|
|
638
|
+
});
|
|
639
|
+
//# sourceMappingURL=modelTools.js.map
|