@adaas/a-concept 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/global/A-Feature/A-Feature.types.ts +1 -1
- package/src/global/A-Scope/A-Scope.class.ts +128 -0
- package/src/global/A-Scope/A-Scope.error.ts +1 -0
- package/src/helpers/A_TypeGuards.helper.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -232,7 +232,7 @@ export type A_TYPES__FeatureExtendDecoratorDescriptor =
|
|
|
232
232
|
*
|
|
233
233
|
* [!] Can be applied only on A-Components
|
|
234
234
|
*/
|
|
235
|
-
export type A_TYPES__FeatureExtendDecoratorTarget = A_Component
|
|
235
|
+
export type A_TYPES__FeatureExtendDecoratorTarget = A_Component | A_Container | A_Entity
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
238
|
* Configuration type for A_Extend decorator
|
|
@@ -1241,7 +1241,135 @@ export class A_Scope<
|
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
|
|
1244
|
+
/**
|
|
1245
|
+
* This method is used to deregister the component from the scope
|
|
1246
|
+
*
|
|
1247
|
+
* @param fragment
|
|
1248
|
+
*/
|
|
1249
|
+
deregister<T extends A_Component>(
|
|
1250
|
+
/**
|
|
1251
|
+
* Provide a component constructor to deregister it in the scope
|
|
1252
|
+
*/
|
|
1253
|
+
component: A_TYPES__Component_Constructor<T>
|
|
1254
|
+
): void
|
|
1255
|
+
deregister(
|
|
1256
|
+
/**
|
|
1257
|
+
* Provide a command instance to deregister it in the scope
|
|
1258
|
+
*/
|
|
1259
|
+
component: A_Component
|
|
1260
|
+
): void
|
|
1261
|
+
deregister<T extends A_Error>(
|
|
1262
|
+
/**
|
|
1263
|
+
* Provide an error constructor to deregister it in the scope
|
|
1264
|
+
*/
|
|
1265
|
+
error: A_TYPES__Error_Constructor<T>
|
|
1266
|
+
): void
|
|
1267
|
+
deregister(
|
|
1268
|
+
/**
|
|
1269
|
+
* Provide an error instance to deregister it in the scope
|
|
1270
|
+
*/
|
|
1271
|
+
error: A_Error
|
|
1272
|
+
): void
|
|
1273
|
+
deregister<T extends A_Fragment>(
|
|
1274
|
+
/**
|
|
1275
|
+
* Provide a command instance to deregister it in the scope
|
|
1276
|
+
*/
|
|
1277
|
+
fragment: A_TYPES__Fragment_Constructor<T>
|
|
1278
|
+
): void
|
|
1279
|
+
deregister(
|
|
1280
|
+
/**
|
|
1281
|
+
* Provide a fragment instance to deregister it in the scope
|
|
1282
|
+
*/
|
|
1283
|
+
fragment: A_Fragment
|
|
1284
|
+
): void
|
|
1285
|
+
deregister<T extends A_Entity>(
|
|
1286
|
+
/**
|
|
1287
|
+
* Provide an entity constructor to deregister it in the scope
|
|
1288
|
+
*/
|
|
1289
|
+
entity: A_TYPES__Entity_Constructor<T>
|
|
1290
|
+
): void
|
|
1291
|
+
deregister(
|
|
1292
|
+
/**
|
|
1293
|
+
* Provide an entity instance to deregister it in the scope
|
|
1294
|
+
*/
|
|
1295
|
+
entity: A_Entity
|
|
1296
|
+
): void
|
|
1297
|
+
|
|
1298
|
+
deregister(
|
|
1299
|
+
param1: unknown
|
|
1300
|
+
): void {
|
|
1301
|
+
switch (true) {
|
|
1302
|
+
// ------------------------------------------
|
|
1303
|
+
// ------------ Instances ----------------
|
|
1304
|
+
// ------------------------------------------
|
|
1305
|
+
// 1) In case when it's a A-Component instance
|
|
1306
|
+
case param1 instanceof A_Component: {
|
|
1307
|
+
|
|
1308
|
+
this._components.delete(param1.constructor as _ComponentType[number]);
|
|
1309
|
+
A_Context.deregister(param1);
|
|
1310
|
+
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
// 3) In case when it's a A-Entity instance
|
|
1314
|
+
case A_TypeGuards.isEntityInstance(param1): {
|
|
1315
|
+
|
|
1316
|
+
this._entities.delete(param1.aseid.toString());
|
|
1317
|
+
A_Context.deregister(param1);
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
// 4) In case when it's a A-Fragment instance
|
|
1321
|
+
case A_TypeGuards.isFragmentInstance(param1): {
|
|
1322
|
+
|
|
1323
|
+
this._fragments.delete(param1.constructor as A_TYPES__Fragment_Constructor<_FragmentType[number]>);
|
|
1324
|
+
A_Context.deregister(param1);
|
|
1325
|
+
|
|
1326
|
+
break;
|
|
1327
|
+
}
|
|
1328
|
+
// 5) In case when it's a A-Error instance
|
|
1329
|
+
case A_TypeGuards.isErrorInstance(param1): {
|
|
1330
|
+
|
|
1331
|
+
this._errors.delete(param1.code);
|
|
1332
|
+
A_Context.deregister(param1);
|
|
1333
|
+
break;
|
|
1334
|
+
}
|
|
1244
1335
|
|
|
1336
|
+
// ------------------------------------------
|
|
1337
|
+
// ------------ Constructors ----------------
|
|
1338
|
+
// ------------------------------------------
|
|
1339
|
+
// 6) In case when it's a A-Component constructor
|
|
1340
|
+
case A_TypeGuards.isComponentConstructor(param1): {
|
|
1341
|
+
this.allowedComponents.delete(param1 as _ComponentType[number]);
|
|
1342
|
+
break;
|
|
1343
|
+
}
|
|
1344
|
+
// 8) In case when it's a A-Fragment constructor
|
|
1345
|
+
case A_TypeGuards.isFragmentConstructor(param1): {
|
|
1346
|
+
this.allowedFragments.delete(param1 as A_TYPES__Fragment_Constructor<_FragmentType[number]>);
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1349
|
+
// 9) In case when it's a A-Entity constructor
|
|
1350
|
+
case A_TypeGuards.isEntityConstructor(param1): {
|
|
1351
|
+
this.allowedEntities.delete(param1 as _EntityType[number]);
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
1354
|
+
// 10) In case when it's a A-Error constructor
|
|
1355
|
+
case A_TypeGuards.isErrorConstructor(param1): {
|
|
1356
|
+
this.allowedErrors.delete(param1 as _ErrorType[number]);
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// ------------------------------------------
|
|
1361
|
+
// ------------ Invalid Cases ----------------
|
|
1362
|
+
// ------------------------------------------
|
|
1363
|
+
|
|
1364
|
+
default:
|
|
1365
|
+
const componentName = A_CommonHelper.getComponentName(param1);
|
|
1366
|
+
|
|
1367
|
+
throw new A_ScopeError(
|
|
1368
|
+
A_ScopeError.DeregistrationError,
|
|
1369
|
+
`Cannot deregister ${componentName} from the scope ${this.name}`
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1245
1373
|
|
|
1246
1374
|
/**
|
|
1247
1375
|
* This method is useful when you want to serialize the scope to JSON
|
|
@@ -307,7 +307,9 @@ export class A_TypeGuards {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
static isAllowedForFeatureExtension(param: any): param is A_TYPES__FeatureExtendDecoratorTarget {
|
|
310
|
-
return A_TypeGuards.isComponentInstance(param)
|
|
310
|
+
return A_TypeGuards.isComponentInstance(param)
|
|
311
|
+
|| A_TypeGuards.isContainerInstance(param)
|
|
312
|
+
|| A_TypeGuards.isEntityInstance(param);
|
|
311
313
|
}
|
|
312
314
|
|
|
313
315
|
static isAllowedForAbstractionDefinition(param: any): param is A_TYPES__AbstractionAvailableComponents {
|