tm1npm 2.0.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/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/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/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/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/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/Subset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAa,MAAO,SAAQ,SAAS;IACjC;OACG;IAEH,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAW;gBAGxB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EAAE;IAmBvB,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,aAAa,CAAC,KAAK,EAAE,MAAM,EAErC;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,aAAa,CAAC,KAAK,EAAE,MAAM,EAErC;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,KAAK,IAAI,MAAM,GAAG,SAAS,CAErC;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAEzC;IAED,IAAW,UAAU,IAAI,MAAM,GAAG,SAAS,CAE1C;IAED,IAAW,UAAU,CAAC,KAAK,EAAE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AC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAQ5C,SAAS,CAAC,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAerD,SAAS,CAAC,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAuBvD;AAGD,qBAAa,eAAgB,SAAQ,MAAM;IACvC;OACG;gBAGC,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,CAAC,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,S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AI7B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;WAUlC,QAAQ,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IAgB7C,IAAW,IAAI,IAAI,MAAM,CAExB;IAEM,aAAa,IAAI,MAAM;CAqBjC"}
|
package/lib/objects/User.js
CHANGED
|
@@ -5,12 +5,13 @@ const TM1Object_1 = require("./TM1Object");
|
|
|
5
5
|
const Utils_1 = require("../utils/Utils");
|
|
6
6
|
var UserType;
|
|
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();
|
|
@@ -271,7 +271,9 @@ describe('DebuggerService and Enhanced Process Debugging (Issue #13)', () => {
|
|
|
271
271
|
expect(plan.hasVariables).toBe(true);
|
|
272
272
|
expect(plan.variableCount).toBe(1);
|
|
273
273
|
expect(plan.procedures.hasPrologProcedure).toBe(true);
|
|
274
|
-
|
|
274
|
+
// addGeneratedStringToCode prepends ~73 chars to each procedure tab,
|
|
275
|
+
// so actual total exceeds 2000 → 'High'
|
|
276
|
+
expect(plan.estimatedComplexity).toBe('High');
|
|
275
277
|
});
|
|
276
278
|
});
|
|
277
279
|
});
|