@memberjunction/global 2.112.0 → 2.113.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/package.json +1 -1
- package/dist/Core.d.ts +0 -29
- package/dist/Core.d.ts.map +0 -1
- package/dist/Core.js +0 -58
- package/dist/Core.js.map +0 -1
- package/dist/generic/QueryCache.d.ts +0 -85
- package/dist/generic/QueryCache.d.ts.map +0 -1
- package/dist/generic/QueryCache.js +0 -198
- package/dist/generic/QueryCache.js.map +0 -1
- package/dist/generic/QueryCacheConfig.d.ts +0 -72
- package/dist/generic/QueryCacheConfig.d.ts.map +0 -1
- package/dist/generic/QueryCacheConfig.js +0 -3
- package/dist/generic/QueryCacheConfig.js.map +0 -1
- package/dist/generic/applicationInfo.d.ts +0 -138
- package/dist/generic/applicationInfo.d.ts.map +0 -1
- package/dist/generic/applicationInfo.js +0 -177
- package/dist/generic/applicationInfo.js.map +0 -1
- package/dist/generic/authEvaluator.d.ts +0 -25
- package/dist/generic/authEvaluator.d.ts.map +0 -1
- package/dist/generic/authEvaluator.js +0 -49
- package/dist/generic/authEvaluator.js.map +0 -1
- package/dist/generic/authTypes.d.ts +0 -193
- package/dist/generic/authTypes.d.ts.map +0 -1
- package/dist/generic/authTypes.js +0 -19
- package/dist/generic/authTypes.js.map +0 -1
- package/dist/generic/baseEngine.d.ts +0 -260
- package/dist/generic/baseEngine.d.ts.map +0 -1
- package/dist/generic/baseEngine.js +0 -510
- package/dist/generic/baseEngine.js.map +0 -1
- package/dist/generic/baseEntity.d.ts +0 -691
- package/dist/generic/baseEntity.d.ts.map +0 -1
- package/dist/generic/baseEntity.js +0 -1688
- package/dist/generic/baseEntity.js.map +0 -1
- package/dist/generic/baseInfo.d.ts +0 -24
- package/dist/generic/baseInfo.d.ts.map +0 -1
- package/dist/generic/baseInfo.js +0 -53
- package/dist/generic/baseInfo.js.map +0 -1
- package/dist/generic/compositeKey.d.ts +0 -206
- package/dist/generic/compositeKey.d.ts.map +0 -1
- package/dist/generic/compositeKey.js +0 -412
- package/dist/generic/compositeKey.js.map +0 -1
- package/dist/generic/databaseProviderBase.d.ts +0 -46
- package/dist/generic/databaseProviderBase.d.ts.map +0 -1
- package/dist/generic/databaseProviderBase.js +0 -14
- package/dist/generic/databaseProviderBase.js.map +0 -1
- package/dist/generic/entityInfo.d.ts +0 -983
- package/dist/generic/entityInfo.d.ts.map +0 -1
- package/dist/generic/entityInfo.js +0 -1401
- package/dist/generic/entityInfo.js.map +0 -1
- package/dist/generic/explorerNavigationItem.d.ts +0 -20
- package/dist/generic/explorerNavigationItem.d.ts.map +0 -1
- package/dist/generic/explorerNavigationItem.js +0 -29
- package/dist/generic/explorerNavigationItem.js.map +0 -1
- package/dist/generic/interfaces.d.ts +0 -610
- package/dist/generic/interfaces.d.ts.map +0 -1
- package/dist/generic/interfaces.js +0 -211
- package/dist/generic/interfaces.js.map +0 -1
- package/dist/generic/libraryInfo.d.ts +0 -40
- package/dist/generic/libraryInfo.d.ts.map +0 -1
- package/dist/generic/libraryInfo.js +0 -56
- package/dist/generic/libraryInfo.js.map +0 -1
- package/dist/generic/logging.d.ts +0 -179
- package/dist/generic/logging.d.ts.map +0 -1
- package/dist/generic/logging.js +0 -382
- package/dist/generic/logging.js.map +0 -1
- package/dist/generic/metadata.d.ts +0 -305
- package/dist/generic/metadata.d.ts.map +0 -1
- package/dist/generic/metadata.js +0 -454
- package/dist/generic/metadata.js.map +0 -1
- package/dist/generic/metadataUtil.d.ts +0 -8
- package/dist/generic/metadataUtil.d.ts.map +0 -1
- package/dist/generic/metadataUtil.js +0 -36
- package/dist/generic/metadataUtil.js.map +0 -1
- package/dist/generic/providerBase.d.ts +0 -546
- package/dist/generic/providerBase.d.ts.map +0 -1
- package/dist/generic/providerBase.js +0 -999
- package/dist/generic/providerBase.js.map +0 -1
- package/dist/generic/queryInfo.d.ts +0 -460
- package/dist/generic/queryInfo.d.ts.map +0 -1
- package/dist/generic/queryInfo.js +0 -633
- package/dist/generic/queryInfo.js.map +0 -1
- package/dist/generic/querySQLFilters.d.ts +0 -54
- package/dist/generic/querySQLFilters.d.ts.map +0 -1
- package/dist/generic/querySQLFilters.js +0 -84
- package/dist/generic/querySQLFilters.js.map +0 -1
- package/dist/generic/runQuery.d.ts +0 -96
- package/dist/generic/runQuery.d.ts.map +0 -1
- package/dist/generic/runQuery.js +0 -66
- package/dist/generic/runQuery.js.map +0 -1
- package/dist/generic/runQuerySQLFilterImplementations.d.ts +0 -51
- package/dist/generic/runQuerySQLFilterImplementations.d.ts.map +0 -1
- package/dist/generic/runQuerySQLFilterImplementations.js +0 -238
- package/dist/generic/runQuerySQLFilterImplementations.js.map +0 -1
- package/dist/generic/runReport.d.ts +0 -25
- package/dist/generic/runReport.d.ts.map +0 -1
- package/dist/generic/runReport.js +0 -42
- package/dist/generic/runReport.js.map +0 -1
- package/dist/generic/securityInfo.d.ts +0 -355
- package/dist/generic/securityInfo.d.ts.map +0 -1
- package/dist/generic/securityInfo.js +0 -425
- package/dist/generic/securityInfo.js.map +0 -1
- package/dist/generic/transactionGroup.d.ts +0 -184
- package/dist/generic/transactionGroup.d.ts.map +0 -1
- package/dist/generic/transactionGroup.js +0 -357
- package/dist/generic/transactionGroup.js.map +0 -1
- package/dist/generic/util.d.ts +0 -81
- package/dist/generic/util.d.ts.map +0 -1
- package/dist/generic/util.js +0 -301
- package/dist/generic/util.js.map +0 -1
- package/dist/views/runView.d.ts +0 -150
- package/dist/views/runView.d.ts.map +0 -1
- package/dist/views/runView.js +0 -100
- package/dist/views/runView.js.map +0 -1
- package/dist/views/viewInfo.d.ts +0 -121
- package/dist/views/viewInfo.d.ts.map +0 -1
- package/dist/views/viewInfo.js +0 -182
- package/dist/views/viewInfo.js.map +0 -1
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositeKey = exports.FieldValueCollection = exports.KeyValuePair = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Used to a store a combination of a key and value pair for a variety of purposes including primary/foreign keys.
|
|
6
|
-
*/
|
|
7
|
-
class KeyValuePair {
|
|
8
|
-
/**
|
|
9
|
-
* Construct a new instance by optionally providing a field name and value.
|
|
10
|
-
* This is useful for creating a key value pair on the fly without needing to set the properties manually.
|
|
11
|
-
* @param fieldName
|
|
12
|
-
* @param value
|
|
13
|
-
*/
|
|
14
|
-
constructor(fieldName, value) {
|
|
15
|
-
this.FieldName = fieldName || '';
|
|
16
|
-
this.Value = value;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.KeyValuePair = KeyValuePair;
|
|
20
|
-
/**
|
|
21
|
-
* Base class for tracking a collection of field name(key)/value pair combinations with utility methods for working with them.
|
|
22
|
-
*/
|
|
23
|
-
class FieldValueCollection {
|
|
24
|
-
constructor(keyValuePairs) {
|
|
25
|
-
if (keyValuePairs && Array.isArray(keyValuePairs)) {
|
|
26
|
-
if (keyValuePairs.length > 0) {
|
|
27
|
-
let kvp = keyValuePairs[0];
|
|
28
|
-
if (kvp.FieldName && kvp.Value) {
|
|
29
|
-
this.KeyValuePairs = keyValuePairs;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
this.KeyValuePairs = [];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* returns the value of the key value pair for the specified field name
|
|
38
|
-
* @param fieldName the field name to get the value for
|
|
39
|
-
* @returns the value of the key value pair for the specified field name
|
|
40
|
-
*/
|
|
41
|
-
GetValueByFieldName(fieldName) {
|
|
42
|
-
let key = this.KeyValuePairs.find((keyValue) => {
|
|
43
|
-
return keyValue.FieldName === fieldName;
|
|
44
|
-
});
|
|
45
|
-
return key ? key.Value : null;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* returns the value of the key value pair at the specified index
|
|
49
|
-
* @param index the index of the key value pair to get the value for
|
|
50
|
-
* @returns the value of the key value pair at the specified index
|
|
51
|
-
*/
|
|
52
|
-
GetValueByIndex(index) {
|
|
53
|
-
if (index >= 0 && index < this.KeyValuePairs.length) {
|
|
54
|
-
return this.KeyValuePairs[index].Value;
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @returns a string representation of the primary key values in the format "FieldName=Value"
|
|
60
|
-
* @example "ID=1 AND Name=John"
|
|
61
|
-
* @param useIsNull if true, will return "FieldName IS NULL" for any key value pair that has a null or undefined value
|
|
62
|
-
*/
|
|
63
|
-
ToString(useIsNull) {
|
|
64
|
-
return this.KeyValuePairs.map((keyValue) => {
|
|
65
|
-
if (useIsNull && (keyValue.Value === null || keyValue.Value === undefined)) {
|
|
66
|
-
return `${keyValue.FieldName} IS NULL`;
|
|
67
|
-
}
|
|
68
|
-
return `${keyValue.FieldName}=${keyValue.Value}`;
|
|
69
|
-
}).join(" AND ");
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @returns a copy of the KeyValuePairs array but with the Value properties as type string
|
|
73
|
-
*/
|
|
74
|
-
ValuesAsString() {
|
|
75
|
-
return this.KeyValuePairs.map((keyValue) => {
|
|
76
|
-
return {
|
|
77
|
-
FieldName: keyValue.FieldName,
|
|
78
|
-
Value: keyValue.Value ? keyValue.Value.toString() : ""
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Utility function to return a copy of the CompositeKey with the Value properties as string
|
|
84
|
-
* @returns a copy of the KeyValuePairs array but with the Value properties as string
|
|
85
|
-
*/
|
|
86
|
-
Copy() {
|
|
87
|
-
let copy = new CompositeKey();
|
|
88
|
-
copy.KeyValuePairs = this.ValuesAsString();
|
|
89
|
-
return copy;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* @returns the KeyValuePairs as a list of strings in the format "FieldName=Value"
|
|
93
|
-
* @param delimiter the delimiter to use between the field name and value. Defaults to '='
|
|
94
|
-
* @example ["ID=1", "Name=John"]
|
|
95
|
-
*/
|
|
96
|
-
ToList(delimiter) {
|
|
97
|
-
return this.KeyValuePairs.map((pk) => {
|
|
98
|
-
return delimiter ? `${pk.FieldName}${delimiter}${pk.Value}` : `${pk.FieldName}=${pk.Value}`;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Utility function to return a string representation of the composite key in the format "FieldName=Value AND FieldName=Value"
|
|
103
|
-
* @param useIsNull if true, will return "FieldName IS NULL" for any key value pair that has a null or undefined value, if false, will return "FieldName=Value"
|
|
104
|
-
* @param quoteString is either 'single' or 'double' and will determine if the string values are quoted with single or double quotes. Quotes are only applied to values that are of type string or Date.
|
|
105
|
-
* @returns a string representation of the composite key in the format "FieldName=Value AND FieldName=Value"
|
|
106
|
-
* @example "ID=1 AND Name='John'"
|
|
107
|
-
*/
|
|
108
|
-
ToWhereClause(useIsNull = true, quoteStyle = 'single') {
|
|
109
|
-
return this.KeyValuePairs.map((keyValue) => {
|
|
110
|
-
let value = keyValue.Value;
|
|
111
|
-
if (useIsNull && (value === null || value === undefined)) {
|
|
112
|
-
return `${keyValue.FieldName} IS NULL`;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
if (typeof value === 'string' || value instanceof Date) {
|
|
116
|
-
if (quoteStyle === 'single') {
|
|
117
|
-
value = `'${value}'`;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
value = `"${value}"`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return `${keyValue.FieldName}=${value}`;
|
|
124
|
-
}
|
|
125
|
-
}).join(" AND ");
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @returns the value of each key value pair in the format "Value1, Value2, Value3"
|
|
129
|
-
* @param delimiter - the delimiter to use between the values. Defaults to ', '
|
|
130
|
-
* @example "1, John"
|
|
131
|
-
*/
|
|
132
|
-
Values(delimiter) {
|
|
133
|
-
return this.KeyValuePairs.map((keyValue) => {
|
|
134
|
-
return keyValue.Value;
|
|
135
|
-
}).join(delimiter || ", ");
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Utility function to check if the composite key has any values set
|
|
139
|
-
*/
|
|
140
|
-
get HasValue() {
|
|
141
|
-
return this.KeyValuePairs.some((keyValue) => {
|
|
142
|
-
return keyValue.Value !== null && keyValue.Value !== undefined && keyValue.Value !== "";
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
LoadFromEntityFields(fields) {
|
|
146
|
-
this.KeyValuePairs = fields.map((field) => {
|
|
147
|
-
return {
|
|
148
|
-
FieldName: field.Name,
|
|
149
|
-
Value: field.Value
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
LoadFromEntityInfoAndRecord(entity, entityRecord) {
|
|
154
|
-
this.KeyValuePairs = entity.PrimaryKeys.map((pk) => {
|
|
155
|
-
return {
|
|
156
|
-
FieldName: pk.Name,
|
|
157
|
-
Value: entityRecord[pk.Name]
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Loads the KeyValuePairs from a list of strings in the format "FieldName=Value"
|
|
163
|
-
* @param list - the list of strings to load from
|
|
164
|
-
* @param delimiter - the delimiter to use between the field name and value. Defaults to '='
|
|
165
|
-
* @example ["ID=1", "Name=John"]
|
|
166
|
-
*/
|
|
167
|
-
LoadFromList(list, delimiter) {
|
|
168
|
-
this.KeyValuePairs = list.map((pk) => {
|
|
169
|
-
let keyValue = delimiter ? pk.split(delimiter) : pk.split("=");
|
|
170
|
-
if (keyValue.length === 2) {
|
|
171
|
-
let keyValuePair = new KeyValuePair();
|
|
172
|
-
keyValuePair.FieldName = keyValue[0];
|
|
173
|
-
keyValuePair.Value = keyValue[1];
|
|
174
|
-
return keyValuePair;
|
|
175
|
-
}
|
|
176
|
-
return;
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Utility to generate a string representation of the key value pairs in the format "Field1|Value1||Field2|Value2" etc.
|
|
181
|
-
* The field delimiter defaults to '||' and the value delimiter defaults to '|'
|
|
182
|
-
* @param fieldDelimiter
|
|
183
|
-
* @param valueDelimiter
|
|
184
|
-
* @returns
|
|
185
|
-
*/
|
|
186
|
-
ToConcatenatedString(fieldDelimiter = '||', valueDelimiter = '|') {
|
|
187
|
-
return this.KeyValuePairs.map((pk) => {
|
|
188
|
-
return `${pk.FieldName}${valueDelimiter}${pk.Value}`;
|
|
189
|
-
}).join(fieldDelimiter);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Utility to load the object from a string representation of the key value pairs in the format "Field1|Value1||Field2|Value2" etc.
|
|
193
|
-
* The delimiters between the fields default to '||' and the values default to '|', but can be anything desired.
|
|
194
|
-
* @param concatenatedString
|
|
195
|
-
* @param fieldDelimiter
|
|
196
|
-
* @param valueDelimiter
|
|
197
|
-
*/
|
|
198
|
-
LoadFromConcatenatedString(concatenatedString, fieldDelimiter = '||', valueDelimiter = '|') {
|
|
199
|
-
if (concatenatedString.includes(valueDelimiter)) {
|
|
200
|
-
const parts = concatenatedString.split(fieldDelimiter);
|
|
201
|
-
const pkVals = [];
|
|
202
|
-
for (let p of parts) {
|
|
203
|
-
const kv = p.split(valueDelimiter);
|
|
204
|
-
pkVals.push({ FieldName: kv[0], Value: kv[1] });
|
|
205
|
-
}
|
|
206
|
-
this.KeyValuePairs = pkVals;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
// do nothing
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* For URL segments, we use | and || as the standard delimiters for field and value respectively in order to avoid
|
|
214
|
-
* conflicts with the standard URL delimiters like = and &. This method converts the key value pairs to a URL segment
|
|
215
|
-
* @param segment
|
|
216
|
-
* @returns
|
|
217
|
-
*/
|
|
218
|
-
ToURLSegment(segment) {
|
|
219
|
-
return this.ToConcatenatedString(segment || CompositeKey.DefaultFieldDelimiter, CompositeKey.DefaultValueDelimiter);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Default delimiter for separating fields in a string that represents a key value pair within the composite key
|
|
223
|
-
*/
|
|
224
|
-
static get DefaultFieldDelimiter() {
|
|
225
|
-
return this._field_delimiter;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Default delimiter for separating values from field names in a string that represents a key value pair within the composite key
|
|
229
|
-
*/
|
|
230
|
-
static get DefaultValueDelimiter() {
|
|
231
|
-
return this._value_delimiter;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Parses a provided url segment using the provided delimiter and loads the key value pairs from it. If the segment just contains a single
|
|
235
|
-
* value and no delimiter, it will assume the field name is the primary key field name of the entity and load that way.
|
|
236
|
-
*/
|
|
237
|
-
LoadFromURLSegment(entity, urlSegment) {
|
|
238
|
-
if (!urlSegment.includes('|')) {
|
|
239
|
-
// If not, return a single element array with a default field name
|
|
240
|
-
this.KeyValuePairs = [{ FieldName: entity.FirstPrimaryKey.Name, Value: urlSegment }];
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
this.SimpleLoadFromURLSegment(urlSegment);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Parses the provided routeSegment and assumes the field names are included in the segment
|
|
248
|
-
* @param urlSegment
|
|
249
|
-
* @param delimiter
|
|
250
|
-
*/
|
|
251
|
-
SimpleLoadFromURLSegment(urlSegment) {
|
|
252
|
-
if (urlSegment.includes(CompositeKey.DefaultValueDelimiter)) {
|
|
253
|
-
const parts = urlSegment.split(CompositeKey.DefaultFieldDelimiter);
|
|
254
|
-
const pkVals = [];
|
|
255
|
-
for (let p of parts) {
|
|
256
|
-
const kv = p.split('|');
|
|
257
|
-
pkVals.push({ FieldName: kv[0], Value: kv[1] });
|
|
258
|
-
}
|
|
259
|
-
this.KeyValuePairs = pkVals;
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
// do nothing
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Loads the key from a single key value pair
|
|
267
|
-
* @param fieldName
|
|
268
|
-
* @param value
|
|
269
|
-
*/
|
|
270
|
-
LoadFromSingleKeyValuePair(fieldName, value) {
|
|
271
|
-
this.KeyValuePairs = [{ FieldName: fieldName, Value: value }];
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Loads from a simple object by extracting the key value pairs from the object
|
|
275
|
-
* @param obj
|
|
276
|
-
*/
|
|
277
|
-
LoadFromSimpleObject(obj) {
|
|
278
|
-
this.KeyValuePairs = Object.keys(obj).map((key) => {
|
|
279
|
-
return { FieldName: key, Value: obj[key] };
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Static helper method to instantiate a FieldValueCollection from a simple object
|
|
284
|
-
* @param obj
|
|
285
|
-
* @returns
|
|
286
|
-
*/
|
|
287
|
-
static FromObject(obj) {
|
|
288
|
-
let fvc = new FieldValueCollection();
|
|
289
|
-
fvc.LoadFromSimpleObject(obj);
|
|
290
|
-
return fvc;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.FieldValueCollection = FieldValueCollection;
|
|
294
|
-
FieldValueCollection._field_delimiter = '||';
|
|
295
|
-
FieldValueCollection._value_delimiter = '|';
|
|
296
|
-
/**
|
|
297
|
-
* Composite keys are used to represent database keys and can include one or more key value pairs.
|
|
298
|
-
*/
|
|
299
|
-
class CompositeKey extends FieldValueCollection {
|
|
300
|
-
constructor(keyValuePairs) {
|
|
301
|
-
super(keyValuePairs);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Static factory method to create a CompositeKey from a single key value pair.
|
|
305
|
-
* @param key
|
|
306
|
-
* @param value
|
|
307
|
-
* @returns
|
|
308
|
-
*/
|
|
309
|
-
static FromKeyValuePair(key, value) {
|
|
310
|
-
let compositeKey = new CompositeKey();
|
|
311
|
-
compositeKey.LoadFromSingleKeyValuePair(key, value);
|
|
312
|
-
return compositeKey;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Static factory method to create a CompositeKey from an array of key value pairs. Mirrors the
|
|
316
|
-
* constructor but allows for a more explicit creation of a CompositeKey from an array of KeyValuePair objects.
|
|
317
|
-
* @param keyValuePairs
|
|
318
|
-
* @returns
|
|
319
|
-
*/
|
|
320
|
-
static FromKeyValuePairs(keyValuePairs) {
|
|
321
|
-
return new CompositeKey(keyValuePairs);
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Many entities have a single primary key field called ID, this utility method allows you to create a CompositeKey from just that ID value.
|
|
325
|
-
* @param id
|
|
326
|
-
* @returns
|
|
327
|
-
*/
|
|
328
|
-
static FromID(id) {
|
|
329
|
-
let compositeKey = new CompositeKey();
|
|
330
|
-
compositeKey.LoadFromSingleKeyValuePair('ID', id);
|
|
331
|
-
return compositeKey;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Creates a CompositeKey from a simple object where the keys are the field names and the values are the values.
|
|
335
|
-
* @param obj
|
|
336
|
-
* @returns
|
|
337
|
-
*/
|
|
338
|
-
static FromObject(obj) {
|
|
339
|
-
let compositeKey = new CompositeKey();
|
|
340
|
-
compositeKey.LoadFromSimpleObject(obj);
|
|
341
|
-
return compositeKey;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Utility function to compare this composite key to another
|
|
345
|
-
* @param compositeKey the composite key to compare against
|
|
346
|
-
* @returns true if the primary key values are the same, false if they are different
|
|
347
|
-
*/
|
|
348
|
-
Equals(compositeKey) {
|
|
349
|
-
if (!compositeKey) {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
return this.EqualsKey(compositeKey.KeyValuePairs);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Helper method to check if the underlying key value pairs are valid or not
|
|
356
|
-
* i.e. if any of the key value pairs are null or undefined
|
|
357
|
-
* @param entity If provided, this method will validate that the composite key is valid for the given entity as a primary key or alternate key.
|
|
358
|
-
* @param primaryKey If set to true, and entity is provided, this method will validate that the composite key is valid as the primary key for the given entity.
|
|
359
|
-
* @returns true if all key value pairs are valid, false if any are null or undefined
|
|
360
|
-
*/
|
|
361
|
-
Validate(entity, primaryKey = true) {
|
|
362
|
-
try {
|
|
363
|
-
// make sure that KeyValuePairs is an array of 1+ objects, and that each object has a FieldName and Value property and that the FieldName is a valid field on the entity that has IsPrimaryKey set to true
|
|
364
|
-
if (!this.KeyValuePairs || this.KeyValuePairs.length === 0)
|
|
365
|
-
throw new Error('KeyValuePairs cannot be null or empty');
|
|
366
|
-
else {
|
|
367
|
-
// now loop through the array and make sure each object has a FieldName and Value property
|
|
368
|
-
// and that the field name is a valid field on the entity that has IsPrimaryKey set to true
|
|
369
|
-
for (let i = 0; i < this.KeyValuePairs.length; i++) {
|
|
370
|
-
const pk = this.KeyValuePairs[i];
|
|
371
|
-
if (!pk.FieldName || pk.FieldName.trim().length === 0)
|
|
372
|
-
throw new Error(`KeyValuePairs[${i}].FieldName cannot be null, empty, or whitespace`);
|
|
373
|
-
if (pk.Value === null || pk.Value === undefined)
|
|
374
|
-
throw new Error(`KeyValuePairs[${i}].Value cannot be null or undefined`);
|
|
375
|
-
if (entity) {
|
|
376
|
-
const field = entity.Fields.find(f => f.Name.trim().toLowerCase() === pk.FieldName.trim().toLowerCase());
|
|
377
|
-
if (!field)
|
|
378
|
-
throw new Error(`KeyValuePairs[${i}].FieldName of ${pk.FieldName} does not exist on ${entity.Name}`);
|
|
379
|
-
if (primaryKey && !field.IsPrimaryKey)
|
|
380
|
-
throw new Error(`KeyValuePairs[${i}].FieldName of ${pk.FieldName} is not a primary key field on ${entity.Name}`);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return { IsValid: true, ErrorMessage: null };
|
|
385
|
-
}
|
|
386
|
-
catch (e) {
|
|
387
|
-
return { IsValid: false, ErrorMessage: e.message };
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Utility function to compare the key primary key of this object to another sets to see if they are the same or not
|
|
392
|
-
* @param kvPairs the primary key values to compare against
|
|
393
|
-
* @returns true if the primary key values are the same, false if they are different
|
|
394
|
-
*/
|
|
395
|
-
EqualsKey(kvPairs) {
|
|
396
|
-
if (!kvPairs || kvPairs.length === 0) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
if (kvPairs.length !== this.KeyValuePairs.length) {
|
|
400
|
-
return false;
|
|
401
|
-
}
|
|
402
|
-
for (const [index, kvPair] of kvPairs.entries()) {
|
|
403
|
-
const sourcekvPair = this.KeyValuePairs[index];
|
|
404
|
-
if (kvPair.FieldName !== sourcekvPair.FieldName || kvPair.Value !== sourcekvPair.Value) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return true;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
exports.CompositeKey = CompositeKey;
|
|
412
|
-
//# sourceMappingURL=compositeKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compositeKey.js","sourceRoot":"","sources":["../../src/generic/compositeKey.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAa,YAAY;IAUrB;;;;;OAKG;IACH,YAAY,SAAkB,EAAE,KAAW;QACvC,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AApBD,oCAoBC;AAED;;GAEG;AACH,MAAa,oBAAoB;IAG7B,YAAY,aAA8B;QACtC,IAAG,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAC,CAAC;YAC9C,IAAG,aAAa,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC;gBACzB,IAAI,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAG,GAAG,CAAC,SAAS,IAA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C,OAAuB;QAC7B,IAAG,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;YACjC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAC,CAAC;YAC9C,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAC,CAAC;YAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC/C,IAAG,MAAM,CAAC,SAAS,KAAK,YAAY,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,EAAC,CAAC;gBACnF,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA7HD,oCA6HC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ProviderBase } from "./providerBase";
|
|
2
|
-
import { UserInfo } from "./securityInfo";
|
|
3
|
-
/**
|
|
4
|
-
* This class is a generic server-side provider class to abstract database operations
|
|
5
|
-
* on any database system and therefore be usable by server-side components that need to
|
|
6
|
-
* do database operations but do not want close coupling with a specific database provider
|
|
7
|
-
* like @see @memberjunction/sqlserver-dataprovider
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class DatabaseProviderBase extends ProviderBase {
|
|
10
|
-
/**
|
|
11
|
-
* Executes a SQL query with optional parameters and options.
|
|
12
|
-
* @param query
|
|
13
|
-
* @param parameters
|
|
14
|
-
* @param options
|
|
15
|
-
* @param contextUser
|
|
16
|
-
* @param T - The type of the result set
|
|
17
|
-
* @returns A promise that resolves to an array of results of type T
|
|
18
|
-
*/
|
|
19
|
-
abstract ExecuteSQL<T>(query: string, parameters?: any[], options?: ExecuteSQLOptions, contextUser?: UserInfo): Promise<Array<T>>;
|
|
20
|
-
/**
|
|
21
|
-
* Begins a transaction for the current database connection.
|
|
22
|
-
*/
|
|
23
|
-
abstract BeginTransaction(): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Commits the current transaction.
|
|
26
|
-
*/
|
|
27
|
-
abstract CommitTransaction(): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Rolls back the current transaction.
|
|
30
|
-
*/
|
|
31
|
-
abstract RollbackTransaction(): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Configuration options for SQL execution with logging support
|
|
35
|
-
*/
|
|
36
|
-
export interface ExecuteSQLOptions {
|
|
37
|
-
/** Optional description for this SQL operation, used by logging, if logging is supported by the underlying provider */
|
|
38
|
-
description?: string;
|
|
39
|
-
/** If true, this statement will not be logged to any logging session */
|
|
40
|
-
ignoreLogging?: boolean;
|
|
41
|
-
/** Whether this is a data mutation operation (INSERT/UPDATE/DELETE or SP call that results in any data change) */
|
|
42
|
-
isMutation?: boolean;
|
|
43
|
-
/** Simple SQL fallback for loggers to emit logging of a simpler SQL statement that doesn't have extra functionality that isn't important for migrations or other logging purposes. */
|
|
44
|
-
simpleSQLFallback?: string;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=databaseProviderBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"databaseProviderBase.d.ts","sourceRoot":"","sources":["../../src/generic/databaseProviderBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;GAKG;AACH,8BAAsB,oBAAqB,SAAQ,YAAY;IAC3D;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEjI;;OAEG;IACH,QAAQ,CAAC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uHAAuH;IACvH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kHAAkH;IAClH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sLAAsL;IACtL,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatabaseProviderBase = void 0;
|
|
4
|
-
const providerBase_1 = require("./providerBase");
|
|
5
|
-
/**
|
|
6
|
-
* This class is a generic server-side provider class to abstract database operations
|
|
7
|
-
* on any database system and therefore be usable by server-side components that need to
|
|
8
|
-
* do database operations but do not want close coupling with a specific database provider
|
|
9
|
-
* like @see @memberjunction/sqlserver-dataprovider
|
|
10
|
-
*/
|
|
11
|
-
class DatabaseProviderBase extends providerBase_1.ProviderBase {
|
|
12
|
-
}
|
|
13
|
-
exports.DatabaseProviderBase = DatabaseProviderBase;
|
|
14
|
-
//# sourceMappingURL=databaseProviderBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"databaseProviderBase.js","sourceRoot":"","sources":["../../src/generic/databaseProviderBase.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAG9C;;;;;GAKG;AACH,MAAsB,oBAAqB,SAAQ,2BAAY;CA0B9D;AA1BD,oDA0BC"}
|