@creatio-devkit/common 0.823.0 → 0.831.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 +4 -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 +4 -0
- package/esm2022/lib/internal/models/transaction/transaction-factory.mjs +2 -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/internal/services/design-time-view-element-registry/design-time-view-element-registry.mjs +4 -4
- package/esm2022/lib/internal/services/interface-designer-item-registry/index.mjs +2 -1
- package/esm2022/lib/internal/services/interface-designer-item-registry/interface-designer-item-registry.mjs +35 -10
- package/esm2022/lib/internal/services/interface-designer-item-registry/mobile-interface-designer-item-registry.mjs +12 -0
- package/esm2022/lib/internal/services/request-handler-registry/request-handler-registry.service.mjs +1 -1
- package/esm2022/lib/internal/services/view-element-registry/base-view-element-registry.mjs +70 -0
- package/esm2022/lib/internal/services/view-element-registry/index.mjs +3 -1
- package/esm2022/lib/internal/services/view-element-registry/mobile-view-element-registry.mjs +13 -0
- package/esm2022/lib/internal/services/view-element-registry/view-element-registry.mjs +3 -66
- package/esm2022/lib/internal/utils/index.mjs +1 -2
- package/esm2022/lib/internal/utils/metadata-utils.mjs +35 -7
- package/esm2022/lib/internal/utils/module-utils.mjs +1 -1
- package/esm2022/lib/public/decorators/interface-designer-item/index.mjs +3 -1
- package/esm2022/lib/public/decorators/interface-designer-item/interface-designer-item-decorator-utils.mjs +29 -0
- package/esm2022/lib/public/decorators/interface-designer-item/interface-designer-item.decorator.mjs +4 -19
- package/esm2022/lib/public/decorators/interface-designer-item/mobile-interface-designer-item.decorator.mjs +10 -0
- package/esm2022/lib/public/decorators/view-element/index.mjs +3 -1
- package/esm2022/lib/public/decorators/view-element/mobile-view-element.decorator.mjs +9 -0
- package/esm2022/lib/public/decorators/view-element/view-element-decorator-utils.mjs +33 -0
- package/esm2022/lib/public/decorators/view-element/view-element.decorator.mjs +4 -23
- package/esm2022/lib/public/functions/bootstrap-crt-module.mjs +34 -27
- 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/models/module-definition.mjs +1 -1
- package/esm2022/lib/public/models/request/view-model-attribute-change-event-options.mjs +1 -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 +3 -1
- package/esm2022/lib/public/services/model/model.mjs +19 -2
- package/esm2022/lib/public/services/transaction-factory/index.mjs +2 -0
- package/esm2022/lib/public/services/transaction-factory/transaction-factory.service.mjs +40 -0
- package/fesm2022/creatio-devkit-common.mjs +331 -70
- package/fesm2022/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +264 -5
- package/package.json +2 -2
- package/esm2022/lib/internal/utils/component-config-utils.mjs +0 -12
|
@@ -361,7 +361,9 @@ class HandlersOrderComparer {
|
|
|
361
361
|
|
|
362
362
|
const moduleMetadataKey = 'module';
|
|
363
363
|
const viewElementMetadataKey = 'viewElement';
|
|
364
|
+
const mobileViewElementMetadataKey = 'mobileViewElement';
|
|
364
365
|
const interfaceDesignerItemMetadataKey = 'interfaceDesignerItem';
|
|
366
|
+
const mobileInterfaceDesignerItemMetadataKey = 'mobileInterfaceDesignerItem';
|
|
365
367
|
const requestHandlerMetadataKey = 'requestHandler';
|
|
366
368
|
const designTimeViewElementMetadataKey = 'designTimeViewElement';
|
|
367
369
|
const validatorMetadataKey = 'validator';
|
|
@@ -388,14 +390,24 @@ function getModuleMetadata(type) {
|
|
|
388
390
|
function setViewElementMetadata(metadata, type) {
|
|
389
391
|
Reflect.defineMetadata(viewElementMetadataKey, metadata, type);
|
|
390
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
function setMobileViewElementMetadata(metadata, type) {
|
|
397
|
+
Reflect.defineMetadata(mobileViewElementMetadataKey, metadata, type);
|
|
398
|
+
}
|
|
391
399
|
/**
|
|
392
400
|
* @internal
|
|
393
401
|
*/
|
|
394
402
|
function getViewElementMetadata(type) {
|
|
395
403
|
const metadata = Reflect.getMetadata(viewElementMetadataKey, type);
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
404
|
+
return metadata;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @internal
|
|
408
|
+
*/
|
|
409
|
+
function getMobileViewElementMetadata(type) {
|
|
410
|
+
const metadata = Reflect.getMetadata(mobileViewElementMetadataKey, type);
|
|
399
411
|
return metadata;
|
|
400
412
|
}
|
|
401
413
|
/**
|
|
@@ -436,14 +448,24 @@ function getConverterMetadata(type) {
|
|
|
436
448
|
function setInterfaceDesignerItemMetadata(metadata, type) {
|
|
437
449
|
Reflect.defineMetadata(interfaceDesignerItemMetadataKey, metadata, type);
|
|
438
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* @internal
|
|
453
|
+
*/
|
|
454
|
+
function setMobileInterfaceDesignerItemMetadata(metadata, type) {
|
|
455
|
+
Reflect.defineMetadata(mobileInterfaceDesignerItemMetadataKey, metadata, type);
|
|
456
|
+
}
|
|
439
457
|
/**
|
|
440
458
|
* @internal
|
|
441
459
|
*/
|
|
442
460
|
function getInterfaceDesignerItemMetadata(type) {
|
|
443
461
|
const metadata = Reflect.getOwnMetadata(interfaceDesignerItemMetadataKey, type);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
462
|
+
return metadata;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
function getMobileInterfaceDesignerItemMetadata(type) {
|
|
468
|
+
const metadata = Reflect.getOwnMetadata(mobileInterfaceDesignerItemMetadataKey, type);
|
|
447
469
|
return metadata;
|
|
448
470
|
}
|
|
449
471
|
/**
|
|
@@ -468,6 +490,12 @@ function getDesignTimeViewElementMetadata(type) {
|
|
|
468
490
|
function hasInterfaceDesignerItemMetadata(type) {
|
|
469
491
|
return Reflect.hasOwnMetadata(interfaceDesignerItemMetadataKey, type);
|
|
470
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* @internal
|
|
495
|
+
*/
|
|
496
|
+
function hasMobileInterfaceDesignerItemMetadata(type) {
|
|
497
|
+
return Reflect.hasOwnMetadata(mobileInterfaceDesignerItemMetadataKey, type);
|
|
498
|
+
}
|
|
471
499
|
/**
|
|
472
500
|
* @internal
|
|
473
501
|
*/
|
|
@@ -1189,21 +1217,16 @@ class ConverterRegistry extends ɵBaseRegistry {
|
|
|
1189
1217
|
|
|
1190
1218
|
/**
|
|
1191
1219
|
* @internal
|
|
1220
|
+
* @hostPublicApi available through window.creatio.registry.BaseViewElementRegistry
|
|
1192
1221
|
*/
|
|
1193
|
-
|
|
1194
|
-
/**
|
|
1195
|
-
* @internal
|
|
1196
|
-
* @hostPublicApi available through window.creatio.registry.ValidatorRegistry
|
|
1197
|
-
*/
|
|
1198
|
-
class ViewElementRegistry extends ɵBaseRegistry {
|
|
1199
|
-
static { this.registryKey = viewElementRegistryKey; }
|
|
1222
|
+
class BaseViewElementRegistry extends ɵBaseRegistry {
|
|
1200
1223
|
static validate(config) {
|
|
1201
1224
|
checkTypeNameFormat(config.type, 'ViewElementTypeName');
|
|
1202
|
-
const existingItem =
|
|
1225
|
+
const existingItem = this.viewElements.get(config.type);
|
|
1203
1226
|
if (existingItem?.lazy && !('selector' in existingItem) && !existingItem.typeRef) {
|
|
1204
1227
|
return;
|
|
1205
1228
|
}
|
|
1206
|
-
checkOnlyOneRegistration(config.type, config,
|
|
1229
|
+
checkOnlyOneRegistration(config.type, config, this.viewElements);
|
|
1207
1230
|
}
|
|
1208
1231
|
static get viewElements() {
|
|
1209
1232
|
return this.store.typeInfos;
|
|
@@ -1260,6 +1283,29 @@ class ViewElementRegistry extends ɵBaseRegistry {
|
|
|
1260
1283
|
}
|
|
1261
1284
|
}
|
|
1262
1285
|
|
|
1286
|
+
/**
|
|
1287
|
+
* @internal
|
|
1288
|
+
*/
|
|
1289
|
+
const viewElementRegistryKey = 'ViewElementRegistry';
|
|
1290
|
+
/**
|
|
1291
|
+
* @internal
|
|
1292
|
+
*/
|
|
1293
|
+
class ViewElementRegistry extends BaseViewElementRegistry {
|
|
1294
|
+
static { this.registryKey = viewElementRegistryKey; }
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* @internal
|
|
1299
|
+
*/
|
|
1300
|
+
const mobileViewElementRegistryKey = 'MobileViewElementRegistry';
|
|
1301
|
+
/**
|
|
1302
|
+
* @internal
|
|
1303
|
+
* @hostPublicApi available through window.creatio.registry.MobileViewElementRegistry
|
|
1304
|
+
*/
|
|
1305
|
+
class MobileViewElementRegistry extends BaseViewElementRegistry {
|
|
1306
|
+
static { this.registryKey = mobileViewElementRegistryKey; }
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1263
1309
|
/**
|
|
1264
1310
|
* @internal
|
|
1265
1311
|
*/
|
|
@@ -1268,22 +1314,58 @@ const interfaceDesignerItemRegistryKey = 'InterfaceDesignerItemRegistry';
|
|
|
1268
1314
|
* @internal
|
|
1269
1315
|
* @hostPublicApi available through window.creatio.registry.InterfaceDesignerItemRegistry
|
|
1270
1316
|
*/
|
|
1271
|
-
class
|
|
1272
|
-
static
|
|
1317
|
+
class BaseInterfaceDesignerItemRegistry extends ɵBaseRegistry {
|
|
1318
|
+
static get _interfaceDesignerItemRegistrationInfos() {
|
|
1319
|
+
return this.store.typeInfos;
|
|
1320
|
+
}
|
|
1273
1321
|
static validate(config) {
|
|
1274
1322
|
checkTypeNameFormat(config.type, 'InterfaceDesignerItemTypeName');
|
|
1275
1323
|
checkCrtTypeNamePascalCase(config.type);
|
|
1276
|
-
checkOnlyOneRegistration(config.type, config, this.
|
|
1324
|
+
checkOnlyOneRegistration(config.type, config, this._interfaceDesignerItemRegistrationInfos);
|
|
1277
1325
|
}
|
|
1278
|
-
static register(config) {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1326
|
+
static register(typeOrConfig, config) {
|
|
1327
|
+
if (typeof typeOrConfig === 'string' && config) {
|
|
1328
|
+
this._interfaceDesignerItemRegistrationInfos.set(typeOrConfig, config);
|
|
1329
|
+
}
|
|
1330
|
+
else if (typeof typeOrConfig !== 'string') {
|
|
1331
|
+
this._interfaceDesignerItemRegistrationInfos.set(typeOrConfig.type, typeOrConfig);
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
throw new Error('Invalid arguments provided to register method.');
|
|
1335
|
+
}
|
|
1283
1336
|
}
|
|
1284
1337
|
static get(type) {
|
|
1285
|
-
return this.
|
|
1338
|
+
return this._interfaceDesignerItemRegistrationInfos.get(type);
|
|
1339
|
+
}
|
|
1340
|
+
static has(type) {
|
|
1341
|
+
return this._interfaceDesignerItemRegistrationInfos.has(type);
|
|
1342
|
+
}
|
|
1343
|
+
static getAll() {
|
|
1344
|
+
return this._interfaceDesignerItemRegistrationInfos;
|
|
1286
1345
|
}
|
|
1346
|
+
static values() {
|
|
1347
|
+
return [...this._interfaceDesignerItemRegistrationInfos.values()];
|
|
1348
|
+
}
|
|
1349
|
+
static clear() {
|
|
1350
|
+
this._interfaceDesignerItemRegistrationInfos.clear();
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* @internal
|
|
1355
|
+
*/
|
|
1356
|
+
class InterfaceDesignerItemRegistry extends BaseInterfaceDesignerItemRegistry {
|
|
1357
|
+
static { this.registryKey = interfaceDesignerItemRegistryKey; }
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* @internal
|
|
1362
|
+
*/
|
|
1363
|
+
const mobileInterfaceDesignerItemRegistryKey = 'MobileInterfaceDesignerItemRegistry';
|
|
1364
|
+
/**
|
|
1365
|
+
* @internal
|
|
1366
|
+
*/
|
|
1367
|
+
class MobileInterfaceDesignerItemRegistry extends BaseInterfaceDesignerItemRegistry {
|
|
1368
|
+
static { this.registryKey = mobileInterfaceDesignerItemRegistryKey; }
|
|
1287
1369
|
}
|
|
1288
1370
|
|
|
1289
1371
|
const global = window;
|
|
@@ -1348,6 +1430,9 @@ const designTimeViewElementRegistryKey = 'DesignTimeViewElementRegistry';
|
|
|
1348
1430
|
*/
|
|
1349
1431
|
class DesignTimeViewElementRegistry extends ɵBaseRegistry {
|
|
1350
1432
|
static { this.registryKey = designTimeViewElementRegistryKey; }
|
|
1433
|
+
static get infos() {
|
|
1434
|
+
return this.store.typeInfos;
|
|
1435
|
+
}
|
|
1351
1436
|
static validate(config) {
|
|
1352
1437
|
checkTypeNameFormat(config.type, 'DesignTimeViewElementRegistryItemTypeName');
|
|
1353
1438
|
checkCrtTypeNamePascalCase(config.type);
|
|
@@ -1363,9 +1448,6 @@ class DesignTimeViewElementRegistry extends ɵBaseRegistry {
|
|
|
1363
1448
|
}
|
|
1364
1449
|
return null;
|
|
1365
1450
|
}
|
|
1366
|
-
static get infos() {
|
|
1367
|
-
return this.store.typeInfos;
|
|
1368
|
-
}
|
|
1369
1451
|
}
|
|
1370
1452
|
|
|
1371
1453
|
/**
|
|
@@ -1520,17 +1602,6 @@ function objectDeepKeys(obj) {
|
|
|
1520
1602
|
.reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
|
|
1521
1603
|
}
|
|
1522
1604
|
|
|
1523
|
-
/**
|
|
1524
|
-
* @internal
|
|
1525
|
-
*/
|
|
1526
|
-
function isComponentPropertyBindable(viewConfigType, componentProperty) {
|
|
1527
|
-
const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
|
|
1528
|
-
if (!componentConfig?.inputs) {
|
|
1529
|
-
return false;
|
|
1530
|
-
}
|
|
1531
|
-
return !!componentConfig?.inputs[componentProperty]?.propertyBindable;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
1605
|
/**
|
|
1535
1606
|
* @internal
|
|
1536
1607
|
*/
|
|
@@ -1749,7 +1820,7 @@ function checkRemoteName(remoteName) {
|
|
|
1749
1820
|
}
|
|
1750
1821
|
}
|
|
1751
1822
|
function skipLazyModuleIfItemIsNonLazy(options) {
|
|
1752
|
-
return !options?.featureValues?.LoadLazyModuleEvenIfItemIsNonLazy;
|
|
1823
|
+
return !options?.featureValues?.['LoadLazyModuleEvenIfItemIsNonLazy'];
|
|
1753
1824
|
}
|
|
1754
1825
|
function isItemRegisteredByNonLazyModule(item) {
|
|
1755
1826
|
return Boolean(item && !item.lazy && item.typeRef);
|
|
@@ -1770,28 +1841,28 @@ function resistantForEach(items, callback) {
|
|
|
1770
1841
|
/**
|
|
1771
1842
|
* @internal
|
|
1772
1843
|
*/
|
|
1773
|
-
function registerViewElements(types
|
|
1844
|
+
function registerViewElements(types) {
|
|
1774
1845
|
resistantForEach(types, (type) => {
|
|
1775
1846
|
const registrationConfig = getViewElementMetadata(type);
|
|
1776
|
-
if (
|
|
1777
|
-
registrationConfig
|
|
1778
|
-
registrationConfig
|
|
1847
|
+
if (registrationConfig) {
|
|
1848
|
+
ViewElementRegistry.validate(registrationConfig);
|
|
1849
|
+
ViewElementRegistry.register(registrationConfig);
|
|
1850
|
+
}
|
|
1851
|
+
const mobileRegistrationConfig = getMobileViewElementMetadata(type);
|
|
1852
|
+
if (mobileRegistrationConfig) {
|
|
1853
|
+
MobileViewElementRegistry.validate(mobileRegistrationConfig);
|
|
1854
|
+
MobileViewElementRegistry.register(mobileRegistrationConfig);
|
|
1855
|
+
}
|
|
1856
|
+
if (!registrationConfig && !mobileRegistrationConfig) {
|
|
1857
|
+
throw new Error(`View element metadata was not found on '${type.name}' class`);
|
|
1779
1858
|
}
|
|
1780
|
-
ViewElementRegistry.validate(registrationConfig);
|
|
1781
|
-
ViewElementRegistry.register(registrationConfig);
|
|
1782
1859
|
});
|
|
1783
1860
|
}
|
|
1784
1861
|
/**
|
|
1785
1862
|
* @internal
|
|
1786
1863
|
*/
|
|
1787
|
-
function registerLazyViewElements(configs,
|
|
1864
|
+
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
1788
1865
|
resistantForEach(configs, (config) => {
|
|
1789
|
-
if (skipLazyModuleIfItemIsNonLazy(options)) {
|
|
1790
|
-
const existingRegistryItem = ViewElementRegistry.viewElements.get(config.type);
|
|
1791
|
-
if (isItemRegisteredByNonLazyModule(existingRegistryItem)) {
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
1866
|
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1796
1867
|
ViewElementRegistry.validate(registryItem);
|
|
1797
1868
|
ViewElementRegistry.register(registryItem);
|
|
@@ -1802,15 +1873,22 @@ function registerLazyViewElements(configs, options, lazyModuleRef) {
|
|
|
1802
1873
|
*/
|
|
1803
1874
|
function registerInterfaceDesignerItems(types, localizeFn) {
|
|
1804
1875
|
resistantForEach(types, (type) => {
|
|
1805
|
-
if (
|
|
1806
|
-
|
|
1876
|
+
if (hasInterfaceDesignerItemMetadata(type)) {
|
|
1877
|
+
let config = getInterfaceDesignerItemMetadata(type);
|
|
1878
|
+
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
1879
|
+
const viewElementMetadata = getViewElementMetadata(type);
|
|
1880
|
+
config.type = viewElementMetadata.type;
|
|
1881
|
+
InterfaceDesignerItemRegistry.validate(config);
|
|
1882
|
+
InterfaceDesignerItemRegistry.register(config);
|
|
1883
|
+
}
|
|
1884
|
+
if (hasMobileInterfaceDesignerItemMetadata(type)) {
|
|
1885
|
+
let config = getMobileInterfaceDesignerItemMetadata(type);
|
|
1886
|
+
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
1887
|
+
const viewElementMetadata = getMobileViewElementMetadata(type);
|
|
1888
|
+
config.type = viewElementMetadata.type;
|
|
1889
|
+
MobileInterfaceDesignerItemRegistry.validate(config);
|
|
1890
|
+
MobileInterfaceDesignerItemRegistry.register(config);
|
|
1807
1891
|
}
|
|
1808
|
-
let config = getInterfaceDesignerItemMetadata(type);
|
|
1809
|
-
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
1810
|
-
const viewElementMetadata = getViewElementMetadata(type);
|
|
1811
|
-
config.type = viewElementMetadata.type;
|
|
1812
|
-
InterfaceDesignerItemRegistry.validate(config);
|
|
1813
|
-
InterfaceDesignerItemRegistry.register(config);
|
|
1814
1892
|
});
|
|
1815
1893
|
}
|
|
1816
1894
|
/**
|
|
@@ -1976,7 +2054,7 @@ function registerLazyRequestHandlers(descriptors, options, remoteName, lazyModul
|
|
|
1976
2054
|
function bootstrapLazyCrtModule(name, descriptor, options, lazyModuleRef) {
|
|
1977
2055
|
try {
|
|
1978
2056
|
if (descriptor.viewElements) {
|
|
1979
|
-
registerLazyViewElements(descriptor.viewElements,
|
|
2057
|
+
registerLazyViewElements(descriptor.viewElements, lazyModuleRef);
|
|
1980
2058
|
}
|
|
1981
2059
|
if (descriptor.requestHandlers) {
|
|
1982
2060
|
registerLazyRequestHandlers(descriptor.requestHandlers, options, name, lazyModuleRef);
|
|
@@ -2007,7 +2085,7 @@ function bootstrapDefaultCrtModule(name, type, options, root) {
|
|
|
2007
2085
|
try {
|
|
2008
2086
|
const moduleDefinition = getModuleMetadata(type);
|
|
2009
2087
|
if (moduleDefinition.viewElements) {
|
|
2010
|
-
registerViewElements(moduleDefinition.viewElements
|
|
2088
|
+
registerViewElements(moduleDefinition.viewElements);
|
|
2011
2089
|
registerInterfaceDesignerItems(moduleDefinition.viewElements, options?.localizeMetadata);
|
|
2012
2090
|
}
|
|
2013
2091
|
if (moduleDefinition.designTimeViewElements) {
|
|
@@ -2295,8 +2373,7 @@ function CrtValidationInput() {
|
|
|
2295
2373
|
/**
|
|
2296
2374
|
* @internal
|
|
2297
2375
|
*/
|
|
2298
|
-
|
|
2299
|
-
function CrtViewElement(config) {
|
|
2376
|
+
function viewElementRegister(config, platform) {
|
|
2300
2377
|
return function (type) {
|
|
2301
2378
|
checkTypeNamePascalCase(config.type);
|
|
2302
2379
|
const inputs = getCrtInputsMetadata(type);
|
|
@@ -2313,10 +2390,32 @@ function CrtViewElement(config) {
|
|
|
2313
2390
|
: { ...baseRegistrationConfig, typeRef: type };
|
|
2314
2391
|
registrationConfig.reuseStrategy = config?.reuseStrategy ?? ViewElementReuseStrategy.Rerender;
|
|
2315
2392
|
defineRenderConfig(registrationConfig);
|
|
2316
|
-
|
|
2393
|
+
if (platform === 'web') {
|
|
2394
|
+
setViewElementMetadata(registrationConfig, type);
|
|
2395
|
+
}
|
|
2396
|
+
else {
|
|
2397
|
+
setMobileViewElementMetadata(registrationConfig, type);
|
|
2398
|
+
}
|
|
2317
2399
|
};
|
|
2318
2400
|
}
|
|
2319
2401
|
|
|
2402
|
+
/**
|
|
2403
|
+
* @internal
|
|
2404
|
+
*/
|
|
2405
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2406
|
+
function CrtMobileViewElement(config) {
|
|
2407
|
+
return viewElementRegister(config, 'mobile');
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* @internal
|
|
2412
|
+
*/
|
|
2413
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2414
|
+
function CrtViewElement(config) {
|
|
2415
|
+
// Register the view element with the 'web' platform type
|
|
2416
|
+
return viewElementRegister(config, 'web');
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2320
2419
|
/**
|
|
2321
2420
|
* @internal
|
|
2322
2421
|
*/
|
|
@@ -2327,8 +2426,7 @@ function CrtModule(moduleDefinition) {
|
|
|
2327
2426
|
/**
|
|
2328
2427
|
* @internal
|
|
2329
2428
|
*/
|
|
2330
|
-
|
|
2331
|
-
function CrtInterfaceDesignerItem(config) {
|
|
2429
|
+
function interfaceDesignerItemRegister(config, platform) {
|
|
2332
2430
|
function _applyTypeCaption() {
|
|
2333
2431
|
if (!config.typeCaption && config.toolbarConfig) {
|
|
2334
2432
|
const toolbarConfig = Array.isArray(config.toolbarConfig)
|
|
@@ -2342,10 +2440,33 @@ function CrtInterfaceDesignerItem(config) {
|
|
|
2342
2440
|
config.viewElementGroupType ??= ViewElementGroupType.CustomElements;
|
|
2343
2441
|
_applyTypeCaption();
|
|
2344
2442
|
defineRenderConfig(config);
|
|
2345
|
-
|
|
2443
|
+
if (platform === 'mobile') {
|
|
2444
|
+
setMobileInterfaceDesignerItemMetadata(config, type);
|
|
2445
|
+
}
|
|
2446
|
+
else {
|
|
2447
|
+
setInterfaceDesignerItemMetadata(config, type);
|
|
2448
|
+
}
|
|
2346
2449
|
};
|
|
2347
2450
|
}
|
|
2348
2451
|
|
|
2452
|
+
// noinspection ES6PreferShortImport
|
|
2453
|
+
/**
|
|
2454
|
+
* @internal
|
|
2455
|
+
*/
|
|
2456
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2457
|
+
function CrtInterfaceDesignerItem(config) {
|
|
2458
|
+
return interfaceDesignerItemRegister(config, 'web');
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
// noinspection ES6PreferShortImport
|
|
2462
|
+
/**
|
|
2463
|
+
* @internal
|
|
2464
|
+
*/
|
|
2465
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2466
|
+
function CrtMobileInterfaceDesignerItem(config) {
|
|
2467
|
+
return interfaceDesignerItemRegister(config, 'mobile');
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2349
2470
|
/**
|
|
2350
2471
|
* @public
|
|
2351
2472
|
* @description
|
|
@@ -2854,7 +2975,15 @@ class Model extends BaseHandlerChainService {
|
|
|
2854
2975
|
insert(dto) {
|
|
2855
2976
|
return this._crtModel._getAsyncResult(this._crtModel.insert(dto));
|
|
2856
2977
|
}
|
|
2857
|
-
update(dto, parameters) {
|
|
2978
|
+
async update(dto, parameters) {
|
|
2979
|
+
const changedAttributes = Object.keys(dto);
|
|
2980
|
+
if (changedAttributes.length) {
|
|
2981
|
+
const schema = await this.getSchema();
|
|
2982
|
+
const primaryAttributeName = schema.primaryAttributeName;
|
|
2983
|
+
changedAttributes
|
|
2984
|
+
.filter((attribute) => attribute !== primaryAttributeName)
|
|
2985
|
+
.forEach((attribute) => this._crtModel.attributeChanged(attribute));
|
|
2986
|
+
}
|
|
2858
2987
|
return this._crtModel._getAsyncResult(this._crtModel.update(dto, parameters));
|
|
2859
2988
|
}
|
|
2860
2989
|
copy(primaryColumnValue, data = {}) {
|
|
@@ -2872,6 +3001,15 @@ class Model extends BaseHandlerChainService {
|
|
|
2872
3001
|
canDelete(params) {
|
|
2873
3002
|
return this._crtModel._getAsyncResult(this._crtModel.canDelete(params));
|
|
2874
3003
|
}
|
|
3004
|
+
insertInTransaction(transaction, dto) {
|
|
3005
|
+
return this._crtModel.insertInTransaction(transaction, dto);
|
|
3006
|
+
}
|
|
3007
|
+
updateInTransaction(transaction, dto, parameters) {
|
|
3008
|
+
return this._crtModel.updateInTransaction(transaction, dto, parameters);
|
|
3009
|
+
}
|
|
3010
|
+
deleteInTransaction(transaction, parameters) {
|
|
3011
|
+
return this._crtModel.deleteInTransaction(transaction, parameters);
|
|
3012
|
+
}
|
|
2875
3013
|
}
|
|
2876
3014
|
__decorate([
|
|
2877
3015
|
ImplementUsingHandlerChain({
|
|
@@ -2968,9 +3106,132 @@ __decorate([
|
|
|
2968
3106
|
__metadata("design:type", Function)
|
|
2969
3107
|
], ProcessEngineService.prototype, "completeExecuting", void 0);
|
|
2970
3108
|
|
|
3109
|
+
/**
|
|
3110
|
+
* Service for managing AI context parts and providing a unified context.
|
|
3111
|
+
* This service allows adding, retrieving, and removing context parts, which can be
|
|
3112
|
+
* either static values, promises, or dynamically provided through a function.
|
|
3113
|
+
*/
|
|
3114
|
+
class AiContextService {
|
|
3115
|
+
constructor() {
|
|
3116
|
+
this._contextParts = [];
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* Retrieves the singleton instance of the `AiContextService`.
|
|
3120
|
+
* If the instance does not exist, it will be created.
|
|
3121
|
+
*/
|
|
3122
|
+
static get instance() {
|
|
3123
|
+
return AiContextService._instance || (AiContextService._instance = new AiContextService());
|
|
3124
|
+
}
|
|
3125
|
+
/**
|
|
3126
|
+
* Generates a unique identifier for a context part.
|
|
3127
|
+
* @returns A string representing a unique identifier.
|
|
3128
|
+
*/
|
|
3129
|
+
_generateId() {
|
|
3130
|
+
const length = 9;
|
|
3131
|
+
const base = 36;
|
|
3132
|
+
const array = new Uint32Array(length);
|
|
3133
|
+
window.crypto.getRandomValues(array);
|
|
3134
|
+
return Array.from(array, (num) => (num % base).toString(base)).join('');
|
|
3135
|
+
}
|
|
3136
|
+
/**
|
|
3137
|
+
* @public
|
|
3138
|
+
* Adds a new context part to the service.
|
|
3139
|
+
* The context part can be a static value, a promise, or a function that provides the value.
|
|
3140
|
+
*
|
|
3141
|
+
* @param value - The context part to add. It can be one of the following:
|
|
3142
|
+
* - `ContextProvider` (a function that provides the context part)
|
|
3143
|
+
* @param id - (Optional) A unique identifier for the context part. If not provided, a new ID will be generated.
|
|
3144
|
+
* @returns The unique identifier of the added context part.
|
|
3145
|
+
*/
|
|
3146
|
+
setContextPart(value, id = this._generateId()) {
|
|
3147
|
+
const provider = typeof value === 'function' ? value : () => value;
|
|
3148
|
+
this._contextParts.push({ id, provider });
|
|
3149
|
+
return id;
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* @public
|
|
3153
|
+
* Retrieves all context parts as an array of resolved values.
|
|
3154
|
+
* If the context parts include promises or functions, they will be resolved.
|
|
3155
|
+
*
|
|
3156
|
+
* @returns A promise that resolves to an array of context parts, which can be
|
|
3157
|
+
* either `CreatioPageContextPart` or `ConstantValuesContextPart`.
|
|
3158
|
+
*/
|
|
3159
|
+
async getContext() {
|
|
3160
|
+
if (!this._contextParts || this._contextParts.length === 0) {
|
|
3161
|
+
return [];
|
|
3162
|
+
}
|
|
3163
|
+
const resolved = await Promise.all(this._contextParts.map((c) => c.provider()));
|
|
3164
|
+
return resolved
|
|
3165
|
+
.filter((e) => e !== null)
|
|
3166
|
+
.map((p) => {
|
|
3167
|
+
const type = p.type;
|
|
3168
|
+
if (!type || type === 'CreatioPageContextPart' || type === 'ConstantValuesContextPart') {
|
|
3169
|
+
return {
|
|
3170
|
+
...p,
|
|
3171
|
+
type,
|
|
3172
|
+
};
|
|
3173
|
+
}
|
|
3174
|
+
throw new Error(`Invalid context part type: ${type}`);
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* @public
|
|
3179
|
+
* Removes a specific context part by its unique identifier.
|
|
3180
|
+
*
|
|
3181
|
+
* @param id - The unique identifier of the context part to remove.
|
|
3182
|
+
*/
|
|
3183
|
+
removeContextPart(id) {
|
|
3184
|
+
this._contextParts = this._contextParts.filter((ctx) => ctx.id !== id);
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* @public
|
|
3188
|
+
* Removes all context parts from the service.
|
|
3189
|
+
*/
|
|
3190
|
+
removeContext() {
|
|
3191
|
+
this._contextParts = [];
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
/**
|
|
3196
|
+
* @public
|
|
3197
|
+
* @class TransactionFactoryService
|
|
3198
|
+
* @classdesc Service to working with transaction factory using a handler chain
|
|
3199
|
+
* @extends {BaseHandlerChainService}
|
|
3200
|
+
*/
|
|
3201
|
+
class TransactionFactoryService extends BaseHandlerChainService {
|
|
3202
|
+
/**
|
|
3203
|
+
* @internal
|
|
3204
|
+
*/
|
|
3205
|
+
constructor() {
|
|
3206
|
+
super();
|
|
3207
|
+
/**
|
|
3208
|
+
* @internal
|
|
3209
|
+
*/
|
|
3210
|
+
this.requestType = 'crt.TransactionFactoryService';
|
|
3211
|
+
}
|
|
3212
|
+
/**
|
|
3213
|
+
* @internal
|
|
3214
|
+
*/
|
|
3215
|
+
static get instance() {
|
|
3216
|
+
if (!this._instance) {
|
|
3217
|
+
this._instance = new TransactionFactoryService();
|
|
3218
|
+
}
|
|
3219
|
+
return this._instance;
|
|
3220
|
+
}
|
|
3221
|
+
static create() {
|
|
3222
|
+
return this.instance.create();
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
__decorate([
|
|
3226
|
+
ImplementUsingHandlerChain({
|
|
3227
|
+
methodName: 'create',
|
|
3228
|
+
}),
|
|
3229
|
+
__metadata("design:type", Function)
|
|
3230
|
+
], TransactionFactoryService.prototype, "create", void 0);
|
|
3231
|
+
|
|
2971
3232
|
/**
|
|
2972
3233
|
* Generated bundle index. Do not edit.
|
|
2973
3234
|
*/
|
|
2974
3235
|
|
|
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,
|
|
3236
|
+
export { AiContextService, BaseInterfaceDesignerItemRegistry, BaseRequestHandler, BaseValidator, BaseViewElementRegistry, BootstrapNotifier, ChatMessageTypeRegistry, ConverterRegistry, CrtChatMessageType, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtMobileInterfaceDesignerItem, CrtMobileViewElement, 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, MobileInterfaceDesignerItemRegistry, MobileViewElementRegistry, Model, PkgTopology, ProcessEngineService, ProcessStatus, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, RunProcessRequest, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, TransactionFactoryService, 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, getMobileInterfaceDesignerItemMetadata, getMobileViewElementMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, hasMobileInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegister, interfaceDesignerItemRegistryKey, localize, matchScopes, mobileInterfaceDesignerItemRegistryKey, mobileViewElementRegistryKey, objectDeepKeys, registerAngularViewElement, registerViewElement, registryKey, resetGlobals, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setMobileInterfaceDesignerItemMetadata, setMobileViewElementMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegister, viewElementRegistryKey, ɵBaseRegistry, ɵcheckTypeNameFormat, ɵinstantiate };
|
|
2976
3237
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|