@onzag/itemize / Modules / base/Root/Module/ItemDefinition/Include / default
base/Root/Module/ItemDefinition/Include.default
This class provides the utilities for the description of an item it's one of the most important classes that defines how an item is added based on an existant item defintion
An item is described mainly by its name and such name must be a valid import for the item definition that its parent holds, for example lets say we have an item definition for Car which has wheels in it
{ "name": "wheels", "enforcedProperties": { "mainAmount": 4 }, "predefinedProperties": { "spares": 1 }, "excludedIf": { "property": "hover-car", "comparator": "equals", "value": true }, "sinkIn": [ "material" ] },
An item might also be a group of items with a gate
- canUserExcludeIf
- defaultExcludedIf
- enforcedProperties
- excludedIf
- itemDefinition
- parentItemDefinition
- parentModule
- predefinedProperties
- rawData
- stateExclusion
- stateExclusionApplied
- stateExclusionHasBeenManuallySet
- stateExclusionModified
- applySoftReadRoleAccessTo
- applyValue
- buildFieldsForRoleAccess
- canExclusionBeSet
- checkRoleAccessFor
- cleanState
- cleanValueFor
- containsAnExternallyCheckedProperty
- getAppliedExclusionState
- getExclusionState
- getI18nDataFor
- getI18nNameFor
- getId
- getItemDefinition
- getItemDefinitionName
- getPrefixedQualifiedIdentifier
- getQualifiedExclusionStateIdentifier
- getQualifiedIdentifier
- getSinkingProperties
- getSinkingPropertiesIds
- getSinkingPropertyFor
- getState
- getStateNoExternalChecking
- isExclusionCallout
- isExclusionTernary
- mergeWithI18n
- restoreValueFor
- setExclusionState
- toJSON
• new default(rawJSON, parentModule, parentItemDefinition): default
The constructor for an Include
| Name | Type | Description |
|---|---|---|
rawJSON |
IIncludeRawJSONDataType |
the raw data as JSON |
parentModule |
default |
the parent module |
parentItemDefinition |
default |
the item definition that this node is located, for example if this include is for a car wheel, and is included in vehicle, this parentItemDefinition would be the vehicle definition |
base/Root/Module/ItemDefinition/Include/index.ts:210
• Private Optional canUserExcludeIf: default
The allowance of exclusion (compiled)
base/Root/Module/ItemDefinition/Include/index.ts:159
• Private Optional defaultExcludedIf: default
The default exclusion state rule (compiled)
base/Root/Module/ItemDefinition/Include/index.ts:163
• Private Optional enforcedProperties: default
Enforced properties (compiled)
base/Root/Module/ItemDefinition/Include/index.ts:168
• Private Optional excludedIf: default
The excluded if rules (compiled)
base/Root/Module/ItemDefinition/Include/index.ts:155
• Private itemDefinition: default
The item definition the include refers to
base/Root/Module/ItemDefinition/Include/index.ts:151
• parentItemDefinition: default
The parent item definition of this include
base/Root/Module/ItemDefinition/Include/index.ts:142
• parentModule: default
The parent module where this include sits
base/Root/Module/ItemDefinition/Include/index.ts:146
• Private Optional predefinedProperties: default
Predefined properties (compiled)
base/Root/Module/ItemDefinition/Include/index.ts:172
• rawData: IIncludeRawJSONDataType
The raw data that comes from the compiled schema
base/Root/Module/ItemDefinition/Include/index.ts:138
• Private stateExclusion: Object
This is the state exclusion of the class, not the defaulted, not the enforced, but the stateful
▪ [mergedID: string]: IncludeExclusionState
base/Root/Module/ItemDefinition/Include/index.ts:178
• Private stateExclusionApplied: Object
The applied exclusion
▪ [mergedID: string]: IncludeExclusionState
base/Root/Module/ItemDefinition/Include/index.ts:191
• Private stateExclusionHasBeenManuallySet: Object
This also shows whether the state has been modified, either by the user or a value has been applied
▪ [mergedID: string]: boolean
base/Root/Module/ItemDefinition/Include/index.ts:198
• Private stateExclusionModified: Object
This also shows whether the state has been modified, either by the user or a value has been applied
▪ [mergedID: string]: boolean
base/Root/Module/ItemDefinition/Include/index.ts:185
▸ applySoftReadRoleAccessTo(role, userId, ownerUserId, rolesManager, value): Promise<void>
For a given requested rq value it will tell which fields need to be filtered for soft read role access
| Name | Type |
|---|---|
role |
string |
userId |
string |
ownerUserId |
string |
rolesManager |
ICustomRoleManager |
value |
IRQValue |
Promise<void>
base/Root/Module/ItemDefinition/Include/index.ts:340
▸ applyValue(id, version, value, exclusionState, doNotApplyValueInPropertyIfPropertyHasBeenManuallySet): void
Applies a value to an include
| Name | Type | Description |
|---|---|---|
id |
string |
the slot id to use |
version |
string |
the slot version to use |
value |
IRQValue |
the value that is applied |
exclusionState |
IncludeExclusionState |
the exclusion state |
doNotApplyValueInPropertyIfPropertyHasBeenManuallySet |
boolean |
to avoid hot updating values when the user is modifying them and an apply value has been called because it has been updated somewhere else, we use this to avoid overriding, note that the value must also not be equal, as in, it must differs; otherwise the value is applied, and manually set will go back to false as it's been used applyValue on it, it's been set now by the computer |
void
base/Root/Module/ItemDefinition/Include/index.ts:670
▸ buildFieldsForRoleAccess(action, role, userId, ownerUserId, rolesManager): Promise<IRQRequestFields>
Builds the fileds as rq fields for a given role that wants to execute a given action, that will be the maximum fields of the include this user can request
| Name | Type | Description |
|---|---|---|
action |
ItemDefinitionIOActions |
the action that is to be executed |
role |
string |
the role that is executing it |
userId |
string |
the user id of that user |
ownerUserId |
string |
the owner of the item definition where the include is localed |
rolesManager |
ICustomRoleManager |
- |
Promise<IRQRequestFields>
a rq fields object
base/Root/Module/ItemDefinition/Include/index.ts:400
▸ canExclusionBeSet(id, version): boolean
Tells whether the exclusion state can be toggled externally This is for when an item might be included like how a car might have a spare wheel or not usually the case is true but it might be false as well
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the given exclusion state slot id |
version |
string |
the version for the given exclusion state slot id |
boolean
a boolean that tells whether if it can be toggled
base/Root/Module/ItemDefinition/Include/index.ts:495
▸ checkRoleAccessFor(action, role, userId, ownerUserId, requestedFields, rolesManager, throwError): Promise<boolean>
Checks the role access for a given include to be accessed given a IO action
| Name | Type | Description |
|---|---|---|
action |
ItemDefinitionIOActions |
the action that wants to be executed |
role |
string |
the role of the user wanting to execute that action |
userId |
string |
the user id of the user wanting to execute (can be null) |
ownerUserId |
string |
the owner of the user wanting to execute (or UNSPECIFIED_OWNER) |
requestedFields |
IRQRequestFields |
the requested fields that are requested from the include these basically represent the sinking properties where the IO action is being applied |
rolesManager |
ICustomRoleManager |
- |
throwError |
boolean |
whether to throw an error in failure |
Promise<boolean>
a boolean on whether it has role access
base/Root/Module/ItemDefinition/Include/index.ts:371
▸ cleanState(init?): void
Cleans the state of the include so that is empty and clears the memory
| Name | Type | Description |
|---|---|---|
init? |
boolean |
whether it was called in the constructor for initialization |
void
base/Root/Module/ItemDefinition/Include/index.ts:267
▸ cleanValueFor(id, version): void
Memory cleans the value in an item
| Name | Type | Description |
|---|---|---|
id |
string |
the slot id |
version |
string |
the slot version |
void
base/Root/Module/ItemDefinition/Include/index.ts:719
▸ containsAnExternallyCheckedProperty(): boolean
Returns true if the item contains a property that needs to be extenrally checked, either an indexed one
boolean
a boolean on whether it contains such a property or not
base/Root/Module/ItemDefinition/Include/index.ts:794
▸ getAppliedExclusionState(id, version): IncludeExclusionState
Provides the applied value for a property
| Name | Type | Description |
|---|---|---|
id |
string |
the id |
version |
string |
the version |
the applied value
base/Root/Module/ItemDefinition/Include/index.ts:591
▸ getExclusionState(id, version): IncludeExclusionState
Tells whether the current item is excluded
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the given exclusion state slot id |
version |
string |
the version for the given exclusion state slot id |
a boolean whether it's excluded or not
base/Root/Module/ItemDefinition/Include/index.ts:444
▸ getI18nDataFor(locale): Object
Provides the item definition item locale data
| Name | Type | Description |
|---|---|---|
locale |
string |
the locale in iso form |
Object
an object or null (if locale not valid)
| Name | Type |
|---|---|
any_label? |
string |
callout_excluded_label? |
string |
excluded_label? |
string |
exclusion_selector_label? |
string |
exclusion_ternary_selector_label? |
string |
included_label? |
string |
name? |
string |
base/Root/Module/ItemDefinition/Include/index.ts:777
▸ getI18nNameFor(locale): string
Gives the i18 name that was specified or otherwise gives the item definition i18 name
| Name | Type | Description |
|---|---|---|
locale |
string |
the locale iso form |
string
a string or null (if locale not valid)
base/Root/Module/ItemDefinition/Include/index.ts:761
▸ getId(): string
Provides the unique id of this item definition the unique id is, well, unique for this item
string
the unique id of the include
base/Root/Module/ItemDefinition/Include/index.ts:555
▸ getItemDefinition(): default
Provides the item definition that this include refers to
the item definition
base/Root/Module/ItemDefinition/Include/index.ts:802
▸ getItemDefinitionName(): string
Provides the name for this item, the name represents the item definition children this item is attached to
string
a string with the item definition name
base/Root/Module/ItemDefinition/Include/index.ts:546
▸ getPrefixedQualifiedIdentifier(): string
Provides the qualified identifier for prefixing other things
string
a prefixed string that is the prefixed qualified identifier
base/Root/Module/ItemDefinition/Include/index.ts:573
▸ getQualifiedExclusionStateIdentifier(): string
Provides the qualfiied name for the exclusion state
string
the string that represents the exclusion identifier
base/Root/Module/ItemDefinition/Include/index.ts:581
▸ getQualifiedIdentifier(): string
Provides the qualified identifier of the include that is an INCLUDE prefixed with the identifier
string
a string that is the qualified identifier
base/Root/Module/ItemDefinition/Include/index.ts:564
▸ getSinkingProperties(): default[]
Provides all the sinking properties as property definition instances
default[]
all sinking properties as instances
base/Root/Module/ItemDefinition/Include/index.ts:325
▸ getSinkingPropertiesIds(): string[]
Provides the ids of the sinking properties
string[]
an array of the sinking properties ids
base/Root/Module/ItemDefinition/Include/index.ts:303
▸ getSinkingPropertyFor(id): default
Propvides a single sinking property for a given id
| Name | Type | Description |
|---|---|---|
id |
string |
the property id |
a single property, if available, otherwise throws an error
base/Root/Module/ItemDefinition/Include/index.ts:312
▸ getState(id, version, onlySinkingProperties): Promise<IIncludeState>
Provides the current value of this item
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the stored item definition or module |
version |
string |
the version |
onlySinkingProperties |
string[] |
- |
Promise<IIncludeState>
a promise for the state of the include
base/Root/Module/ItemDefinition/Include/index.ts:637
▸ getStateNoExternalChecking(id, version, onlySinkingProperties, emulateExternalChecking?): IIncludeState
Provides the current value of this item
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the stored item definition or module |
version |
string |
the slot version |
onlySinkingProperties |
string[] |
- |
emulateExternalChecking? |
boolean |
whether to emulate the external checking results using previous cached results |
the state of the include
base/Root/Module/ItemDefinition/Include/index.ts:608
▸ isExclusionCallout(): boolean
Checks whether excluding this item (while possible) will cause a callout, that is, a clear display that the item definition instance is missing it, this is for key items, eg. car, wheels missing.
boolean
a boolean on whether the exclusion must be called out
base/Root/Module/ItemDefinition/Include/index.ts:524
▸ isExclusionTernary(): boolean
Checks whether the exclusion state is a ternary type, this basically only exists in search item definition items because it's used during the search mode
boolean
a boolean on whether the exclusion is ternary
base/Root/Module/ItemDefinition/Include/index.ts:514
▸ mergeWithI18n(includeRaw): void
Merges the i18n data of another include in another language
| Name | Type | Description |
|---|---|---|
includeRaw |
IIncludeRawJSONDataType |
the include itself |
void
base/Root/Module/ItemDefinition/Include/index.ts:810
▸ restoreValueFor(id, version): void
restores the include value to the applied value
| Name | Type | Description |
|---|---|---|
id |
string |
the slot id |
version |
string |
the slot version |
void
base/Root/Module/ItemDefinition/Include/index.ts:737
▸ setExclusionState(id, version, value): void
Sets the exclusion state to a new value
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the given exclusion state slot id |
version |
string |
the version for the given exclusion state slot id |
value |
IncludeExclusionState |
the value for the exclusion state |
void
base/Root/Module/ItemDefinition/Include/index.ts:534
▸ toJSON(): IIncludeRawJSONDataType
Basically returns the raw data of this item
the json value raw data