@creatio-devkit/common 0.823.0 → 0.830.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 +2 -0
- package/esm2022/lib/base-exports.mjs +1 -1
- package/esm2022/lib/internal/models/index.mjs +2 -1
- package/esm2022/lib/internal/models/interface-designer-item/toolbar-view-element-config.mjs +1 -1
- package/esm2022/lib/internal/models/transaction/index.mjs +3 -0
- package/esm2022/lib/internal/models/transaction/transaction-operation.mjs +2 -0
- package/esm2022/lib/internal/models/transaction/transaction.mjs +2 -0
- package/esm2022/lib/public/functions/bootstrap-crt-module.mjs +6 -16
- package/esm2022/lib/public/models/ai-context/ai-context-part.mjs +2 -0
- package/esm2022/lib/public/models/ai-context/index.mjs +2 -0
- package/esm2022/lib/public/models/index.mjs +2 -1
- package/esm2022/lib/public/services/ai-context/ai-context.service.mjs +86 -0
- package/esm2022/lib/public/services/ai-context/index.mjs +2 -0
- package/esm2022/lib/public/services/index.mjs +2 -1
- package/fesm2022/creatio-devkit-common.mjs +92 -16
- package/fesm2022/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +128 -0
- package/package.json +2 -2
|
@@ -1749,7 +1749,7 @@ function checkRemoteName(remoteName) {
|
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
1751
|
function skipLazyModuleIfItemIsNonLazy(options) {
|
|
1752
|
-
return !options?.featureValues?.LoadLazyModuleEvenIfItemIsNonLazy;
|
|
1752
|
+
return !options?.featureValues?.['LoadLazyModuleEvenIfItemIsNonLazy'];
|
|
1753
1753
|
}
|
|
1754
1754
|
function isItemRegisteredByNonLazyModule(item) {
|
|
1755
1755
|
return Boolean(item && !item.lazy && item.typeRef);
|
|
@@ -1770,13 +1770,9 @@ function resistantForEach(items, callback) {
|
|
|
1770
1770
|
/**
|
|
1771
1771
|
* @internal
|
|
1772
1772
|
*/
|
|
1773
|
-
function registerViewElements(types
|
|
1773
|
+
function registerViewElements(types) {
|
|
1774
1774
|
resistantForEach(types, (type) => {
|
|
1775
1775
|
const registrationConfig = getViewElementMetadata(type);
|
|
1776
|
-
if (skipLazyModuleIfItemIsNonLazy(options) && !options.lazy) {
|
|
1777
|
-
registrationConfig.lazy = false;
|
|
1778
|
-
registrationConfig.lazyModuleRef = null;
|
|
1779
|
-
}
|
|
1780
1776
|
ViewElementRegistry.validate(registrationConfig);
|
|
1781
1777
|
ViewElementRegistry.register(registrationConfig);
|
|
1782
1778
|
});
|
|
@@ -1784,14 +1780,8 @@ function registerViewElements(types, options) {
|
|
|
1784
1780
|
/**
|
|
1785
1781
|
* @internal
|
|
1786
1782
|
*/
|
|
1787
|
-
function registerLazyViewElements(configs,
|
|
1783
|
+
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
1788
1784
|
resistantForEach(configs, (config) => {
|
|
1789
|
-
if (skipLazyModuleIfItemIsNonLazy(options)) {
|
|
1790
|
-
const existingRegistryItem = ViewElementRegistry.viewElements.get(config.type);
|
|
1791
|
-
if (isItemRegisteredByNonLazyModule(existingRegistryItem)) {
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
1785
|
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1796
1786
|
ViewElementRegistry.validate(registryItem);
|
|
1797
1787
|
ViewElementRegistry.register(registryItem);
|
|
@@ -1976,7 +1966,7 @@ function registerLazyRequestHandlers(descriptors, options, remoteName, lazyModul
|
|
|
1976
1966
|
function bootstrapLazyCrtModule(name, descriptor, options, lazyModuleRef) {
|
|
1977
1967
|
try {
|
|
1978
1968
|
if (descriptor.viewElements) {
|
|
1979
|
-
registerLazyViewElements(descriptor.viewElements,
|
|
1969
|
+
registerLazyViewElements(descriptor.viewElements, lazyModuleRef);
|
|
1980
1970
|
}
|
|
1981
1971
|
if (descriptor.requestHandlers) {
|
|
1982
1972
|
registerLazyRequestHandlers(descriptor.requestHandlers, options, name, lazyModuleRef);
|
|
@@ -2007,7 +1997,7 @@ function bootstrapDefaultCrtModule(name, type, options, root) {
|
|
|
2007
1997
|
try {
|
|
2008
1998
|
const moduleDefinition = getModuleMetadata(type);
|
|
2009
1999
|
if (moduleDefinition.viewElements) {
|
|
2010
|
-
registerViewElements(moduleDefinition.viewElements
|
|
2000
|
+
registerViewElements(moduleDefinition.viewElements);
|
|
2011
2001
|
registerInterfaceDesignerItems(moduleDefinition.viewElements, options?.localizeMetadata);
|
|
2012
2002
|
}
|
|
2013
2003
|
if (moduleDefinition.designTimeViewElements) {
|
|
@@ -2968,9 +2958,95 @@ __decorate([
|
|
|
2968
2958
|
__metadata("design:type", Function)
|
|
2969
2959
|
], ProcessEngineService.prototype, "completeExecuting", void 0);
|
|
2970
2960
|
|
|
2961
|
+
/**
|
|
2962
|
+
* Service for managing AI context parts and providing a unified context.
|
|
2963
|
+
* This service allows adding, retrieving, and removing context parts, which can be
|
|
2964
|
+
* either static values, promises, or dynamically provided through a function.
|
|
2965
|
+
*/
|
|
2966
|
+
class AiContextService {
|
|
2967
|
+
constructor() {
|
|
2968
|
+
this._contextParts = [];
|
|
2969
|
+
}
|
|
2970
|
+
/**
|
|
2971
|
+
* Retrieves the singleton instance of the `AiContextService`.
|
|
2972
|
+
* If the instance does not exist, it will be created.
|
|
2973
|
+
*/
|
|
2974
|
+
static get instance() {
|
|
2975
|
+
return AiContextService._instance || (AiContextService._instance = new AiContextService());
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* Generates a unique identifier for a context part.
|
|
2979
|
+
* @returns A string representing a unique identifier.
|
|
2980
|
+
*/
|
|
2981
|
+
_generateId() {
|
|
2982
|
+
const length = 9;
|
|
2983
|
+
const base = 36;
|
|
2984
|
+
const array = new Uint32Array(length);
|
|
2985
|
+
window.crypto.getRandomValues(array);
|
|
2986
|
+
return Array.from(array, (num) => (num % base).toString(base)).join('');
|
|
2987
|
+
}
|
|
2988
|
+
/**
|
|
2989
|
+
* @public
|
|
2990
|
+
* Adds a new context part to the service.
|
|
2991
|
+
* The context part can be a static value, a promise, or a function that provides the value.
|
|
2992
|
+
*
|
|
2993
|
+
* @param value - The context part to add. It can be one of the following:
|
|
2994
|
+
* - `ContextProvider` (a function that provides the context part)
|
|
2995
|
+
* @param id - (Optional) A unique identifier for the context part. If not provided, a new ID will be generated.
|
|
2996
|
+
* @returns The unique identifier of the added context part.
|
|
2997
|
+
*/
|
|
2998
|
+
setContextPart(value, id = this._generateId()) {
|
|
2999
|
+
const provider = typeof value === 'function' ? value : () => value;
|
|
3000
|
+
this._contextParts.push({ id, provider });
|
|
3001
|
+
return id;
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* @public
|
|
3005
|
+
* Retrieves all context parts as an array of resolved values.
|
|
3006
|
+
* If the context parts include promises or functions, they will be resolved.
|
|
3007
|
+
*
|
|
3008
|
+
* @returns A promise that resolves to an array of context parts, which can be
|
|
3009
|
+
* either `CreatioPageContextPart` or `ConstantValuesContextPart`.
|
|
3010
|
+
*/
|
|
3011
|
+
async getContext() {
|
|
3012
|
+
if (!this._contextParts || this._contextParts.length === 0) {
|
|
3013
|
+
return [];
|
|
3014
|
+
}
|
|
3015
|
+
const resolved = await Promise.all(this._contextParts.map((c) => c.provider()));
|
|
3016
|
+
return resolved
|
|
3017
|
+
.filter((e) => e !== null)
|
|
3018
|
+
.map((p) => {
|
|
3019
|
+
const type = p.type;
|
|
3020
|
+
if (!type || type === 'CreatioPageContextPart' || type === 'ConstantValuesContextPart') {
|
|
3021
|
+
return {
|
|
3022
|
+
...p,
|
|
3023
|
+
type,
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
throw new Error(`Invalid context part type: ${type}`);
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
/**
|
|
3030
|
+
* @public
|
|
3031
|
+
* Removes a specific context part by its unique identifier.
|
|
3032
|
+
*
|
|
3033
|
+
* @param id - The unique identifier of the context part to remove.
|
|
3034
|
+
*/
|
|
3035
|
+
removeContextPart(id) {
|
|
3036
|
+
this._contextParts = this._contextParts.filter((ctx) => ctx.id !== id);
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* @public
|
|
3040
|
+
* Removes all context parts from the service.
|
|
3041
|
+
*/
|
|
3042
|
+
removeContext() {
|
|
3043
|
+
this._contextParts = [];
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
|
|
2971
3047
|
/**
|
|
2972
3048
|
* Generated bundle index. Do not edit.
|
|
2973
3049
|
*/
|
|
2974
3050
|
|
|
2975
|
-
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, MessageChannelService, MethodInvokeRequest, Model, PkgTopology, ProcessEngineService, ProcessStatus, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, RunProcessRequest, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, VIEW_ELEMENT_DEFAULT_HEIGHT, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementProperty, ViewElementRegistry, ViewElementRenderStrategy, ViewElementReuseStrategy, _from, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, bootstrappedCrtModules, callOnContextCreateHooks, callOnContextDestroyHooks, callOnContextUpdateHooks, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, defineRenderConfig, designTimeViewElementRegistryKey, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDeepModuleDependencies, 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 };
|
|
3051
|
+
export { AiContextService, 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, MessageChannelService, MethodInvokeRequest, Model, PkgTopology, ProcessEngineService, ProcessStatus, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, RunProcessRequest, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, VIEW_ELEMENT_DEFAULT_HEIGHT, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementProperty, ViewElementRegistry, ViewElementRenderStrategy, ViewElementReuseStrategy, _from, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, bootstrappedCrtModules, callOnContextCreateHooks, callOnContextDestroyHooks, callOnContextUpdateHooks, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, defineRenderConfig, designTimeViewElementRegistryKey, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDeepModuleDependencies, 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 };
|
|
2976
3052
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|