@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.
- package/dist/Core.d.ts +29 -0
- package/dist/Core.d.ts.map +1 -0
- package/dist/Core.js +58 -0
- package/dist/Core.js.map +1 -0
- package/dist/generic/QueryCache.d.ts +85 -0
- package/dist/generic/QueryCache.d.ts.map +1 -0
- package/dist/generic/QueryCache.js +198 -0
- package/dist/generic/QueryCache.js.map +1 -0
- package/dist/generic/QueryCacheConfig.d.ts +72 -0
- package/dist/generic/QueryCacheConfig.d.ts.map +1 -0
- package/dist/generic/QueryCacheConfig.js +3 -0
- package/dist/generic/QueryCacheConfig.js.map +1 -0
- package/dist/generic/applicationInfo.d.ts +138 -0
- package/dist/generic/applicationInfo.d.ts.map +1 -0
- package/dist/generic/applicationInfo.js +177 -0
- package/dist/generic/applicationInfo.js.map +1 -0
- package/dist/generic/authEvaluator.d.ts +25 -0
- package/dist/generic/authEvaluator.d.ts.map +1 -0
- package/dist/generic/authEvaluator.js +49 -0
- package/dist/generic/authEvaluator.js.map +1 -0
- package/dist/generic/authTypes.d.ts +193 -0
- package/dist/generic/authTypes.d.ts.map +1 -0
- package/dist/generic/authTypes.js +19 -0
- package/dist/generic/authTypes.js.map +1 -0
- package/dist/generic/baseEngine.d.ts +260 -0
- package/dist/generic/baseEngine.d.ts.map +1 -0
- package/dist/generic/baseEngine.js +510 -0
- package/dist/generic/baseEngine.js.map +1 -0
- package/dist/generic/baseEntity.d.ts +691 -0
- package/dist/generic/baseEntity.d.ts.map +1 -0
- package/dist/generic/baseEntity.js +1688 -0
- package/dist/generic/baseEntity.js.map +1 -0
- package/dist/generic/baseInfo.d.ts +24 -0
- package/dist/generic/baseInfo.d.ts.map +1 -0
- package/dist/generic/baseInfo.js +53 -0
- package/dist/generic/baseInfo.js.map +1 -0
- package/dist/generic/compositeKey.d.ts +206 -0
- package/dist/generic/compositeKey.d.ts.map +1 -0
- package/dist/generic/compositeKey.js +412 -0
- package/dist/generic/compositeKey.js.map +1 -0
- package/dist/generic/databaseProviderBase.d.ts +46 -0
- package/dist/generic/databaseProviderBase.d.ts.map +1 -0
- package/dist/generic/databaseProviderBase.js +14 -0
- package/dist/generic/databaseProviderBase.js.map +1 -0
- package/dist/generic/entityInfo.d.ts +983 -0
- package/dist/generic/entityInfo.d.ts.map +1 -0
- package/dist/generic/entityInfo.js +1401 -0
- package/dist/generic/entityInfo.js.map +1 -0
- package/dist/generic/explorerNavigationItem.d.ts +20 -0
- package/dist/generic/explorerNavigationItem.d.ts.map +1 -0
- package/dist/generic/explorerNavigationItem.js +29 -0
- package/dist/generic/explorerNavigationItem.js.map +1 -0
- package/dist/generic/interfaces.d.ts +610 -0
- package/dist/generic/interfaces.d.ts.map +1 -0
- package/dist/generic/interfaces.js +211 -0
- package/dist/generic/interfaces.js.map +1 -0
- package/dist/generic/libraryInfo.d.ts +40 -0
- package/dist/generic/libraryInfo.d.ts.map +1 -0
- package/dist/generic/libraryInfo.js +56 -0
- package/dist/generic/libraryInfo.js.map +1 -0
- package/dist/generic/logging.d.ts +179 -0
- package/dist/generic/logging.d.ts.map +1 -0
- package/dist/generic/logging.js +382 -0
- package/dist/generic/logging.js.map +1 -0
- package/dist/generic/metadata.d.ts +305 -0
- package/dist/generic/metadata.d.ts.map +1 -0
- package/dist/generic/metadata.js +454 -0
- package/dist/generic/metadata.js.map +1 -0
- package/dist/generic/metadataUtil.d.ts +8 -0
- package/dist/generic/metadataUtil.d.ts.map +1 -0
- package/dist/generic/metadataUtil.js +36 -0
- package/dist/generic/metadataUtil.js.map +1 -0
- package/dist/generic/providerBase.d.ts +546 -0
- package/dist/generic/providerBase.d.ts.map +1 -0
- package/dist/generic/providerBase.js +999 -0
- package/dist/generic/providerBase.js.map +1 -0
- package/dist/generic/queryInfo.d.ts +460 -0
- package/dist/generic/queryInfo.d.ts.map +1 -0
- package/dist/generic/queryInfo.js +633 -0
- package/dist/generic/queryInfo.js.map +1 -0
- package/dist/generic/querySQLFilters.d.ts +54 -0
- package/dist/generic/querySQLFilters.d.ts.map +1 -0
- package/dist/generic/querySQLFilters.js +84 -0
- package/dist/generic/querySQLFilters.js.map +1 -0
- package/dist/generic/runQuery.d.ts +96 -0
- package/dist/generic/runQuery.d.ts.map +1 -0
- package/dist/generic/runQuery.js +66 -0
- package/dist/generic/runQuery.js.map +1 -0
- package/dist/generic/runQuerySQLFilterImplementations.d.ts +51 -0
- package/dist/generic/runQuerySQLFilterImplementations.d.ts.map +1 -0
- package/dist/generic/runQuerySQLFilterImplementations.js +238 -0
- package/dist/generic/runQuerySQLFilterImplementations.js.map +1 -0
- package/dist/generic/runReport.d.ts +25 -0
- package/dist/generic/runReport.d.ts.map +1 -0
- package/dist/generic/runReport.js +42 -0
- package/dist/generic/runReport.js.map +1 -0
- package/dist/generic/securityInfo.d.ts +355 -0
- package/dist/generic/securityInfo.d.ts.map +1 -0
- package/dist/generic/securityInfo.js +425 -0
- package/dist/generic/securityInfo.js.map +1 -0
- package/dist/generic/transactionGroup.d.ts +184 -0
- package/dist/generic/transactionGroup.d.ts.map +1 -0
- package/dist/generic/transactionGroup.js +357 -0
- package/dist/generic/transactionGroup.js.map +1 -0
- package/dist/generic/util.d.ts +81 -0
- package/dist/generic/util.d.ts.map +1 -0
- package/dist/generic/util.js +301 -0
- package/dist/generic/util.js.map +1 -0
- package/dist/views/runView.d.ts +150 -0
- package/dist/views/runView.d.ts.map +1 -0
- package/dist/views/runView.js +100 -0
- package/dist/views/runView.js.map +1 -0
- package/dist/views/viewInfo.d.ts +121 -0
- package/dist/views/viewInfo.d.ts.map +1 -0
- package/dist/views/viewInfo.js +182 -0
- package/dist/views/viewInfo.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionGroupBase = exports.TransactionVariable = exports.TransactionPreprocessingItem = exports.TransactionResult = exports.TransactionItem = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const logging_1 = require("./logging");
|
|
6
|
+
/**
|
|
7
|
+
* Internal class used by TransactionGroupBase and sub-classes to manage individual transactions
|
|
8
|
+
*/
|
|
9
|
+
class TransactionItem {
|
|
10
|
+
get Vars() {
|
|
11
|
+
return this._vars;
|
|
12
|
+
}
|
|
13
|
+
get ExtraData() {
|
|
14
|
+
return this._extraData;
|
|
15
|
+
}
|
|
16
|
+
get Instruction() {
|
|
17
|
+
return this._instruction;
|
|
18
|
+
}
|
|
19
|
+
set Instruction(value) {
|
|
20
|
+
this._instruction = value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Callback function that gets called when the transaction is complete
|
|
24
|
+
* @returns A function that takes a result object (database row) and a success boolean
|
|
25
|
+
*/
|
|
26
|
+
get CallBack() {
|
|
27
|
+
return this._callBack;
|
|
28
|
+
}
|
|
29
|
+
get BaseEntity() {
|
|
30
|
+
return this._baseEntity;
|
|
31
|
+
}
|
|
32
|
+
get OperationType() {
|
|
33
|
+
return this._operationType;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new TransactionItem
|
|
37
|
+
* @param baseEntity The base entity object this transaction is associated with
|
|
38
|
+
* @param operationType The type of operation (Create, Update, Delete)
|
|
39
|
+
* @param instruction The SQL or GraphQL instruction to execute
|
|
40
|
+
* @param vars Variables to pass to the SQL or GraphQL
|
|
41
|
+
* @param extraData Additional data needed for processing by the provider
|
|
42
|
+
* @param callBack Callback function that gets called when the transaction completes
|
|
43
|
+
*/
|
|
44
|
+
constructor(baseEntity, operationType, instruction, vars, extraData, callBack) {
|
|
45
|
+
this._operationType = operationType;
|
|
46
|
+
this._baseEntity = baseEntity;
|
|
47
|
+
this._instruction = instruction;
|
|
48
|
+
this._vars = vars;
|
|
49
|
+
this._extraData = extraData;
|
|
50
|
+
this._callBack = callBack;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.TransactionItem = TransactionItem;
|
|
54
|
+
/**
|
|
55
|
+
* Tracks the individual transactions within a transaction group and their commit results
|
|
56
|
+
*/
|
|
57
|
+
class TransactionResult {
|
|
58
|
+
constructor(transaction, result, success) {
|
|
59
|
+
this.Transaction = transaction;
|
|
60
|
+
this.Result = result;
|
|
61
|
+
this.Success = success;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.TransactionResult = TransactionResult;
|
|
65
|
+
/**
|
|
66
|
+
* Used internally within the transaction group to manage the preprocessing of entities before a transaction is submitted
|
|
67
|
+
*/
|
|
68
|
+
class TransactionPreprocessingItem {
|
|
69
|
+
constructor(entity, completionPromise) {
|
|
70
|
+
this.complete = false;
|
|
71
|
+
this.entity = entity;
|
|
72
|
+
this.completionPromise = completionPromise;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.TransactionPreprocessingItem = TransactionPreprocessingItem;
|
|
76
|
+
/**
|
|
77
|
+
* This class is used to encapsulate the concept of a variable to be used within a transaction group. This is designed to allow for the flow
|
|
78
|
+
* of data from one item in a transaction group to another. For example say you had a transaction group where you are creating a new record in
|
|
79
|
+
* EntityA and you wanted to get the newly created ID value from that record and then set it into a field called "EntityA_ID" in a record in EntityB.
|
|
80
|
+
* You can do this by telling the TransactionGroup about these variables with the AddVariable() method in the TransactionGroupBase/sub-classes.
|
|
81
|
+
*/
|
|
82
|
+
class TransactionVariable {
|
|
83
|
+
get Name() {
|
|
84
|
+
return this._name;
|
|
85
|
+
}
|
|
86
|
+
get EntityObject() {
|
|
87
|
+
return this._entityObject;
|
|
88
|
+
}
|
|
89
|
+
get FieldName() {
|
|
90
|
+
return this._fieldName;
|
|
91
|
+
}
|
|
92
|
+
get Type() {
|
|
93
|
+
return this._type;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Indicates if the variable has been processed. This is only true after the transaction group has been submitted and the results have been mapped back to the variables.
|
|
97
|
+
*/
|
|
98
|
+
get IsProcessed() {
|
|
99
|
+
return this._isProcessed;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Processed Value is only available after the related transaction item has been executed and the results have been mapped back to the variables that are related to that transaction item.
|
|
103
|
+
*/
|
|
104
|
+
get ProcessedValue() {
|
|
105
|
+
return this._processedValue;
|
|
106
|
+
}
|
|
107
|
+
set ProcessedValue(value) {
|
|
108
|
+
this._processedValue = value;
|
|
109
|
+
this._isProcessed = true;
|
|
110
|
+
}
|
|
111
|
+
constructor(name, entityObject, fieldName, type) {
|
|
112
|
+
this._isProcessed = false;
|
|
113
|
+
this._name = name;
|
|
114
|
+
this._entityObject = entityObject;
|
|
115
|
+
this._fieldName = fieldName;
|
|
116
|
+
this._type = type;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.TransactionVariable = TransactionVariable;
|
|
120
|
+
/**
|
|
121
|
+
* TransactionGroup is a class that handles the bundling of multiple transactions into a single request. The provider handles
|
|
122
|
+
* the implementation details. If a transaction group is provided to the baseEntity object before either Save() or Delete() is called
|
|
123
|
+
* instead of just immediately executing its SQL or GQL, it provides the instructions to the TransactionGroup object instead.
|
|
124
|
+
*
|
|
125
|
+
* Then, whenever the TransactionGroup object instance has its Submit() method called, all of the requests will be bundled into a single
|
|
126
|
+
* request and handled. For example in the case of the GraphQLDataProvider, we queue up all of the GQL statements for all of the
|
|
127
|
+
* mutations and send them across as a single GraphQL request. The GraphQL server handles the actual DB transaction stuff.
|
|
128
|
+
*
|
|
129
|
+
* TransactionGroup will call a callback function, if provided, after the transaction has either completed succesfully or failed.
|
|
130
|
+
* If it is succesful, for Save() method calls, the latest data for that record will be provided back.
|
|
131
|
+
* For Delete() method calls, the callback will be called with no data.
|
|
132
|
+
*
|
|
133
|
+
* This class is the base class for managing a group of transactions and submitting it to the provider so it can be handled as an ATOMic transaction
|
|
134
|
+
*/
|
|
135
|
+
class TransactionGroupBase {
|
|
136
|
+
constructor() {
|
|
137
|
+
this._pendingTransactions = [];
|
|
138
|
+
this._variables = [];
|
|
139
|
+
this._status = 'Pending';
|
|
140
|
+
// RxJS Subject to notify about transaction status
|
|
141
|
+
this.transactionNotifier = new rxjs_1.Subject();
|
|
142
|
+
this._preprocessingItems = [];
|
|
143
|
+
}
|
|
144
|
+
get PendingTransactions() {
|
|
145
|
+
return this._pendingTransactions;
|
|
146
|
+
}
|
|
147
|
+
get Status() {
|
|
148
|
+
return this._status;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The array of variables that are to be used within the transaction group. These are used to pass data from one transaction item to another. See documentation on @class TransactionVariable
|
|
152
|
+
*/
|
|
153
|
+
get Variables() {
|
|
154
|
+
return this._variables;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Adds a new variable to the transaction group.
|
|
158
|
+
*/
|
|
159
|
+
AddVariable(newVariable) {
|
|
160
|
+
this._variables.push(newVariable);
|
|
161
|
+
}
|
|
162
|
+
// Expose transaction notifications as an observable
|
|
163
|
+
get TransactionNotifications$() {
|
|
164
|
+
return this.transactionNotifier.asObservable();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Notifies observers about transaction success or failure
|
|
168
|
+
* @param success Whether the transaction was successful
|
|
169
|
+
* @param results The transaction results (if applicable)
|
|
170
|
+
* @param error Any error that occurred (if applicable)
|
|
171
|
+
*/
|
|
172
|
+
NotifyTransactionStatus(success, results, error) {
|
|
173
|
+
this.transactionNotifier.next({ success, results, error });
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* If an entity object needs to conduct any type of asynchronous preprocessing before a transaction is submitted, it must notify its transaction group
|
|
177
|
+
* that it is doing so with this method. This causes the TransactionGroup to wait for all preprocessing to be completed before submitting the transaction.
|
|
178
|
+
* This method checks to see if an the entity has already been registered for preprocessing and if so, does nothing.
|
|
179
|
+
* @param entity
|
|
180
|
+
*/
|
|
181
|
+
RegisterPreprocessing(entity) {
|
|
182
|
+
const existingEntry = this._preprocessingItems.find((i) => i.entity === entity);
|
|
183
|
+
if (!existingEntry) {
|
|
184
|
+
const preprocessingPromise = new Promise((resolve) => {
|
|
185
|
+
entity.RegisterEventHandler((e) => {
|
|
186
|
+
if (e.type === 'transaction_ready' && e.baseEntity === entity) {
|
|
187
|
+
const found = this._preprocessingItems.find((i) => i.entity === entity);
|
|
188
|
+
if (found) {
|
|
189
|
+
found.complete = true;
|
|
190
|
+
resolve();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
const newItem = new TransactionPreprocessingItem(entity, preprocessingPromise);
|
|
196
|
+
this._preprocessingItems.push(newItem);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Indicates whether all of the entities that have registered with this transaction group have completed their preprocessing
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
PreprocessingComplete() {
|
|
204
|
+
if (this._preprocessingItems.length === 0)
|
|
205
|
+
return true;
|
|
206
|
+
else
|
|
207
|
+
return this._preprocessingItems.every((i) => i.complete);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Waits for all preprocessing to be complete.
|
|
211
|
+
*/
|
|
212
|
+
async waitForPreprocessing() {
|
|
213
|
+
try {
|
|
214
|
+
await Promise.all(this._preprocessingItems.map(item => item.completionPromise));
|
|
215
|
+
this._preprocessingItems = []; // clear out the preprocessing items
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
(0, logging_1.LogError)(`Error during preprocessing TransactionGroupBase. Error: ${e.message}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* This is used by the BaseEntity/Provider objects to manage transactions on your behalf.
|
|
223
|
+
* WARNING: Do NOT directly call this method. Instead set the TransactionGroup property on
|
|
224
|
+
* the @BaseEntity class to make an entity object part of a transaction group.
|
|
225
|
+
* @param transaction
|
|
226
|
+
*/
|
|
227
|
+
AddTransaction(transaction) {
|
|
228
|
+
this._pendingTransactions.push(transaction);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Helper method for sub-classes to map a variable to a position in the pending transactions array
|
|
232
|
+
* @param variable
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
MapVariableEntityObjectToPosition(variable) {
|
|
236
|
+
const index = this._pendingTransactions.findIndex((t) => {
|
|
237
|
+
return t.BaseEntity === variable.EntityObject;
|
|
238
|
+
});
|
|
239
|
+
return index;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Submits the transaction group to the provider for handling. The provider will handle the actual transaction and call the callback functions
|
|
243
|
+
* @returns true if the transaction was successful, false if it failed. If the method fails, check each of the individual BaseEntity objects within
|
|
244
|
+
* the TransactionGroup for their result histories using BaseEntity.ResultHistory and BaseEntity.LatestResult
|
|
245
|
+
* @param allowRetryOfFailedTransaction If true, the transaction group will be resubmitted even if it has failed. If false, the transaction group will not be resubmitted if it has failed.
|
|
246
|
+
*/
|
|
247
|
+
async Submit(allowRetryOfFailedTransaction = false) {
|
|
248
|
+
if (this.Status === 'Complete') {
|
|
249
|
+
throw new Error('TransactionGroup has already been completed');
|
|
250
|
+
}
|
|
251
|
+
else if (this.Status === 'In Progress') {
|
|
252
|
+
throw new Error('TransactionGroup is already in progress');
|
|
253
|
+
}
|
|
254
|
+
else if (this.Status === 'Failed') {
|
|
255
|
+
if (!allowRetryOfFailedTransaction) {
|
|
256
|
+
throw new Error('TransactionGroup has failed and cannot be resubmitted unless allowRetryOfFailedTransaction is set to true');
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// the caller has specifid that we can retry the transaction even if it has failed, log this and continue
|
|
260
|
+
(0, logging_1.LogStatus)('TransactionGroupBase.Submit', 'TransactionGroup is in a failed state, resubmitting');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
this._status = 'In Progress';
|
|
264
|
+
try {
|
|
265
|
+
// Wait for all preprocessing to be complete
|
|
266
|
+
await this.waitForPreprocessing();
|
|
267
|
+
if (this._pendingTransactions.length > 0) {
|
|
268
|
+
// subclass handles the actual submit implementation whatever that does
|
|
269
|
+
let results = await this.HandleSubmit();
|
|
270
|
+
// now we have the results back, so we can call the callback functions
|
|
271
|
+
for (let i = 0; i < results.length; i++) {
|
|
272
|
+
await results[i].Transaction.CallBack(results[i].Result, results[i].Success);
|
|
273
|
+
}
|
|
274
|
+
// now, see if there are any false values for results[x].Success, if so, we have to return false
|
|
275
|
+
const overallSuccess = results.every(r => r.Success);
|
|
276
|
+
this.NotifyTransactionStatus(overallSuccess, results);
|
|
277
|
+
this._status = overallSuccess ? 'Complete' : 'Failed';
|
|
278
|
+
return overallSuccess;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// there are no transactions to submit, so we just return true and go back to pending since there were no transactions
|
|
282
|
+
(0, logging_1.LogStatus)('No transactions to submit, switching status back to Pending');
|
|
283
|
+
this._status = 'Pending';
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
console.error(err);
|
|
289
|
+
// it failed, so we have to call the callback functions with the error
|
|
290
|
+
for (let i = 0; i < this._pendingTransactions.length; i++) {
|
|
291
|
+
await this._pendingTransactions[i].CallBack(err, false);
|
|
292
|
+
}
|
|
293
|
+
this.NotifyTransactionStatus(false, undefined, err);
|
|
294
|
+
this._status = 'Failed';
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* This utility method is to be used by sub-classes to set the values of the variables on the BaseEntity objects before the transaction is executed for variables
|
|
300
|
+
* that are defined as 'Use' type. This is used to pass values from one transaction item to another.
|
|
301
|
+
* @param entityObject
|
|
302
|
+
* @returns the number of values set on the entity object
|
|
303
|
+
*/
|
|
304
|
+
SetEntityValuesFromVariables(entityObject) {
|
|
305
|
+
let numSet = 0;
|
|
306
|
+
const vars = this.Variables.filter(v => v.EntityObject === entityObject);
|
|
307
|
+
// we have variables that we need to handle for this object. For any variables that have type of 'Use'
|
|
308
|
+
// we need to set those values on the object before we execute the query
|
|
309
|
+
for (const varItem of vars) {
|
|
310
|
+
if (varItem.Type === 'Use') {
|
|
311
|
+
// get the value from the variable that matches the NAME that has Type === 'Define'
|
|
312
|
+
const defineVar = this.Variables.find(v => v.Name.trim().toLowerCase() === varItem.Name.trim().toLowerCase() && v.Type === 'Define');
|
|
313
|
+
if (defineVar) {
|
|
314
|
+
if (defineVar.IsProcessed) {
|
|
315
|
+
// found the variable definition, now get the value from that BaseEntity from the variable's source field name
|
|
316
|
+
const value = defineVar.ProcessedValue;
|
|
317
|
+
// set the value on the BaseEntity for the current item
|
|
318
|
+
entityObject.Set(varItem.FieldName, value);
|
|
319
|
+
numSet++;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// the definition of the variable was never processed, so we can't set the value, must throw an exception and blow up the transaction
|
|
323
|
+
throw new Error(`Variable ${varItem.Name} was never processed, can't continue with transaction`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
// we can't set the value, must throw an exception and blow up the transaction
|
|
328
|
+
throw new Error(`Unable to find variable definition for variable ${varItem.Name}, can't continue with transaction`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return numSet;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* This utility method is to be used by sub-classes to set the values of the variables on the BaseEntity objects after the transaction is executed for variables
|
|
336
|
+
* @returns the number of variables that had their processed values set from the provided entity object
|
|
337
|
+
*/
|
|
338
|
+
SetVariableValuesFromEntity(entityObject, queryResults) {
|
|
339
|
+
let numVarsSet = 0;
|
|
340
|
+
const vars = this.Variables.filter(v => v.EntityObject === entityObject);
|
|
341
|
+
// we have variables that we need to handle for this object. For any variables that have type of 'Define'
|
|
342
|
+
// we need to set those values on the variable object after we execute the query and have the results
|
|
343
|
+
for (const varItem of vars) {
|
|
344
|
+
if (varItem.Type === 'Define') {
|
|
345
|
+
// get the value from the query results
|
|
346
|
+
const value = queryResults[varItem.FieldName];
|
|
347
|
+
// stash the value into the variable object
|
|
348
|
+
varItem.ProcessedValue = value;
|
|
349
|
+
// increment the counter
|
|
350
|
+
numVarsSet++;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return numVarsSet;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
exports.TransactionGroupBase = TransactionGroupBase;
|
|
357
|
+
//# sourceMappingURL=transactionGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionGroup.js","sourceRoot":"","sources":["../../src/generic/transactionGroup.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,uCAAgD;AAEhD;;GAEG;AACH,MAAa,eAAe;IAaxB,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC;IACD;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACH,YAAa,UAAsB,EAAE,aAA6C,EAAE,WAAmB,EAAE,IAAS,EAAE,SAAc,EAAE,QAAiE;QACjM,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,C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AAmC,CAAC,CAAC;gBACxH,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,2BAA2B,CAAC,YAAwB,EAAE,YAAiB;QAC7E,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;QACzE,yGAAyG;QACzG,qGAAqG;QACrG,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;YACzB,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5B,uCAAuC;gBACvC,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAE9C,2CAA2C;gBAC3C,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;gBAE/B,wBAAwB;gBACxB,UAAU,EAAE,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAxPD,oDAwPC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the TypeScript type that corresponds to the SQL type passed in
|
|
3
|
+
*/
|
|
4
|
+
export declare function TypeScriptTypeFromSQLType(sqlType: string): 'string' | 'number' | 'boolean' | 'Date';
|
|
5
|
+
export declare function TypeScriptTypeFromSQLTypeWithNullableOption(sqlType: string, addNullableOption: boolean): 'string' | 'string | null' | 'number' | 'number | null' | 'boolean' | 'boolean | null' | 'Date' | 'Date | null';
|
|
6
|
+
/**
|
|
7
|
+
* Formats a value based on the parameters passed in
|
|
8
|
+
* @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
|
|
9
|
+
* @param value - Value to format
|
|
10
|
+
* @param decimals Number of decimals to show, defaults to 2
|
|
11
|
+
* @param currency Currency to use when formatting, defaults to USD
|
|
12
|
+
* @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
|
|
13
|
+
* @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 "..."
|
|
14
|
+
* @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
|
|
15
|
+
*/
|
|
16
|
+
export declare function FormatValue(sqlType: string, value: any, decimals?: number, currency?: string, maxLength?: number, trailingChars?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a string that contains the full SQL type including length, precision and scale if applicable
|
|
19
|
+
* @param baseType
|
|
20
|
+
* @param length
|
|
21
|
+
* @param precision
|
|
22
|
+
* @param scale
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function SQLFullType(baseType: string, length: number, precision: number, scale: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* This function determines the actual maximum length for a given SQL field based on the base type and the length specified in the schema.
|
|
28
|
+
* For example, for a varchar(50) field, the length is 50, for an nvarchar(50) field, the length is 50/2 = 25
|
|
29
|
+
* @param sqlBaseType
|
|
30
|
+
* @param sqlLength
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare function SQLMaxLength(sqlBaseType: string, sqlLength: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* This function returns an array of common stop words that are used in text processing
|
|
36
|
+
* @returns An array of common stop words that are used in text processing
|
|
37
|
+
*/
|
|
38
|
+
export declare function CommonStopWords(): string[];
|
|
39
|
+
/**
|
|
40
|
+
* This function takes a string and removes common stop words from it, using the CommonStopWords() function to get the list of stop words
|
|
41
|
+
* @param inputString
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export declare function StripStopWords(inputString: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* 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
|
|
47
|
+
*/
|
|
48
|
+
export declare function CodeNameFromString(input: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Run concurrent promises with a maximum concurrency level
|
|
51
|
+
* @param concurrency - The number of concurrently running promises
|
|
52
|
+
* @param funcs - An array of functions that return promises
|
|
53
|
+
* @returns A promise that resolves to an array of the resolved values from the promises returned by funcs
|
|
54
|
+
*/
|
|
55
|
+
export declare function Concurrent<V>(concurrency: number, funcs: (() => Promise<V>)[]): Promise<V[]>;
|
|
56
|
+
/**
|
|
57
|
+
* 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
|
|
58
|
+
* 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
|
|
59
|
+
* @param storedDefaultValue - The default value as stored in the DBMS
|
|
60
|
+
*/
|
|
61
|
+
export declare function ExtractActualDefaultValue(storedDefaultValue: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Strips out the N prefix and single quotes from a string if they exist so that a value like
|
|
64
|
+
* N'Active' becomes Active
|
|
65
|
+
*/
|
|
66
|
+
export declare function StripUnicodePrefix(value: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Strips out single quotes from a string if they exist so that a value like
|
|
69
|
+
* 'Active' becomes Active
|
|
70
|
+
* @param value
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export declare function StripSingleQuotes(value: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Strips out any number of symmetric containing parens from a string, for example ((0)) becomes 0
|
|
76
|
+
* and ('Active') becomes 'Active'
|
|
77
|
+
* @param value
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
export declare function StripContainingParens(value: string): string;
|
|
81
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"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