Index

lib/shared/utils/files.utils.ts

createDirectoriesIfNotExist
createDirectoriesIfNotExist(directoryPath: string)

Creates directories if they do not exist.

Parameters :
Name Type Optional Description
directoryPath string No
  • The path of the directory to create.
fileType
fileType()

Gets the file type module.

getHashFromBuffer
getHashFromBuffer(fileBuffer: Buffer)

Generates an SHA-256 hash from a buffer.

Parameters :
Name Type Optional Description
fileBuffer Buffer No
  • The buffer to hash.
readDirectoryRecursively
readDirectoryRecursively(dirPath: string)

Recursively reads a directory and returns its structure.

Parameters :
Name Type Optional Description
dirPath string No
  • The path of the directory to read.

A promise that resolves to the directory structure.

readFile
readFile(path: string, opts?)

Reads a file.

Parameters :
Name Type Optional Description
path string No
  • The path of the file to read.
opts Yes
  • Optional read options.

lib/shared/utils/transform.utils.ts

dateToTime
dateToTime(__namedParameters: {value})

Converts a Date object to a timestamp.

Parameters :
Name Optional Description
value No
  • The Date object to convert.
parseParamsString
parseParamsString(filterString: string)

Parses a parameter string into an object.

Parameters :
Name Type Optional Description
filterString string No
  • The parameter string to parse.
Returns : literal type

An object representing the parsed parameters.

stringifyParamsObject
stringifyParamsObject(filterObject)

Stringifies an object into a parameter string.

Parameters :
Name Optional Description
filterObject No
  • The object to stringify.
Returns : string

The parameter string.

lib/common/xml-data-bridge/xml-data-bridge.constants.ts

deepEqual
deepEqual(obj1: ObjectLiteral, obj2: ObjectLiteral)

Checks if two objects are deeply equal.

Parameters :
Name Type Optional Description
obj1 ObjectLiteral No
  • The first object.
obj2 ObjectLiteral No
  • The second object.
Returns : boolean

A boolean indicating whether the objects are deeply equal.

getXmlParser
getXmlParser()

Returns the XML parser instance.

parseXmlBody
parseXmlBody(body)

Parses the XML body into an XdbObject.

Parameters :
Name Optional Description
body No
  • The body containing the XML schema.
parseXmlFile
parseXmlFile(xmlData: Buffer)

Parses an XML file into an XdbObject.

Parameters :
Name Type Optional Description
xmlData Buffer No
  • The XML data buffer.
Returns : Promise<XdbObject>

A promise that resolves to the parsed XdbObject.

removeDuplicateObjects
removeDuplicateObjects(array)

Removes duplicate objects from an array of XdbDecomposedEntity.

Parameters :
Name Optional Description
array No
  • The array of XdbDecomposedEntity.

The array with duplicates removed.

lib/shared/utils/number.utils.ts

generateRandomInt
generateRandomInt(max, min: number)

Generates a random integer between the given minimum and maximum values (inclusive).

Parameters :
Name Type Optional Default value Description
max No Number.MAX_SAFE_INTEGER
  • The maximum value of the random integer (default: Number.MAX_SAFE_INTEGER).
min number No 0
  • The minimum value of the random integer (default: 0).

lib/shared/utils/string.utils.ts

generateRandomString
generateRandomString(min: number, max: number)

Generates a random string of a random length between the given minimum and maximum values (inclusive).

Parameters :
Name Type Optional Description
min number No
  • The minimum length of the random string.
max number No
  • The maximum length of the random string.
Returns : string

A random string with a length between the specified min and max values.

lib/common/process/process.constants.ts

getProcessInstance
getProcessInstance(code: string)

Gets a process instance by its code.

Parameters :
Name Type Optional Description
code string No
  • The code of the process.
getRegisteredProcesses
getRegisteredProcesses()

Gets the store of registered processes.

hasProcessInstance
hasProcessInstance(code: string)

Checks if a process instance is registered.

Parameters :
Name Type Optional Description
code string No
  • The code of the process.
registerProcess
registerProcess(process: T)

Registers a process.

Parameters :
Name Type Optional Description
process T No
  • The process to register.

lib/shared/utils/user.utils.ts

hasAccessForRoles
hasAccessForRoles(userRoles, allowedRoles)

Checks if a user has access based on their roles and the allowed roles.

Parameters :
Name Optional Description
userRoles No
  • The roles of the user.
allowedRoles No
  • The roles that are allowed access.
hasSomeRole
hasSomeRole(userRoles, ...roles: undefined)

Checks if a user has at least one of the specified roles.

Parameters :
Name Optional Description
userRoles No
  • The roles of the user.
roles No
  • The roles to check for.

lib/shared/utils/object.utils.ts

inspect
inspect(obj: T)

Inspects an object and returns a string representation of it.

Parameters :
Name Type Optional Description
obj T No
  • The object to inspect.
sort
sort(obj: Array, property: string, vector)

Sorts array of objects.

Parameters :
Name Type Optional Default value Description
obj Array No
  • The object to sort.
property string No
  • name of property by sorting
vector No true
  • sorting order

lib/shared/utils/json.utils.ts

jsonFilter
jsonFilter(key, value)

Filters JSON objects, removing null values and empty arrays.

Parameters :
Name Optional Description
key No
  • The key of the JSON object.
value No
  • The value of the JSON object.
removeCircularReferences
removeCircularReferences(value, cache)

Removes circular references from an object or array to make it serializable.

Parameters :
Name Optional Default value Description
value No
  • The object or array to process.
cache No new Set()
  • A Set used to store already visited nodes to detect circular references.

lib/shared/utils/env.loader.ts

loadEnvironment
loadEnvironment(logger?: Logger)

Loads environment variables from a .env file based on the current NODE_ENV. Falls back to the "default.env" file if the target .env file is not found.

Parameters :
Name Type Optional Description
logger Logger Yes
  • Optional logger instance to use for logging messages.

lib/common/explorer/explorer.constants.ts

provideSaveHandlers
provideSaveHandlers(args)

This function provide save handlers for entities, check UserEntityPwdAndRolesSaveHandler as example

Parameters :
Name Optional
args No

lib/shared/decorators/response-dto.decorator.ts

ResponseDto
ResponseDto(serializer)

A decorator to apply the specified DTO serializer to the response.

Parameters :
Name Optional Description
serializer No
  • The DTO serializer to use.

lib/shared/utils/common.utils.ts

sleep
sleep(delay: number)

Pauses execution for a specified duration.

Parameters :
Name Type Optional Description
delay number No
  • The delay in milliseconds.

lib/common/xml-data-bridge/xml-data-bridge-file-schema.ts

xmlFileInsertUpdateNodeTpl
xmlFileInsertUpdateNodeTpl(target: string)

Generates the XML file InsertUpdate node template.

Parameters :
Name Type Optional Description
target string No
  • The target entity.
xmlFileNodeTpl
xmlFileNodeTpl(obj: ObjectLiteral)

Generates the XML file node template.

Parameters :
Name Type Optional Description
obj ObjectLiteral No
  • The file object.
xmlFileRowNode
xmlFileRowNode()

Generates the XML file row node template.

xmlFileRowPropertyNode
xmlFileRowPropertyNode(stack, key: string, value)

Generates the XML file row property node template.

Parameters :
Name Type Optional Description
stack No
  • The stack of decomposed entities.
key string No
  • The property key.
value No
  • The property value.
xmlFileSchemaTpl
xmlFileSchemaTpl()

Generates the XML file schema template.

xmlMediaNodeTpl
xmlMediaNodeTpl(obj: ObjectLiteral)

Generates the XML media node template.

Parameters :
Name Type Optional Description
obj ObjectLiteral No
  • The media object.

results matching ""

    No results matching ""