@onzag/itemize / Modules / base/Root/Module / default
base/Root/Module.default
The class module that defines how the module behaves
- childItemDefinitions
- childModules
- childPropExtensionItemDefinition
- parentModule
- parentRoot
- propExtensions
- rawData
- searchModeModule
- applySoftReadRoleAccessTo
- checkRoleAccessFor
- checkRoleAccessForIgnoreLimiters
- checkRoleAccessForModeration
- cleanState
- getAllChildDefinitionsRecursive
- getAllChildItemDefinitions
- getAllModules
- getAllPropExtensions
- getChildModule
- getI18nDataFor
- getItemDefinitionFor
- getItemDefinitionRawFor
- getMaxSearchRecords
- getMaxSearchResults
- getModuleFor
- getName
- getParentModule
- getParentRoot
- getPath
- getPropExtensionFor
- getPropExtensionItemDefinition
- getQualifiedPathName
- getRolesWithAccessTo
- getRolesWithModerationAccess
- getRolesWithSearchAccess
- getSearchLimiters
- getSearchModule
- getStandardModule
- getTableName
- hasItemDefinitionFor
- hasParentModule
- hasPropExtensionFor
- init
- isInSearchMode
- isPropExtensionInSearchModeOnly
- isSearchEngineEnabled
- isSearchable
- listModuleNames
- mergeWithI18n
- buildSearchMode
- getItemDefinitionRawFor
- getPropExtensionRawFor
• new default(rawJSON, parentRoot, parentModule, disableSearchModeRetrieval?): default
Builds a module from raw json data
| Name | Type | Description |
|---|---|---|
rawJSON |
IModuleRawJSONDataType |
the raw json data of the module |
parentRoot |
default |
the root that contains the module |
parentModule |
default |
the parent module of the module, can be null |
disableSearchModeRetrieval? |
boolean |
makes the search module be null and it's not calculated this is for use because search modules are generated automatically on every instance this would create an infite loop if this option wasn't available |
• Private childItemDefinitions: default[]
The children item definitions, as instances
• Private childModules: default[]
The children modules as instances
• Private childPropExtensionItemDefinition: default
The prop extensions emulated item definition that contains all the prop extensions as an item definition itself
• Private parentModule: default
The parent module, if any of this module instance as an instance
• Private parentRoot: default
The root that contains the module
• Private propExtensions: default[]
The property definitions that the module itself has, and every item defintion in itself hence inherits
• rawData: IModuleRawJSONDataType
The raw data of the module
• Private searchModeModule: default
The search mode of this module, it is generated automatically based on the data using the build search mode functionality
▸ 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>
▸ checkRoleAccessFor(action, role, userId, ownerUserId, requestedFields, rolesManager, throwError): Promise<boolean>
Checks the role access for an action in a module
| Name | Type | Description |
|---|---|---|
action |
ItemDefinitionIOActions |
the IO action (for modules this can only logically be a READ action for module level searches) |
role |
string |
the role of the user attempting the action |
userId |
string |
the user id of the user attempting the action |
ownerUserId |
string |
the owner of that item definition |
requestedFields |
IRQRequestFields |
the requested fields (single properties will be checked as well) |
rolesManager |
ICustomRoleManager |
a roles manager instance |
throwError |
boolean |
whether to throw an error if failed (otherwise returns a boolean) |
Promise<boolean>
a boolean on whether the user is granted role access
▸ checkRoleAccessForIgnoreLimiters(role, userId, ownerUserId, rolesManager, throwError): Promise<boolean>
| Name | Type |
|---|---|
role |
string |
userId |
string |
ownerUserId |
string |
rolesManager |
ICustomRoleManager |
throwError |
boolean |
Promise<boolean>
▸ checkRoleAccessForModeration(role, userId, ownerUserId, rolesManager, throwError): Promise<boolean>
| Name | Type |
|---|---|
role |
string |
userId |
string |
ownerUserId |
string |
rolesManager |
ICustomRoleManager |
throwError |
boolean |
Promise<boolean>
▸ cleanState(): void
void
▸ getAllChildDefinitionsRecursive(): default[]
Provides the live child definitions recursively, it does not get in Module children
default[]
an array of item definitions
▸ getAllChildItemDefinitions(): default[]
Provides all live child item definitions
default[]
a list of item definitions
▸ getAllModules(): default[]
Provides all the modules it contains should follow
default[]
Retuns
a list of all the child modules as Module instances
▸ getAllPropExtensions(): default[]
Provides all the prop extensions
default[]
a list of property definitions
▸ getChildModule(name): default
Gets a specific module given its name
| Name | Type | Description |
|---|---|---|
name |
string |
the name of the module |
a Module instance for the child module, or throws an error
▸ getI18nDataFor(locale): IRawJsonI18NSpecificLocaleDataType
Provides the module locale data
| Name | Type | Description |
|---|---|---|
locale |
string |
the locale in iso form |
IRawJsonI18NSpecificLocaleDataType
an object or null (if locale not valid)
▸ getItemDefinitionFor(name): default
Gets a live item definition given a specific path the path has to be full
| Name | Type | Description |
|---|---|---|
name |
string[] |
the path name for the item definition |
an item definition
Throws
an error if the path finds a dead end
▸ getItemDefinitionRawFor(name): IItemDefinitionRawJSONDataType
Gives you raw data for an item definition given its full path
| Name | Type | Description |
|---|---|---|
name |
string[] |
the full path of the item definition |
IItemDefinitionRawJSONDataType
a raw item definition
Throws
an error if this item definition does not exist
▸ getMaxSearchRecords(): number
Specifies how many search records might be obtained at once
number
an integer
base/Root/Module/index.ts:1044
▸ getMaxSearchResults(): number
Specifies how many search results might be obtained at once
number
an integer
base/Root/Module/index.ts:1052
▸ getModuleFor(name): default
Gets a specific module given its name
| Name | Type | Description |
|---|---|---|
name |
string[] |
the name of the module |
a module that exists within this module
▸ getName(): string
Gives the name of this module
string
a string
▸ getParentModule(): default
Just gives the parent module
a module (or null)
▸ getParentRoot(): default
Just gives the parent root
the parent root
▸ getPath(): string[]
Provides the path of the module from the root
string[]
an array of string that represents the path all the way to the root
▸ getPropExtensionFor(id): default
Provides a prop extension from the module
| Name | Type | Description |
|---|---|---|
id |
string |
the property definition id |
a property definition, or throws an error if it doesn't exist
Throws
error if the property does not exist
▸ getPropExtensionItemDefinition(): default
▸ getQualifiedPathName(): string
Provides the full qualified path name that is used for absolute reference of the whole module, this is unique
string
the string qualified path name
▸ getRolesWithAccessTo(action): string[]
Provides the roles that have access to a given action based on the rules that were set
| Name | Type | Description |
|---|---|---|
action |
ItemDefinitionIOActions |
the action from the ItemDefinitionIOActions |
string[]
an array of string with the roles that have the specific io role access
▸ getRolesWithModerationAccess(): string[]
Provides the roles that have moderation access to the moderation fileds for a given module
string[]
an array of string with the roles that have moderation access
▸ getRolesWithSearchAccess(): string[]
Provides the search access for the given module
string[]
Retuns
an array with the approved roles or the anyone metarole
▸ getSearchLimiters(): ISearchLimitersType
Provides the module request limiters
the request limiters object or null
base/Root/Module/index.ts:1036
▸ getSearchModule(): default
Provides the search form of this module, will throw an error if already in the search form
the search form of the module
▸ getStandardModule(): default
Provides the standard form of this module, will throw an error if already in the standard form
the standard form of the module
▸ getTableName(): string
An utility function that returns the table name for the module
string
▸ hasItemDefinitionFor(name): boolean
checks whether a module has an item definition for an specific children given its full path
| Name | Type | Description |
|---|---|---|
name |
string[] |
the name path of the definition |
boolean
a boolean
▸ hasParentModule(): boolean
Tells whether it has a parent module
boolean
a boolean on whether this module is parented
▸ hasPropExtensionFor(id): boolean
Checks whether a property extension exists in this module
| Name | Type | Description |
|---|---|---|
id |
string |
the property definition id |
boolean
a boolean on whether this prop extension exists
▸ init(): void
Runs the initialization of the module, for cross access, this executes once the entire tree is ready so this module other parts of the tree Root class executes this function recursively
void
▸ isInSearchMode(): boolean
Checks whether the module is in search module
boolean
a boolean
▸ isPropExtensionInSearchModeOnly(id): boolean
Given a string id it specifies whether it is considered a search only property only available in the search mode
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the property |
boolean
a boolean
▸ isSearchEngineEnabled(): boolean
Wether the item is search engine enabled
boolean
a boolean
▸ isSearchable(): boolean
Tells whether module based searches are allowed
boolean
a boolean on whether the module is setup as searchable
▸ listModuleNames(): string[]
list all module names it contains
string[]
a list of string for the module names
▸ mergeWithI18n(mod, rootI18nData): void
Merges two i18n data components, for example the i18n data for the english build and the i18n data for the russian build, that way the state is not lost
| Name | Type | Description |
|---|---|---|
mod |
IModuleRawJSONDataType |
the raw module that is merging |
rootI18nData |
Ii18NType |
the i18n data of the root |
void
base/Root/Module/index.ts:1063
▸ buildSearchMode(rawData, rootI18nData): IModuleRawJSONDataType
Builds the search mode of a raw module this gives a module that is the search module of the given module
| Name | Type | Description |
|---|---|---|
rawData |
IModuleRawJSONDataType |
the raw data of the module in json |
rootI18nData |
Ii18NType |
the root i18n data |
a raw json for the search module
▸ getItemDefinitionRawFor(parentModuleRaw, name): IItemDefinitionRawJSONDataType
Provides a full item definition in raw form given raw data of a module and a full path for a name
| Name | Type | Description |
|---|---|---|
parentModuleRaw |
IModuleRawJSONDataType |
the raw json module data |
name |
string[] |
the name of the item definition as a path |
IItemDefinitionRawJSONDataType
▸ getPropExtensionRawFor(parentModuleRaw, id): IPropertyDefinitionRawJSONDataType
provides the prop exension property for a given raw module and its id
| Name | Type | Description |
|---|---|---|
parentModuleRaw |
IModuleRawJSONDataType |
the parent module in raw form |
id |
string |
the id of the property extension |
IPropertyDefinitionRawJSONDataType
a raw property definition