Skip to content

Latest commit

 

History

History
1113 lines (627 loc) · 27.6 KB

File metadata and controls

1113 lines (627 loc) · 27.6 KB

@onzag/itemize / Modules / base/Root/Module / default

Class: default

base/Root/Module.default

The class module that defines how the module behaves

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new default(rawJSON, parentRoot, parentModule, disableSearchModeRetrieval?): default

Builds a module from raw json data

Parameters

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

Returns

default

Defined in

base/Root/Module/index.ts:347

Properties

childItemDefinitions

Private childItemDefinitions: default[]

The children item definitions, as instances

Defined in

base/Root/Module/index.ts:321


childModules

Private childModules: default[]

The children modules as instances

Defined in

base/Root/Module/index.ts:325


childPropExtensionItemDefinition

Private childPropExtensionItemDefinition: default

The prop extensions emulated item definition that contains all the prop extensions as an item definition itself

Defined in

base/Root/Module/index.ts:330


parentModule

Private parentModule: default

The parent module, if any of this module instance as an instance

Defined in

base/Root/Module/index.ts:310


parentRoot

Private parentRoot: default

The root that contains the module

Defined in

base/Root/Module/index.ts:305


propExtensions

Private propExtensions: default[]

The property definitions that the module itself has, and every item defintion in itself hence inherits

Defined in

base/Root/Module/index.ts:336


rawData

rawData: IModuleRawJSONDataType

The raw data of the module

Defined in

base/Root/Module/index.ts:300


searchModeModule

Private searchModeModule: default

The search mode of this module, it is generated automatically based on the data using the build search mode functionality

Defined in

base/Root/Module/index.ts:316

Methods

applySoftReadRoleAccessTo

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

Parameters

Name Type
role string
userId string
ownerUserId string
rolesManager ICustomRoleManager
value IRQValue

Returns

Promise<void>

Defined in

base/Root/Module/index.ts:861


checkRoleAccessFor

checkRoleAccessFor(action, role, userId, ownerUserId, requestedFields, rolesManager, throwError): Promise<boolean>

Checks the role access for an action in a module

Parameters

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)

Returns

Promise<boolean>

a boolean on whether the user is granted role access

Defined in

base/Root/Module/index.ts:973


checkRoleAccessForIgnoreLimiters

checkRoleAccessForIgnoreLimiters(role, userId, ownerUserId, rolesManager, throwError): Promise<boolean>

Parameters

Name Type
role string
userId string
ownerUserId string
rolesManager ICustomRoleManager
throwError boolean

Returns

Promise<boolean>

Defined in

base/Root/Module/index.ts:887


checkRoleAccessForModeration

checkRoleAccessForModeration(role, userId, ownerUserId, rolesManager, throwError): Promise<boolean>

Parameters

Name Type
role string
userId string
ownerUserId string
rolesManager ICustomRoleManager
throwError boolean

Returns

Promise<boolean>

Defined in

base/Root/Module/index.ts:927


cleanState

cleanState(): void

Returns

void

Defined in

base/Root/Module/index.ts:445


getAllChildDefinitionsRecursive

getAllChildDefinitionsRecursive(): default[]

Provides the live child definitions recursively, it does not get in Module children

Returns

default[]

an array of item definitions

Defined in

base/Root/Module/index.ts:654


getAllChildItemDefinitions

getAllChildItemDefinitions(): default[]

Provides all live child item definitions

Returns

default[]

a list of item definitions

Defined in

base/Root/Module/index.ts:645


getAllModules

getAllModules(): default[]

Provides all the modules it contains should follow

Returns

default[]

Retuns

a list of all the child modules as Module instances

Defined in

base/Root/Module/index.ts:692


getAllPropExtensions

getAllPropExtensions(): default[]

Provides all the prop extensions

Returns

default[]

a list of property definitions

Defined in

base/Root/Module/index.ts:637


getChildModule

getChildModule(name): default

Gets a specific module given its name

Parameters

Name Type Description
name string the name of the module

Returns

default

a Module instance for the child module, or throws an error

Defined in

base/Root/Module/index.ts:701


getI18nDataFor

getI18nDataFor(locale): IRawJsonI18NSpecificLocaleDataType

Provides the module locale data

Parameters

Name Type Description
locale string the locale in iso form

Returns

IRawJsonI18NSpecificLocaleDataType

an object or null (if locale not valid)

Defined in

base/Root/Module/index.ts:675


getItemDefinitionFor

getItemDefinitionFor(name): default

Gets a live item definition given a specific path the path has to be full

Parameters

Name Type Description
name string[] the path name for the item definition

Returns

default

an item definition

Throws

an error if the path finds a dead end

Defined in

base/Root/Module/index.ts:539


getItemDefinitionRawFor

getItemDefinitionRawFor(name): IItemDefinitionRawJSONDataType

Gives you raw data for an item definition given its full path

Parameters

Name Type Description
name string[] the full path of the item definition

Returns

IItemDefinitionRawJSONDataType

a raw item definition

Throws

an error if this item definition does not exist

Defined in

base/Root/Module/index.ts:518


getMaxSearchRecords

getMaxSearchRecords(): number

Specifies how many search records might be obtained at once

Returns

number

an integer

Defined in

base/Root/Module/index.ts:1044


getMaxSearchResults

getMaxSearchResults(): number

Specifies how many search results might be obtained at once

Returns

number

an integer

Defined in

base/Root/Module/index.ts:1052


getModuleFor

getModuleFor(name): default

Gets a specific module given its name

Parameters

Name Type Description
name string[] the name of the module

Returns

default

a module that exists within this module

Defined in

base/Root/Module/index.ts:575


getName

getName(): string

Gives the name of this module

Returns

string

a string

Defined in

base/Root/Module/index.ts:666


getParentModule

getParentModule(): default

Just gives the parent module

Returns

default

a module (or null)

Defined in

base/Root/Module/index.ts:748


getParentRoot

getParentRoot(): default

Just gives the parent root

Returns

default

the parent root

Defined in

base/Root/Module/index.ts:756


getPath

getPath(): string[]

Provides the path of the module from the root

Returns

string[]

an array of string that represents the path all the way to the root

Defined in

base/Root/Module/index.ts:764


getPropExtensionFor

getPropExtensionFor(id): default

Provides a prop extension from the module

Parameters

Name Type Description
id string the property definition id

Returns

default

a property definition, or throws an error if it doesn't exist

Throws

error if the property does not exist

Defined in

base/Root/Module/index.ts:613


getPropExtensionItemDefinition

getPropExtensionItemDefinition(): default

Returns

default

Defined in

base/Root/Module/index.ts:566


getQualifiedPathName

getQualifiedPathName(): string

Provides the full qualified path name that is used for absolute reference of the whole module, this is unique

Returns

string

the string qualified path name

Defined in

base/Root/Module/index.ts:782


getRolesWithAccessTo

getRolesWithAccessTo(action): string[]

Provides the roles that have access to a given action based on the rules that were set

Parameters

Name Type Description
action ItemDefinitionIOActions the action from the ItemDefinitionIOActions

Returns

string[]

an array of string with the roles that have the specific io role access

Defined in

base/Root/Module/index.ts:811


getRolesWithModerationAccess

getRolesWithModerationAccess(): string[]

Provides the roles that have moderation access to the moderation fileds for a given module

Returns

string[]

an array of string with the roles that have moderation access

Defined in

base/Root/Module/index.ts:825


getRolesWithSearchAccess

getRolesWithSearchAccess(): string[]

Provides the search access for the given module

Returns

string[]

Retuns

an array with the approved roles or the anyone metarole

Defined in

base/Root/Module/index.ts:801


getSearchLimiters

getSearchLimiters(): ISearchLimitersType

Provides the module request limiters

Returns

ISearchLimitersType

the request limiters object or null

Defined in

base/Root/Module/index.ts:1036


getSearchModule

getSearchModule(): default

Provides the search form of this module, will throw an error if already in the search form

Returns

default

the search form of the module

Defined in

base/Root/Module/index.ts:729


getStandardModule

getStandardModule(): default

Provides the standard form of this module, will throw an error if already in the standard form

Returns

default

the standard form of the module

Defined in

base/Root/Module/index.ts:715


getTableName

getTableName(): string

An utility function that returns the table name for the module

Returns

string

Defined in

base/Root/Module/index.ts:793


hasItemDefinitionFor

hasItemDefinitionFor(name): boolean

checks whether a module has an item definition for an specific children given its full path

Parameters

Name Type Description
name string[] the name path of the definition

Returns

boolean

a boolean

Defined in

base/Root/Module/index.ts:479


hasParentModule

hasParentModule(): boolean

Tells whether it has a parent module

Returns

boolean

a boolean on whether this module is parented

Defined in

base/Root/Module/index.ts:773


hasPropExtensionFor

hasPropExtensionFor(id): boolean

Checks whether a property extension exists in this module

Parameters

Name Type Description
id string the property definition id

Returns

boolean

a boolean on whether this prop extension exists

Defined in

base/Root/Module/index.ts:601


init

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

Returns

void

Defined in

base/Root/Module/index.ts:458


isInSearchMode

isInSearchMode(): boolean

Checks whether the module is in search module

Returns

boolean

a boolean

Defined in

base/Root/Module/index.ts:740


isPropExtensionInSearchModeOnly

isPropExtensionInSearchModeOnly(id): boolean

Given a string id it specifies whether it is considered a search only property only available in the search mode

Parameters

Name Type Description
id string the id of the property

Returns

boolean

a boolean

Defined in

base/Root/Module/index.ts:627


isSearchEngineEnabled

isSearchEngineEnabled(): boolean

Wether the item is search engine enabled

Returns

boolean

a boolean

Defined in

base/Root/Module/index.ts:847


isSearchable

isSearchable(): boolean

Tells whether module based searches are allowed

Returns

boolean

a boolean on whether the module is setup as searchable

Defined in

base/Root/Module/index.ts:836


listModuleNames

listModuleNames(): string[]

list all module names it contains

Returns

string[]

a list of string for the module names

Defined in

base/Root/Module/index.ts:683


mergeWithI18n

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

Parameters

Name Type Description
mod IModuleRawJSONDataType the raw module that is merging
rootI18nData Ii18NType the i18n data of the root

Returns

void

Defined in

base/Root/Module/index.ts:1063


buildSearchMode

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

Parameters

Name Type Description
rawData IModuleRawJSONDataType the raw data of the module in json
rootI18nData Ii18NType the root i18n data

Returns

IModuleRawJSONDataType

a raw json for the search module

Defined in

base/Root/Module/index.ts:235


getItemDefinitionRawFor

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

Parameters

Name Type Description
parentModuleRaw IModuleRawJSONDataType the raw json module data
name string[] the name of the item definition as a path

Returns

IItemDefinitionRawJSONDataType

Defined in

base/Root/Module/index.ts:260


getPropExtensionRawFor

getPropExtensionRawFor(parentModuleRaw, id): IPropertyDefinitionRawJSONDataType

provides the prop exension property for a given raw module and its id

Parameters

Name Type Description
parentModuleRaw IModuleRawJSONDataType the parent module in raw form
id string the id of the property extension

Returns

IPropertyDefinitionRawJSONDataType

a raw property definition

Defined in

base/Root/Module/index.ts:248