tm1npm 1.6.0 → 2.1.0
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/CHANGELOG.md +89 -0
- package/lib/objects/Axis.d.ts +1 -0
- package/lib/objects/Axis.d.ts.map +1 -1
- package/lib/objects/Axis.js +3 -0
- package/lib/objects/Chore.d.ts +2 -2
- package/lib/objects/Chore.d.ts.map +1 -1
- package/lib/objects/Chore.js +7 -13
- package/lib/objects/Cube.d.ts.map +1 -1
- package/lib/objects/Cube.js +2 -1
- package/lib/objects/Hierarchy.js +10 -10
- package/lib/objects/MDXView.d.ts +2 -0
- package/lib/objects/MDXView.d.ts.map +1 -1
- package/lib/objects/MDXView.js +30 -9
- package/lib/objects/NativeView.d.ts +5 -5
- package/lib/objects/NativeView.d.ts.map +1 -1
- package/lib/objects/NativeView.js +17 -34
- package/lib/objects/Process.d.ts +8 -3
- package/lib/objects/Process.d.ts.map +1 -1
- package/lib/objects/Process.js +143 -33
- package/lib/objects/Subset.d.ts.map +1 -1
- package/lib/objects/Subset.js +10 -3
- package/lib/objects/User.d.ts +5 -5
- package/lib/objects/User.d.ts.map +1 -1
- package/lib/objects/User.js +14 -23
- package/lib/services/ApplicationService.d.ts.map +1 -1
- package/lib/services/AsyncOperationService.d.ts +8 -1
- package/lib/services/AsyncOperationService.d.ts.map +1 -1
- package/lib/services/AsyncOperationService.js +69 -26
- package/lib/services/FileService.d.ts.map +1 -1
- package/lib/services/ProcessService.d.ts +18 -13
- package/lib/services/ProcessService.d.ts.map +1 -1
- package/lib/services/ProcessService.js +28 -17
- package/lib/services/RestService.d.ts +213 -25
- package/lib/services/RestService.d.ts.map +1 -1
- package/lib/services/RestService.js +840 -271
- package/lib/services/TM1Service.d.ts +42 -1
- package/lib/services/TM1Service.d.ts.map +1 -1
- package/lib/services/TM1Service.js +94 -4
- package/lib/tests/asyncOperationService.test.js +51 -45
- package/lib/tests/debuggerService.test.js +3 -1
- package/lib/tests/objectModelParity.test.js +362 -11
- package/lib/tests/objects.improved.test.js +28 -5
- package/lib/tests/processService.comprehensive.test.js +2 -2
- package/lib/tests/processService.test.js +20 -6
- package/lib/tests/restService.test.d.ts +0 -4
- package/lib/tests/restService.test.d.ts.map +1 -1
- package/lib/tests/restService.test.js +1558 -143
- package/lib/tests/tm1Service.test.js +80 -8
- package/lib/tests/user.issue61.test.d.ts +2 -0
- package/lib/tests/user.issue61.test.d.ts.map +1 -0
- package/lib/tests/user.issue61.test.js +180 -0
- package/lib/utils/Utils.d.ts +6 -1
- package/lib/utils/Utils.d.ts.map +1 -1
- package/lib/utils/Utils.js +56 -7
- package/package.json +1 -1
- package/src/objects/Axis.ts +4 -0
- package/src/objects/Chore.ts +7 -14
- package/src/objects/Cube.ts +2 -1
- package/src/objects/Hierarchy.ts +11 -11
- package/src/objects/MDXView.ts +29 -9
- package/src/objects/NativeView.ts +26 -42
- package/src/objects/Process.ts +182 -66
- package/src/objects/Subset.ts +17 -3
- package/src/objects/User.ts +17 -23
- package/src/services/ApplicationService.ts +4 -4
- package/src/services/AsyncOperationService.ts +76 -29
- package/src/services/FileService.ts +3 -3
- package/src/services/ProcessService.ts +67 -37
- package/src/services/RestService.ts +1020 -278
- package/src/services/TM1Service.ts +124 -6
- package/src/tests/asyncOperationService.test.ts +52 -48
- package/src/tests/debuggerService.test.ts +3 -1
- package/src/tests/objectModelParity.test.ts +456 -11
- package/src/tests/objects.improved.test.ts +41 -9
- package/src/tests/processService.comprehensive.test.ts +3 -3
- package/src/tests/processService.test.ts +21 -9
- package/src/tests/restService.test.ts +1844 -139
- package/src/tests/tm1Service.test.ts +95 -11
- package/src/tests/user.issue61.test.ts +206 -0
- package/src/utils/Utils.ts +60 -7
package/lib/objects/Process.js
CHANGED
|
@@ -56,11 +56,17 @@ class Process extends TM1Object_1.TM1Object {
|
|
|
56
56
|
this._uiData = uiData;
|
|
57
57
|
this._parameters = parameters ? Array.from(parameters) : [];
|
|
58
58
|
this._variables = variables ? Array.from(variables) : [];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
if (variablesUiData) {
|
|
60
|
+
// Handle encoding issue in variable_ui_data for async requests
|
|
61
|
+
this._variablesUiData = Array.from(variablesUiData).map((entry) => typeof entry === 'string' ? entry.replace(/€/g, '\f') : entry);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this._variablesUiData = [];
|
|
65
|
+
}
|
|
66
|
+
this._prologProcedure = Process.addGeneratedStringToCode(prologProcedure);
|
|
67
|
+
this._metadataProcedure = Process.addGeneratedStringToCode(metadataProcedure);
|
|
68
|
+
this._dataProcedure = Process.addGeneratedStringToCode(dataProcedure);
|
|
69
|
+
this._epilogProcedure = Process.addGeneratedStringToCode(epilogProcedure);
|
|
64
70
|
this._datasourceType = datasourceType;
|
|
65
71
|
this._datasourceAsciiDecimalSeparator = datasourceAsciiDecimalSeparator;
|
|
66
72
|
this._datasourceAsciiDelimiterChar = datasourceAsciiDelimiterChar;
|
|
@@ -146,13 +152,76 @@ class Process extends TM1Object_1.TM1Object {
|
|
|
146
152
|
this._datasourceType = value;
|
|
147
153
|
}
|
|
148
154
|
static fromDict(processAsDict) {
|
|
149
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
150
156
|
/** Alternative constructor
|
|
151
157
|
*
|
|
152
158
|
* :param process_as_dict: process as dict
|
|
153
159
|
* :return: process, an instance of this class
|
|
154
160
|
*/
|
|
155
|
-
|
|
161
|
+
const ds = (_a = processAsDict['DataSource']) !== null && _a !== void 0 ? _a : {};
|
|
162
|
+
return new Process(processAsDict['Name'], processAsDict['HasSecurityAccess'], (_b = processAsDict['UIData']) !== null && _b !== void 0 ? _b : '', processAsDict['Parameters'], processAsDict['Variables'], (_c = processAsDict['VariablesUIData']) !== null && _c !== void 0 ? _c : '', processAsDict['PrologProcedure'], processAsDict['MetadataProcedure'], processAsDict['DataProcedure'], processAsDict['EpilogProcedure'], (_d = ds['Type']) !== null && _d !== void 0 ? _d : '', (_e = ds['asciiDecimalSeparator']) !== null && _e !== void 0 ? _e : '', (_f = ds['asciiDelimiterChar']) !== null && _f !== void 0 ? _f : '', (_g = ds['asciiDelimiterType']) !== null && _g !== void 0 ? _g : '', (_h = ds['asciiHeaderRecords']) !== null && _h !== void 0 ? _h : '', (_j = ds['asciiQuoteCharacter']) !== null && _j !== void 0 ? _j : '', (_k = ds['asciiThousandSeparator']) !== null && _k !== void 0 ? _k : '', (_l = ds['dataSourceNameForClient']) !== null && _l !== void 0 ? _l : '', (_m = ds['dataSourceNameForServer']) !== null && _m !== void 0 ? _m : '', (_o = ds['password']) !== null && _o !== void 0 ? _o : '', (_p = ds['userName']) !== null && _p !== void 0 ? _p : '', (_q = ds['query']) !== null && _q !== void 0 ? _q : '', (_r = ds['usesUnicode']) !== null && _r !== void 0 ? _r : '', (_s = ds['view']) !== null && _s !== void 0 ? _s : '', (_t = ds['subset']) !== null && _t !== void 0 ? _t : '', (_u = ds['jsonRootPointer']) !== null && _u !== void 0 ? _u : '', (_v = ds['jsonVariableMapping']) !== null && _v !== void 0 ? _v : '');
|
|
163
|
+
}
|
|
164
|
+
addVariable(name, variableType) {
|
|
165
|
+
// variable consists of actual variable and UI-Information ('ignore','other', etc.)
|
|
166
|
+
// 1. handle Variable info
|
|
167
|
+
const variable = {
|
|
168
|
+
Name: name,
|
|
169
|
+
Type: variableType,
|
|
170
|
+
Position: this._variables.length + 1,
|
|
171
|
+
StartByte: 0,
|
|
172
|
+
EndByte: 0,
|
|
173
|
+
};
|
|
174
|
+
this._variables.push(variable);
|
|
175
|
+
// 2. handle UI info
|
|
176
|
+
const varType = variableType === 'Numeric' ? 33 : 32;
|
|
177
|
+
// '\f' !
|
|
178
|
+
const variableUiData = 'VarType=' + varType + '\f' + 'ColType=' + 827 + '\f';
|
|
179
|
+
/*
|
|
180
|
+
* mapping VariableUIData:
|
|
181
|
+
* VarType 33 -> Numeric
|
|
182
|
+
* VarType 32 -> String
|
|
183
|
+
* ColType 827 -> Other
|
|
184
|
+
*/
|
|
185
|
+
this._variablesUiData.push(variableUiData);
|
|
186
|
+
}
|
|
187
|
+
removeVariable(name) {
|
|
188
|
+
for (const variable of this._variables.slice()) {
|
|
189
|
+
if (variable['Name'] === name) {
|
|
190
|
+
const vuid = this._variablesUiData[this._variables.indexOf(variable)];
|
|
191
|
+
const vuidIdx = this._variablesUiData.indexOf(vuid);
|
|
192
|
+
if (vuidIdx !== -1) {
|
|
193
|
+
this._variablesUiData.splice(vuidIdx, 1);
|
|
194
|
+
}
|
|
195
|
+
const varIdx = this._variables.indexOf(variable);
|
|
196
|
+
if (varIdx !== -1) {
|
|
197
|
+
this._variables.splice(varIdx, 1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
addParameter(name, prompt, value, parameterType) {
|
|
203
|
+
if (!parameterType) {
|
|
204
|
+
parameterType = typeof value === 'string' ? 'String' : 'Numeric';
|
|
205
|
+
}
|
|
206
|
+
const parameter = { Name: name, Prompt: prompt, Value: value, Type: parameterType };
|
|
207
|
+
this._parameters.push(parameter);
|
|
208
|
+
}
|
|
209
|
+
removeParameter(name) {
|
|
210
|
+
for (const parameter of this._parameters.slice()) {
|
|
211
|
+
if (parameter['Name'] === name) {
|
|
212
|
+
const idx = this._parameters.indexOf(parameter);
|
|
213
|
+
if (idx !== -1) {
|
|
214
|
+
this._parameters.splice(idx, 1);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
dropParameterTypes() {
|
|
220
|
+
for (let p = 0; p < this._parameters.length; p++) {
|
|
221
|
+
if ('Type' in this._parameters[p]) {
|
|
222
|
+
delete this._parameters[p]['Type'];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
156
225
|
}
|
|
157
226
|
get body() {
|
|
158
227
|
return JSON.stringify(this.constructBody());
|
|
@@ -161,39 +230,80 @@ class Process extends TM1Object_1.TM1Object {
|
|
|
161
230
|
return this.constructBody();
|
|
162
231
|
}
|
|
163
232
|
constructBody() {
|
|
164
|
-
|
|
233
|
+
// general parameters — key order matches tm1py _construct_body_as_dict
|
|
234
|
+
const bodyAsDict = {
|
|
165
235
|
Name: this._name,
|
|
236
|
+
PrologProcedure: this._prologProcedure,
|
|
237
|
+
MetadataProcedure: this._metadataProcedure,
|
|
238
|
+
DataProcedure: this._dataProcedure,
|
|
239
|
+
EpilogProcedure: this._epilogProcedure,
|
|
166
240
|
HasSecurityAccess: this._hasSecurityAccess,
|
|
167
241
|
UIData: this._uiData,
|
|
242
|
+
DataSource: {},
|
|
168
243
|
Parameters: this._parameters,
|
|
169
244
|
Variables: this._variables,
|
|
170
245
|
VariablesUIData: this._variablesUiData,
|
|
171
|
-
PrologProcedure: this._prologProcedure,
|
|
172
|
-
MetadataProcedure: this._metadataProcedure,
|
|
173
|
-
DataProcedure: this._dataProcedure,
|
|
174
|
-
EpilogProcedure: this._epilogProcedure
|
|
175
|
-
};
|
|
176
|
-
// Add DataSource information
|
|
177
|
-
body.DataSource = {
|
|
178
|
-
Type: this._datasourceType,
|
|
179
|
-
AsciiDecimalSeparator: this._datasourceAsciiDecimalSeparator,
|
|
180
|
-
AsciiDelimiterChar: this._datasourceAsciiDelimiterChar,
|
|
181
|
-
AsciiDelimiterType: this._datasourceAsciiDelimiterType,
|
|
182
|
-
AsciiHeaderRecords: this._datasourceAsciiHeaderRecords,
|
|
183
|
-
AsciiQuoteCharacter: this._datasourceAsciiQuoteCharacter,
|
|
184
|
-
AsciiThousandSeparator: this._datasourceAsciiThousandSeparator,
|
|
185
|
-
DataSourceNameForClient: this._datasourceDataSourceNameForClient,
|
|
186
|
-
DataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
187
|
-
Password: this._datasourcePassword,
|
|
188
|
-
UserName: this._datasourceUserName,
|
|
189
|
-
Query: this._datasourceQuery,
|
|
190
|
-
UsesUnicode: this._datasourceUsesUnicode,
|
|
191
|
-
View: this._datasourceView,
|
|
192
|
-
Subset: this._datasourceSubset,
|
|
193
|
-
JsonRootPointer: this._datasourceJsonRootPointer,
|
|
194
|
-
JsonVariableMapping: this._datasourceJsonVariableMapping
|
|
195
246
|
};
|
|
196
|
-
|
|
247
|
+
// specific parameters (depending on datasource type)
|
|
248
|
+
if (this._datasourceType === 'ASCII') {
|
|
249
|
+
bodyAsDict['DataSource'] = {
|
|
250
|
+
Type: this._datasourceType,
|
|
251
|
+
asciiDecimalSeparator: this._datasourceAsciiDecimalSeparator,
|
|
252
|
+
asciiDelimiterChar: this._datasourceAsciiDelimiterChar,
|
|
253
|
+
asciiDelimiterType: this._datasourceAsciiDelimiterType,
|
|
254
|
+
asciiHeaderRecords: this._datasourceAsciiHeaderRecords,
|
|
255
|
+
asciiQuoteCharacter: this._datasourceAsciiQuoteCharacter,
|
|
256
|
+
asciiThousandSeparator: this._datasourceAsciiThousandSeparator,
|
|
257
|
+
dataSourceNameForClient: this._datasourceDataSourceNameForClient,
|
|
258
|
+
dataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
259
|
+
};
|
|
260
|
+
if (this._datasourceAsciiDelimiterType === 'FixedWidth') {
|
|
261
|
+
delete bodyAsDict['DataSource']['asciiDelimiterChar'];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else if (this._datasourceType === 'None') {
|
|
265
|
+
bodyAsDict['DataSource'] = { Type: 'None' };
|
|
266
|
+
}
|
|
267
|
+
else if (this._datasourceType === 'ODBC') {
|
|
268
|
+
bodyAsDict['DataSource'] = {
|
|
269
|
+
Type: this._datasourceType,
|
|
270
|
+
dataSourceNameForClient: this._datasourceDataSourceNameForClient,
|
|
271
|
+
dataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
272
|
+
userName: this._datasourceUserName,
|
|
273
|
+
password: this._datasourcePassword,
|
|
274
|
+
query: this._datasourceQuery,
|
|
275
|
+
usesUnicode: this._datasourceUsesUnicode,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
else if (this._datasourceType === 'TM1CubeView') {
|
|
279
|
+
bodyAsDict['DataSource'] = {
|
|
280
|
+
Type: this._datasourceType,
|
|
281
|
+
// Note: tm1py uses _datasource_data_source_name_for_server for BOTH client and server
|
|
282
|
+
dataSourceNameForClient: this._datasourceDataSourceNameForServer,
|
|
283
|
+
dataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
284
|
+
view: this._datasourceView,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
else if (this._datasourceType === 'TM1DimensionSubset') {
|
|
288
|
+
bodyAsDict['DataSource'] = {
|
|
289
|
+
Type: this._datasourceType,
|
|
290
|
+
// Note: tm1py uses _datasource_data_source_name_for_server for BOTH client and server
|
|
291
|
+
dataSourceNameForClient: this._datasourceDataSourceNameForServer,
|
|
292
|
+
dataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
293
|
+
subset: this._datasourceSubset,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
else if (this._datasourceType === 'JSON') {
|
|
297
|
+
bodyAsDict['DataSource'] = {
|
|
298
|
+
Type: this._datasourceType,
|
|
299
|
+
// Note: tm1py uses _datasource_data_source_name_for_server for BOTH client and server
|
|
300
|
+
dataSourceNameForClient: this._datasourceDataSourceNameForServer,
|
|
301
|
+
dataSourceNameForServer: this._datasourceDataSourceNameForServer,
|
|
302
|
+
jsonRootPointer: this._datasourceJsonRootPointer,
|
|
303
|
+
jsonVariableMapping: this._datasourceJsonVariableMapping,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return bodyAsDict;
|
|
197
307
|
}
|
|
198
308
|
}
|
|
199
309
|
exports.Process = Process;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subset.d.ts","sourceRoot":"","sources":["../../src/objects/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AAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,KAAK,GAAE,MAAW;WAYR,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe;WAa/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe;IAyE1E,SAAS,CAAC,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAcrD,SAAS,CAAC,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAsBvD"}
|
package/lib/objects/Subset.js
CHANGED
|
@@ -166,11 +166,18 @@ class AnonymousSubset extends Subset {
|
|
|
166
166
|
}
|
|
167
167
|
else if ("Hierarchy@odata.bind" in subsetAsDict) {
|
|
168
168
|
const hierarchyOdata = subsetAsDict["Hierarchy@odata.bind"];
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
// tm1py parity (TM1py/Objects/Subset.py): two read_object_name_from_url
|
|
170
|
+
// calls with these exact regex patterns. Both return match.group(1) (the
|
|
171
|
+
// first capture group), so both names resolve to the dimension. This
|
|
172
|
+
// mirrors tm1py's behavior — including the latent bug where a non-default
|
|
173
|
+
// hierarchy name in the URL is dropped. Do NOT "fix" without tm1py.
|
|
174
|
+
const dimResult = (0, Utils_1.readObjectNameFromUrl)(hierarchyOdata, /^Dimensions\('(.*?)'\)\/Hierarchies\('(.+?)'\)/);
|
|
175
|
+
const hierResult = (0, Utils_1.readObjectNameFromUrl)(hierarchyOdata, /^Dimensions\('(.+?)'\)\/Hierarchies\('(.*?)'\)/);
|
|
176
|
+
if (!dimResult || !hierResult) {
|
|
172
177
|
throw new Error(`Unexpected value for 'Hierarchy@odata.bind' property in subset dict: '${hierarchyOdata}'`);
|
|
173
178
|
}
|
|
179
|
+
dimensionName = dimResult;
|
|
180
|
+
hierarchyName = hierResult;
|
|
174
181
|
}
|
|
175
182
|
else {
|
|
176
183
|
throw new Error("Subset dict must contain 'Hierarchy' or 'Hierarchy@odata.bind' as key");
|
package/lib/objects/User.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TM1Object } from './TM1Object';
|
|
2
2
|
export declare enum UserType {
|
|
3
|
-
User =
|
|
4
|
-
SecurityAdmin =
|
|
5
|
-
DataAdmin =
|
|
6
|
-
Admin =
|
|
7
|
-
OperationsAdmin =
|
|
3
|
+
User = "User",
|
|
4
|
+
SecurityAdmin = "SecurityAdmin",
|
|
5
|
+
DataAdmin = "DataAdmin",
|
|
6
|
+
Admin = "Admin",
|
|
7
|
+
OperationsAdmin = "OperationsAdmin"
|
|
8
8
|
}
|
|
9
9
|
export declare class User extends TM1Object {
|
|
10
10
|
/** Abstraction of a TM1 User
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/objects/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,oBAAY,QAAQ;IAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/objects/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,oBAAY,QAAQ;IAChB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,eAAe,oBAAoB;CACtC;AAMD,qBAAa,IAAK,SAAQ,SAAS;IAC/B;;OAEG;IAEH,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,CAAC,SAAS,CAA2B;gBAGxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,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|
7
7
|
(function (UserType) {
|
|
8
|
-
UserType[
|
|
9
|
-
UserType[
|
|
10
|
-
UserType[
|
|
11
|
-
UserType[
|
|
12
|
-
UserType[
|
|
8
|
+
UserType["User"] = "User";
|
|
9
|
+
UserType["SecurityAdmin"] = "SecurityAdmin";
|
|
10
|
+
UserType["DataAdmin"] = "DataAdmin";
|
|
11
|
+
UserType["Admin"] = "Admin";
|
|
12
|
+
UserType["OperationsAdmin"] = "OperationsAdmin";
|
|
13
13
|
})(UserType || (exports.UserType = UserType = {}));
|
|
14
|
+
const USER_TYPE_LOOKUP = new Map(Object.entries(UserType).map(([k, v]) => [k.toLowerCase(), v]));
|
|
14
15
|
class User extends TM1Object_1.TM1Object {
|
|
15
16
|
constructor(name, groups, friendlyName, password, userType, enabled) {
|
|
16
17
|
super();
|
|
@@ -55,25 +56,14 @@ class User extends TM1Object_1.TM1Object {
|
|
|
55
56
|
return this._userType;
|
|
56
57
|
}
|
|
57
58
|
set userType(value) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
for (const [key, enumValue] of Object.entries(UserType)) {
|
|
62
|
-
if (key.toLowerCase() === lowerValue) {
|
|
63
|
-
this._userType = enumValue;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (this._userType === undefined) {
|
|
68
|
-
throw new Error(`Invalid element type=${value}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this._userType = value;
|
|
59
|
+
const resolved = USER_TYPE_LOOKUP.get((0, Utils_1.lowerAndDropSpaces)(value));
|
|
60
|
+
if (resolved === undefined) {
|
|
61
|
+
throw new Error(`Invalid user type=${value}`);
|
|
73
62
|
}
|
|
63
|
+
this._userType = resolved;
|
|
74
64
|
// update groups as well, since TM1 doesn't react to change in user_type property
|
|
75
65
|
if (this._userType !== UserType.User) {
|
|
76
|
-
this.addGroup(this._userType
|
|
66
|
+
this.addGroup(this._userType);
|
|
77
67
|
}
|
|
78
68
|
}
|
|
79
69
|
get friendlyName() {
|
|
@@ -89,7 +79,7 @@ class User extends TM1Object_1.TM1Object {
|
|
|
89
79
|
this._password = value;
|
|
90
80
|
}
|
|
91
81
|
get isAdmin() {
|
|
92
|
-
return this._groups.has("
|
|
82
|
+
return this._groups.has("Admin");
|
|
93
83
|
}
|
|
94
84
|
get isDataAdmin() {
|
|
95
85
|
return this._groups.has("Admin") || this._groups.has("DataAdmin");
|
|
@@ -125,13 +115,14 @@ class User extends TM1Object_1.TM1Object {
|
|
|
125
115
|
return User.fromDict(userAsDict);
|
|
126
116
|
}
|
|
127
117
|
static fromDict(userAsDict) {
|
|
118
|
+
var _a;
|
|
128
119
|
/** Alternative constructor
|
|
129
120
|
*
|
|
130
121
|
* :param user_as_dict: user as dict
|
|
131
122
|
* :return: user, an instance of this class
|
|
132
123
|
*/
|
|
133
124
|
return new User(userAsDict.Name, userAsDict.Groups.map((group) => group.Name), userAsDict.FriendlyName, undefined, // password not included in dict
|
|
134
|
-
userAsDict.Type, userAsDict.Enabled);
|
|
125
|
+
(_a = userAsDict.Type) !== null && _a !== void 0 ? _a : undefined, userAsDict.Enabled);
|
|
135
126
|
}
|
|
136
127
|
get body() {
|
|
137
128
|
return this.constructBody();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationService.d.ts","sourceRoot":"","sources":["../../src/services/ApplicationService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ApplicationService.d.ts","sourceRoot":"","sources":["../../src/services/ApplicationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACH,WAAW,EACX,gBAAgB,EAIhB,mBAAmB,EAOtB,MAAM,wBAAwB,CAAC;AAIhC,qBAAa,kB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
|
46
46
|
result?: any;
|
|
47
47
|
parameters?: Record<string, any>;
|
|
48
48
|
metadata?: Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* When true, the operation is tracked with a client-side UUID and the
|
|
51
|
+
* TM1 server has no record of it. `getAsyncOperationStatus` returns the
|
|
52
|
+
* cached status instead of polling `/_async('{id}')`.
|
|
53
|
+
*/
|
|
54
|
+
trackedLocally?: boolean;
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* Interface for schedule configuration
|
|
@@ -87,6 +93,8 @@ export declare class AsyncOperationService {
|
|
|
87
93
|
* @returns Promise resolving to the operation status
|
|
88
94
|
*/
|
|
89
95
|
getAsyncOperationStatus(operationId: string): Promise<OperationStatus>;
|
|
96
|
+
private deriveStatusFromResponse;
|
|
97
|
+
private extractErrorFromResponse;
|
|
90
98
|
/**
|
|
91
99
|
* List all active async operations
|
|
92
100
|
*
|
|
@@ -169,7 +177,6 @@ export declare class AsyncOperationService {
|
|
|
169
177
|
getAllOperations(): AsyncOperation[];
|
|
170
178
|
private generateOperationId;
|
|
171
179
|
private isTerminalStatus;
|
|
172
|
-
private mapServerStatus;
|
|
173
180
|
private stopPolling;
|
|
174
181
|
private sleep;
|
|
175
182
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncOperationService.d.ts","sourceRoot":"","sources":["../../src/services/AsyncOperationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,oBAAY,aAAa;IACrB,iBAAiB,qBAAqB;IACtC,SAAS,aAAa;IACtB,cAAc,kBAAkB;IAChC,cAAc,kBAAkB;IAChC,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AsyncOperationService.d.ts","sourceRoot":"","sources":["../../src/services/AsyncOperationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,oBAAY,aAAa;IACrB,iBAAiB,qBAAqB;IACtC,SAAS,aAAa;IACtB,cAAc,kBAAkB;IAChC,cAAc,kBAAkB;IAChC,MAAM,WAAW;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,aAA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qBAAqB,CACxB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE,GAAG,EACZ,KAAK,CAAC,EAAE,MAAM,GACf,IAAI;IAkBP;;;;;OAKG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIpE;;;;OAIG;IACI,0BAA0B,CAAC,QAAQ,GAAE,MAAgB,GAAG,IAAI;IAmBnE;;;;OAIG;IACI,gBAAgB,IAAI,cAAc,EAAE;IAM3C,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,KAAK;IAIb;;OAEG;IACI,OAAO,IAAI,IAAI;CAMzB"}
|
|
@@ -44,6 +44,7 @@ class AsyncOperationService {
|
|
|
44
44
|
* @returns Promise resolving to the operation status
|
|
45
45
|
*/
|
|
46
46
|
async getAsyncOperationStatus(operationId) {
|
|
47
|
+
var _a, _b, _c;
|
|
47
48
|
const operation = this.operations.get(operationId);
|
|
48
49
|
if (!operation) {
|
|
49
50
|
throw new TM1Exception_1.TM1Exception(`Operation with ID ${operationId} not found`);
|
|
@@ -52,29 +53,79 @@ class AsyncOperationService {
|
|
|
52
53
|
if (this.isTerminalStatus(operation.status)) {
|
|
53
54
|
return operation.status;
|
|
54
55
|
}
|
|
55
|
-
//
|
|
56
|
+
// Locally tracked operations hold a client-side UUID; the TM1 server
|
|
57
|
+
// would return 404 for them. Rely on the in-memory cache, which is
|
|
58
|
+
// populated by background .then()/.catch() callbacks in helpers like
|
|
59
|
+
// ProcessService.executeWithReturnAsync.
|
|
60
|
+
if (operation.trackedLocally) {
|
|
61
|
+
return operation.status;
|
|
62
|
+
}
|
|
63
|
+
// Poll TM1 server for updated status. /_async('{id}') returns 202 while
|
|
64
|
+
// the op is pending, and 200/201 with the final operation payload once done.
|
|
65
|
+
// TM1 v12 may encode embedded failures in the `asyncresult` response header.
|
|
56
66
|
try {
|
|
57
|
-
const url = (0, Utils_1.formatUrl)("/
|
|
58
|
-
const response = await this.rest.get(url);
|
|
59
|
-
const serverStatus = this.
|
|
60
|
-
// Update operation status
|
|
67
|
+
const url = (0, Utils_1.formatUrl)("/_async('{}')", operationId);
|
|
68
|
+
const response = await this.rest.get(url, { asyncRequestsMode: false });
|
|
69
|
+
const serverStatus = this.deriveStatusFromResponse(response);
|
|
61
70
|
operation.status = serverStatus;
|
|
62
71
|
if (this.isTerminalStatus(serverStatus)) {
|
|
63
72
|
operation.endTime = new Date();
|
|
64
|
-
if (serverStatus === OperationStatus.COMPLETED
|
|
65
|
-
operation.result = response.data
|
|
73
|
+
if (serverStatus === OperationStatus.COMPLETED) {
|
|
74
|
+
operation.result = response.data;
|
|
66
75
|
}
|
|
67
|
-
else if (serverStatus === OperationStatus.FAILED
|
|
68
|
-
operation.error = response
|
|
76
|
+
else if (serverStatus === OperationStatus.FAILED) {
|
|
77
|
+
operation.error = this.extractErrorFromResponse(response);
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
return serverStatus;
|
|
72
81
|
}
|
|
73
82
|
catch (error) {
|
|
74
|
-
//
|
|
83
|
+
// HTTP 4xx/5xx surfaces as a thrown TM1RestException — treat as a terminal FAILED
|
|
84
|
+
// so callers stop polling. Network errors (no status) leave cached status intact.
|
|
85
|
+
// Note: 404 is treated as FAILED here (operation never materialized). This differs
|
|
86
|
+
// from ProcessService.pollExecuteWithReturn which treats 404 as "not ready yet"
|
|
87
|
+
// because process async IDs can take a moment to register on the server.
|
|
88
|
+
const status = (_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
89
|
+
if (typeof status === 'number' && status >= 400) {
|
|
90
|
+
operation.status = OperationStatus.FAILED;
|
|
91
|
+
operation.endTime = new Date();
|
|
92
|
+
operation.error = (_c = error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : String(error);
|
|
93
|
+
return OperationStatus.FAILED;
|
|
94
|
+
}
|
|
75
95
|
return operation.status;
|
|
76
96
|
}
|
|
77
97
|
}
|
|
98
|
+
deriveStatusFromResponse(response) {
|
|
99
|
+
var _a;
|
|
100
|
+
if (response.status === 202) {
|
|
101
|
+
return OperationStatus.RUNNING;
|
|
102
|
+
}
|
|
103
|
+
const asyncResult = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['asyncresult'];
|
|
104
|
+
if (typeof asyncResult === 'string') {
|
|
105
|
+
const embedded = parseInt(asyncResult.trim().split(/\s+/)[0], 10);
|
|
106
|
+
if (!Number.isNaN(embedded) && (embedded < 200 || embedded >= 300)) {
|
|
107
|
+
return OperationStatus.FAILED;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (response.status === 200 || response.status === 201) {
|
|
111
|
+
return OperationStatus.COMPLETED;
|
|
112
|
+
}
|
|
113
|
+
return OperationStatus.PENDING;
|
|
114
|
+
}
|
|
115
|
+
extractErrorFromResponse(response) {
|
|
116
|
+
var _a, _b, _c;
|
|
117
|
+
const asyncResult = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['asyncresult'];
|
|
118
|
+
if (typeof asyncResult === 'string') {
|
|
119
|
+
return asyncResult;
|
|
120
|
+
}
|
|
121
|
+
if (typeof response.data === 'string') {
|
|
122
|
+
return response.data;
|
|
123
|
+
}
|
|
124
|
+
if ((_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) {
|
|
125
|
+
return response.data.error.message;
|
|
126
|
+
}
|
|
127
|
+
return JSON.stringify(response.data);
|
|
128
|
+
}
|
|
78
129
|
/**
|
|
79
130
|
* List all active async operations
|
|
80
131
|
*
|
|
@@ -110,12 +161,11 @@ class AsyncOperationService {
|
|
|
110
161
|
// Stop polling if active
|
|
111
162
|
this.stopPolling(operationId);
|
|
112
163
|
try {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
await this.rest.post(url, {});
|
|
164
|
+
const url = (0, Utils_1.formatUrl)("/_async('{}')", operationId);
|
|
165
|
+
await this.rest.delete(url, { asyncRequestsMode: false });
|
|
116
166
|
}
|
|
117
167
|
catch (error) {
|
|
118
|
-
|
|
168
|
+
console.warn(`Failed to cancel async operation ${operationId} on server:`, error);
|
|
119
169
|
}
|
|
120
170
|
// Update operation status
|
|
121
171
|
operation.status = OperationStatus.CANCELLED;
|
|
@@ -173,6 +223,9 @@ class AsyncOperationService {
|
|
|
173
223
|
*/
|
|
174
224
|
async createAsyncOperation(definition) {
|
|
175
225
|
const operationId = this.generateOperationId();
|
|
226
|
+
// generateOperationId produces a client-side UUID; the server has no
|
|
227
|
+
// record of it, so polling /_async('{id}') would 404. Mark as locally
|
|
228
|
+
// tracked so getAsyncOperationStatus returns the cached status instead.
|
|
176
229
|
const operation = {
|
|
177
230
|
id: operationId,
|
|
178
231
|
type: definition.type,
|
|
@@ -180,7 +233,8 @@ class AsyncOperationService {
|
|
|
180
233
|
status: OperationStatus.PENDING,
|
|
181
234
|
startTime: new Date(),
|
|
182
235
|
parameters: definition.parameters,
|
|
183
|
-
metadata: definition.metadata
|
|
236
|
+
metadata: definition.metadata,
|
|
237
|
+
trackedLocally: true
|
|
184
238
|
};
|
|
185
239
|
this.operations.set(operationId, operation);
|
|
186
240
|
return operationId;
|
|
@@ -337,17 +391,6 @@ class AsyncOperationService {
|
|
|
337
391
|
status === OperationStatus.CANCELLED ||
|
|
338
392
|
status === OperationStatus.TIMEOUT;
|
|
339
393
|
}
|
|
340
|
-
mapServerStatus(serverStatus) {
|
|
341
|
-
const statusMap = {
|
|
342
|
-
'Pending': OperationStatus.PENDING,
|
|
343
|
-
'Running': OperationStatus.RUNNING,
|
|
344
|
-
'CompletedSuccessfully': OperationStatus.COMPLETED,
|
|
345
|
-
'CompletedWithErrors': OperationStatus.FAILED,
|
|
346
|
-
'Cancelled': OperationStatus.CANCELLED,
|
|
347
|
-
'Timeout': OperationStatus.TIMEOUT
|
|
348
|
-
};
|
|
349
|
-
return statusMap[serverStatus] || OperationStatus.PENDING;
|
|
350
|
-
}
|
|
351
394
|
stopPolling(operationId) {
|
|
352
395
|
const intervalId = this.pollingIntervals.get(operationId);
|
|
353
396
|
if (intervalId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../src/services/FileService.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../src/services/FileService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,WAAY,SAAQ,aAAa;IAC1C;OACG;IAEH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAY;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAY;IACxD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;gBAEhC,IAAI,EAAE,WAAW;IAKhB,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAM7B,WAAW,CAAC,SAAS,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOtD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQtC,MAAM,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,eAAe,CAAC,EAAE,OAAO,EACzB,YAAY,GAAE,MAAY,EAC1B,UAAU,GAAE,MAAU,GACvB,OAAO,CAAC,aAAa,CAAC;IA8BZ,MAAM,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,eAAe,CAAC,EAAE,OAAO,EACzB,YAAY,GA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