@creatio-devkit/common 0.808.0 → 0.809.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -5
- package/esm2020/lib/internal/enums/data-schema-type.enum.mjs +10 -0
- package/esm2020/lib/internal/enums/index.mjs +2 -1
- package/esm2020/lib/internal/models/interface-designer-item/toolbar-view-element-config.mjs +1 -1
- package/esm2020/lib/internal/models/request-handler/handler-source.mjs +1 -1
- package/esm2020/lib/internal/models/request-handler/request-handler-registration-config.model.mjs +1 -1
- package/esm2020/lib/internal/services/element-registration-checker/element-registration-checker.mjs +1 -1
- package/esm2020/lib/internal/services/handler-chain-services-registry/handler-chain-services-registry.mjs +3 -2
- package/esm2020/lib/internal/services/interface-designer-item-registry/interface-designer-item-registry.mjs +3 -2
- package/esm2020/lib/internal/utils/handlers-order-comparer.mjs +2 -2
- package/esm2020/lib/public/esq/data-model/enums/function-type.enum.mjs +5 -1
- package/esm2020/lib/public/esq/data-model/filters/between-filter.mjs +1 -1
- package/esm2020/lib/public/esq/data-model/filters/compare-filter.mjs +1 -1
- package/esm2020/lib/public/esq/data-model/filters/in-filter.mjs +1 -1
- package/esm2020/lib/public/esq/data-model/filters/isnull-filter.mjs +1 -1
- package/esm2020/lib/public/esq/data-model/filters/single-filter.mjs +1 -1
- package/esm2020/lib/public/handlers/base-request-handler.mjs +2 -2
- package/esm2020/lib/public/models/image-value.model.mjs +1 -1
- package/esm2020/lib/public/models/lookup-value.model.mjs +1 -1
- package/esm2020/lib/public/models/validation/crt-validator-fn.mjs +1 -1
- package/esm2020/lib/public/services/handler-chain/handler-chain.service.mjs +1 -1
- package/esm2020/lib/public/services/handler-chain/internal-handler-chain.mjs +4 -3
- package/esm2020/lib/public/services/model/data-schema.mjs +1 -1
- package/esm2020/lib/public/services/sys-values/sys-values.mjs +1 -1
- package/esm2020/lib/public/types/entity-column-value.mjs +1 -1
- package/fesm2015/creatio-devkit-common.mjs +412 -397
- package/fesm2015/creatio-devkit-common.mjs.map +1 -1
- package/fesm2020/creatio-devkit-common.mjs +404 -389
- package/fesm2020/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
2
2
|
import { Exclude, Expose, classToPlain } from 'class-transformer';
|
|
3
|
-
import {
|
|
3
|
+
import { get, set, upperFirst, camelCase, isEqual, cloneDeep } from 'lodash';
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
|
|
6
6
|
var DataValueType;
|
|
@@ -189,6 +189,10 @@ var FunctionType;
|
|
|
189
189
|
FunctionType[FunctionType["Length"] = 4] = "Length";
|
|
190
190
|
/** Window query function */
|
|
191
191
|
FunctionType[FunctionType["Window"] = 5] = "Window";
|
|
192
|
+
/** Date add. */
|
|
193
|
+
FunctionType[FunctionType["DateAdd"] = 6] = "DateAdd";
|
|
194
|
+
/** Date diff. */
|
|
195
|
+
FunctionType[FunctionType["DateDiff"] = 7] = "DateDiff";
|
|
192
196
|
})(FunctionType || (FunctionType = {}));
|
|
193
197
|
|
|
194
198
|
var OrderDirection;
|
|
@@ -1132,6 +1136,381 @@ const crtValidationInputPrefix = 'crtValidationInput:';
|
|
|
1132
1136
|
*/
|
|
1133
1137
|
const crtInjectPrefix = 'crtInject:';
|
|
1134
1138
|
|
|
1139
|
+
/**
|
|
1140
|
+
* @internal
|
|
1141
|
+
*/
|
|
1142
|
+
var ViewElementGroupType;
|
|
1143
|
+
(function (ViewElementGroupType) {
|
|
1144
|
+
ViewElementGroupType["Charts"] = "Charts";
|
|
1145
|
+
ViewElementGroupType["Components"] = "Components";
|
|
1146
|
+
ViewElementGroupType["LayoutElements"] = "LayoutElements";
|
|
1147
|
+
ViewElementGroupType["Inputs"] = "Inputs";
|
|
1148
|
+
ViewElementGroupType["CustomElements"] = "CustomElements";
|
|
1149
|
+
})(ViewElementGroupType || (ViewElementGroupType = {}));
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @internal
|
|
1153
|
+
*/
|
|
1154
|
+
var ViewElementDataGroupType;
|
|
1155
|
+
(function (ViewElementDataGroupType) {
|
|
1156
|
+
ViewElementDataGroupType["Data"] = "Data";
|
|
1157
|
+
})(ViewElementDataGroupType || (ViewElementDataGroupType = {}));
|
|
1158
|
+
/**
|
|
1159
|
+
* @internal
|
|
1160
|
+
*/
|
|
1161
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1162
|
+
const DesignerToolGroupType = Object.assign(Object.assign({}, ViewElementDataGroupType), ViewElementGroupType);
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* @internal
|
|
1166
|
+
*/
|
|
1167
|
+
var DataSourceScope;
|
|
1168
|
+
(function (DataSourceScope) {
|
|
1169
|
+
DataSourceScope["ViewElement"] = "viewElement";
|
|
1170
|
+
DataSourceScope["Page"] = "page";
|
|
1171
|
+
})(DataSourceScope || (DataSourceScope = {}));
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* @internal
|
|
1175
|
+
*/
|
|
1176
|
+
var ModelInPageAction;
|
|
1177
|
+
(function (ModelInPageAction) {
|
|
1178
|
+
ModelInPageAction["Edit"] = "edit";
|
|
1179
|
+
ModelInPageAction["Add"] = "add";
|
|
1180
|
+
ModelInPageAction["Copy"] = "copy";
|
|
1181
|
+
})(ModelInPageAction || (ModelInPageAction = {}));
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* Handler source types in order of call priority.
|
|
1185
|
+
* @internal
|
|
1186
|
+
*/
|
|
1187
|
+
var HandlerSourceType;
|
|
1188
|
+
(function (HandlerSourceType) {
|
|
1189
|
+
HandlerSourceType[HandlerSourceType["Schema"] = 0] = "Schema";
|
|
1190
|
+
HandlerSourceType[HandlerSourceType["Remote"] = 1] = "Remote";
|
|
1191
|
+
HandlerSourceType[HandlerSourceType["Host"] = 2] = "Host";
|
|
1192
|
+
})(HandlerSourceType || (HandlerSourceType = {}));
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* @internal
|
|
1196
|
+
*/
|
|
1197
|
+
var DataSchemaAttributeType;
|
|
1198
|
+
(function (DataSchemaAttributeType) {
|
|
1199
|
+
DataSchemaAttributeType["OwnAttribute"] = "Own";
|
|
1200
|
+
DataSchemaAttributeType["ForwardReferenceAttribute"] = "ForwardReference";
|
|
1201
|
+
DataSchemaAttributeType["BackReferenceAttribute"] = "BackReference";
|
|
1202
|
+
DataSchemaAttributeType["AggregationAttribute"] = "Aggregation";
|
|
1203
|
+
DataSchemaAttributeType["FunctionAttribute"] = "Function";
|
|
1204
|
+
})(DataSchemaAttributeType || (DataSchemaAttributeType = {}));
|
|
1205
|
+
/**
|
|
1206
|
+
* @internal
|
|
1207
|
+
*/
|
|
1208
|
+
var DataSchemaAttributeUsageType;
|
|
1209
|
+
(function (DataSchemaAttributeUsageType) {
|
|
1210
|
+
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["General"] = 0] = "General";
|
|
1211
|
+
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["Advanced"] = 1] = "Advanced";
|
|
1212
|
+
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["None"] = 2] = "None";
|
|
1213
|
+
})(DataSchemaAttributeUsageType || (DataSchemaAttributeUsageType = {}));
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Type of DataSchema. In combination with the name is used for unique identification of {@link DataSchema}.
|
|
1217
|
+
* @internal
|
|
1218
|
+
*/
|
|
1219
|
+
var DataSchemaType;
|
|
1220
|
+
(function (DataSchemaType) {
|
|
1221
|
+
DataSchemaType["Entity"] = "Entity";
|
|
1222
|
+
DataSchemaType["ClientUnit"] = "ClientUnit";
|
|
1223
|
+
})(DataSchemaType || (DataSchemaType = {}));
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* @internal
|
|
1227
|
+
*/
|
|
1228
|
+
var DefaultValueSource;
|
|
1229
|
+
(function (DefaultValueSource) {
|
|
1230
|
+
DefaultValueSource[DefaultValueSource["None"] = 0] = "None";
|
|
1231
|
+
DefaultValueSource[DefaultValueSource["Const"] = 1] = "Const";
|
|
1232
|
+
DefaultValueSource[DefaultValueSource["Settings"] = 2] = "Settings";
|
|
1233
|
+
DefaultValueSource[DefaultValueSource["SystemValue"] = 3] = "SystemValue";
|
|
1234
|
+
DefaultValueSource[DefaultValueSource["Sequence"] = 4] = "Sequence";
|
|
1235
|
+
})(DefaultValueSource || (DefaultValueSource = {}));
|
|
1236
|
+
|
|
1237
|
+
const global$3 = window;
|
|
1238
|
+
/**
|
|
1239
|
+
* @internal
|
|
1240
|
+
*/
|
|
1241
|
+
class BaseRegistry {
|
|
1242
|
+
constructor() {
|
|
1243
|
+
this.store = {
|
|
1244
|
+
typeInfos: new Map(),
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
static get store() {
|
|
1248
|
+
if (!this._instance) {
|
|
1249
|
+
let globalInstance = get(global$3, this._prefix + this.registryKey);
|
|
1250
|
+
if (!globalInstance) {
|
|
1251
|
+
globalInstance = new this();
|
|
1252
|
+
set(global$3, this._prefix + this.registryKey, globalInstance);
|
|
1253
|
+
}
|
|
1254
|
+
this._instance = globalInstance;
|
|
1255
|
+
}
|
|
1256
|
+
return this._instance.store;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
BaseRegistry._prefix = 'creatio.registry.';
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* @internal
|
|
1263
|
+
*/
|
|
1264
|
+
class PkgTopology extends BaseRegistry {
|
|
1265
|
+
static get items() {
|
|
1266
|
+
return this.store.typeInfos;
|
|
1267
|
+
}
|
|
1268
|
+
static get(pkgName) {
|
|
1269
|
+
const order = this.items.get(pkgName);
|
|
1270
|
+
if (order === undefined) {
|
|
1271
|
+
throw new Error(`Package with name ${pkgName} not found in topology`);
|
|
1272
|
+
}
|
|
1273
|
+
return order;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
PkgTopology.registryKey = 'pkgTopology';
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* @internal
|
|
1280
|
+
*/
|
|
1281
|
+
class HandlersOrderComparer {
|
|
1282
|
+
constructor(_request) {
|
|
1283
|
+
var _a;
|
|
1284
|
+
this._request = _request;
|
|
1285
|
+
const scopesOrderEntries = [...((_a = this._request.scopes) !== null && _a !== void 0 ? _a : [])].reverse().map((scope, index) => [scope, index]);
|
|
1286
|
+
this._scopesOrder = Object.fromEntries(scopesOrderEntries);
|
|
1287
|
+
}
|
|
1288
|
+
_getOrderByScopes(handler) {
|
|
1289
|
+
if (!handler.scopes) {
|
|
1290
|
+
return Number.MAX_VALUE;
|
|
1291
|
+
}
|
|
1292
|
+
const scopesOrder = handler.scopes.filter((s) => s in this._scopesOrder).map((s) => this._scopesOrder[s]);
|
|
1293
|
+
return Math.min(...scopesOrder);
|
|
1294
|
+
}
|
|
1295
|
+
_getOrderByPkgTopology(handler) {
|
|
1296
|
+
if (handler.source.type === HandlerSourceType.Host) {
|
|
1297
|
+
return Number.MAX_VALUE;
|
|
1298
|
+
}
|
|
1299
|
+
return PkgTopology.get(handler.source.packageName);
|
|
1300
|
+
}
|
|
1301
|
+
compare(a, b) {
|
|
1302
|
+
const aScopeOrder = this._getOrderByScopes(a);
|
|
1303
|
+
const bScopeOrder = this._getOrderByScopes(b);
|
|
1304
|
+
let diff = aScopeOrder - bScopeOrder;
|
|
1305
|
+
if (diff) {
|
|
1306
|
+
return diff;
|
|
1307
|
+
}
|
|
1308
|
+
const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
|
|
1309
|
+
const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
|
|
1310
|
+
diff = aPkgTopologyOrder - bPkgTopologyOrder;
|
|
1311
|
+
if (diff) {
|
|
1312
|
+
return diff;
|
|
1313
|
+
}
|
|
1314
|
+
diff = a.source.type - b.source.type;
|
|
1315
|
+
return diff;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* @internal
|
|
1321
|
+
*/
|
|
1322
|
+
class InternalHandlerChain {
|
|
1323
|
+
constructor() {
|
|
1324
|
+
this._handlers = [];
|
|
1325
|
+
this._handlersCache = new Map();
|
|
1326
|
+
this._handlersScopesByContextId = new Map();
|
|
1327
|
+
this.handlerChain$ = {
|
|
1328
|
+
process: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
1329
|
+
const handler = this._getHandler(request);
|
|
1330
|
+
return handler === null || handler === void 0 ? void 0 : handler.handle(request);
|
|
1331
|
+
}),
|
|
1332
|
+
register: (info) => {
|
|
1333
|
+
this._handlersCache.delete(info.requestType);
|
|
1334
|
+
this._handlers.push(info);
|
|
1335
|
+
return () => {
|
|
1336
|
+
const index = this._handlers.indexOf(info);
|
|
1337
|
+
if (index > -1) {
|
|
1338
|
+
this._handlers.splice(index, 1);
|
|
1339
|
+
this._handlersCache.delete(info.requestType);
|
|
1340
|
+
}
|
|
1341
|
+
else {
|
|
1342
|
+
console.warn(`${info === null || info === void 0 ? void 0 : info.requestType} not found to unsubscribe`);
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
},
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
clearContextedHandlersCache(contextId) {
|
|
1349
|
+
var _a;
|
|
1350
|
+
const configs = (_a = this._handlersScopesByContextId.get(contextId)) !== null && _a !== void 0 ? _a : [];
|
|
1351
|
+
return configs.every(({ requestType, scope }) => { var _a; return (_a = this._handlersCache.get(requestType)) === null || _a === void 0 ? void 0 : _a.delete(scope); });
|
|
1352
|
+
}
|
|
1353
|
+
_getHandler(request) {
|
|
1354
|
+
return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
|
|
1355
|
+
}
|
|
1356
|
+
_getCacheHandler(request) {
|
|
1357
|
+
const map = this._handlersCache.get(request.type);
|
|
1358
|
+
const key = this._getCacheScopesKey(request);
|
|
1359
|
+
return map.get(key);
|
|
1360
|
+
}
|
|
1361
|
+
_hasCacheHandler(request) {
|
|
1362
|
+
const map = this._handlersCache.get(request.type);
|
|
1363
|
+
const key = this._getCacheScopesKey(request);
|
|
1364
|
+
return map && map.has(key);
|
|
1365
|
+
}
|
|
1366
|
+
_getCacheScopesKey(request) {
|
|
1367
|
+
var _a, _b;
|
|
1368
|
+
const injectionContextKey = (_b = (_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
|
1369
|
+
return (request.scopes || ['']).join('_').concat(injectionContextKey);
|
|
1370
|
+
}
|
|
1371
|
+
_getInjectionContext(viewModel) {
|
|
1372
|
+
return ((viewModel === null || viewModel === void 0 ? void 0 : viewModel['_injectionContext']) ||
|
|
1373
|
+
((viewModel === null || viewModel === void 0 ? void 0 : viewModel['parent']) && this._getInjectionContext(viewModel['parent'])));
|
|
1374
|
+
}
|
|
1375
|
+
_setContextedScopes(request, scope) {
|
|
1376
|
+
var _a;
|
|
1377
|
+
const injectionContext = (_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id;
|
|
1378
|
+
const configs = this._handlersScopesByContextId.has(injectionContext)
|
|
1379
|
+
? this._handlersScopesByContextId.get(injectionContext)
|
|
1380
|
+
: [];
|
|
1381
|
+
configs.push({ requestType: request.type, scope });
|
|
1382
|
+
this._handlersScopesByContextId.set(injectionContext, configs);
|
|
1383
|
+
}
|
|
1384
|
+
_setCacheHandler(request, handler) {
|
|
1385
|
+
var _a;
|
|
1386
|
+
const map = this._handlersCache.has(request.type)
|
|
1387
|
+
? this._handlersCache.get(request.type)
|
|
1388
|
+
: new Map();
|
|
1389
|
+
const key = this._getCacheScopesKey(request);
|
|
1390
|
+
map.set(key, handler);
|
|
1391
|
+
if ((_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id) {
|
|
1392
|
+
this._setContextedScopes(request, key);
|
|
1393
|
+
}
|
|
1394
|
+
this._handlersCache.set(request.type, map);
|
|
1395
|
+
}
|
|
1396
|
+
_isRequestHandler(handler) {
|
|
1397
|
+
return (typeof handler.handle === 'function' &&
|
|
1398
|
+
typeof handler.setNext === 'function');
|
|
1399
|
+
}
|
|
1400
|
+
_checkHandlerInstanceOf(handler) {
|
|
1401
|
+
if (!this._isRequestHandler(handler)) {
|
|
1402
|
+
throw new Error('Handler should implement "BaseRequestHandler"');
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
_buildHandlersChain(request) {
|
|
1406
|
+
const handlers = this._handlers.filter((h) => {
|
|
1407
|
+
var _a;
|
|
1408
|
+
if (h.requestType !== request.type) {
|
|
1409
|
+
return false;
|
|
1410
|
+
}
|
|
1411
|
+
if (!((_a = h.scopes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1412
|
+
return true;
|
|
1413
|
+
}
|
|
1414
|
+
return h.scopes.some((s) => { var _a; return (_a = request.scopes) === null || _a === void 0 ? void 0 : _a.includes(s); });
|
|
1415
|
+
});
|
|
1416
|
+
const comparer = new HandlersOrderComparer(request);
|
|
1417
|
+
handlers.sort((a, b) => comparer.compare(a, b));
|
|
1418
|
+
const handlerInstances = handlers.map((handlerConfig) => {
|
|
1419
|
+
const injectionContext = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context);
|
|
1420
|
+
return handlerConfig.createHandler(injectionContext);
|
|
1421
|
+
});
|
|
1422
|
+
handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
|
|
1423
|
+
this._joinHandlersInChain(handlerInstances);
|
|
1424
|
+
const result = handlerInstances[0];
|
|
1425
|
+
this._setCacheHandler(request, result);
|
|
1426
|
+
return result;
|
|
1427
|
+
}
|
|
1428
|
+
_joinHandlersInChain(handlers) {
|
|
1429
|
+
for (let index = 0; index < handlers.length - 1; index++) {
|
|
1430
|
+
try {
|
|
1431
|
+
handlers[index].setNext(handlers[index + 1]);
|
|
1432
|
+
}
|
|
1433
|
+
catch (error) {
|
|
1434
|
+
if (error instanceof NextHandlerAlreadySpecifiedException) {
|
|
1435
|
+
throw new Error('Handler factory should return new instance of ' +
|
|
1436
|
+
'BaseRequestHandler class or its subclass ' +
|
|
1437
|
+
'(next handler should not be specified)');
|
|
1438
|
+
}
|
|
1439
|
+
throw error;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
const global$2 = window;
|
|
1446
|
+
/**
|
|
1447
|
+
* @public
|
|
1448
|
+
* @class HandlerChainService
|
|
1449
|
+
* @classdesc Service to design handlers in chain.
|
|
1450
|
+
*/
|
|
1451
|
+
class HandlerChainService {
|
|
1452
|
+
constructor() {
|
|
1453
|
+
if (!this._chain) {
|
|
1454
|
+
this._createGlobalHandlerChain();
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
get _chain() {
|
|
1458
|
+
return global$2.handlerChain;
|
|
1459
|
+
}
|
|
1460
|
+
set _chain(value) {
|
|
1461
|
+
global$2.handlerChain = value;
|
|
1462
|
+
}
|
|
1463
|
+
static get instance() {
|
|
1464
|
+
return HandlerChainService._instance || (HandlerChainService._instance = new HandlerChainService());
|
|
1465
|
+
}
|
|
1466
|
+
_createGlobalHandlerChain() {
|
|
1467
|
+
this._chain = new InternalHandlerChain();
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* @internal
|
|
1471
|
+
*/
|
|
1472
|
+
clearContextedHandlersCache(contextId) {
|
|
1473
|
+
return this._chain.clearContextedHandlersCache(contextId);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* @internal
|
|
1477
|
+
*/
|
|
1478
|
+
register(handlerConfig) {
|
|
1479
|
+
return this._chain.handlerChain$.register(handlerConfig);
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* @description Method to process passed request
|
|
1483
|
+
* @param request - {@link BaseRequest}
|
|
1484
|
+
* @return `Promise<unknown>`
|
|
1485
|
+
*/
|
|
1486
|
+
process(request) {
|
|
1487
|
+
return this._chain.handlerChain$.process(request);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* @internal
|
|
1493
|
+
*/
|
|
1494
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1495
|
+
function ImplementUsingHandlerChain(config) {
|
|
1496
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1497
|
+
return function (target, method, descriptor) {
|
|
1498
|
+
const methodImplementation = function (...args) {
|
|
1499
|
+
return HandlerChainService.instance.process({
|
|
1500
|
+
type: (config === null || config === void 0 ? void 0 : config.requestType) ? config.requestType : this.requestType,
|
|
1501
|
+
method: (config === null || config === void 0 ? void 0 : config.methodName) ? config.methodName : method,
|
|
1502
|
+
args,
|
|
1503
|
+
});
|
|
1504
|
+
};
|
|
1505
|
+
if (descriptor) {
|
|
1506
|
+
descriptor.value = methodImplementation;
|
|
1507
|
+
}
|
|
1508
|
+
else {
|
|
1509
|
+
target[method] = methodImplementation;
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1135
1514
|
/**
|
|
1136
1515
|
* @internal
|
|
1137
1516
|
*/
|
|
@@ -1238,10 +1617,10 @@ class InternalRequestHandlerRegistryType {
|
|
|
1238
1617
|
InternalRequestHandlerRegistryType._addItemListeners = [];
|
|
1239
1618
|
InternalRequestHandlerRegistryType._removeItemListeners = [];
|
|
1240
1619
|
InternalRequestHandlerRegistryType._requestHandlersMap = new Map();
|
|
1241
|
-
const global$
|
|
1242
|
-
(_a = global$
|
|
1243
|
-
if (!global$
|
|
1244
|
-
Object.defineProperty(global$
|
|
1620
|
+
const global$1 = window;
|
|
1621
|
+
(_a = global$1.creatio) !== null && _a !== void 0 ? _a : (global$1.creatio = {});
|
|
1622
|
+
if (!global$1.creatio.requestHandlerRegistry) {
|
|
1623
|
+
Object.defineProperty(global$1.creatio, 'requestHandlerRegistry', {
|
|
1245
1624
|
get: () => InternalRequestHandlerRegistryType,
|
|
1246
1625
|
configurable: false,
|
|
1247
1626
|
});
|
|
@@ -1273,7 +1652,7 @@ class RequestHandlerRegistryService {
|
|
|
1273
1652
|
RequestHandlerRegistryService._internalRegistry.addRequestHandler(requestHandlerType, requestHandlerMapValue);
|
|
1274
1653
|
}
|
|
1275
1654
|
}
|
|
1276
|
-
RequestHandlerRegistryService._internalRegistry = global$
|
|
1655
|
+
RequestHandlerRegistryService._internalRegistry = global$1.creatio.requestHandlerRegistry;
|
|
1277
1656
|
|
|
1278
1657
|
/**
|
|
1279
1658
|
* @internal
|
|
@@ -1307,30 +1686,6 @@ class RequestRegistryService {
|
|
|
1307
1686
|
RequestRegistryService._requestsMap = new Map();
|
|
1308
1687
|
RequestRegistryService._requestsRegistrationInfos = new Map();
|
|
1309
1688
|
|
|
1310
|
-
const global$2 = window;
|
|
1311
|
-
/**
|
|
1312
|
-
* @internal
|
|
1313
|
-
*/
|
|
1314
|
-
class BaseRegistry {
|
|
1315
|
-
constructor() {
|
|
1316
|
-
this.store = {
|
|
1317
|
-
typeInfos: new Map(),
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
static get store() {
|
|
1321
|
-
if (!this._instance) {
|
|
1322
|
-
let globalInstance = get(global$2, this._prefix + this.registryKey);
|
|
1323
|
-
if (!globalInstance) {
|
|
1324
|
-
globalInstance = new this();
|
|
1325
|
-
set(global$2, this._prefix + this.registryKey, globalInstance);
|
|
1326
|
-
}
|
|
1327
|
-
this._instance = globalInstance;
|
|
1328
|
-
}
|
|
1329
|
-
return this._instance.store;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
BaseRegistry._prefix = 'creatio.registry.';
|
|
1333
|
-
|
|
1334
1689
|
/**
|
|
1335
1690
|
* @internal
|
|
1336
1691
|
*/
|
|
@@ -1404,7 +1759,7 @@ class InterfaceDesignerItemRegistry extends BaseRegistry {
|
|
|
1404
1759
|
}
|
|
1405
1760
|
InterfaceDesignerItemRegistry.registryKey = interfaceDesignerItemRegistryKey;
|
|
1406
1761
|
|
|
1407
|
-
const global
|
|
1762
|
+
const global = window;
|
|
1408
1763
|
/**
|
|
1409
1764
|
* @internal
|
|
1410
1765
|
*/
|
|
@@ -1413,10 +1768,10 @@ class BootstrapNotifier {
|
|
|
1413
1768
|
this._subscribers = new Set();
|
|
1414
1769
|
}
|
|
1415
1770
|
static get instance() {
|
|
1416
|
-
if (!global
|
|
1417
|
-
global
|
|
1771
|
+
if (!global.__crtModuleBootstrapNotifier) {
|
|
1772
|
+
global.__crtModuleBootstrapNotifier = new BootstrapNotifier();
|
|
1418
1773
|
}
|
|
1419
|
-
return global
|
|
1774
|
+
return global.__crtModuleBootstrapNotifier;
|
|
1420
1775
|
}
|
|
1421
1776
|
notify(moduleType) {
|
|
1422
1777
|
for (const subscriber of this._subscribers.values()) {
|
|
@@ -1512,183 +1867,37 @@ class ValidatorRegistry extends BaseRegistry {
|
|
|
1512
1867
|
}
|
|
1513
1868
|
static register(config) {
|
|
1514
1869
|
this.items.set(config.type, config);
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
ValidatorRegistry.registryKey = validatorRegistryKey;
|
|
1518
|
-
|
|
1519
|
-
/**
|
|
1520
|
-
* @internal
|
|
1521
|
-
*/
|
|
1522
|
-
class PkgTopology extends BaseRegistry {
|
|
1523
|
-
static get items() {
|
|
1524
|
-
return this.store.typeInfos;
|
|
1525
|
-
}
|
|
1526
|
-
static get(pkgName) {
|
|
1527
|
-
const order = this.items.get(pkgName);
|
|
1528
|
-
if (order === undefined) {
|
|
1529
|
-
throw new Error(`Package with name ${pkgName} not found in topology`);
|
|
1530
|
-
}
|
|
1531
|
-
return order;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
PkgTopology.registryKey = 'pkgTopology';
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* @internal
|
|
1538
|
-
* @dontChange
|
|
1539
|
-
*/
|
|
1540
|
-
class RemoteEntriesRegistry extends BaseRegistry {
|
|
1541
|
-
/**
|
|
1542
|
-
* @dontChange
|
|
1543
|
-
*/
|
|
1544
|
-
static get items() {
|
|
1545
|
-
return this.store.typeInfos;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
/**
|
|
1549
|
-
* @dontChange
|
|
1550
|
-
*/
|
|
1551
|
-
RemoteEntriesRegistry.registryKey = 'remotes';
|
|
1552
|
-
|
|
1553
|
-
/**
|
|
1554
|
-
* @internal
|
|
1555
|
-
*/
|
|
1556
|
-
function isComponentPropertyBindable(viewConfigType, componentProperty) {
|
|
1557
|
-
var _a;
|
|
1558
|
-
const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
|
|
1559
|
-
if (!(componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.inputs)) {
|
|
1560
|
-
return false;
|
|
1561
|
-
}
|
|
1562
|
-
return !!((_a = componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.inputs[componentProperty]) === null || _a === void 0 ? void 0 : _a.propertyBindable);
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
/**
|
|
1566
|
-
* @internal
|
|
1567
|
-
*/
|
|
1568
|
-
var ViewElementGroupType;
|
|
1569
|
-
(function (ViewElementGroupType) {
|
|
1570
|
-
ViewElementGroupType["Charts"] = "Charts";
|
|
1571
|
-
ViewElementGroupType["Components"] = "Components";
|
|
1572
|
-
ViewElementGroupType["LayoutElements"] = "LayoutElements";
|
|
1573
|
-
ViewElementGroupType["Inputs"] = "Inputs";
|
|
1574
|
-
ViewElementGroupType["CustomElements"] = "CustomElements";
|
|
1575
|
-
})(ViewElementGroupType || (ViewElementGroupType = {}));
|
|
1576
|
-
|
|
1577
|
-
/**
|
|
1578
|
-
* @internal
|
|
1579
|
-
*/
|
|
1580
|
-
var ViewElementDataGroupType;
|
|
1581
|
-
(function (ViewElementDataGroupType) {
|
|
1582
|
-
ViewElementDataGroupType["Data"] = "Data";
|
|
1583
|
-
})(ViewElementDataGroupType || (ViewElementDataGroupType = {}));
|
|
1584
|
-
/**
|
|
1585
|
-
* @internal
|
|
1586
|
-
*/
|
|
1587
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1588
|
-
const DesignerToolGroupType = Object.assign(Object.assign({}, ViewElementDataGroupType), ViewElementGroupType);
|
|
1589
|
-
|
|
1590
|
-
/**
|
|
1591
|
-
* @internal
|
|
1592
|
-
*/
|
|
1593
|
-
var DataSourceScope;
|
|
1594
|
-
(function (DataSourceScope) {
|
|
1595
|
-
DataSourceScope["ViewElement"] = "viewElement";
|
|
1596
|
-
DataSourceScope["Page"] = "page";
|
|
1597
|
-
})(DataSourceScope || (DataSourceScope = {}));
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
* @internal
|
|
1601
|
-
*/
|
|
1602
|
-
var ModelInPageAction;
|
|
1603
|
-
(function (ModelInPageAction) {
|
|
1604
|
-
ModelInPageAction["Edit"] = "edit";
|
|
1605
|
-
ModelInPageAction["Add"] = "add";
|
|
1606
|
-
ModelInPageAction["Copy"] = "copy";
|
|
1607
|
-
})(ModelInPageAction || (ModelInPageAction = {}));
|
|
1608
|
-
|
|
1609
|
-
/**
|
|
1610
|
-
* Handler source types in order of call priority.
|
|
1611
|
-
* @internal
|
|
1612
|
-
*/
|
|
1613
|
-
var HandlerSourceType;
|
|
1614
|
-
(function (HandlerSourceType) {
|
|
1615
|
-
HandlerSourceType[HandlerSourceType["Schema"] = 0] = "Schema";
|
|
1616
|
-
HandlerSourceType[HandlerSourceType["Remote"] = 1] = "Remote";
|
|
1617
|
-
HandlerSourceType[HandlerSourceType["Host"] = 2] = "Host";
|
|
1618
|
-
})(HandlerSourceType || (HandlerSourceType = {}));
|
|
1619
|
-
|
|
1620
|
-
/**
|
|
1621
|
-
* @internal
|
|
1622
|
-
*/
|
|
1623
|
-
var DataSchemaAttributeType;
|
|
1624
|
-
(function (DataSchemaAttributeType) {
|
|
1625
|
-
DataSchemaAttributeType["OwnAttribute"] = "Own";
|
|
1626
|
-
DataSchemaAttributeType["ForwardReferenceAttribute"] = "ForwardReference";
|
|
1627
|
-
DataSchemaAttributeType["BackReferenceAttribute"] = "BackReference";
|
|
1628
|
-
DataSchemaAttributeType["AggregationAttribute"] = "Aggregation";
|
|
1629
|
-
DataSchemaAttributeType["FunctionAttribute"] = "Function";
|
|
1630
|
-
})(DataSchemaAttributeType || (DataSchemaAttributeType = {}));
|
|
1631
|
-
/**
|
|
1632
|
-
* @internal
|
|
1633
|
-
*/
|
|
1634
|
-
var DataSchemaAttributeUsageType;
|
|
1635
|
-
(function (DataSchemaAttributeUsageType) {
|
|
1636
|
-
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["General"] = 0] = "General";
|
|
1637
|
-
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["Advanced"] = 1] = "Advanced";
|
|
1638
|
-
DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["None"] = 2] = "None";
|
|
1639
|
-
})(DataSchemaAttributeUsageType || (DataSchemaAttributeUsageType = {}));
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
ValidatorRegistry.registryKey = validatorRegistryKey;
|
|
1640
1873
|
|
|
1641
1874
|
/**
|
|
1642
1875
|
* @internal
|
|
1876
|
+
* @dontChange
|
|
1643
1877
|
*/
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
}
|
|
1878
|
+
class RemoteEntriesRegistry extends BaseRegistry {
|
|
1879
|
+
/**
|
|
1880
|
+
* @dontChange
|
|
1881
|
+
*/
|
|
1882
|
+
static get items() {
|
|
1883
|
+
return this.store.typeInfos;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* @dontChange
|
|
1888
|
+
*/
|
|
1889
|
+
RemoteEntriesRegistry.registryKey = 'remotes';
|
|
1652
1890
|
|
|
1653
1891
|
/**
|
|
1654
1892
|
* @internal
|
|
1655
1893
|
*/
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
this._scopesOrder = Object.fromEntries(scopesOrderEntries);
|
|
1662
|
-
}
|
|
1663
|
-
_getOrderByScopes(handler) {
|
|
1664
|
-
if (!handler.scopes) {
|
|
1665
|
-
return Number.MAX_VALUE;
|
|
1666
|
-
}
|
|
1667
|
-
const scopesOrder = handler.scopes.filter((s) => s in this._scopesOrder).map((s) => this._scopesOrder[s]);
|
|
1668
|
-
return Math.min(...scopesOrder);
|
|
1669
|
-
}
|
|
1670
|
-
_getOrderByPkgTopology(handler) {
|
|
1671
|
-
if (handler.source.type === HandlerSourceType.Host) {
|
|
1672
|
-
return Number.MAX_VALUE;
|
|
1673
|
-
}
|
|
1674
|
-
return PkgTopology.get(handler.source.packageName);
|
|
1675
|
-
}
|
|
1676
|
-
compare(a, b) {
|
|
1677
|
-
const aScopeOrder = this._getOrderByScopes(a);
|
|
1678
|
-
const bScopeOrder = this._getOrderByScopes(b);
|
|
1679
|
-
let diff = aScopeOrder - bScopeOrder;
|
|
1680
|
-
if (diff) {
|
|
1681
|
-
return diff;
|
|
1682
|
-
}
|
|
1683
|
-
const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
|
|
1684
|
-
const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
|
|
1685
|
-
diff = aPkgTopologyOrder - bPkgTopologyOrder;
|
|
1686
|
-
if (diff) {
|
|
1687
|
-
return diff;
|
|
1688
|
-
}
|
|
1689
|
-
diff = a.source.type - b.source.type;
|
|
1690
|
-
return diff;
|
|
1894
|
+
function isComponentPropertyBindable(viewConfigType, componentProperty) {
|
|
1895
|
+
var _a;
|
|
1896
|
+
const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
|
|
1897
|
+
if (!(componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.inputs)) {
|
|
1898
|
+
return false;
|
|
1691
1899
|
}
|
|
1900
|
+
return !!((_a = componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.inputs[componentProperty]) === null || _a === void 0 ? void 0 : _a.propertyBindable);
|
|
1692
1901
|
}
|
|
1693
1902
|
|
|
1694
1903
|
const moduleMetadataKey = 'module';
|
|
@@ -2022,200 +2231,6 @@ function applyLocalizeMetadataFn(obj, localizeMetadata) {
|
|
|
2022
2231
|
return localized;
|
|
2023
2232
|
}
|
|
2024
2233
|
|
|
2025
|
-
/**
|
|
2026
|
-
* @internal
|
|
2027
|
-
*/
|
|
2028
|
-
class InternalHandlerChain {
|
|
2029
|
-
constructor() {
|
|
2030
|
-
this._handlers = [];
|
|
2031
|
-
this._handlersCache = new Map();
|
|
2032
|
-
this._handlersScopesByContextId = new Map();
|
|
2033
|
-
this.handlerChain$ = {
|
|
2034
|
-
process: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
2035
|
-
const handler = this._getHandler(request);
|
|
2036
|
-
return handler === null || handler === void 0 ? void 0 : handler.handle(request);
|
|
2037
|
-
}),
|
|
2038
|
-
register: (info) => {
|
|
2039
|
-
this._handlersCache.delete(info.requestType);
|
|
2040
|
-
this._handlers.push(info);
|
|
2041
|
-
return () => {
|
|
2042
|
-
const index = this._handlers.indexOf(info);
|
|
2043
|
-
if (index > -1) {
|
|
2044
|
-
this._handlers.splice(index, 1);
|
|
2045
|
-
this._handlersCache.delete(info.requestType);
|
|
2046
|
-
}
|
|
2047
|
-
else {
|
|
2048
|
-
console.warn(`${info === null || info === void 0 ? void 0 : info.requestType} not found to unsubscribe`);
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
},
|
|
2052
|
-
};
|
|
2053
|
-
}
|
|
2054
|
-
clearContextedHandlersCache(contextId) {
|
|
2055
|
-
var _a;
|
|
2056
|
-
const configs = (_a = this._handlersScopesByContextId.get(contextId)) !== null && _a !== void 0 ? _a : [];
|
|
2057
|
-
return configs.every(({ requestType, scope }) => { var _a; return (_a = this._handlersCache.get(requestType)) === null || _a === void 0 ? void 0 : _a.delete(scope); });
|
|
2058
|
-
}
|
|
2059
|
-
_getHandler(request) {
|
|
2060
|
-
return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
|
|
2061
|
-
}
|
|
2062
|
-
_getCacheHandler(request) {
|
|
2063
|
-
const map = this._handlersCache.get(request.type);
|
|
2064
|
-
const key = this._getCacheScopesKey(request);
|
|
2065
|
-
return map.get(key);
|
|
2066
|
-
}
|
|
2067
|
-
_hasCacheHandler(request) {
|
|
2068
|
-
const map = this._handlersCache.get(request.type);
|
|
2069
|
-
const key = this._getCacheScopesKey(request);
|
|
2070
|
-
return map && map.has(key);
|
|
2071
|
-
}
|
|
2072
|
-
_getCacheScopesKey(request) {
|
|
2073
|
-
var _a, _b;
|
|
2074
|
-
const injectionContextKey = (_b = (_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
|
2075
|
-
return (request.scopes || ['']).join('_').concat(injectionContextKey);
|
|
2076
|
-
}
|
|
2077
|
-
_getInjectionContext(viewModel) {
|
|
2078
|
-
return (viewModel === null || viewModel === void 0 ? void 0 : viewModel['_injectionContext']) || ((viewModel === null || viewModel === void 0 ? void 0 : viewModel.parent) && this._getInjectionContext(viewModel.parent));
|
|
2079
|
-
}
|
|
2080
|
-
_setContextedScopes(request, scope) {
|
|
2081
|
-
var _a;
|
|
2082
|
-
const injectionContext = (_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id;
|
|
2083
|
-
const configs = this._handlersScopesByContextId.has(injectionContext)
|
|
2084
|
-
? this._handlersScopesByContextId.get(injectionContext)
|
|
2085
|
-
: [];
|
|
2086
|
-
configs.push({ requestType: request.type, scope });
|
|
2087
|
-
this._handlersScopesByContextId.set(injectionContext, configs);
|
|
2088
|
-
}
|
|
2089
|
-
_setCacheHandler(request, handler) {
|
|
2090
|
-
var _a;
|
|
2091
|
-
const map = this._handlersCache.has(request.type)
|
|
2092
|
-
? this._handlersCache.get(request.type)
|
|
2093
|
-
: new Map();
|
|
2094
|
-
const key = this._getCacheScopesKey(request);
|
|
2095
|
-
map.set(key, handler);
|
|
2096
|
-
if ((_a = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context)) === null || _a === void 0 ? void 0 : _a.id) {
|
|
2097
|
-
this._setContextedScopes(request, key);
|
|
2098
|
-
}
|
|
2099
|
-
this._handlersCache.set(request.type, map);
|
|
2100
|
-
}
|
|
2101
|
-
_isRequestHandler(handler) {
|
|
2102
|
-
return (typeof handler.handle === 'function' &&
|
|
2103
|
-
typeof handler.setNext === 'function');
|
|
2104
|
-
}
|
|
2105
|
-
_checkHandlerInstanceOf(handler) {
|
|
2106
|
-
if (!this._isRequestHandler(handler)) {
|
|
2107
|
-
throw new Error('Handler should implement "BaseRequestHandler"');
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
_buildHandlersChain(request) {
|
|
2111
|
-
const handlers = this._handlers.filter((h) => {
|
|
2112
|
-
var _a;
|
|
2113
|
-
if (h.requestType !== request.type) {
|
|
2114
|
-
return false;
|
|
2115
|
-
}
|
|
2116
|
-
if (!((_a = h.scopes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2117
|
-
return true;
|
|
2118
|
-
}
|
|
2119
|
-
return h.scopes.some((s) => { var _a; return (_a = request.scopes) === null || _a === void 0 ? void 0 : _a.includes(s); });
|
|
2120
|
-
});
|
|
2121
|
-
const comparer = new HandlersOrderComparer(request);
|
|
2122
|
-
handlers.sort((a, b) => comparer.compare(a, b));
|
|
2123
|
-
const handlerInstances = handlers.map((handlerConfig) => {
|
|
2124
|
-
const injectionContext = this._getInjectionContext(request === null || request === void 0 ? void 0 : request.$context);
|
|
2125
|
-
return handlerConfig.createHandler(injectionContext);
|
|
2126
|
-
});
|
|
2127
|
-
handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
|
|
2128
|
-
this._joinHandlersInChain(handlerInstances);
|
|
2129
|
-
const result = handlerInstances[0];
|
|
2130
|
-
this._setCacheHandler(request, result);
|
|
2131
|
-
return result;
|
|
2132
|
-
}
|
|
2133
|
-
_joinHandlersInChain(handlers) {
|
|
2134
|
-
for (let index = 0; index < handlers.length - 1; index++) {
|
|
2135
|
-
try {
|
|
2136
|
-
handlers[index].setNext(handlers[index + 1]);
|
|
2137
|
-
}
|
|
2138
|
-
catch (error) {
|
|
2139
|
-
if (error instanceof NextHandlerAlreadySpecifiedException) {
|
|
2140
|
-
throw new Error('Handler factory should return new instance of ' +
|
|
2141
|
-
'BaseRequestHandler class or its subclass ' +
|
|
2142
|
-
'(next handler should not be specified)');
|
|
2143
|
-
}
|
|
2144
|
-
throw error;
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
const global = window;
|
|
2151
|
-
/**
|
|
2152
|
-
* @public
|
|
2153
|
-
* @class HandlerChainService
|
|
2154
|
-
* @classdesc Service to design handlers in chain.
|
|
2155
|
-
*/
|
|
2156
|
-
class HandlerChainService {
|
|
2157
|
-
constructor() {
|
|
2158
|
-
if (!this._chain) {
|
|
2159
|
-
this._createGlobalHandlerChain();
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
get _chain() {
|
|
2163
|
-
return global.handlerChain;
|
|
2164
|
-
}
|
|
2165
|
-
set _chain(value) {
|
|
2166
|
-
global.handlerChain = value;
|
|
2167
|
-
}
|
|
2168
|
-
static get instance() {
|
|
2169
|
-
return HandlerChainService._instance || (HandlerChainService._instance = new HandlerChainService());
|
|
2170
|
-
}
|
|
2171
|
-
_createGlobalHandlerChain() {
|
|
2172
|
-
this._chain = new InternalHandlerChain();
|
|
2173
|
-
}
|
|
2174
|
-
/**
|
|
2175
|
-
* @internal
|
|
2176
|
-
*/
|
|
2177
|
-
clearContextedHandlersCache(contextId) {
|
|
2178
|
-
return this._chain.clearContextedHandlersCache(contextId);
|
|
2179
|
-
}
|
|
2180
|
-
/**
|
|
2181
|
-
* @internal
|
|
2182
|
-
*/
|
|
2183
|
-
register(handlerConfig) {
|
|
2184
|
-
return this._chain.handlerChain$.register(handlerConfig);
|
|
2185
|
-
}
|
|
2186
|
-
/**
|
|
2187
|
-
* @description Method to process passed request
|
|
2188
|
-
* @param request - {@link BaseRequest}
|
|
2189
|
-
* @return `Promise<unknown>`
|
|
2190
|
-
*/
|
|
2191
|
-
process(request) {
|
|
2192
|
-
return this._chain.handlerChain$.process(request);
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
/**
|
|
2197
|
-
* @internal
|
|
2198
|
-
*/
|
|
2199
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2200
|
-
function ImplementUsingHandlerChain(config) {
|
|
2201
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2202
|
-
return function (target, method, descriptor) {
|
|
2203
|
-
const methodImplementation = function (...args) {
|
|
2204
|
-
return HandlerChainService.instance.process({
|
|
2205
|
-
type: (config === null || config === void 0 ? void 0 : config.requestType) ? config.requestType : this.requestType,
|
|
2206
|
-
method: (config === null || config === void 0 ? void 0 : config.methodName) ? config.methodName : method,
|
|
2207
|
-
args,
|
|
2208
|
-
});
|
|
2209
|
-
};
|
|
2210
|
-
if (descriptor) {
|
|
2211
|
-
descriptor.value = methodImplementation;
|
|
2212
|
-
}
|
|
2213
|
-
else {
|
|
2214
|
-
target[method] = methodImplementation;
|
|
2215
|
-
}
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
2234
|
/**
|
|
2220
2235
|
* @internal
|
|
2221
2236
|
*/
|
|
@@ -3406,5 +3421,5 @@ var ModelParameterType;
|
|
|
3406
3421
|
* Generated bundle index. Do not edit.
|
|
3407
3422
|
*/
|
|
3408
3423
|
|
|
3409
|
-
export { AggregationEvalType, AggregationFunction, AggregationFunctionColumn, AggregationFunctionExpression, AggregationSubQueryColumn, AggregationSubQueryExpression, AggregationType, ArgumentEmptyException, ArgumentFunctionExpression, ArgumentOutOfRangeException, ArithmeticExpression, ArithmeticOperation, ArithmeticQueryColumn, BaseExpression, BaseFilter, BaseFilterableQuery, BaseQuery, BaseQueryColumn, BaseRegistry, BaseRequest, BaseRequestHandler, BaseValidator, BetweenFilter, BootstrapNotifier, ColumnExpression, CompareFilter, ComparisonType, ConverterRegistry, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, DataRequest, DataSchemaAttributeType, DataSchemaAttributeUsageType, DataSourceScope, DataValueType, DatePartFunctionColumn, DatePartFunctionExpression, DatePartType, DefaultValueSource, DeleteQuery, DesignTimeViewElementRegistry, DesignerToolGroupType, EMPTY_GUID, EXPRESSION_TYPE_MOCK, EntityQueryColumn, EntitySchemaQuery, ExistsFilter, ExpressionMock, ExpressionType, FeatureService, FilterGroup, FilterMock, FilterType, FunctionExpression, FunctionType, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InFilter, InsertQuery, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, IsNullFilter, ItemNotFoundException, LengthFunctionColumn, LengthFunctionExpression, LocalizableValue, LogicalOperatorType, MacrosFunctionColumn, MacrosFunctionExpression, MaskService, MethodInvokeRequest, Model, ModelInPageAction, ModelParameterType, NextHandlerAlreadySpecifiedException, OrderDirection, ParameterExpression, ParameterQueryColumn, PkgTopology, QueryMacrosType, QueryOperationType, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SchemaViewMaskRequest, SchemaViewMaskRequestAction, SelectLocalizationQuery, SingleFilter, SubQueryColumn, SubQueryExpression, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, UpdateQuery, ValidationUtilities, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementRegistry, WindowFunctionColumn, WindowFunctionExpression, _bootstrapCrtModule, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, encodeDate, generateGuid, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, isEmptyGuid, isGuid, localize, objectDeepKeys, registerAngularViewElement, registerViewElement, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toLocalISOString, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey };
|
|
3424
|
+
export { AggregationEvalType, AggregationFunction, AggregationFunctionColumn, AggregationFunctionExpression, AggregationSubQueryColumn, AggregationSubQueryExpression, AggregationType, ArgumentEmptyException, ArgumentFunctionExpression, ArgumentOutOfRangeException, ArithmeticExpression, ArithmeticOperation, ArithmeticQueryColumn, BaseExpression, BaseFilter, BaseFilterableQuery, BaseQuery, BaseQueryColumn, BaseRegistry, BaseRequest, BaseRequestHandler, BaseValidator, BetweenFilter, BootstrapNotifier, ColumnExpression, CompareFilter, ComparisonType, ConverterRegistry, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, DataRequest, DataSchemaAttributeType, DataSchemaAttributeUsageType, DataSchemaType, DataSourceScope, DataValueType, DatePartFunctionColumn, DatePartFunctionExpression, DatePartType, DefaultValueSource, DeleteQuery, DesignTimeViewElementRegistry, DesignerToolGroupType, EMPTY_GUID, EXPRESSION_TYPE_MOCK, EntityQueryColumn, EntitySchemaQuery, ExistsFilter, ExpressionMock, ExpressionType, FeatureService, FilterGroup, FilterMock, FilterType, FunctionExpression, FunctionType, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InFilter, InsertQuery, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, IsNullFilter, ItemNotFoundException, LengthFunctionColumn, LengthFunctionExpression, LocalizableValue, LogicalOperatorType, MacrosFunctionColumn, MacrosFunctionExpression, MaskService, MethodInvokeRequest, Model, ModelInPageAction, ModelParameterType, NextHandlerAlreadySpecifiedException, OrderDirection, ParameterExpression, ParameterQueryColumn, PkgTopology, QueryMacrosType, QueryOperationType, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SchemaViewMaskRequest, SchemaViewMaskRequestAction, SelectLocalizationQuery, SingleFilter, SubQueryColumn, SubQueryExpression, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, UpdateQuery, ValidationUtilities, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementRegistry, WindowFunctionColumn, WindowFunctionExpression, _bootstrapCrtModule, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, encodeDate, generateGuid, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, isEmptyGuid, isGuid, localize, objectDeepKeys, registerAngularViewElement, registerViewElement, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toLocalISOString, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey };
|
|
3410
3425
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|