@creatio-devkit/common 0.812.0 → 0.814.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 +13 -2
- package/esm2020/lib/base-exports.mjs +4 -2
- package/esm2020/lib/internal/decorators/request/request.decorator.mjs +1 -1
- package/esm2020/lib/internal/models/converter/converter-registry-item.mjs +1 -1
- package/esm2020/lib/internal/models/index.mjs +3 -1
- package/esm2020/lib/internal/models/injection-context/injection-context.mjs +1 -1
- package/esm2020/lib/internal/models/internal-interface-designer-item-registration-config.model.mjs +1 -1
- package/esm2020/lib/internal/models/internal-module-definition.mjs +2 -0
- package/esm2020/lib/internal/models/lazy-module-metadata.mjs +2 -0
- package/esm2020/lib/internal/models/lazy-module-ref.mjs +26 -0
- package/esm2020/lib/internal/models/lazy-registry-item.mjs +2 -0
- package/esm2020/lib/internal/models/request-handler/handler-config.mjs +1 -1
- package/esm2020/lib/internal/models/request-handler/request-handler-registration-config.model.mjs +1 -1
- package/esm2020/lib/internal/models/validator/validator-registry-item.mjs +1 -1
- package/esm2020/lib/internal/models/view-element/angular-view-element-registration-config.model.mjs +1 -1
- package/esm2020/lib/internal/models/view-element-registry-item.mjs +1 -1
- package/esm2020/lib/internal/services/chat-message-type-registry/chat-message-type-registry.mjs +22 -0
- package/esm2020/lib/internal/services/chat-message-type-registry/index.mjs +2 -0
- package/esm2020/lib/internal/services/global-converters-registry/converter-registry.mjs +9 -2
- package/esm2020/lib/internal/services/index.mjs +3 -1
- package/esm2020/lib/internal/services/lazy-modules-manager/index.mjs +2 -0
- package/esm2020/lib/internal/services/lazy-modules-manager/lazy-modules-manager.mjs +35 -0
- package/esm2020/lib/internal/services/request-handler-registry/request-handler-registry.service.mjs +17 -4
- package/esm2020/lib/internal/services/request-registry/request-registry.service.mjs +1 -1
- package/esm2020/lib/internal/services/validator-registry/validator-registry.mjs +11 -3
- package/esm2020/lib/internal/services/view-element-registry/view-element-registry.mjs +14 -2
- package/esm2020/lib/internal/utils/index.mjs +2 -1
- package/esm2020/lib/internal/utils/metadata-utils.mjs +1 -1
- package/esm2020/lib/internal/utils/request-handler-scopes.mjs +10 -0
- package/esm2020/lib/public/decorators/chat-message-type/chat-message-type.decorator.mjs +20 -0
- package/esm2020/lib/public/decorators/chat-message-type/index.mjs +2 -0
- package/esm2020/lib/public/decorators/index.mjs +2 -1
- package/esm2020/lib/public/decorators/module/module.decorator.mjs +2 -18
- package/esm2020/lib/public/decorators/view-element/view-element.decorator.mjs +1 -1
- package/esm2020/lib/public/functions/bootstrap-crt-module-handler-chain-services.mjs +6 -2
- package/esm2020/lib/public/functions/bootstrap-crt-module.mjs +107 -6
- package/esm2020/lib/public/functions/bootstrapped-crt-modules.mjs +9 -0
- package/esm2020/lib/public/functions/crt-module-context-hooks.mjs +30 -0
- package/esm2020/lib/public/functions/index.mjs +4 -1
- package/esm2020/lib/public/functions/reset-globals.mjs +37 -0
- package/esm2020/lib/public/models/index.mjs +3 -1
- package/esm2020/lib/public/models/input/input-registration-config.model.mjs +1 -1
- package/esm2020/lib/public/models/item-creation-config.mjs +2 -0
- package/esm2020/lib/public/models/license/index.mjs +2 -0
- package/esm2020/lib/public/models/license/license-restriction-operation-values.model.mjs +2 -0
- package/esm2020/lib/public/models/request/handle-view-model-attribute-change.request.mjs +29 -0
- package/esm2020/lib/public/models/request/index.mjs +4 -2
- package/esm2020/lib/public/models/request/model-event.model.mjs +2 -0
- package/esm2020/lib/public/models/request/view-model-attribute-change-event-options.mjs +2 -0
- package/esm2020/lib/public/services/dialog-service/dialog.service.mjs +24 -0
- package/esm2020/lib/public/services/dialog-service/index.mjs +2 -0
- package/esm2020/lib/public/services/handler-chain/handler-chain.service.mjs +13 -1
- package/esm2020/lib/public/services/handler-chain/internal-handler-chain.mjs +50 -14
- package/esm2020/lib/public/services/index.mjs +3 -1
- package/esm2020/lib/public/services/license/index.mjs +2 -0
- package/esm2020/lib/public/services/license/license.service.mjs +22 -0
- package/esm2020/lib/public/services/mask-service/index.mjs +1 -2
- package/esm2020/lib/public/services/mask-service/mask.service.mjs +2 -2
- package/esm2020/lib/public/services/model/model.mjs +4 -1
- package/fesm2015/creatio-devkit-common.mjs +462 -79
- package/fesm2015/creatio-devkit-common.mjs.map +1 -1
- package/fesm2020/creatio-devkit-common.mjs +472 -78
- package/fesm2020/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +188 -4
- package/package.json +2 -2
- package/esm2020/lib/public/models/request/request-registration-config.model.mjs +0 -2
- package/esm2020/lib/public/services/mask-service/schema-view-mask.request.mjs +0 -22
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ɵAggregationType, ɵAggregationFunction, ɵAggregationEvalType, ɵDatePartType, ɵFunctionType, ɵOrderDirection, ɵgenerateGuid, ɵNextHandlerAlreadySpecifiedException, ɵBaseRequest } from '@creatio/base';
|
|
2
|
-
export { ɵAggregationEvalType as AggregationEvalType, ɵAggregationFunction as AggregationFunction, ɵAggregationFunctionColumn as AggregationFunctionColumn, ɵAggregationFunctionExpression as AggregationFunctionExpression, ɵAggregationSubQueryColumn as AggregationSubQueryColumn, ɵAggregationSubQueryExpression as AggregationSubQueryExpression, ɵAggregationType as AggregationType, ɵArgumentEmptyException as ArgumentEmptyException, ɵArgumentFunctionExpression as ArgumentFunctionExpression, ɵArgumentOutOfRangeException as ArgumentOutOfRangeException, ɵArithmeticExpression as ArithmeticExpression, ɵArithmeticOperation as ArithmeticOperation, ɵArithmeticQueryColumn as ArithmeticQueryColumn, ɵBaseExpression as BaseExpression, ɵBaseExpressionParser as BaseExpressionParser, ɵBaseFilter as BaseFilter, ɵBaseFilterParser as BaseFilterParser, ɵBaseFilterableQuery as BaseFilterableQuery, ɵBaseQuery as BaseQuery, ɵBaseQueryColumn as BaseQueryColumn, ɵBaseRequest as BaseRequest, ɵBetweenFilter as BetweenFilter, ɵColumnExpression as ColumnExpression, ɵCompareFilter as CompareFilter, ɵComparisonType as ComparisonType, ɵDEFAULT_COLUMN_PLAIN_OBJ as DEFAULT_COLUMN_PLAIN_OBJ, ɵDEFAULT_FILTER_PLAIN_OBJ as DEFAULT_FILTER_PLAIN_OBJ, ɵDataSchemaAttributeType as DataSchemaAttributeType, ɵDataSchemaAttributeUsageType as DataSchemaAttributeUsageType, ɵDataSchemaType as DataSchemaType, ɵDataSourceScope as DataSourceScope, ɵDataValueType as DataValueType, ɵDatePartFunctionColumn as DatePartFunctionColumn, ɵDatePartFunctionExpression as DatePartFunctionExpression, ɵDatePartType as DatePartType, ɵDefaultValueSource as DefaultValueSource, ɵDeleteQuery as DeleteQuery, ɵEMPTY_GUID as EMPTY_GUID, ɵEntityQueryColumn as EntityQueryColumn, ɵEntitySchemaQuery as EntitySchemaQuery, ɵExistsFilter as ExistsFilter, ɵExpressionMock as ExpressionMock, ɵExpressionParser as ExpressionParser, ɵExpressionResolver as ExpressionResolver, ɵExpressionType as ExpressionType, ɵFilterGroup as FilterGroup, ɵFilterMock as FilterMock, ɵFilterParser as FilterParser, ɵFilterResolver as FilterResolver, ɵFilterType as FilterType, ɵFunctionExpression as FunctionExpression, ɵFunctionType as FunctionType, ɵInFilter as InFilter, ɵInsertQuery as InsertQuery, ɵIsNullFilter as IsNullFilter, ɵItemNotFoundException as ItemNotFoundException, ɵLengthFunctionColumn as LengthFunctionColumn, ɵLengthFunctionExpression as LengthFunctionExpression, ɵLogicalOperatorType as LogicalOperatorType, ɵMacrosFunctionColumn as MacrosFunctionColumn, ɵMacrosFunctionExpression as MacrosFunctionExpression, ɵModelInPageAction as ModelInPageAction, ɵModelParameterType as ModelParameterType, ɵNextHandlerAlreadySpecifiedException as NextHandlerAlreadySpecifiedException, ɵOrderDirection as OrderDirection, ɵParameterExpression as ParameterExpression, ɵParameterQueryColumn as ParameterQueryColumn, ɵQueryMacrosType as QueryMacrosType, ɵQueryOperationType as QueryOperationType, ɵSelectLocalizationQuery as SelectLocalizationQuery, ɵSingleFilter as SingleFilter, ɵSubQueryColumn as SubQueryColumn, ɵSubQueryExpression as SubQueryExpression, ɵUpdateQuery as UpdateQuery, ɵValidationUtilities as ValidationUtilities, ɵWindowFunctionColumn as WindowFunctionColumn, ɵWindowFunctionExpression as WindowFunctionExpression, ɵencodeDate as encodeDate, ɵgenerateGuid as generateGuid, ɵgetColumnPlainObj as getColumnPlainObj, ɵgetFilterPlainObj as getFilterPlainObj, ɵisEmptyGuid as isEmptyGuid, ɵisGuid as isGuid, ɵparserMock as parserMock, ɵtoLocalISOString as toLocalISOString } from '@creatio/base';
|
|
1
|
+
import { ɵAggregationType, ɵAggregationFunction, ɵAggregationEvalType, ɵDatePartType, ɵFunctionType, ɵOrderDirection, ɵgenerateGuid, ɵNextHandlerAlreadySpecifiedException, ɵBaseRequest, ɵSchemaViewMaskRequest, ɵSchemaViewMaskRequestAction } from '@creatio/base';
|
|
2
|
+
export { ɵAggregationEvalType as AggregationEvalType, ɵAggregationFunction as AggregationFunction, ɵAggregationFunctionColumn as AggregationFunctionColumn, ɵAggregationFunctionExpression as AggregationFunctionExpression, ɵAggregationSubQueryColumn as AggregationSubQueryColumn, ɵAggregationSubQueryExpression as AggregationSubQueryExpression, ɵAggregationType as AggregationType, ɵArgumentEmptyException as ArgumentEmptyException, ɵArgumentFunctionExpression as ArgumentFunctionExpression, ɵArgumentOutOfRangeException as ArgumentOutOfRangeException, ɵArithmeticExpression as ArithmeticExpression, ɵArithmeticOperation as ArithmeticOperation, ɵArithmeticQueryColumn as ArithmeticQueryColumn, ɵBaseExpression as BaseExpression, ɵBaseExpressionParser as BaseExpressionParser, ɵBaseFilter as BaseFilter, ɵBaseFilterParser as BaseFilterParser, ɵBaseFilterableQuery as BaseFilterableQuery, ɵBaseQuery as BaseQuery, ɵBaseQueryColumn as BaseQueryColumn, ɵBaseRequest as BaseRequest, ɵBetweenFilter as BetweenFilter, ɵColumnExpression as ColumnExpression, ɵCompareFilter as CompareFilter, ɵComparisonType as ComparisonType, ɵDEFAULT_COLUMN_PLAIN_OBJ as DEFAULT_COLUMN_PLAIN_OBJ, ɵDEFAULT_FILTER_PLAIN_OBJ as DEFAULT_FILTER_PLAIN_OBJ, ɵDataSchemaAttributeType as DataSchemaAttributeType, ɵDataSchemaAttributeUsageType as DataSchemaAttributeUsageType, ɵDataSchemaType as DataSchemaType, ɵDataSourceScope as DataSourceScope, ɵDataValueType as DataValueType, ɵDatePartFunctionColumn as DatePartFunctionColumn, ɵDatePartFunctionExpression as DatePartFunctionExpression, ɵDatePartType as DatePartType, ɵDefaultValueSource as DefaultValueSource, ɵDeleteQuery as DeleteQuery, ɵEMPTY_GUID as EMPTY_GUID, ɵEntityQueryColumn as EntityQueryColumn, ɵEntitySchemaQuery as EntitySchemaQuery, ɵExistsFilter as ExistsFilter, ɵExpressionMock as ExpressionMock, ɵExpressionParser as ExpressionParser, ɵExpressionResolver as ExpressionResolver, ɵExpressionType as ExpressionType, ɵFilterGroup as FilterGroup, ɵFilterMock as FilterMock, ɵFilterParser as FilterParser, ɵFilterResolver as FilterResolver, ɵFilterType as FilterType, ɵFunctionExpression as FunctionExpression, ɵFunctionType as FunctionType, ɵInFilter as InFilter, ɵInsertQuery as InsertQuery, ɵIsNullFilter as IsNullFilter, ɵItemNotFoundException as ItemNotFoundException, ɵLengthFunctionColumn as LengthFunctionColumn, ɵLengthFunctionExpression as LengthFunctionExpression, ɵLogicalOperatorType as LogicalOperatorType, ɵMacrosFunctionColumn as MacrosFunctionColumn, ɵMacrosFunctionExpression as MacrosFunctionExpression, ɵModelInPageAction as ModelInPageAction, ɵModelParameterType as ModelParameterType, ɵNextHandlerAlreadySpecifiedException as NextHandlerAlreadySpecifiedException, ɵOrderDirection as OrderDirection, ɵParameterExpression as ParameterExpression, ɵParameterQueryColumn as ParameterQueryColumn, ɵPlatformAPIs as PlatformAPIs, ɵQueryMacrosType as QueryMacrosType, ɵQueryOperationType as QueryOperationType, ɵSchemaViewMaskRequest as SchemaViewMaskRequest, ɵSchemaViewMaskRequestAction as SchemaViewMaskRequestAction, ɵSelectLocalizationQuery as SelectLocalizationQuery, ɵSingleFilter as SingleFilter, ɵSubQueryColumn as SubQueryColumn, ɵSubQueryExpression as SubQueryExpression, ɵUpdateQuery as UpdateQuery, ɵValidationUtilities as ValidationUtilities, ɵWindowFunctionColumn as WindowFunctionColumn, ɵWindowFunctionExpression as WindowFunctionExpression, ɵencodeDate as encodeDate, ɵgenerateGuid as generateGuid, ɵgetColumnPlainObj as getColumnPlainObj, ɵgetFilterPlainObj as getFilterPlainObj, ɵisEmptyGuid as isEmptyGuid, ɵisGuid as isGuid, ɵparserMock as parserMock, ɵtoLocalISOString as toLocalISOString } from '@creatio/base';
|
|
3
3
|
import { get, set, upperFirst, camelCase, isEqual, cloneDeep } from 'lodash';
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
import { __decorate, __metadata } from 'tslib';
|
|
@@ -196,6 +196,40 @@ const crtInjectPrefix = 'crtInject:';
|
|
|
196
196
|
*/
|
|
197
197
|
const VIEW_ELEMENT_DEFAULT_HEIGHT = '39px';
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
class LazyModulesManager {
|
|
203
|
+
constructor() {
|
|
204
|
+
this._refs = new Set();
|
|
205
|
+
this.lazyLoadingDisabled = false;
|
|
206
|
+
}
|
|
207
|
+
static get instance() {
|
|
208
|
+
if (!this._instance) {
|
|
209
|
+
let globalInstance = get(window, this._globalInstancePath);
|
|
210
|
+
if (!globalInstance) {
|
|
211
|
+
globalInstance = new this();
|
|
212
|
+
set(window, this._globalInstancePath, globalInstance);
|
|
213
|
+
}
|
|
214
|
+
this._instance = globalInstance;
|
|
215
|
+
}
|
|
216
|
+
return this._instance;
|
|
217
|
+
}
|
|
218
|
+
add(ref) {
|
|
219
|
+
this._refs.add(ref);
|
|
220
|
+
}
|
|
221
|
+
size() {
|
|
222
|
+
return this._refs.size;
|
|
223
|
+
}
|
|
224
|
+
loadAll() {
|
|
225
|
+
return Promise.all(Array.from(this._refs).map((ref) => ref.loadAndBootstrap()));
|
|
226
|
+
}
|
|
227
|
+
clear() {
|
|
228
|
+
this._refs.clear();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
LazyModulesManager._globalInstancePath = 'creatio._lazyModulesManager';
|
|
232
|
+
|
|
199
233
|
/**
|
|
200
234
|
* @internal
|
|
201
235
|
* @hostPublicApi
|
|
@@ -236,7 +270,7 @@ var HandlerSourceType;
|
|
|
236
270
|
HandlerSourceType[HandlerSourceType["Host"] = 2] = "Host";
|
|
237
271
|
})(HandlerSourceType || (HandlerSourceType = {}));
|
|
238
272
|
|
|
239
|
-
const global$
|
|
273
|
+
const global$4 = window;
|
|
240
274
|
/**
|
|
241
275
|
* @public
|
|
242
276
|
* @description For internal use only.
|
|
@@ -254,10 +288,10 @@ class ɵBaseRegistry {
|
|
|
254
288
|
}
|
|
255
289
|
static get store() {
|
|
256
290
|
if (!this._instance) {
|
|
257
|
-
let globalInstance = get(global$
|
|
291
|
+
let globalInstance = get(global$4, this._prefix + this.registryKey);
|
|
258
292
|
if (!globalInstance) {
|
|
259
293
|
globalInstance = new this();
|
|
260
|
-
set(global$
|
|
294
|
+
set(global$4, this._prefix + this.registryKey, globalInstance);
|
|
261
295
|
}
|
|
262
296
|
this._instance = globalInstance;
|
|
263
297
|
}
|
|
@@ -323,6 +357,54 @@ class HandlersOrderComparer {
|
|
|
323
357
|
}
|
|
324
358
|
}
|
|
325
359
|
|
|
360
|
+
/**
|
|
361
|
+
* @internal
|
|
362
|
+
*/
|
|
363
|
+
function matchScopes(handlerScopes, requestScopes) {
|
|
364
|
+
if (!handlerScopes?.length) {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
return handlerScopes.some((s) => requestScopes?.includes(s));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
var _a;
|
|
371
|
+
const global$3 = window;
|
|
372
|
+
global$3.creatio ?? (global$3.creatio = {});
|
|
373
|
+
(_a = global$3.creatio)._bootstrappedCrtModules ?? (_a._bootstrappedCrtModules = new Map());
|
|
374
|
+
/**
|
|
375
|
+
* @internal
|
|
376
|
+
*/
|
|
377
|
+
const bootstrappedCrtModules = global$3.creatio._bootstrappedCrtModules;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @internal
|
|
381
|
+
*/
|
|
382
|
+
function iterateRootModules(callback) {
|
|
383
|
+
bootstrappedCrtModules.forEach((info, type) => {
|
|
384
|
+
if (info.root) {
|
|
385
|
+
callback(info, type);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @internal
|
|
391
|
+
*/
|
|
392
|
+
function callOnContextCreateHooks(context) {
|
|
393
|
+
iterateRootModules((info) => info.options?.onContextCreate?.(context));
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* @internal
|
|
397
|
+
*/
|
|
398
|
+
function callOnContextUpdateHooks(context) {
|
|
399
|
+
iterateRootModules((info) => info.options?.onContextUpdate?.(context));
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
function callOnContextDestroyHooks(context) {
|
|
405
|
+
iterateRootModules((info) => info.options?.onContextDestroy?.(context));
|
|
406
|
+
}
|
|
407
|
+
|
|
326
408
|
/**
|
|
327
409
|
* @internal
|
|
328
410
|
* @hostPublicApi available through window.handlerChain
|
|
@@ -341,7 +423,17 @@ class InternalHandlerChain {
|
|
|
341
423
|
* @hostPublicApi
|
|
342
424
|
*/
|
|
343
425
|
process: async (request) => {
|
|
344
|
-
|
|
426
|
+
let handler;
|
|
427
|
+
if (this._hasCacheHandler(request)) {
|
|
428
|
+
handler = this._getCacheHandler(request);
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
const handlers = this._getMatchedHandlers(request);
|
|
432
|
+
if (!LazyModulesManager.instance.lazyLoadingDisabled) {
|
|
433
|
+
await this._loadLazyHandlers(request, handlers);
|
|
434
|
+
}
|
|
435
|
+
handler = this._buildHandlersChain(request, handlers);
|
|
436
|
+
}
|
|
345
437
|
this._requestListeners.forEach((listener) => listener?.(request));
|
|
346
438
|
return handler?.handle(request);
|
|
347
439
|
},
|
|
@@ -362,6 +454,15 @@ class InternalHandlerChain {
|
|
|
362
454
|
}
|
|
363
455
|
};
|
|
364
456
|
},
|
|
457
|
+
/**
|
|
458
|
+
* @hostPublicApi
|
|
459
|
+
*/
|
|
460
|
+
update: (updatedInfo) => {
|
|
461
|
+
const config = this._handlers.find((h) => h.type === updatedInfo.type);
|
|
462
|
+
if (config) {
|
|
463
|
+
config.createHandler = updatedInfo.createHandler;
|
|
464
|
+
}
|
|
465
|
+
},
|
|
365
466
|
/**
|
|
366
467
|
* @hostPublicApi
|
|
367
468
|
*/
|
|
@@ -387,8 +488,11 @@ class InternalHandlerChain {
|
|
|
387
488
|
const configs = this._handlersScopesByContextId.get(contextId) ?? [];
|
|
388
489
|
return configs.every(({ requestType, scope }) => this._handlersCache.get(requestType)?.delete(scope));
|
|
389
490
|
}
|
|
390
|
-
|
|
391
|
-
|
|
491
|
+
clear() {
|
|
492
|
+
this._handlers.splice(0);
|
|
493
|
+
this._requestListeners.clear();
|
|
494
|
+
this._handlersCache.clear();
|
|
495
|
+
this._handlersScopesByContextId.clear();
|
|
392
496
|
}
|
|
393
497
|
_getCacheHandler(request) {
|
|
394
498
|
const map = this._handlersCache.get(request.type);
|
|
@@ -436,22 +540,33 @@ class InternalHandlerChain {
|
|
|
436
540
|
throw new Error('Handler should implement "BaseRequestHandler"');
|
|
437
541
|
}
|
|
438
542
|
}
|
|
439
|
-
|
|
440
|
-
const
|
|
543
|
+
async _loadLazyHandlers(request, configs) {
|
|
544
|
+
const lazyModules = new Set();
|
|
545
|
+
configs.forEach((config) => {
|
|
546
|
+
if (config.lazy && !config.createHandler) {
|
|
547
|
+
lazyModules.add(config.lazyModuleRef);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
await Promise.all([...lazyModules].map((m) => m.loadAndBootstrap()));
|
|
551
|
+
const injectionContext = this._getInjectionContext(request?.$context);
|
|
552
|
+
if (injectionContext && lazyModules.size) {
|
|
553
|
+
lazyModules.forEach((ref) => injectionContext.addLazyModule(ref.typeRef));
|
|
554
|
+
callOnContextUpdateHooks(injectionContext);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
_getMatchedHandlers(request) {
|
|
558
|
+
return this._handlers.filter((h) => {
|
|
441
559
|
if (h.requestType !== request.type) {
|
|
442
560
|
return false;
|
|
443
561
|
}
|
|
444
|
-
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
return h.scopes.some((s) => request.scopes?.includes(s));
|
|
562
|
+
return matchScopes(h.scopes, request.scopes);
|
|
448
563
|
});
|
|
564
|
+
}
|
|
565
|
+
_buildHandlersChain(request, handlers) {
|
|
449
566
|
const comparer = new HandlersOrderComparer(request);
|
|
450
567
|
handlers.sort((a, b) => comparer.compare(a, b));
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
return handlerConfig.createHandler(injectionContext);
|
|
454
|
-
});
|
|
568
|
+
const injectionContext = this._getInjectionContext(request?.$context);
|
|
569
|
+
const handlerInstances = handlers.map((handlerConfig) => handlerConfig.createHandler.call(handlerConfig, injectionContext));
|
|
455
570
|
handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
|
|
456
571
|
this._joinHandlersInChain(handlerInstances);
|
|
457
572
|
const result = handlerInstances[0];
|
|
@@ -511,6 +626,12 @@ class HandlerChainService {
|
|
|
511
626
|
register(handlerConfig) {
|
|
512
627
|
return this._chain.handlerChain$.register(handlerConfig);
|
|
513
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* @internal
|
|
631
|
+
*/
|
|
632
|
+
update(handlerConfig) {
|
|
633
|
+
return this._chain.handlerChain$.update(handlerConfig);
|
|
634
|
+
}
|
|
514
635
|
/**
|
|
515
636
|
* @description Method to process passed request
|
|
516
637
|
* @param request - {@link ɵBaseRequest}
|
|
@@ -531,6 +652,12 @@ class HandlerChainService {
|
|
|
531
652
|
subscribe(callback, context) {
|
|
532
653
|
return this._chain.handlerChain$.subscribe(callback, context);
|
|
533
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* @internal
|
|
657
|
+
*/
|
|
658
|
+
clear() {
|
|
659
|
+
this._chain.clear();
|
|
660
|
+
}
|
|
534
661
|
}
|
|
535
662
|
|
|
536
663
|
/**
|
|
@@ -661,10 +788,18 @@ class InternalRequestHandlerRegistryType {
|
|
|
661
788
|
* @publicHostApi
|
|
662
789
|
*/
|
|
663
790
|
static addRequestHandler(handlerType, config) {
|
|
664
|
-
|
|
665
|
-
|
|
791
|
+
const existingHandler = this._requestHandlersMap.get(handlerType);
|
|
792
|
+
if (!existingHandler || (existingHandler.instanceConfig?.lazy && !existingHandler.instanceType)) {
|
|
793
|
+
const mergedConfig = {
|
|
794
|
+
instanceType: config.instanceType,
|
|
795
|
+
instanceConfig: {
|
|
796
|
+
...(existingHandler?.instanceConfig ?? {}),
|
|
797
|
+
...config.instanceConfig,
|
|
798
|
+
},
|
|
799
|
+
};
|
|
800
|
+
this._requestHandlersMap.set(handlerType, mergedConfig);
|
|
666
801
|
for (const listener of this._addItemListeners) {
|
|
667
|
-
listener(handlerType,
|
|
802
|
+
listener(handlerType, mergedConfig);
|
|
668
803
|
}
|
|
669
804
|
}
|
|
670
805
|
}
|
|
@@ -680,6 +815,11 @@ class InternalRequestHandlerRegistryType {
|
|
|
680
815
|
}
|
|
681
816
|
}
|
|
682
817
|
}
|
|
818
|
+
static clear() {
|
|
819
|
+
for (const type of this._requestHandlersMap.keys()) {
|
|
820
|
+
this.removeRequestHandler(type);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
683
823
|
}
|
|
684
824
|
InternalRequestHandlerRegistryType._addItemListeners = [];
|
|
685
825
|
InternalRequestHandlerRegistryType._removeItemListeners = [];
|
|
@@ -758,6 +898,9 @@ RequestRegistryService._requestsRegistrationInfos = new Map();
|
|
|
758
898
|
* @hostPublicApi available through window.creatio.registry.ConverterRegistry
|
|
759
899
|
*/
|
|
760
900
|
class ConverterRegistry extends ɵBaseRegistry {
|
|
901
|
+
static has(type) {
|
|
902
|
+
return this.store.typeInfos.has(type);
|
|
903
|
+
}
|
|
761
904
|
static get(type) {
|
|
762
905
|
if (!this.store.typeInfos.has(type)) {
|
|
763
906
|
throw new Error(`'${type}' converter doesn't exist`);
|
|
@@ -768,7 +911,11 @@ class ConverterRegistry extends ɵBaseRegistry {
|
|
|
768
911
|
checkTypeNameFormat(item.type, 'ConverterTypeName');
|
|
769
912
|
checkCrtTypeNamePascalCase(item.type);
|
|
770
913
|
// TODO RND-21723
|
|
771
|
-
this.store.typeInfos.
|
|
914
|
+
const existingItem = this.store.typeInfos.get(item.type);
|
|
915
|
+
this.store.typeInfos.set(item.type, {
|
|
916
|
+
...(existingItem ?? {}),
|
|
917
|
+
...item,
|
|
918
|
+
});
|
|
772
919
|
}
|
|
773
920
|
static clear() {
|
|
774
921
|
this.store.typeInfos.clear();
|
|
@@ -787,13 +934,21 @@ const viewElementRegistryKey = 'ViewElementRegistry';
|
|
|
787
934
|
class ViewElementRegistry extends ɵBaseRegistry {
|
|
788
935
|
static validate(config) {
|
|
789
936
|
checkTypeNameFormat(config.type, 'ViewElementTypeName');
|
|
937
|
+
const existingItem = ViewElementRegistry.viewElements.get(config.type);
|
|
938
|
+
if (existingItem?.lazy && !('selector' in existingItem) && !existingItem.typeRef) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
790
941
|
checkOnlyOneRegistration(config.type, config, ViewElementRegistry.viewElements);
|
|
791
942
|
}
|
|
792
943
|
static get viewElements() {
|
|
793
944
|
return this.store.typeInfos;
|
|
794
945
|
}
|
|
795
946
|
static register(config) {
|
|
796
|
-
this.viewElements.
|
|
947
|
+
const existingConfig = this.viewElements.get(config.type);
|
|
948
|
+
this.viewElements.set(config.type, {
|
|
949
|
+
...(existingConfig ?? {}),
|
|
950
|
+
...config,
|
|
951
|
+
});
|
|
797
952
|
}
|
|
798
953
|
static getFormControlRelatesAttribute(type) {
|
|
799
954
|
const config = this.store.typeInfos.get(type);
|
|
@@ -803,6 +958,10 @@ class ViewElementRegistry extends ɵBaseRegistry {
|
|
|
803
958
|
const config = this.store.typeInfos.get(type);
|
|
804
959
|
return config?.inputs ?? {};
|
|
805
960
|
}
|
|
961
|
+
static getViewElementOutputs(type) {
|
|
962
|
+
const config = this.store.typeInfos.get(type);
|
|
963
|
+
return config?.outputs ?? {};
|
|
964
|
+
}
|
|
806
965
|
static getViewElementPropertiesDefaultValues(type) {
|
|
807
966
|
const config = this.store.typeInfos.get(type);
|
|
808
967
|
const propertiesDefaultValues = Object.entries(config?.inputs ?? {})
|
|
@@ -945,11 +1104,15 @@ const validatorRegistryKey = 'ValidatorRegistry';
|
|
|
945
1104
|
*/
|
|
946
1105
|
class ValidatorRegistry extends ɵBaseRegistry {
|
|
947
1106
|
static _has(configType, type) {
|
|
1107
|
+
const config = ValidatorRegistry.items.get(configType);
|
|
1108
|
+
if (config?.lazy && !config?.typeRef) {
|
|
1109
|
+
return false;
|
|
1110
|
+
}
|
|
948
1111
|
return ValidatorRegistry.items.has(configType) && ValidatorRegistry.items.get(configType)?.typeRef !== type;
|
|
949
1112
|
}
|
|
950
1113
|
static validate(config) {
|
|
951
1114
|
checkTypeNameFormat(config.type, 'ValidatorTypeName');
|
|
952
|
-
if (ValidatorRegistry._has(config.type, config.typeRef)) {
|
|
1115
|
+
if (config.typeRef && ValidatorRegistry._has(config.type, config.typeRef)) {
|
|
953
1116
|
throw new Error(`Error when register ${config.type}. Element with this type has already exist`);
|
|
954
1117
|
}
|
|
955
1118
|
}
|
|
@@ -957,7 +1120,11 @@ class ValidatorRegistry extends ɵBaseRegistry {
|
|
|
957
1120
|
return this.store.typeInfos;
|
|
958
1121
|
}
|
|
959
1122
|
static register(config) {
|
|
960
|
-
this.items.
|
|
1123
|
+
const existingConfig = this.items.get(config.type);
|
|
1124
|
+
this.items.set(config.type, {
|
|
1125
|
+
...(existingConfig ?? {}),
|
|
1126
|
+
...config,
|
|
1127
|
+
});
|
|
961
1128
|
}
|
|
962
1129
|
}
|
|
963
1130
|
ValidatorRegistry.registryKey = validatorRegistryKey;
|
|
@@ -979,6 +1146,27 @@ class RemoteEntriesRegistry extends ɵBaseRegistry {
|
|
|
979
1146
|
*/
|
|
980
1147
|
RemoteEntriesRegistry.registryKey = 'remotes';
|
|
981
1148
|
|
|
1149
|
+
/**
|
|
1150
|
+
* @internal
|
|
1151
|
+
*/
|
|
1152
|
+
const registryKey = 'ChatMessageTypeRegistry';
|
|
1153
|
+
/**
|
|
1154
|
+
* @internal
|
|
1155
|
+
* @hostPublicApi available through window.creatio.registry.ChatMessageTypeRegistry
|
|
1156
|
+
*/
|
|
1157
|
+
class ChatMessageTypeRegistry extends ɵBaseRegistry {
|
|
1158
|
+
static get messageTypes() {
|
|
1159
|
+
return this.store.typeInfos;
|
|
1160
|
+
}
|
|
1161
|
+
static register(messageType, selector) {
|
|
1162
|
+
this.messageTypes.set(messageType, selector);
|
|
1163
|
+
}
|
|
1164
|
+
static getSelector(messageType) {
|
|
1165
|
+
return this.store.typeInfos.get(messageType);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
ChatMessageTypeRegistry.registryKey = registryKey;
|
|
1169
|
+
|
|
982
1170
|
/**
|
|
983
1171
|
* @internal
|
|
984
1172
|
*/
|
|
@@ -1242,6 +1430,43 @@ class DataRequest extends ɵBaseRequest {
|
|
|
1242
1430
|
* @property {unknown} params - request parameters.
|
|
1243
1431
|
*/
|
|
1244
1432
|
|
|
1433
|
+
/**
|
|
1434
|
+
* @internal
|
|
1435
|
+
*/
|
|
1436
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1437
|
+
function CrtRequest(config) {
|
|
1438
|
+
return function (type) {
|
|
1439
|
+
checkTypeNameFormat(config.type, 'RequestTypeName');
|
|
1440
|
+
checkCrtTypeNamePascalCase(config.type);
|
|
1441
|
+
RequestRegistryService.register(config, type);
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* @hostPublicApi
|
|
1447
|
+
* TODO: RND-55882
|
|
1448
|
+
*/
|
|
1449
|
+
let HandleViewModelAttributeChangeRequest = class HandleViewModelAttributeChangeRequest extends ɵBaseRequest {
|
|
1450
|
+
constructor(payload) {
|
|
1451
|
+
super();
|
|
1452
|
+
this.type = 'crt.HandleViewModelAttributeChangeRequest';
|
|
1453
|
+
this.attributeName = payload.attributeName;
|
|
1454
|
+
this.value = payload.value;
|
|
1455
|
+
this.oldValue = payload.oldValue;
|
|
1456
|
+
// eslint-disable-next-line sonar/deprecation
|
|
1457
|
+
this.silent = Boolean(payload.silent);
|
|
1458
|
+
this.preventAttributeChangeRequest = Boolean(payload.preventAttributeChangeRequest);
|
|
1459
|
+
this.preventStateChange = Boolean(payload.preventStateChange);
|
|
1460
|
+
this.preventRunBusinessRules = Boolean(payload.preventRunBusinessRules);
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
HandleViewModelAttributeChangeRequest = __decorate([
|
|
1464
|
+
CrtRequest({
|
|
1465
|
+
type: 'crt.HandleViewModelAttributeChangeRequest',
|
|
1466
|
+
}),
|
|
1467
|
+
__metadata("design:paramtypes", [Object])
|
|
1468
|
+
], HandleViewModelAttributeChangeRequest);
|
|
1469
|
+
|
|
1245
1470
|
/**
|
|
1246
1471
|
* @internal
|
|
1247
1472
|
*/
|
|
@@ -1368,18 +1593,6 @@ function CrtDesignTimeViewElement(config) {
|
|
|
1368
1593
|
};
|
|
1369
1594
|
}
|
|
1370
1595
|
|
|
1371
|
-
/**
|
|
1372
|
-
* @internal
|
|
1373
|
-
*/
|
|
1374
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1375
|
-
function CrtRequest(config) {
|
|
1376
|
-
return function (type) {
|
|
1377
|
-
checkTypeNameFormat(config.type, 'RequestTypeName');
|
|
1378
|
-
checkCrtTypeNamePascalCase(config.type);
|
|
1379
|
-
RequestRegistryService.register(config, type);
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1596
|
/**
|
|
1384
1597
|
* @internal
|
|
1385
1598
|
* @hostPublicApi
|
|
@@ -1407,6 +1620,32 @@ var RemoteEntryType;
|
|
|
1407
1620
|
RemoteEntryType["Module"] = "module";
|
|
1408
1621
|
})(RemoteEntryType || (RemoteEntryType = {}));
|
|
1409
1622
|
|
|
1623
|
+
/**
|
|
1624
|
+
* @internal
|
|
1625
|
+
*/
|
|
1626
|
+
class LazyModuleRef {
|
|
1627
|
+
get typeRef() {
|
|
1628
|
+
return this._typeRef;
|
|
1629
|
+
}
|
|
1630
|
+
constructor(_metadata, _bootstrapFn,
|
|
1631
|
+
/** Name of source build ('host' or remote name) */
|
|
1632
|
+
sourceName) {
|
|
1633
|
+
this._metadata = _metadata;
|
|
1634
|
+
this._bootstrapFn = _bootstrapFn;
|
|
1635
|
+
this.sourceName = sourceName;
|
|
1636
|
+
}
|
|
1637
|
+
loadAndBootstrap() {
|
|
1638
|
+
if (!this._modulePromise) {
|
|
1639
|
+
this._modulePromise = this._metadata.load().then((type) => {
|
|
1640
|
+
this._typeRef = type;
|
|
1641
|
+
this._bootstrapFn(type);
|
|
1642
|
+
return type;
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
return this._modulePromise;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1410
1649
|
/**
|
|
1411
1650
|
* @public
|
|
1412
1651
|
* @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
|
|
@@ -1500,23 +1739,7 @@ function CrtViewElement(config) {
|
|
|
1500
1739
|
}
|
|
1501
1740
|
|
|
1502
1741
|
/**
|
|
1503
|
-
* @
|
|
1504
|
-
* @description CrtModule decorator is a 'container' where user actually setup elements.
|
|
1505
|
-
* In could contain viewElements, definitions of other CrtModules.
|
|
1506
|
-
* @param moduleDefinition - {@link ModuleDefinition}
|
|
1507
|
-
*
|
|
1508
|
-
* @example
|
|
1509
|
-
* @CrtModule({
|
|
1510
|
-
* viewElements: [AppComponent],
|
|
1511
|
-
* requestHandlers: [SomeRequestHandler],
|
|
1512
|
-
* validators: [SomeValidator],
|
|
1513
|
-
* })
|
|
1514
|
-
* @NgModule({
|
|
1515
|
-
* declarations: [AppComponent],
|
|
1516
|
-
* imports: [BrowserModule],
|
|
1517
|
-
* providers: [],
|
|
1518
|
-
* })
|
|
1519
|
-
* export class AppModule {}
|
|
1742
|
+
* @internal
|
|
1520
1743
|
*/
|
|
1521
1744
|
function CrtModule(moduleDefinition) {
|
|
1522
1745
|
return (type) => setModuleMetadata(moduleDefinition, type);
|
|
@@ -1620,6 +1843,25 @@ function CrtConverter(config) {
|
|
|
1620
1843
|
};
|
|
1621
1844
|
}
|
|
1622
1845
|
|
|
1846
|
+
/**
|
|
1847
|
+
* @public
|
|
1848
|
+
* @description CrtChatMessageType decorator allows user to register components as a message type in chat.
|
|
1849
|
+
* @param config - registration config. {@link ChatMessageTypeRegistrationConfig}.
|
|
1850
|
+
*
|
|
1851
|
+
* @example
|
|
1852
|
+
* @CrtChatMessageType({
|
|
1853
|
+
* selector: 'usr-video-message',
|
|
1854
|
+
* messageType: 'video',
|
|
1855
|
+
* })
|
|
1856
|
+
* export class AppComponent { }
|
|
1857
|
+
*/
|
|
1858
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1859
|
+
function CrtChatMessageType(config) {
|
|
1860
|
+
return function (type) {
|
|
1861
|
+
ChatMessageTypeRegistry.register(config.messageType, config.selector);
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1623
1865
|
/**
|
|
1624
1866
|
* @internal
|
|
1625
1867
|
*/
|
|
@@ -1671,6 +1913,9 @@ function registerAngularViewElement(config, typeRef) {
|
|
|
1671
1913
|
});
|
|
1672
1914
|
}
|
|
1673
1915
|
|
|
1916
|
+
/**
|
|
1917
|
+
* @internal
|
|
1918
|
+
*/
|
|
1674
1919
|
function checkRemoteName(remoteName) {
|
|
1675
1920
|
if (!RemoteEntriesRegistry.items.has(remoteName)) {
|
|
1676
1921
|
throw new Error(`Remote entry with name '${remoteName}' does not exist`);
|
|
@@ -1699,6 +1944,16 @@ function registerViewElements(types) {
|
|
|
1699
1944
|
ViewElementRegistry.register(registrationConfig);
|
|
1700
1945
|
});
|
|
1701
1946
|
}
|
|
1947
|
+
/**
|
|
1948
|
+
* @internal
|
|
1949
|
+
*/
|
|
1950
|
+
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
1951
|
+
resistantForEach(configs, (config) => {
|
|
1952
|
+
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1953
|
+
ViewElementRegistry.validate(registryItem);
|
|
1954
|
+
ViewElementRegistry.register(registryItem);
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1702
1957
|
/**
|
|
1703
1958
|
* @internal
|
|
1704
1959
|
*/
|
|
@@ -1744,6 +1999,16 @@ function registerValidators(types, options) {
|
|
|
1744
1999
|
ValidatorRegistry.register(registrationConfig);
|
|
1745
2000
|
});
|
|
1746
2001
|
}
|
|
2002
|
+
/**
|
|
2003
|
+
* @internal
|
|
2004
|
+
*/
|
|
2005
|
+
function registerLazyValidators(configs, lazyModuleRef) {
|
|
2006
|
+
resistantForEach(configs, (config) => {
|
|
2007
|
+
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
2008
|
+
ValidatorRegistry.validate(registryItem);
|
|
2009
|
+
ValidatorRegistry.register(registryItem);
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
1747
2012
|
/**
|
|
1748
2013
|
* @internal
|
|
1749
2014
|
*/
|
|
@@ -1762,6 +2027,15 @@ function registerConverters(types, options) {
|
|
|
1762
2027
|
ConverterRegistry.register(registrationConfig);
|
|
1763
2028
|
});
|
|
1764
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* @internal
|
|
2032
|
+
*/
|
|
2033
|
+
function registerLazyConverters(descriptors, lazyModuleRef) {
|
|
2034
|
+
resistantForEach(descriptors, (descriptor) => {
|
|
2035
|
+
const registryItem = { ...descriptor, lazy: true, lazyModuleRef };
|
|
2036
|
+
ConverterRegistry.register(registryItem);
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
1765
2039
|
/**
|
|
1766
2040
|
* @internal
|
|
1767
2041
|
*/
|
|
@@ -1800,7 +2074,63 @@ function registerRequestHandlers(types, options, remoteName) {
|
|
|
1800
2074
|
RequestHandlerRegistryService.register(registrationConfig, type);
|
|
1801
2075
|
});
|
|
1802
2076
|
}
|
|
1803
|
-
|
|
2077
|
+
/**
|
|
2078
|
+
* @internal
|
|
2079
|
+
*/
|
|
2080
|
+
function registerLazyRequestHandlers(descriptors, options, remoteName, lazyModuleRef) {
|
|
2081
|
+
resistantForEach(descriptors, (descriptor) => {
|
|
2082
|
+
const registrationConfig = {
|
|
2083
|
+
...descriptor,
|
|
2084
|
+
lazy: true,
|
|
2085
|
+
lazyModuleRef,
|
|
2086
|
+
};
|
|
2087
|
+
if (options.moduleType === 'host') {
|
|
2088
|
+
registrationConfig.source = { type: HandlerSourceType.Host };
|
|
2089
|
+
}
|
|
2090
|
+
else {
|
|
2091
|
+
const remote = RemoteEntriesRegistry.items.get(remoteName);
|
|
2092
|
+
registrationConfig.source = {
|
|
2093
|
+
type: HandlerSourceType.Remote,
|
|
2094
|
+
packageName: remote.packageName,
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
RequestHandlerRegistryService.register(registrationConfig);
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* @internal
|
|
2102
|
+
*/
|
|
2103
|
+
function bootstrapLazyCrtModule(name, descriptor, options, lazyModuleRef) {
|
|
2104
|
+
try {
|
|
2105
|
+
if (descriptor.viewElements) {
|
|
2106
|
+
registerLazyViewElements(descriptor.viewElements, lazyModuleRef);
|
|
2107
|
+
}
|
|
2108
|
+
if (descriptor.requestHandlers) {
|
|
2109
|
+
registerLazyRequestHandlers(descriptor.requestHandlers, options, name, lazyModuleRef);
|
|
2110
|
+
}
|
|
2111
|
+
if (descriptor.validators) {
|
|
2112
|
+
registerLazyValidators(descriptor.validators, lazyModuleRef);
|
|
2113
|
+
}
|
|
2114
|
+
if (descriptor.converters) {
|
|
2115
|
+
registerLazyConverters(descriptor.converters, lazyModuleRef);
|
|
2116
|
+
}
|
|
2117
|
+
descriptor.includes?.forEach((m) => {
|
|
2118
|
+
bootstrapLazyCrtModule(name, m, options, lazyModuleRef);
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
catch (error) {
|
|
2122
|
+
console.error(error);
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* @internal
|
|
2127
|
+
*/
|
|
2128
|
+
function bootstrapDefaultCrtModule(name, type, options, root) {
|
|
2129
|
+
if (bootstrappedCrtModules.has(type)) {
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
const source = options.moduleType === 'host' ? 'host' : name;
|
|
2133
|
+
bootstrappedCrtModules.set(type, { source, root, options });
|
|
1804
2134
|
try {
|
|
1805
2135
|
const moduleDefinition = getModuleMetadata(type);
|
|
1806
2136
|
if (moduleDefinition.viewElements) {
|
|
@@ -1820,8 +2150,19 @@ function bootstrapDefaultCrtModule(name, type, options) {
|
|
|
1820
2150
|
registerConverters(moduleDefinition.converters, options);
|
|
1821
2151
|
}
|
|
1822
2152
|
moduleDefinition.includes?.forEach((t) => {
|
|
1823
|
-
|
|
1824
|
-
|
|
2153
|
+
if (typeof t === 'function') {
|
|
2154
|
+
bootstrapDefaultCrtModule(name, t, options, false);
|
|
2155
|
+
bootstrapPredefinedModules(name, t, options);
|
|
2156
|
+
}
|
|
2157
|
+
else if (typeof t === 'object') {
|
|
2158
|
+
if (options.moduleType === 'remote' && !name) {
|
|
2159
|
+
console.error("To use lazy loading, 'remoteName' parameter should be specified.");
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
const ref = new LazyModuleRef(t, (x) => bootstrapDefaultCrtModule(name, x, options, false), source);
|
|
2163
|
+
bootstrapLazyCrtModule(name, t, options, ref);
|
|
2164
|
+
LazyModulesManager.instance.add(ref);
|
|
2165
|
+
}
|
|
1825
2166
|
});
|
|
1826
2167
|
}
|
|
1827
2168
|
catch (error) {
|
|
@@ -1863,7 +2204,7 @@ function bootstrapCrtModule(...args) {
|
|
|
1863
2204
|
throw new Error('Host module cannot have name');
|
|
1864
2205
|
}
|
|
1865
2206
|
}
|
|
1866
|
-
bootstrapDefaultCrtModule(name, type, options);
|
|
2207
|
+
bootstrapDefaultCrtModule(name, type, options, true);
|
|
1867
2208
|
bootstrapPredefinedModules(name, type, options);
|
|
1868
2209
|
if (options.moduleType === 'remote') {
|
|
1869
2210
|
BootstrapNotifier.instance.notify(type);
|
|
@@ -1915,7 +2256,11 @@ function _bootstrapCrtModuleHandlerChainServices(type) {
|
|
|
1915
2256
|
if (moduleDefinition.handlerChainServices) {
|
|
1916
2257
|
registerHandlerChainServices(moduleDefinition.handlerChainServices);
|
|
1917
2258
|
}
|
|
1918
|
-
moduleDefinition.includes?.forEach((t) =>
|
|
2259
|
+
moduleDefinition.includes?.forEach((t) => {
|
|
2260
|
+
if (typeof t === 'function') {
|
|
2261
|
+
_bootstrapCrtModuleHandlerChainServices(t);
|
|
2262
|
+
}
|
|
2263
|
+
});
|
|
1919
2264
|
}
|
|
1920
2265
|
/**
|
|
1921
2266
|
* @internal
|
|
@@ -1924,6 +2269,33 @@ function bootstrapCrtModuleHandlerChainServices(type) {
|
|
|
1924
2269
|
_bootstrapCrtModuleHandlerChainServices(type);
|
|
1925
2270
|
}
|
|
1926
2271
|
|
|
2272
|
+
/**
|
|
2273
|
+
* @internal
|
|
2274
|
+
* Clears global registries, resets state of global services.
|
|
2275
|
+
* Can be used in unit tests to clear global registries after bootstrapping module.
|
|
2276
|
+
* @example
|
|
2277
|
+
* beforeEach(() => {
|
|
2278
|
+
* bootstrapCrtModule('test', TestModule);
|
|
2279
|
+
* });
|
|
2280
|
+
*
|
|
2281
|
+
* afterEach(() => {
|
|
2282
|
+
* resetGlobals();
|
|
2283
|
+
* });
|
|
2284
|
+
*/
|
|
2285
|
+
function resetGlobals() {
|
|
2286
|
+
bootstrappedCrtModules.clear();
|
|
2287
|
+
ViewElementRegistry.viewElements.clear();
|
|
2288
|
+
InternalRequestHandlerRegistry.clear();
|
|
2289
|
+
HandlerChainService.instance.clear();
|
|
2290
|
+
ValidatorRegistry.items.clear();
|
|
2291
|
+
ConverterRegistry.clear();
|
|
2292
|
+
RemoteEntriesRegistry.items.clear();
|
|
2293
|
+
PkgTopology.items.clear();
|
|
2294
|
+
LazyModulesManager.instance.clear();
|
|
2295
|
+
LazyModulesManager.instance.lazyLoadingDisabled = false;
|
|
2296
|
+
DesignTimeViewElementRegistry.infos.clear();
|
|
2297
|
+
}
|
|
2298
|
+
|
|
1927
2299
|
/**
|
|
1928
2300
|
* @public
|
|
1929
2301
|
* @abstract
|
|
@@ -2166,25 +2538,23 @@ __decorate([
|
|
|
2166
2538
|
], HttpClientService.prototype, "patch", null);
|
|
2167
2539
|
|
|
2168
2540
|
/**
|
|
2169
|
-
* @
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
(function (SchemaViewMaskRequestAction) {
|
|
2173
|
-
SchemaViewMaskRequestAction["AddTask"] = "addTask";
|
|
2174
|
-
SchemaViewMaskRequestAction["RemoveTask"] = "removeTask";
|
|
2175
|
-
})(SchemaViewMaskRequestAction || (SchemaViewMaskRequestAction = {}));
|
|
2176
|
-
/**
|
|
2177
|
-
* @internal
|
|
2541
|
+
* @public
|
|
2542
|
+
* @classdesc Represents a service to working with license restrictions.
|
|
2543
|
+
* @extends {BaseHandlerChainService}
|
|
2178
2544
|
*/
|
|
2179
|
-
class
|
|
2180
|
-
constructor(
|
|
2181
|
-
super();
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
this.
|
|
2545
|
+
class LicenseService extends BaseHandlerChainService {
|
|
2546
|
+
constructor() {
|
|
2547
|
+
super(...arguments);
|
|
2548
|
+
/**
|
|
2549
|
+
* @internal
|
|
2550
|
+
*/
|
|
2551
|
+
this.requestType = 'crt.LicenseService';
|
|
2186
2552
|
}
|
|
2187
2553
|
}
|
|
2554
|
+
__decorate([
|
|
2555
|
+
ImplementUsingHandlerChain(),
|
|
2556
|
+
__metadata("design:type", Function)
|
|
2557
|
+
], LicenseService.prototype, "loadLicenseOperationStatuses", void 0);
|
|
2188
2558
|
|
|
2189
2559
|
/**
|
|
2190
2560
|
* @public
|
|
@@ -2205,7 +2575,7 @@ class MaskService extends BaseHandlerChainService {
|
|
|
2205
2575
|
* @param context
|
|
2206
2576
|
*/
|
|
2207
2577
|
async showMask(taskName, context) {
|
|
2208
|
-
const request = new
|
|
2578
|
+
const request = new ɵSchemaViewMaskRequest(ɵSchemaViewMaskRequestAction.AddTask, taskName, context);
|
|
2209
2579
|
await HandlerChainService.instance.process(request);
|
|
2210
2580
|
}
|
|
2211
2581
|
/**
|
|
@@ -2214,7 +2584,7 @@ class MaskService extends BaseHandlerChainService {
|
|
|
2214
2584
|
* @param context
|
|
2215
2585
|
*/
|
|
2216
2586
|
async hideMask(taskName, context) {
|
|
2217
|
-
const request = new
|
|
2587
|
+
const request = new ɵSchemaViewMaskRequest(ɵSchemaViewMaskRequestAction.RemoveTask, taskName, context);
|
|
2218
2588
|
await HandlerChainService.instance.process(request);
|
|
2219
2589
|
}
|
|
2220
2590
|
}
|
|
@@ -2275,6 +2645,9 @@ class Model extends BaseHandlerChainService {
|
|
|
2275
2645
|
return this._crtModel._getAsyncResult(this._crtModel.getSchema());
|
|
2276
2646
|
}
|
|
2277
2647
|
load(config) {
|
|
2648
|
+
if (config?.loadOptions && !config?.options) {
|
|
2649
|
+
config.options = config.loadOptions;
|
|
2650
|
+
}
|
|
2278
2651
|
return this._crtModel._getAsyncResult(this._crtModel.load(config));
|
|
2279
2652
|
}
|
|
2280
2653
|
insert(dto) {
|
|
@@ -2325,9 +2698,30 @@ __decorate([
|
|
|
2325
2698
|
__metadata("design:type", Function)
|
|
2326
2699
|
], CrtZoneService.prototype, "runOutside", void 0);
|
|
2327
2700
|
|
|
2701
|
+
/**
|
|
2702
|
+
* @public
|
|
2703
|
+
* @classdesc Service to working with dialog using handler chain.
|
|
2704
|
+
* @extends {BaseHandlerChainService}
|
|
2705
|
+
*/
|
|
2706
|
+
class DialogService extends BaseHandlerChainService {
|
|
2707
|
+
constructor() {
|
|
2708
|
+
super(...arguments);
|
|
2709
|
+
/**
|
|
2710
|
+
* @internal
|
|
2711
|
+
*/
|
|
2712
|
+
this.requestType = 'crt.DialogService';
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
__decorate([
|
|
2716
|
+
ImplementUsingHandlerChain({
|
|
2717
|
+
methodName: 'openDialog',
|
|
2718
|
+
}),
|
|
2719
|
+
__metadata("design:type", Function)
|
|
2720
|
+
], DialogService.prototype, "open", void 0);
|
|
2721
|
+
|
|
2328
2722
|
/**
|
|
2329
2723
|
* Generated bundle index. Do not edit.
|
|
2330
2724
|
*/
|
|
2331
2725
|
|
|
2332
|
-
export { BaseRequestHandler, BaseValidator, BootstrapNotifier, ConverterRegistry, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, CrtZoneService, DataRequest, DataSourceLoadType, DesignTimeViewElementRegistry, DesignerToolGroupType, FeatureService, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, LocalizableValue, MaskService, MethodInvokeRequest, Model, PkgTopology, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService,
|
|
2726
|
+
export { BaseRequestHandler, BaseValidator, BootstrapNotifier, ChatMessageTypeRegistry, ConverterRegistry, CrtChatMessageType, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, CrtZoneService, DataRequest, DataSourceLoadType, DesignTimeViewElementRegistry, DesignerToolGroupType, DialogService, FeatureService, HandleViewModelAttributeChangeRequest, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, LazyModuleRef, LazyModulesManager, LicenseService, LocalizableValue, MaskService, MethodInvokeRequest, Model, PkgTopology, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, VIEW_ELEMENT_DEFAULT_HEIGHT, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementProperty, ViewElementRegistry, ViewElementReuseStrategy, ViewElementVisibilityStrategy, _from, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, bootstrappedCrtModules, callOnContextCreateHooks, callOnContextDestroyHooks, callOnContextUpdateHooks, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, localize, matchScopes, objectDeepKeys, registerAngularViewElement, registerViewElement, registryKey, resetGlobals, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey, ɵBaseRegistry, ɵcheckTypeNameFormat, ɵinstantiate };
|
|
2333
2727
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|