@memberjunction/global 2.111.0 → 2.112.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.
Files changed (117) hide show
  1. package/dist/Core.d.ts +29 -0
  2. package/dist/Core.d.ts.map +1 -0
  3. package/dist/Core.js +58 -0
  4. package/dist/Core.js.map +1 -0
  5. package/dist/generic/QueryCache.d.ts +85 -0
  6. package/dist/generic/QueryCache.d.ts.map +1 -0
  7. package/dist/generic/QueryCache.js +198 -0
  8. package/dist/generic/QueryCache.js.map +1 -0
  9. package/dist/generic/QueryCacheConfig.d.ts +72 -0
  10. package/dist/generic/QueryCacheConfig.d.ts.map +1 -0
  11. package/dist/generic/QueryCacheConfig.js +3 -0
  12. package/dist/generic/QueryCacheConfig.js.map +1 -0
  13. package/dist/generic/applicationInfo.d.ts +138 -0
  14. package/dist/generic/applicationInfo.d.ts.map +1 -0
  15. package/dist/generic/applicationInfo.js +177 -0
  16. package/dist/generic/applicationInfo.js.map +1 -0
  17. package/dist/generic/authEvaluator.d.ts +25 -0
  18. package/dist/generic/authEvaluator.d.ts.map +1 -0
  19. package/dist/generic/authEvaluator.js +49 -0
  20. package/dist/generic/authEvaluator.js.map +1 -0
  21. package/dist/generic/authTypes.d.ts +193 -0
  22. package/dist/generic/authTypes.d.ts.map +1 -0
  23. package/dist/generic/authTypes.js +19 -0
  24. package/dist/generic/authTypes.js.map +1 -0
  25. package/dist/generic/baseEngine.d.ts +260 -0
  26. package/dist/generic/baseEngine.d.ts.map +1 -0
  27. package/dist/generic/baseEngine.js +510 -0
  28. package/dist/generic/baseEngine.js.map +1 -0
  29. package/dist/generic/baseEntity.d.ts +691 -0
  30. package/dist/generic/baseEntity.d.ts.map +1 -0
  31. package/dist/generic/baseEntity.js +1688 -0
  32. package/dist/generic/baseEntity.js.map +1 -0
  33. package/dist/generic/baseInfo.d.ts +24 -0
  34. package/dist/generic/baseInfo.d.ts.map +1 -0
  35. package/dist/generic/baseInfo.js +53 -0
  36. package/dist/generic/baseInfo.js.map +1 -0
  37. package/dist/generic/compositeKey.d.ts +206 -0
  38. package/dist/generic/compositeKey.d.ts.map +1 -0
  39. package/dist/generic/compositeKey.js +412 -0
  40. package/dist/generic/compositeKey.js.map +1 -0
  41. package/dist/generic/databaseProviderBase.d.ts +46 -0
  42. package/dist/generic/databaseProviderBase.d.ts.map +1 -0
  43. package/dist/generic/databaseProviderBase.js +14 -0
  44. package/dist/generic/databaseProviderBase.js.map +1 -0
  45. package/dist/generic/entityInfo.d.ts +983 -0
  46. package/dist/generic/entityInfo.d.ts.map +1 -0
  47. package/dist/generic/entityInfo.js +1401 -0
  48. package/dist/generic/entityInfo.js.map +1 -0
  49. package/dist/generic/explorerNavigationItem.d.ts +20 -0
  50. package/dist/generic/explorerNavigationItem.d.ts.map +1 -0
  51. package/dist/generic/explorerNavigationItem.js +29 -0
  52. package/dist/generic/explorerNavigationItem.js.map +1 -0
  53. package/dist/generic/interfaces.d.ts +610 -0
  54. package/dist/generic/interfaces.d.ts.map +1 -0
  55. package/dist/generic/interfaces.js +211 -0
  56. package/dist/generic/interfaces.js.map +1 -0
  57. package/dist/generic/libraryInfo.d.ts +40 -0
  58. package/dist/generic/libraryInfo.d.ts.map +1 -0
  59. package/dist/generic/libraryInfo.js +56 -0
  60. package/dist/generic/libraryInfo.js.map +1 -0
  61. package/dist/generic/logging.d.ts +179 -0
  62. package/dist/generic/logging.d.ts.map +1 -0
  63. package/dist/generic/logging.js +382 -0
  64. package/dist/generic/logging.js.map +1 -0
  65. package/dist/generic/metadata.d.ts +305 -0
  66. package/dist/generic/metadata.d.ts.map +1 -0
  67. package/dist/generic/metadata.js +454 -0
  68. package/dist/generic/metadata.js.map +1 -0
  69. package/dist/generic/metadataUtil.d.ts +8 -0
  70. package/dist/generic/metadataUtil.d.ts.map +1 -0
  71. package/dist/generic/metadataUtil.js +36 -0
  72. package/dist/generic/metadataUtil.js.map +1 -0
  73. package/dist/generic/providerBase.d.ts +546 -0
  74. package/dist/generic/providerBase.d.ts.map +1 -0
  75. package/dist/generic/providerBase.js +999 -0
  76. package/dist/generic/providerBase.js.map +1 -0
  77. package/dist/generic/queryInfo.d.ts +460 -0
  78. package/dist/generic/queryInfo.d.ts.map +1 -0
  79. package/dist/generic/queryInfo.js +633 -0
  80. package/dist/generic/queryInfo.js.map +1 -0
  81. package/dist/generic/querySQLFilters.d.ts +54 -0
  82. package/dist/generic/querySQLFilters.d.ts.map +1 -0
  83. package/dist/generic/querySQLFilters.js +84 -0
  84. package/dist/generic/querySQLFilters.js.map +1 -0
  85. package/dist/generic/runQuery.d.ts +96 -0
  86. package/dist/generic/runQuery.d.ts.map +1 -0
  87. package/dist/generic/runQuery.js +66 -0
  88. package/dist/generic/runQuery.js.map +1 -0
  89. package/dist/generic/runQuerySQLFilterImplementations.d.ts +51 -0
  90. package/dist/generic/runQuerySQLFilterImplementations.d.ts.map +1 -0
  91. package/dist/generic/runQuerySQLFilterImplementations.js +238 -0
  92. package/dist/generic/runQuerySQLFilterImplementations.js.map +1 -0
  93. package/dist/generic/runReport.d.ts +25 -0
  94. package/dist/generic/runReport.d.ts.map +1 -0
  95. package/dist/generic/runReport.js +42 -0
  96. package/dist/generic/runReport.js.map +1 -0
  97. package/dist/generic/securityInfo.d.ts +355 -0
  98. package/dist/generic/securityInfo.d.ts.map +1 -0
  99. package/dist/generic/securityInfo.js +425 -0
  100. package/dist/generic/securityInfo.js.map +1 -0
  101. package/dist/generic/transactionGroup.d.ts +184 -0
  102. package/dist/generic/transactionGroup.d.ts.map +1 -0
  103. package/dist/generic/transactionGroup.js +357 -0
  104. package/dist/generic/transactionGroup.js.map +1 -0
  105. package/dist/generic/util.d.ts +81 -0
  106. package/dist/generic/util.d.ts.map +1 -0
  107. package/dist/generic/util.js +301 -0
  108. package/dist/generic/util.js.map +1 -0
  109. package/dist/views/runView.d.ts +150 -0
  110. package/dist/views/runView.d.ts.map +1 -0
  111. package/dist/views/runView.js +100 -0
  112. package/dist/views/runView.js.map +1 -0
  113. package/dist/views/viewInfo.d.ts +121 -0
  114. package/dist/views/viewInfo.d.ts.map +1 -0
  115. package/dist/views/viewInfo.js +182 -0
  116. package/dist/views/viewInfo.js.map +1 -0
  117. package/package.json +1 -1
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StripContainingParens = exports.StripSingleQuotes = exports.StripUnicodePrefix = exports.ExtractActualDefaultValue = exports.Concurrent = exports.CodeNameFromString = exports.StripStopWords = exports.CommonStopWords = exports.SQLMaxLength = exports.SQLFullType = exports.FormatValue = exports.TypeScriptTypeFromSQLTypeWithNullableOption = exports.TypeScriptTypeFromSQLType = void 0;
4
+ const logging_1 = require("./logging");
5
+ /**
6
+ * Returns the TypeScript type that corresponds to the SQL type passed in
7
+ */
8
+ function TypeScriptTypeFromSQLType(sqlType) {
9
+ switch (sqlType.trim().toLowerCase()) {
10
+ case 'text':
11
+ case 'char':
12
+ case 'varchar':
13
+ case 'ntext':
14
+ case 'nchar':
15
+ case 'nvarchar':
16
+ case 'uniqueidentifier': //treat this as a string
17
+ return 'string';
18
+ case 'datetime':
19
+ case 'datetime2':
20
+ case 'datetimeoffset':
21
+ case 'date':
22
+ case 'time':
23
+ return 'Date';
24
+ case 'bit':
25
+ return 'boolean';
26
+ default:
27
+ return 'number';
28
+ }
29
+ }
30
+ exports.TypeScriptTypeFromSQLType = TypeScriptTypeFromSQLType;
31
+ function TypeScriptTypeFromSQLTypeWithNullableOption(sqlType, addNullableOption) {
32
+ const retVal = TypeScriptTypeFromSQLType(sqlType);
33
+ if (addNullableOption) {
34
+ return retVal + ' | null';
35
+ }
36
+ else {
37
+ return retVal;
38
+ }
39
+ }
40
+ exports.TypeScriptTypeFromSQLTypeWithNullableOption = TypeScriptTypeFromSQLTypeWithNullableOption;
41
+ /**
42
+ * Formats a value based on the parameters passed in
43
+ * @param sqlType - Required - the base type in SQL Server, for example int, nvarchar, etc. For types that have a length like numeric(28,4) or nvarchar(50) do NOT provide the length, just numeric and nvarchar in those examples
44
+ * @param value - Value to format
45
+ * @param decimals Number of decimals to show, defaults to 2
46
+ * @param currency Currency to use when formatting, defaults to USD
47
+ * @param maxLength Maximum length of the string to return, if the formatted value is longer than this length then the string will be truncated and the trailingChars will be appended to the end of the string
48
+ * @param trailingChars Only used if maxLength is > 0 and the string being formatted is > maxLength, this is the string that will be appended to the end of the string to indicate that it was truncated, defaults to "..."
49
+ * @returns either the original string value or a formatted version. If the format cannot be applied an an exception occurs it is captured and the error is put to the log, and the original value is returned
50
+ */
51
+ function FormatValue(sqlType, value, decimals = 2, currency = 'USD', maxLength = 0, trailingChars = "...") {
52
+ try {
53
+ const retVal = FormatValueInternal(sqlType, value, decimals, currency, maxLength, trailingChars);
54
+ if (maxLength > 0 && retVal && retVal.length > maxLength)
55
+ return retVal.substring(0, maxLength) + trailingChars;
56
+ else
57
+ return retVal;
58
+ }
59
+ catch (e) {
60
+ (0, logging_1.LogError)(`Error formatting value ${value} of type ${sqlType} with decimals ${decimals} and currency ${currency}`, e);
61
+ return value; // just return the value as is if we cant format it
62
+ }
63
+ }
64
+ exports.FormatValue = FormatValue;
65
+ // internal only function used by FormatValue() to do the actual formatting
66
+ function FormatValueInternal(sqlType, value, decimals = 2, currency = 'USD', maxLength = 0, trailingChars = "...") {
67
+ if (value === null || value === undefined) {
68
+ return value;
69
+ }
70
+ switch (sqlType.trim().toLowerCase()) {
71
+ case 'money':
72
+ if (isNaN(value))
73
+ return value;
74
+ else
75
+ return new Intl.NumberFormat(undefined, { style: 'currency',
76
+ currency: currency,
77
+ minimumFractionDigits: decimals,
78
+ maximumFractionDigits: decimals }).format(value);
79
+ case 'date':
80
+ case 'time':
81
+ case 'datetime':
82
+ case 'datetime2':
83
+ case 'datetimeoffset':
84
+ let date = new Date(value);
85
+ return new Intl.DateTimeFormat().format(date);
86
+ case 'decimal':
87
+ case 'real':
88
+ case 'float':
89
+ return new Intl.NumberFormat(undefined, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }).format(value);
90
+ case 'int':
91
+ return new Intl.NumberFormat(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
92
+ case 'percent':
93
+ return new Intl.NumberFormat(undefined, { style: 'percent',
94
+ minimumFractionDigits: decimals,
95
+ maximumFractionDigits: decimals }).format(value);
96
+ default:
97
+ return value;
98
+ }
99
+ }
100
+ /**
101
+ * Returns a string that contains the full SQL type including length, precision and scale if applicable
102
+ * @param baseType
103
+ * @param length
104
+ * @param precision
105
+ * @param scale
106
+ * @returns
107
+ */
108
+ function SQLFullType(baseType, length, precision, scale) {
109
+ const type = baseType.trim().toLowerCase();
110
+ let sOutput = type;
111
+ if (type === 'varchar')
112
+ sOutput += `(${length > 0 ? length : 'MAX'})`;
113
+ else if (type === 'nvarchar')
114
+ sOutput += `(${length > 0 ? length / 2 : 'MAX'})`; // nvarchar divide the system length by 2 to get the actual length for the output
115
+ else if (type === 'char')
116
+ sOutput += `(${length})`;
117
+ else if (type === 'nchar')
118
+ sOutput += `(${length / 2})`; // nchar divide the system length by 2 to get the actual length for the output
119
+ else if (type === 'decimal' || type === 'numeric')
120
+ sOutput += `(${precision}, ${scale})`;
121
+ else if (type === 'float')
122
+ sOutput += `(${precision})`;
123
+ return sOutput;
124
+ }
125
+ exports.SQLFullType = SQLFullType;
126
+ /**
127
+ * This function determines the actual maximum length for a given SQL field based on the base type and the length specified in the schema.
128
+ * For example, for a varchar(50) field, the length is 50, for an nvarchar(50) field, the length is 50/2 = 25
129
+ * @param sqlBaseType
130
+ * @param sqlLength
131
+ * @returns
132
+ */
133
+ function SQLMaxLength(sqlBaseType, sqlLength) {
134
+ switch (sqlBaseType.trim().toLowerCase()) {
135
+ case 'varchar':
136
+ case 'char':
137
+ case 'text':
138
+ return sqlLength;
139
+ case 'nvarchar':
140
+ case 'nchar':
141
+ case 'ntext':
142
+ return sqlLength / 2; // length in the schema is the # of bytes and on unicode fields we divide by 2 to get the # of characters a user is allowed to put in.
143
+ default:
144
+ return 0;
145
+ }
146
+ }
147
+ exports.SQLMaxLength = SQLMaxLength;
148
+ const _stopwords = [
149
+ "a", "about", "above", "after", "again", "against", "ain", "all", "am", "an", "and", "any", "are", "aren", "aren't", "as", "at",
150
+ "be", "because", "been", "before", "being", "below", "between", "both", "but", "by",
151
+ "can", "couldn", "couldn't", "could",
152
+ "d", "did", "didn", "didn't", "do", "does", "doesn", "doesn't", "doing", "don", "don't", "down", "during",
153
+ "each",
154
+ "few", "for", "from", "further",
155
+ "had", "hadn", "hadn't", "has", "hasn", "hasn't", "have", "haven", "haven't", "having", "he", "her", "here", "hers", "herself", "him", "himself", "his", "how",
156
+ "i", "if", "in", "into", "is", "isn", "isn't", "it", "it's", "its", "itself",
157
+ "just",
158
+ "ll",
159
+ "m", "ma", "me", "mightn", "mightn't", "more", "most", "mustn", "mustn't", "my", "myself",
160
+ "needn", "needn't", "no", "nor", "not", "now",
161
+ "o", "of", "off", "on", "once", "only", "or", "other", "our", "ours", "ourselves", "out", "over", "own",
162
+ "re",
163
+ "s", "same", "shan", "shan't", "she", "she's", "should", "should've", "shouldn", "shouldn't", "so", "some", "such",
164
+ "t", "than", "that", "that'll", "the", "their", "theirs", "them", "themselves", "then", "there", "these", "they", "this", "those", "through", "to", "too",
165
+ "under", "until", "up",
166
+ "ve", "very",
167
+ "was", "wasn", "wasn't", "we", "were", "weren", "weren't", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "won", "won't", "wouldn", "wouldn't",
168
+ "y", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves"
169
+ ];
170
+ /**
171
+ * This function returns an array of common stop words that are used in text processing
172
+ * @returns An array of common stop words that are used in text processing
173
+ */
174
+ function CommonStopWords() {
175
+ return _stopwords;
176
+ }
177
+ exports.CommonStopWords = CommonStopWords;
178
+ /**
179
+ * This function takes a string and removes common stop words from it, using the CommonStopWords() function to get the list of stop words
180
+ * @param inputString
181
+ * @returns
182
+ */
183
+ function StripStopWords(inputString) {
184
+ const stopwordPattern = new RegExp(`\\b(${_stopwords.join('|')})\\b`, 'gi');
185
+ let outputString = inputString.replace(stopwordPattern, '');
186
+ outputString = outputString.replace(/ +/g, ' '); // Replace multiple spaces with a single space
187
+ return outputString;
188
+ }
189
+ exports.StripStopWords = StripStopWords;
190
+ /**
191
+ * Returns a system-wide standard CodeName which is a programmatically acceptable identifier for a class, variable, etc using a standard replacement strategy for characters that are not acceptable in that context from a regular name
192
+ */
193
+ function CodeNameFromString(input) {
194
+ // the code below replaces characters invalid for SQL or TypeScript identifiers with _ and stashes the result in a private variable so we only do this once
195
+ // Replace all invalid characters with _
196
+ let codeName = input.replace(/[^a-zA-Z0-9_]/g, "_");
197
+ // Prepend an underscore if the first character is a number
198
+ if (/^[0-9]/.test(codeName)) {
199
+ codeName = "_" + codeName;
200
+ }
201
+ return codeName;
202
+ }
203
+ exports.CodeNameFromString = CodeNameFromString;
204
+ /**
205
+ * Run concurrent promises with a maximum concurrency level
206
+ * @param concurrency - The number of concurrently running promises
207
+ * @param funcs - An array of functions that return promises
208
+ * @returns A promise that resolves to an array of the resolved values from the promises returned by funcs
209
+ */
210
+ function Concurrent(concurrency, funcs) {
211
+ return new Promise((resolve, reject) => {
212
+ let index = -1;
213
+ const p = [];
214
+ for (let i = 0; i < Math.max(1, Math.min(concurrency, funcs.length)); i++)
215
+ runPromise();
216
+ function runPromise() {
217
+ if (++index < funcs.length)
218
+ (p[p.length] = funcs[index]()).then(runPromise).catch(reject);
219
+ else if (index === funcs.length)
220
+ Promise.all(p).then(resolve).catch(reject);
221
+ }
222
+ });
223
+ }
224
+ exports.Concurrent = Concurrent;
225
+ /**
226
+ * The DBMS may store the default value for a column with extra parens, for example ((1)) or (getdate()) or (('Pending')) or (('Active')) and in addition for unicode characters
227
+ * it may prefix the value with an N, for example N'Active'. This function will strip out the extra parens and the N prefix if it exists and return the actual default value
228
+ * @param storedDefaultValue - The default value as stored in the DBMS
229
+ */
230
+ function ExtractActualDefaultValue(storedDefaultValue) {
231
+ if (!storedDefaultValue || storedDefaultValue.trim().length === 0)
232
+ return storedDefaultValue;
233
+ const noParens = StripContainingParens(storedDefaultValue);
234
+ const unicodeStripped = StripUnicodePrefix(noParens);
235
+ // now, we need to see if the unicodeStripped value is exactly equal to NULL which should be treated
236
+ // as the same as no default value. Without checking this, string data types that have a DEFAULT set to NULL
237
+ // which is the same as no default, will end up with a STRING 'null' in the default value, but that isn't the
238
+ // intent.
239
+ // BY CHECKING this BEFORE we strip the single quotes, we allow for a string of 'NULL', 'null' etc to exist
240
+ // in a string data type's default value. As odd as that might be for a string default value it should be allowed
241
+ if (unicodeStripped.trim().toLowerCase() === 'null') {
242
+ return null; // return the actual TypeScript/JavaScript null here as opposed to a string
243
+ }
244
+ else {
245
+ // our unicodeStripped value is NOT equal to exact match of null, so whatever we have is what we use
246
+ // but we strip single quotes now
247
+ const finalValue = StripSingleQuotes(unicodeStripped);
248
+ return finalValue;
249
+ }
250
+ }
251
+ exports.ExtractActualDefaultValue = ExtractActualDefaultValue;
252
+ /**
253
+ * Strips out the N prefix and single quotes from a string if they exist so that a value like
254
+ * N'Active' becomes Active
255
+ */
256
+ function StripUnicodePrefix(value) {
257
+ if (!value) {
258
+ return value;
259
+ }
260
+ value = value.trim(); // trim it first
261
+ // check to see if the first character is an N and if the character after
262
+ // that as well as the last character are single quotes, if so, strip all of those out
263
+ if (value && value.toUpperCase().startsWith('N') &&
264
+ value.length > 1 && value.charAt(1) === '\'' &&
265
+ value.charAt(value.length - 1) === '\'') {
266
+ return value.substring(2, value.length - 1); // strip out the N and the single quotes for example N'Active' becomes Active
267
+ }
268
+ return value;
269
+ }
270
+ exports.StripUnicodePrefix = StripUnicodePrefix;
271
+ /**
272
+ * Strips out single quotes from a string if they exist so that a value like
273
+ * 'Active' becomes Active
274
+ * @param value
275
+ * @returns
276
+ */
277
+ function StripSingleQuotes(value) {
278
+ if (!value)
279
+ return value;
280
+ const val = value.trim(); // trim it first
281
+ // now check for symmetrical single quotes and remove them
282
+ // this is for cases like 'Pending' or 'Active' which are stored in the DB as ('Pending') or ('Active')
283
+ return val.startsWith("'") && val.endsWith("'") ? val.substring(1, val.length - 1) : val;
284
+ }
285
+ exports.StripSingleQuotes = StripSingleQuotes;
286
+ /**
287
+ * Strips out any number of symmetric containing parens from a string, for example ((0)) becomes 0
288
+ * and ('Active') becomes 'Active'
289
+ * @param value
290
+ * @returns
291
+ */
292
+ function StripContainingParens(value) {
293
+ if (value.startsWith('(') && value.endsWith(')')) {
294
+ // recursive call so if we have ((0)) we keep stripping parens until we get to inner value
295
+ // could be something like (getdate()) in which case we'll only strip the SYMMENTRIC parens
296
+ return StripContainingParens(value.substring(1, value.length - 1));
297
+ }
298
+ return value;
299
+ }
300
+ exports.StripContainingParens = StripContainingParens;
301
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/generic/util.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAErC;;GAEG;AACH,SAAgB,yBAAyB,CAAC,OAAe;IACrD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QACnC,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS,CAAC;QACf,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,kBAAkB,EAAE,wBAAwB;YAC7C,OAAO,QAAQ,CAAC;QACpB,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACP,OAAO,MAAM,CAAC;QAClB,KAAK,KAAK;YACN,OAAO,SAAS,CAAC;QACrB;YACI,OAAO,QAAQ,CAAC;IACxB,CAAC;AACL,CAAC;AArBD,8DAqBC;AAED,SAAgB,2CAA2C,CAAC,OAAe,EAAE,iBAA0B;IACnG,MA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M,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,6EAA6E;IAC9H,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAhBD,gDAgBC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEzB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB;IAE1C,0DAA0D;IAC1D,uGAAuG;IACvG,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7F,CAAC;AARD,8CAQC;AAGD;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,KAAa;IAC/C,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,0FAA0F;QAC1F,2FAA2F;QAC3F,OAAO,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAPD,sDAOC"}
@@ -0,0 +1,150 @@
1
+ import { IMetadataProvider, IRunViewProvider, RunViewResult } from '../generic/interfaces';
2
+ import { UserInfo } from '../generic/securityInfo';
3
+ import { BaseEntity } from '../generic/baseEntity';
4
+ /**
5
+ * Parameters for running either a stored or dynamic view.
6
+ * A stored view is a view that is saved in the database and can be run either by ID or Name.
7
+ * A dynamic view is one that is not stored in the database and you provide parameters to return data as
8
+ * desired programatically.
9
+ */
10
+ export type RunViewParams = {
11
+ /**
12
+ * optional - ID of the UserView record to run, if provided, ViewName is ignored
13
+ */
14
+ ViewID?: string;
15
+ /**
16
+ * optional - Name of the UserView record to run, if you are using this, make sure to use a naming convention
17
+ * so that your view names are unique. For example use a prefix like __Entity_View_ etc so that you're
18
+ * likely to have a single result. If more than one view is available that matches a provided view name an
19
+ * exception will be thrown.
20
+ */
21
+ ViewName?: string;
22
+ /**
23
+ * optional - this is the loaded instance of the BaseEntity (UserViewEntityComplete or a subclass of it).
24
+ * This is the preferred parameter to use IF you already have a view entity object loaded up in your code
25
+ * becuase by passing this in, the RunView() method doesn't have to lookup all the metadata for the view and it is faster.
26
+ * If you provide ViewEntity, ViewID/ViewName are ignored.
27
+ */
28
+ ViewEntity?: BaseEntity;
29
+ /**
30
+ * optional - this is only used if ViewID/ViewName/ViewEntity are not provided, it is used for
31
+ * Dynamic Views in combination with the optional ExtraFilter
32
+ */
33
+ EntityName?: string;
34
+ /**
35
+ * An optional SQL WHERE clause that you can add to the existing filters on a stored view. For dynamic views, you can either
36
+ * run a view without a filter (if the entity definition allows it with AllowAllRowsAPI=1) or filter with any valid SQL WHERE clause.
37
+ */
38
+ ExtraFilter?: string;
39
+ /**
40
+ * An optional SQL ORDER BY clause that you can use for dynamic views, as well as to OVERRIDE the stored view's sorting order.
41
+ */
42
+ OrderBy?: string;
43
+ /**
44
+ * An optional array of field names that you want returned. The RunView() function will always return ID so you don't need to ask for that. If you leave this null then
45
+ * for a dynamic view all fields are returned, and for stored views, the fields stored in it view configuration are returned.
46
+ */
47
+ Fields?: string[];
48
+ /**
49
+ * optional - string that represents a user "search" - typically from a text search option in a UI somewhere. This field is then used in the view filtering to search whichever fields are configured to be included in search in the Entity Fields definition.
50
+ * Search String is combined with the stored view filters as well as ExtraFilter with an AND.
51
+ */
52
+ UserSearchString?: string;
53
+ /**
54
+ * optional - if provided, records that were returned in the specified UserViewRunID will NOT be allowed in the result set.
55
+ * This is useful if you want to run a particular view over time and exclude a specific prior run's resulting data set. If you
56
+ * want to exclude ALL data returned from ALL prior runs, use the ExcludeDataFromAllPriorViewRuns property instead.
57
+ */
58
+ ExcludeUserViewRunID?: string;
59
+ /**
60
+ * optional - if set to true, the resulting data will filter out ANY records that were ever returned by this view, when the SaveViewResults property was set to true.
61
+ * This is useful if you want to run a particular view over time and make sure the results returned each time are new to the view.
62
+ */
63
+ ExcludeDataFromAllPriorViewRuns?: boolean;
64
+ /**
65
+ * optional - if you are providing the optional ExcludeUserViewRunID property, you can also optionally provide
66
+ * this filter which will negate the specific list of record IDs that are excluded by the ExcludeUserViewRunID property.
67
+ * This can be useful if you want to ensure a certain class of data is always allowed into your view and not filtered out
68
+ * by a prior view run.
69
+ *
70
+ */
71
+ OverrideExcludeFilter?: string;
72
+ /**
73
+ * optional - if set to true, the LIST OF ID values from the view run will be stored in the User View Runs entity and the
74
+ * newly created UserViewRun.ID value will be returned in the RunViewResult that the RunView() function sends back to ya.
75
+ */
76
+ SaveViewResults?: boolean;
77
+ /**
78
+ * optional - if set to true, if there IS any UserViewMaxRows property set for the entity in question, it will be IGNORED. This is useful in scenarios where you
79
+ * want to programmatically run a view and get ALL the data back, regardless of the MaxRows setting on the entity.
80
+ */
81
+ IgnoreMaxRows?: boolean;
82
+ /**
83
+ * optional - if provided, and if IgnoreMaxRows = false, this value will be used to constrain the total # of rows returned by the view. If this is not provided, either the default settings at the entity-level will be used, or if the entity has no UserViewMaxRows setting, all rows will be returned that match any filter, if provided.
84
+ */
85
+ MaxRows?: number;
86
+ /**
87
+ * optional - if provided, this value will be used to offset the rows returned.
88
+ */
89
+ StartRow?: number;
90
+ /**
91
+ * optional - if set to true, the view run will ALWAYS be logged to the Audit Log, regardless of the entity's property settings for logging view runs.
92
+ */
93
+ ForceAuditLog?: boolean;
94
+ /**
95
+ * optional - if provided and either ForceAuditLog is set, or the entity's property settings for logging view runs are set to true, this will be used as the Audit Log Description.
96
+ */
97
+ AuditLogDescription?: string;
98
+ /**
99
+ * Result Type is: 'simple', 'entity_object', or 'count_only' and defaults to 'simple'. If 'entity_object' is specified, the Results[] array will contain
100
+ * BaseEntity-derived objects instead of simple objects. This is useful if you want to work with the data in a more strongly typed manner and/or
101
+ * if you plan to do any update/delete operations on the data after it is returned. The 'count_only' option will return no rows, but the TotalRowCount property of the RunViewResult object will be populated.
102
+ */
103
+ ResultType?: 'simple' | 'entity_object' | 'count_only';
104
+ };
105
+ /**
106
+ * Class for running views in a generic, tier-independent manner - uses a provider model for
107
+ * implementation transparently from the viewpoint of the consumer of the class. By default the RunView class you create will
108
+ * connect to the DEFAULT provider. If you want your RunView to connect to a different provider, you can pass in the provider
109
+ * to the constructor.
110
+ */
111
+ export declare class RunView {
112
+ private _provider;
113
+ /**
114
+ * Optionally, you can pass in a provider to the constructor. If you do not, the static RunView.Provider property is used.
115
+ * @param Provider
116
+ */
117
+ constructor(Provider?: IRunViewProvider | null);
118
+ /**
119
+ * This property is used to get the IRunViewProvider implementation that is used by this instance of the RunView class. If a provider was specified to the constructor, that provider is used, otherwise the static RunView.Provider property is used.
120
+ */
121
+ get ProviderToUse(): IRunViewProvider;
122
+ /**
123
+ * Runs a view based on the provided parameters, see documentation for RunViewParams for more
124
+ * @param params
125
+ * @param contextUser if provided, this user is used for permissions and logging. For server based calls, this is generally required because there is no "Current User" since this object is shared across all requests.
126
+ * @returns
127
+ */
128
+ RunView<T = any>(params: RunViewParams, contextUser?: UserInfo): Promise<RunViewResult<T>>;
129
+ /**
130
+ * Runs multiple views based on the provided parameters, see documentation for RunViewParams for more information
131
+ * @param params
132
+ * @param contextUser
133
+ * @returns
134
+ */
135
+ RunViews<T = any>(params: RunViewParams[], contextUser?: UserInfo): Promise<RunViewResult<T>[]>;
136
+ private static _globalProviderKey;
137
+ /**
138
+ * This is the static provider property that is used to get/set the IRunViewProvider implementation that is used by the RunView class.
139
+ * This property can be overridden on a per-instance basis by passing in the optional Provider parameter to the RunView constructor.
140
+ */
141
+ static get Provider(): IRunViewProvider;
142
+ static set Provider(value: IRunViewProvider);
143
+ /**
144
+ * Utility method that calculates the entity name for a given RunViewParams object by looking at the EntityName property as well as the ViewID/ViewName/ViewEntity properties as needed.
145
+ * @param params
146
+ * @returns
147
+ */
148
+ static GetEntityNameFromRunViewParams(params: RunViewParams, provider?: IMetadataProvider | null): Promise<string>;
149
+ }
150
+ //# sourceMappingURL=runView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runView.d.ts","sourceRoot":"","sources":["../../src/views/runView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAC1C;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAA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global");
5
+ /**
6
+ * Class for running views in a generic, tier-independent manner - uses a provider model for
7
+ * implementation transparently from the viewpoint of the consumer of the class. By default the RunView class you create will
8
+ * connect to the DEFAULT provider. If you want your RunView to connect to a different provider, you can pass in the provider
9
+ * to the constructor.
10
+ */
11
+ class RunView {
12
+ /**
13
+ * Optionally, you can pass in a provider to the constructor. If you do not, the static RunView.Provider property is used.
14
+ * @param Provider
15
+ */
16
+ constructor(Provider = null) {
17
+ this._provider = null;
18
+ if (Provider)
19
+ this._provider = Provider;
20
+ }
21
+ /**
22
+ * This property is used to get the IRunViewProvider implementation that is used by this instance of the RunView class. If a provider was specified to the constructor, that provider is used, otherwise the static RunView.Provider property is used.
23
+ */
24
+ get ProviderToUse() {
25
+ return this._provider || RunView.Provider;
26
+ }
27
+ /**
28
+ * Runs a view based on the provided parameters, see documentation for RunViewParams for more
29
+ * @param params
30
+ * @param contextUser if provided, this user is used for permissions and logging. For server based calls, this is generally required because there is no "Current User" since this object is shared across all requests.
31
+ * @returns
32
+ */
33
+ async RunView(params, contextUser) {
34
+ // simple proxy to the provider, pre/post process moved to ProviderBase and called by each sub-class
35
+ // for validation and for optional transformation of the result
36
+ return await this.ProviderToUse.RunView(params, contextUser);
37
+ }
38
+ /**
39
+ * Runs multiple views based on the provided parameters, see documentation for RunViewParams for more information
40
+ * @param params
41
+ * @param contextUser
42
+ * @returns
43
+ */
44
+ async RunViews(params, contextUser) {
45
+ // same as RunView, a simple proxy to the provider, pre/post processes are moved to
46
+ // ProviderBase as with RunView
47
+ return this.ProviderToUse.RunViews(params, contextUser);
48
+ }
49
+ /**
50
+ * This is the static provider property that is used to get/set the IRunViewProvider implementation that is used by the RunView class.
51
+ * This property can be overridden on a per-instance basis by passing in the optional Provider parameter to the RunView constructor.
52
+ */
53
+ static get Provider() {
54
+ const g = Global_1.MJGlobal.Instance.GetGlobalObjectStore();
55
+ if (g)
56
+ return g[RunView._globalProviderKey];
57
+ else
58
+ throw new Error('No global object store, so we cant get the static provider');
59
+ }
60
+ static set Provider(value) {
61
+ const g = Global_1.MJGlobal.Instance.GetGlobalObjectStore();
62
+ if (g)
63
+ g[RunView._globalProviderKey] = value;
64
+ else
65
+ throw new Error('No global object store, so we cant set the static provider');
66
+ }
67
+ /**
68
+ * Utility method that calculates the entity name for a given RunViewParams object by looking at the EntityName property as well as the ViewID/ViewName/ViewEntity properties as needed.
69
+ * @param params
70
+ * @returns
71
+ */
72
+ static async GetEntityNameFromRunViewParams(params, provider = null) {
73
+ const p = provider ? provider : RunView.Provider;
74
+ if (params.EntityName)
75
+ return params.EntityName;
76
+ else if (params.ViewEntity) {
77
+ const entityID = params.ViewEntity.Get('EntityID'); // using weak typing because this is MJCore and we don't want to use the sub-classes from core-entities as that would create a circular dependency
78
+ const entity = p.Entities.find((e) => e.ID === entityID);
79
+ if (entity)
80
+ return entity.Name;
81
+ }
82
+ else if (params.ViewID || params.ViewName) {
83
+ // we don't have a view entity loaded, so load it up now
84
+ const rv = new RunView(p);
85
+ const result = await rv.RunView({
86
+ EntityName: 'User Views',
87
+ ExtraFilter: params.ViewID ? `ID = '${params.ViewID}'` : `Name = '${params.ViewName}'`,
88
+ ResultType: 'entity_object',
89
+ });
90
+ if (result && result.Success && result.Results.length > 0) {
91
+ return result.Results[0].Entity; // virtual field in the User Views entity called Entity
92
+ }
93
+ }
94
+ else
95
+ return null;
96
+ }
97
+ }
98
+ exports.RunView = RunView;
99
+ RunView._globalProviderKey = 'MJ_RunViewProvider';
100
+ //# sourceMappingURL=runView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runView.js","sourceRoot":"","sources":["../../src/views/runView.ts"],"names":[],"mappings":";;;AAIA,sCAAqC;AAyGrC;;;;;GAKG;AACH,MAAa,OAAO;IAElB;;;OAGG;IACH,YAAY,WAAoC,IAAI;QAL5C,cAAS,GAA4B,IAAI,CAAC;QAMhD,IAAI,QAAQ;YAAE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC1C,CAAC;IAED;;OA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