### Install Axios for file uploads Source: https://matrixrequirements.github.io/matrix-sdk-docs/part3 Install the Axios library, required for uploading local files with the Matrix SDK. ```bash npm install axios ``` -------------------------------- ### Install matrix-requirements-sdk with npm Source: https://matrixrequirements.github.io/matrix-sdk-docs Install the matrix-requirements-sdk package from npm. The output shows a successful installation with no vulnerabilities. ```shell mstanton@darkstar:~/examples/users-guide (main)$ npm install matrix-requirements-sdk added 1 package, and audited 54 packages in 1s 1 package is looking for funding run `npm fund` for details found 0 vulnerabilities ``` -------------------------------- ### getConfiguration Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the configuration. ```APIDOC ## getConfiguration() ### Description Gets the configuration. ### Returns - **TestManagerConfiguration** - The configuration object. ``` -------------------------------- ### getProjectSettings Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets the settings for a project. ```APIDOC ## getProjectSettings ### Description Gets the settings for a project. ### Method getProjectSettings ### Parameters - **project** (string) - Required - The project name. ### Returns - **Promise** - A promise that resolves to a GetProjectSettingAck object. ``` -------------------------------- ### getProjectTodos Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets the todos for a project. ```APIDOC ## getProjectTodos ### Description Gets the todos for a project. ### Method getProjectTodos ### Parameters - **project** (string) - Required - The project name. - **itemRef** (string) - Optional - The item reference. - **includeDone** (boolean) - Optional - Whether to include completed todos. - **includeAllUsers** (boolean) - Optional - Whether to include all users. - **includeFuture** (boolean) - Optional - Whether to include future todos. ### Returns - **Promise** - A promise that resolves to a GetTodosAck object. ``` -------------------------------- ### Output of node list-projects.js Source: https://matrixrequirements.github.io/matrix-sdk-docs Example output from running list-projects.js, showing the list of projects available on the configured Matrix instance. ```shell mstanton@darkstar:~/examples/users-guide (main)$ node list-projects.js ALM2, ALMSandbox, INSULINEPEN_SDK, MyWheely, PRINT, PRINT_ORG, QMS, QMS_FILE, TESTING_PRINT, TOOLS, WHEELY, WHEELY_CLEAN, WHEELY_CLIENT_TESTS, WHEELY_OBSERVABLE ``` -------------------------------- ### Get and set server settings with Server.getServerSettings() Source: https://matrixrequirements.github.io/matrix-sdk-docs/zee-faq Retrieves server settings with `Server.getServerSettings()`, checks for a `favorites` setting, and creates it with `putServerSetting()` if missing. The output shows two runs: the first saves favorites, the second finds them. ```javascript const lib = require("./lib.js"); async function run() { const [server, wheely] = await lib.getServerAndProject(); const settings = await server.getServerSettings(); let favorites = settings.settingList.filter((setting) => setting.key === "favorites"); let favorite = {}; if (favorites.length > 0) { console.log("Found existing favorites"); favorite = JSON.parse(favorites[0].value); } else { favorite = { car: "Mustang", food: "Tacos", music: "Post-rock" }; await server.putServerSetting("favorites", JSON.stringify(favorite)); console.log("Saved favorites"); } console.dir(favorite); } run().then(() => process.exit(0)); ``` ```text mstanton@darkstar:~/work/matrix-sdk-docs/codes (main)$ node server-setting.js Saved favorites { car: 'Mustang', food: 'Tacos', music: 'Post-rock' } mstanton@darkstar:~/work/matrix-sdk-docs/codes (main)$ node server-setting.js Found existing favorites { car: 'Mustang', food: 'Tacos', music: 'Post-rock' } ``` -------------------------------- ### getExtrasConfig(): IExtras Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the extras configuration. ```APIDOC ## getExtrasConfig(): IExtras ### Description Gets the extras configuration. ### Returns IExtras ``` -------------------------------- ### getCloneSources Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the clone sources. ```APIDOC ## getCloneSources() ### Description Gets the clone sources. ### Returns - **string[]** - An array of clone source strings. ``` -------------------------------- ### Render DOC to PDF (partial) Source: https://matrixrequirements.github.io/matrix-sdk-docs/zee-faq Starts the code for rendering and downloading a DOC as a PDF using toPDF() and downloadJobResult(). The snippet is incomplete in the source. ```javascript const lib = require("./lib.js"); const fs = require("fs"); async function run() { const [server, wheely] = await lib.getServerAndProject(); ``` -------------------------------- ### getCategorySettings(category): XRSettingType[] Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets all settings for a category. ```APIDOC ## getCategorySettings(category): XRSettingType[] ### Description Gets all settings for a category. ### Parameters - **category** (string) - Required - The category. ### Returns XRSettingType[] ``` -------------------------------- ### getConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the configuration of the category. ```APIDOC ## getConfig() ### Description Gets the configuration of the category. ### Returns ICategoryConfig - The category configuration. ``` -------------------------------- ### Output of upload-image script Source: https://matrixrequirements.github.io/matrix-sdk-docs/part3 Example output from running the upload script. Shows the upload progress messages and the generated file URL. ```bash mstanton@darkstar:~/work/matrix-sdk-docs/codes (main)$ node place-image Uploading... Uploading... Visit https://clouds5.matrixreq.com/rest/1/WHEELY_OBSERVABLE/file/11075?key=key_elnjk70etp7p1qadc5vuqss634 to get your file mstanton@darkstar:~/work/matrix-sdk-docs/codes (main)$ ``` -------------------------------- ### Create and retrieve Todos with the SDK Source: https://matrixrequirements.github.io/matrix-sdk-docs/zee-faq Creates two Todos on user cases using `createTodo()` and then retrieves all Todos with `getTodos()`. The example shows how to use the `Item` class methods for notifications. ```javascript const lib = require("./lib.js"); async function run() { const [server, wheely] = await lib.getServerAndProject(); let ucs = await wheely.searchForItems("mrql:category=UC"); let todoId1 = await ucs[0].createTodo(["mike"], "user", "Here is a notification", new Date()); let todoId2 = await ucs[1].createTodo(["francois"], "user", "Here is a notification", new Date()); console.log(`Created Todos ${todoId1}, ${todoId2}`); const todos = await wheely.getTodos(undefined, undefined, true); console.dir(todos, {}); } run().then(() => process.exit(0)); ``` -------------------------------- ### getACLConfig(): IACL Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the ACL configuration. ```APIDOC ## getACLConfig(): IACL ### Description Gets the ACL configuration. ### Returns IACL ``` -------------------------------- ### getContextPagesConfig(): IContextPageConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the context pages configuration. ```APIDOC ## getContextPagesConfig(): IContextPageConfig ### Description Gets the context pages configuration. ### Returns IContextPageConfig ``` -------------------------------- ### initProject(project): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Initializes a project. ```APIDOC ## initProject(project): void ### Description Initializes a project. ### Method initProject ### Parameters - **project** (string) - Required - The project identifier. ### Returns void ``` -------------------------------- ### getTree(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Gets the initial tree structure from a project. Project must be set first. ```APIDOC ## getTree(): Promise ### Description Gets the initial tree structure from a project. Project must be set first. ### Method SDK Method ### Returns Promise - A promise that resolves to an array of title and ID pairs. ``` -------------------------------- ### Output of node get-one-item.js Source: https://matrixrequirements.github.io/matrix-sdk-docs Output from running `node get-one-item.js` in the users-guide examples directory. Shows the retrieved item's ID, title, and description with HTML formatting. ```text mstanton@darkstar:~/examples/users-guide (main)$ node get-one-item.js ID: REQ-1 Title: Design / Looks Description:
The wheelchair should not look like a medical device but like something which looks nice to kids from 6 to 10 years.
 
mstanton@darkstar:~/examples/users-guide (main)$ ``` -------------------------------- ### initServerSettings Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes server settings. Takes no parameters and returns void. ```APIDOC ## initServerSettings ### Description Initializes server settings. Takes no parameters and returns void. ### Method initServerSettings ### Parameters None ### Returns void ``` -------------------------------- ### initProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes the project. Takes no parameters and returns void. ```APIDOC ## initProject ### Description Initializes the project. Takes no parameters and returns void. ### Method initProject ### Parameters None ### Returns void ``` -------------------------------- ### toDocItem(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Visits the server and gets this Item as a DocItem. ```APIDOC ## toDocItem(): Promise ### Description Visit the server and get this Item as a DocItem. ### Method toDocItem ### Returns - **Promise** - a DocItem. ### Throws - Error if the fields of this Item are dirty. ``` -------------------------------- ### getUrlInfo Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets URL information. ```APIDOC ## getUrlInfo ### Description Gets URL information. ### Method getUrlInfo ### Parameters None ### Returns - **[string, string]** - A tuple containing two strings. ``` -------------------------------- ### initItem(_item, _jui): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Initializes an item. ```APIDOC ## initItem(_item, _jui): void ### Description Initializes an item. ### Method initItem ### Parameters - **_item** (IItem) - Required - The item to initialize. - **_jui** (JQuery) - Required - The jQuery object associated with the item. ### Returns void ``` -------------------------------- ### init(config) Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Initializes the item configuration with the provided project information. ```APIDOC ## init(config) ### Description Initializes the item configuration with the provided project information. ### Method Function call ### Signature `init(config): void` ### Parameters - **config** (XRProjectInfo) - Required - The project information to initialize with. ### Returns void - No return value. ``` -------------------------------- ### rootGet(adminUI?, output?, options?): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Retrieves a list of projects and settings. ```APIDOC ## rootGet(adminUI?, output?, options?): Promise ### Description Retrieves a list of projects and settings. ### Parameters - **adminUI** (number) - Optional - **output** (string) - Optional - **options** (unknown) - Optional ### Returns Promise ``` -------------------------------- ### getJobStatus Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets the status of a job. ```APIDOC ## getJobStatus ### Description Gets the status of a job. ### Method getJobStatus ### Parameters - **project** (string) - Required - The project name. - **jobId** (string) - Required - The ID of the job. - **options** (object) - Optional - Additional options. ### Returns - **Promise** - A promise that resolves to a JobsStatusWithUrl object. ``` -------------------------------- ### getSettings() Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Retrieves all settings. ```APIDOC ## getSettings() ### Description Retrieves all settings. ### Method SDK Method ### Returns XRSettingType[] ``` -------------------------------- ### getItemFromProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets an item from a project. ```APIDOC ## getItemFromProject ### Description Gets an item from a project. ### Method getItemFromProject ### Parameters - **project** (string) - Required - The project name. - **id** (string) - Required - The ID of the item. ### Returns - **Promise** - A promise that resolves to an IItemGet object. ``` -------------------------------- ### Characterize projects with getItemConfig and openProject Source: https://matrixrequirements.github.io/matrix-sdk-docs Connects to the server, opens two projects (WHEELY_OBSERVABLE and INSULINEPEN_SDK), and prints an HTML table of their item categories and fields. Ignores DOC and REPORT categories. Requires the lib.js module and a valid server connection named "clouds5". ```javascript const lib = require("./lib.js"); function getCharacterizations(projects) { function makeTable(proj) { const itemConfig = proj.getItemConfig(); let res = ''; let cats = itemConfig.getCategories(); // Ignore DOCs and REPORTs for now. cats.splice(cats.indexOf("DOC"), 1); cats.splice(cats.indexOf("REPORT"), 1); for (let cat of cats) { // Get the fields of the category. let fields = []; for (let field of itemConfig.getItemConfiguration(cat).fieldList) { fields.push(`${field.label}(${field.fieldType})`); } let renderedFields = fields.join(", "); res += ``; } res += `
ItemFields
${cat}${renderedFields}
`; return res; } let rows = ""; for (let project in projects) { rows += `${projects[project].getName()}${makeTable(projects[project])}\n` } return `${rows}
`; } async function run() { const server = await lib.getServerConnection("clouds5"); let projects = {}; projects.wheely = await server.openProject("WHEELY_OBSERVABLE"); projects.insulin = await server.openProject("INSULINEPEN_SDK"); console.log(getCharacterizations(projects)); } run().then(() => process.exit(0)); ``` -------------------------------- ### getFieldsByType Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets fields by their type. ```APIDOC ## getFieldsByType ### Description Gets fields by their type. ### Method getFieldsByType ### Parameters - **type** (FieldType) - Required - The type of the fields. ### Returns Field[] - The fields of the given type. ``` -------------------------------- ### getFieldByName Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets a field by its name. ```APIDOC ## getFieldByName ### Description Gets a field by its name. ### Method getFieldByName ### Parameters - **fieldName** (string) - Required - The name of the field. ### Returns Field - The field with the given name. ``` -------------------------------- ### addSettings(s): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Adds settings from the provided data. ```APIDOC ## addSettings(s): void ### Description Adds settings from the provided data. ### Parameters - **s** (XRProjectInfo | XRGetSettingAck) - Required - The settings data to add. ### Returns void ``` -------------------------------- ### InitializeProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Initializes the project. ```APIDOC ## InitializeProject() ### Description Initializes the project. ### Returns - **void** - No return value. ``` -------------------------------- ### getCategory Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets the category of the item. ```APIDOC ## getCategory ### Description Gets the category of the item. ### Method getCategory ### Returns Category - The category of the item. ``` -------------------------------- ### getTitle Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.DocItem.html Get the Item title. ```APIDOC ## getTitle ### Description Get the Item title. ### Method SDK Method ### Signature `getTitle(): string` ### Returns - **string** - The Item title. ``` -------------------------------- ### onInitProject(project): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Called when a project is initialized. ```APIDOC ## onInitProject(project): void ### Description Called when a project is initialized. ### Method onInitProject ### Parameters - **project** (string) - Required - The project identifier. ### Returns void ``` -------------------------------- ### Log REST calls with getFetchLog() using Promises Source: https://matrixrequirements.github.io/matrix-sdk-docs/part2 Use getFetchLog() to retrieve the list of REST calls made to the server. This example uses classic Promise chaining instead of async/await. After running, the log shows three calls: server info, project info, and the search request. ```javascript const lib = require("./lib.js"); lib.getServerConnection("clouds5").then((server) => { server.openProject("WHEELY_OBSERVABLE").then(async (project) => { project.searchForItems("mrql:category=REQ or category=UC").then((items) => { console.log(server.getFetchLog().join("\n")); }); }); }); ``` -------------------------------- ### getXTCType Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the XTC type. ```APIDOC ## getXTCType() ### Description Gets the XTC type. ### Returns - **string** - The XTC type string. ``` -------------------------------- ### lib.js: getServerConnection and getServerAndProject helpers Source: https://matrixrequirements.github.io/matrix-sdk-docs lib.js provides helper functions to connect to a Matrix instance using credentials from a JSON file. getServerConnection reads the credentials file and creates a console API; getServerAndProject opens a project with default values if not provided. ```javascript const fs = require("fs"); const sdk = require("matrix-requirements-sdk/server"); // Securely connect to a server with stored credentials async function getServerConnection(key) { const credentialsFilename = "./credentials.json"; const db = JSON.parse(fs.readFileSync(credentialsFilename, "utf-8")); return await sdk.createConsoleAPI(db[key]); } async function getServerAndProject(connection, projectName) { if (connection == undefined) { connection = "clouds5"; } if (projectName == undefined) { projectName = "WHEELY_OBSERVABLE"; } const server = await getServerConnection(connection); const wheely = await server.openProject(projectName); return [server, wheely]; } module.exports = { sdk, getServerConnection, getServerAndProject }; ``` -------------------------------- ### getSearchExpression Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the search expression. ```APIDOC ## getSearchExpression(resultType, notEqual) ### Description Gets the search expression. ### Parameters - **resultType** (string) - Required - The result type. - **notEqual** (boolean) - Required - Whether to negate the equality. ### Returns - **string** - The search expression string. ``` -------------------------------- ### getMappingItems Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the mapping items. ```APIDOC ## getMappingItems() ### Description Gets the mapping items. ### Returns - **IFieldMapping[]** - An array of field mappings. ``` -------------------------------- ### putSetting(key, value): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Project.html Stores a project setting with the given key and value. ```APIDOC ## putSetting(key, value): Promise ### Description Put a project setting. ### Method putSetting ### Parameters - **key** (string) - Required - The key to save the setting under. - **value** (string) - Required - The value of the setting. ### Returns Promise ``` -------------------------------- ### getItems Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets all items of this Category. ```APIDOC ## getItems(options?) ### Description Gets all of the items of this Category. ### Parameters - **options** (ICategoryItemOptions) - Optional - An optional ICategoryItemOptions describing search options. ### Returns Promise - An array of Items of this Category, configured according to the options given. ``` -------------------------------- ### setUplinks Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Sets the uplinks of the item. ```APIDOC ## setUplinks ### Description Sets the uplinks of the item. ### Method setUplinks ### Parameters - **uplinks** (Link[]) - Required - The uplinks to set. ``` -------------------------------- ### getId Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the identifier of the category. ```APIDOC ## getId() ### Description Gets the identifier of the category. ### Returns string - The category identifier. ``` -------------------------------- ### getCustomerSettingPagesAsync(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Retrieves the customer setting pages for the plugin. ```APIDOC ## getCustomerSettingPagesAsync(): Promise ### Description Retrieves the customer setting pages for the plugin. ### Method getCustomerSettingPagesAsync ### Returns Promise ``` -------------------------------- ### getFields Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the fields of the category. ```APIDOC ## getFields() ### Description Gets the fields of the category. ### Returns XRFieldTypeAnnotated[] - An array of annotated field types. ``` -------------------------------- ### init Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes the Notifications instance. Takes no parameters and returns void. ```APIDOC ## init ### Description Initializes the Notifications instance. Takes no parameters and returns void. ### Method init ### Parameters None ### Returns void ``` -------------------------------- ### list-projects.js: list projects on a Matrix server Source: https://matrixrequirements.github.io/matrix-sdk-docs list-projects.js uses the lib helper to connect to the 'clouds5' server and prints the list of projects. Save as list-projects.js and run with node; output shows project names separated by commas. ```javascript const lib = require("./lib.js"); async function run() { const server = await lib.getServerConnection("clouds5"); // List the projects available on this server: console.log((await server.getProjects()).join(", ")); } run().then(() => process.exit(0)); ``` -------------------------------- ### getProjectAudit Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets the audit log for a project. ```APIDOC ## getProjectAudit ### Description Gets the audit log for a project. ### Method getProjectAudit ### Parameters - **project** (string) - Required - The project name. - **startAt** (string) - Optional - The start date. - **maxResults** (number) - Optional - The maximum number of results. - **deleteOnly** (boolean) - Optional - Whether to only include deletions. - **tech** (boolean) - Optional - Whether to include technical entries. - **auditIdMin** (number) - Optional - The minimum audit ID. - **auditIdMax** (number) - Optional - The maximum audit ID. - **noReport** (boolean) - Optional - Whether to exclude reports. - **noImport** (boolean) - Optional - Whether to exclude imports. - **include** (string) - Optional - Additional include options. - **resolveRef** (boolean) - Optional - Whether to resolve references. - **itemRef** (string) - Optional - The item reference. ### Returns - **Promise** - A promise that resolves to a TrimAuditList object. ``` -------------------------------- ### getPluginSettings() Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Retrieves all plugin settings. ```APIDOC ## getPluginSettings() ### Description Retrieves all plugin settings. ### Method SDK Method ### Returns XRPluginSetting[] ``` -------------------------------- ### getFullTreeFromProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/interfaces/serverSdk.IProjectNeeds.html Gets the full tree from a project. ```APIDOC ## getFullTreeFromProject ### Description Gets the full tree from a project. ### Method getFullTreeFromProject ### Parameters - **projectName** (string) - Required - The name of the project. ### Returns - **Promise** - A promise that resolves to an array of FancyFolder objects. ``` -------------------------------- ### onInitItem(_item): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Called when an item is initialized. ```APIDOC ## onInitItem(_item): void ### Description Called when an item is initialized. ### Method onInitItem ### Parameters - **_item** (IItem) - Required - The item being initialized. ### Returns void ``` -------------------------------- ### getSingleFieldByName Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets a single field by its name. ```APIDOC ## getSingleFieldByName ### Description Gets a single field by its name. ### Method getSingleFieldByName ### Parameters - **fieldName** (string) - Required - The name of the field. ### Returns Field - The field with the given name. ``` -------------------------------- ### getMaxVersion Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets the maximum version of the item. ```APIDOC ## getMaxVersion ### Description Gets the maximum version of the item. ### Method getMaxVersion ### Returns number - The maximum version of the item. ``` -------------------------------- ### createFrom23Environment(skipSdkVersionCheck?) Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/functions/serverSdk.createFrom23Environment.html Creates a StandaloneMatrixSDK by sniffing context from globals in a 2.3 environment. Optionally skips SDK version check. Throws an error if environment variables are missing. ```APIDOC ## createFrom23Environment(skipSdkVersionCheck?) ### Description Creates a StandaloneMatrixSDK by sniffing context from globals in a 2.3 environment. Optionally skips SDK version check. Throws an error if environment variables are missing. ### Method Function ### Signature createFrom23Environment(skipSdkVersionCheck?: boolean): Promise ### Parameters - **skipSdkVersionCheck** (boolean) - Optional - If true, skips the SDK version check. ### Returns Promise - A StandaloneMatrixSDK ### Throws An Error if some of the environment variables can't be found. ``` -------------------------------- ### getDHFConfig(): IDHFConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the DHF configuration. ```APIDOC ## getDHFConfig(): IDHFConfig ### Description Gets the DHF configuration. ### Returns IDHFConfig ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.ProjectStorage.html Creates a new ProjectStorage instance with the specified project, app version, matrix base URL, and DOMPurify library. ```APIDOC ## constructor ### Description Creates a new ProjectStorage instance. ### Method constructor ### Signature `new ProjectStorage(project: string, appVersion: string, matrixBaseUrl: string, dompurifylib: any): ProjectStorage` ### Parameters - **project** (string) - Required - The project identifier. - **appVersion** (string) - Required - The application version. - **matrixBaseUrl** (string) - Required - The base URL for the matrix server. - **dompurifylib** (any) - Required - The DOMPurify library instance. ### Returns ProjectStorage ``` -------------------------------- ### initPrintingAsync(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Initializes printing functionality. ```APIDOC ## initPrintingAsync(): Promise ### Description Initializes printing functionality. ### Method initPrintingAsync ### Returns Promise ``` -------------------------------- ### getCreationDate Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Item.html Gets the creation date of the item. ```APIDOC ## getCreationDate ### Description Gets the creation date of the item. ### Method getCreationDate ### Returns Date - The creation date of the item. ``` -------------------------------- ### init Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.RiskCalculator.html Initializes the calculator with a risk value. ```APIDOC ## init(riskValue) ### Description Initializes the calculator with a risk value. ### Parameters - **riskValue** (IRiskValue) - Required - The risk value to initialize with. ### Returns void ``` -------------------------------- ### getTestStepsConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the test steps configuration. ```APIDOC ## getTestStepsConfig(category) ### Description Gets the test steps configuration. ### Parameters - **category** (string) - Required - The category. ### Returns - **ITestConfigTablesColumns** - The test config tables columns. ``` -------------------------------- ### getSetting(s) Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Retrieves a setting by its name. ```APIDOC ## getSetting(s) ### Description Retrieves a setting by its name. ### Method SDK Method ### Parameters - **s** (string) - Required - The name of the setting. ### Returns string ``` -------------------------------- ### showDialog(configPage, title, height, input, onOk, width?) Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.LineEditor.html Displays a dialog for editing lines. Takes configuration, title, height, input lines, an OK callback, and an optional width. ```APIDOC ## showDialog(configPage, title, height, input, onOk, width?) ### Description Displays a dialog for editing lines. Takes configuration, title, height, input lines, an OK callback, and an optional width. ### Method `showDialog(configPage: ConfigPage, title: string, height: number, input: ILineEditorLine[], onOk: ((update) => boolean), width?: number): void` ### Parameters - **configPage** (ConfigPage) - Required - The configuration page. - **title** (string) - Required - The title of the dialog. - **height** (number) - Required - The height of the dialog. - **input** (ILineEditorLine[]) - Required - The input lines to edit. - **onOk** ((update) => boolean) - Required - Callback invoked when OK is clicked. Receives the updated lines and returns a boolean. - **update** (ILineEditorLine[]) - The updated lines. - **width** (number) - Optional - The width of the dialog. ### Returns - **void** - No return value. ``` -------------------------------- ### getItem Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Field.html Gets the Item which contains this field. ```APIDOC ## getItem() ### Description Gets the Item which contains this field. ### Returns Item - the containing Item ``` -------------------------------- ### getValue Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.RiskCalculator.html Gets the current risk value. ```APIDOC ## getValue() ### Description Gets the current risk value. ### Returns IRiskValue - The current risk value. ``` -------------------------------- ### initItem Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes an item with the given item and jQuery UI object. Returns void. ```APIDOC ## initItem ### Description Initializes an item with the given item and jQuery UI object. Returns void. ### Method initItem ### Parameters - **item** (IItem) - Required - The item to initialize. - **jui** (JQuery) - Required - The jQuery UI object. ### Returns void ``` -------------------------------- ### getProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the project that this category belongs to. ```APIDOC ## getProject() ### Description Gets the project that this category belongs to. ### Returns Project - The project. ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TreeFolder.html Creates a new TreeFolder instance. ```APIDOC ## new TreeFolder(needs, folder, parent?) ### Description Creates a new TreeFolder instance. ### Parameters - **needs** (ITreeFolderNeeds) - Required - The needs object. - **folder** (FancyFolder) - Required - The folder object. - **parent** (TreeFolder) - Optional - The parent folder. ### Returns TreeFolder ``` -------------------------------- ### getItemConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the item configuration for the category. ```APIDOC ## getItemConfig() ### Description Gets the item configuration for the category. ### Returns ItemConfiguration - The item configuration. ``` -------------------------------- ### getEmail(user): string Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the email of a user. ```APIDOC ## getEmail(user): string ### Description Gets the email of a user. ### Parameters - **user** (string) - Required - The user. ### Returns string ``` -------------------------------- ### getDropDowns(dropdownId?): IDropDownInfo[] Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets dropdown information. ```APIDOC ## getDropDowns(dropdownId?): IDropDownInfo[] ### Description Gets dropdown information. ### Parameters - **dropdownId** (string) - Optional - The dropdown ID to filter by. ### Returns IDropDownInfo[] ``` -------------------------------- ### Render DOC to PDF and download result Source: https://matrixrequirements.github.io/matrix-sdk-docs/zee-faq Renders a DOC item to PDF using `doc.toPDF()`, then downloads the resulting PDF file via `wheely.downloadJobResult()` and writes it to disk. The output shows progress updates and the final download message. ```javascript let doc = await wheely.getItemAsDoc("DOC-8"); let jobId; let jobData; const urlToPDF = await doc.toPDF((jid, details) => { console.log(`Progress: ${details.progress}%`); if (details.progress == 100) { // When the job is finished, save information on the output. jobId = jid; jobData = details.jobFile; } }); if (jobData) { // There are several output files in DOC rendering, focus on the one which is the PDF. let fileInfo = jobData.filter(d => d.restUrl == urlToPDF)[0]; console.log(`Downloading Job ${jobId} File ${fileInfo.jobFileId} as download.pdf...`); let result = await wheely.downloadJobResult(jobId, fileInfo.jobFileId); fs.writeFileSync("download.pdf", Buffer.from(result)); } } run().then(() => process.exit(0)); ``` ```text darkstar:~/matrix-sdk-docs/codes $ node get-doc-8-pdf.js Progress: 10% Progress: 40% Progress: 40% Progress: 40% Progress: 90% Progress: 91% Progress: 91% Progress: 100% Downloading Job 4853 File 7393 as download.pdf... ``` -------------------------------- ### initServerSettings Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes server settings. This method is part of the Notifications class. ```APIDOC ## initServerSettings ### Description Initializes server settings. This method is part of the Notifications class. ### Method initServerSettings ``` -------------------------------- ### createConsoleAPI(__namedParameters) Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/functions/serverSdk.createConsoleAPI.html Creates a standalone Matrix SDK console API instance. ```APIDOC ## createConsoleAPI(__namedParameters) ### Description Creates a standalone Matrix SDK console API instance. ### Parameters - **__namedParameters** (ICreateConsoleAPIArgs) - Required - The arguments for creating the console API. ### Returns - **Promise** - A promise that resolves to a standalone Matrix SDK instance. ``` -------------------------------- ### getCategoryLabel(category): string Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the label of a category. ```APIDOC ## getCategoryLabel(category): string ### Description Gets the label of a category. ### Parameters - **category** (string) - Required - The category to get the label for. ### Returns string ``` -------------------------------- ### initProject Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes a project. This method is part of the Notifications class. ```APIDOC ## initProject ### Description Initializes a project. This method is part of the Notifications class. ### Method initProject ``` -------------------------------- ### getCategoryId(category): string Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the ID of a category. ```APIDOC ## getCategoryId(category): string ### Description Gets the ID of a category. ### Parameters - **category** (string) - Required - The category to get the ID for. ### Returns string ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PrintProcessor.html Creates a new instance of the PrintProcessor class. ```APIDOC ## constructor ### Description Creates a new PrintProcessor instance. ### Method constructor ### Returns PrintProcessor ``` -------------------------------- ### getCategoryGroupConfig(): ICategoryGroups Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the category group configuration. ```APIDOC ## getCategoryGroupConfig(): ICategoryGroups ### Description Gets the category group configuration. ### Returns ICategoryGroups ``` -------------------------------- ### getProjectMenuItems(): IPluginMenuAction[] Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Returns a list of menu items to be added to the project list. ```APIDOC ## getProjectMenuItems(): IPluginMenuAction[] ### Description Returns a list of menu items to be added to the project list. ### Method getProjectMenuItems ### Returns IPluginMenuAction[] ``` -------------------------------- ### getServerSettings(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Returns server settings (also called customer settings). ```APIDOC ## getServerSettings(): Promise ### Description Returns server settings (also called customer settings). ### Method SDK Method ### Returns Promise - A GetSettingAck object describing all the server settings. ``` -------------------------------- ### getCategories(noFolders?): string[] Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the list of categories. ```APIDOC ## getCategories(noFolders?): string[] ### Description Gets the list of categories. ### Parameters - **noFolders** (boolean) - Optional - If true, excludes folders. ### Returns string[] ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.SimpleItemTools.html Creates a new instance of the SimpleItemTools class. ```APIDOC ## constructor ### Description Creates a new SimpleItemTools instance. ### Method constructor ### Signature new SimpleItemTools(): SimpleItemTools ### Returns SimpleItemTools ``` -------------------------------- ### getNextDHFFieldName Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.DocItem.html Get the next section that needs to be filled. ```APIDOC ## getNextDHFFieldName ### Description Get the next section that needs to be filled. ### Method SDK Method ### Signature `getNextDHFFieldName(): string` ### Returns - **string** - The name of the next DHF field. ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ReviewControlColumns.html Creates a new instance of the ReviewControlColumns class. ```APIDOC ## constructor ### Description Creates a new instance of the ReviewControlColumns class. ### Method constructor ### Returns ReviewControlColumns ``` -------------------------------- ### getFieldMask Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.DocItem.html Gets the ItemFieldMask which specifies which fields are loaded. ```APIDOC ## getFieldMask ### Description Gets the ItemFieldMask which specifies which fields are loaded. ### Method SDK Method ### Signature `getFieldMask(): ItemFieldMask` ### Returns - **ItemFieldMask** - An ItemFieldMask object. ``` -------------------------------- ### getProjectSettingPagesAsync(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.PluginCore.html Retrieves project setting pages for the plugin. ```APIDOC ## getProjectSettingPagesAsync(): Promise ### Description Retrieves project setting pages for the plugin. ### Method getProjectSettingPagesAsync ### Returns Promise ``` -------------------------------- ### getTestStepsResultsConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the test steps results configuration. ```APIDOC ## getTestStepsResultsConfig() ### Description Gets the test steps results configuration. ### Returns - **ITestStepsResultsConfig** - The test steps results configuration. ``` -------------------------------- ### getTestRunResultPlaceholder Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the test run result placeholder. ```APIDOC ## getTestRunResultPlaceholder(value) ### Description Gets the test run result placeholder. ### Parameters - **value** (string) - Required - The value. ### Returns - **string** - The placeholder string. ``` -------------------------------- ### getTestRunResultOptions Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.TestManager.html Gets the test run result options. ```APIDOC ## getTestRunResultOptions() ### Description Gets the test run result options. ### Returns - **ITestStepsResultOption[]** - An array of test steps result options. ``` -------------------------------- ### initItem Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Initializes an item. This method is part of the Notifications class. ```APIDOC ## initItem ### Description Initializes an item. This method is part of the Notifications class. ### Method initItem ``` -------------------------------- ### getTestConfig Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Gets the test manager configuration for the category. ```APIDOC ## getTestConfig() ### Description Gets the test manager configuration for the category. ### Returns TestManagerConfiguration - The test manager configuration. ``` -------------------------------- ### openCurrentProjectFromSession(): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Opens the current project from the session. Calls openProject() with the session's current project string. ```APIDOC ## openCurrentProjectFromSession(): Promise ### Description The session object contains a string that represents the "current project." This convenience method calls openProject() with that string. ### Returns Promise - A valid Project object, or null if the session has no project. ``` -------------------------------- ### Get first REQ item details with getItem() Source: https://matrixrequirements.github.io/matrix-sdk-docs Retrieves the first REQ item from the search results and prints its ID, title, and HTML description. Uses `getItem()` with the first ID from `searchForIds()`, then accesses the Description field handler to get its HTML content. ```javascript const lib = require("./lib.js"); async function run() { const server = await lib.getServerConnection("clouds5"); // List the projects available on this server: const project = await server.openProject("WHEELY_OBSERVABLE"); const reqs = await project.searchForIds("mrql:Category=REQ"); const wheelyFirstREQ = await project.getItem(reqs[0]); console.log("ID: " + wheelyFirstREQ.getId()); console.log("Title: " + wheelyFirstREQ.getTitle()); const descriptionHandler = wheelyFirstREQ.getSingleFieldByName("Description").getHandler(); const desc = descriptionHandler.getHtml(); console.log(`Description: ${desc}`); } run().then(() => process.exit(0)); ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.NotificationsBL.html Creates a new instance of NotificationsBL. ```APIDOC ## constructor ### Description Creates a new instance of NotificationsBL. ### Method constructor ### Signature new NotificationsBL(): NotificationsBL ### Returns NotificationsBL ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.Category.html Creates a new Category instance with the given category identifier and project. ```APIDOC ## new Category(category, project) ### Description Creates a new Category instance. ### Parameters - **category** (string) - Required - The category identifier. - **project** (Project) - Required - The project that this category belongs to. ### Returns Category - The newly created Category instance. ``` -------------------------------- ### getCombinedName(user): string Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the combined name of a user. ```APIDOC ## getCombinedName(user): string ### Description Gets the combined name of a user. ### Parameters - **user** (XRUserType | XRUserPermissionType) - Required - The user. ### Returns string ``` -------------------------------- ### getId Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.DocItem.html Get the unique Id of the Item within the Project. ```APIDOC ## getId ### Description Get the unique Id of the Item within the Project. ### Method SDK Method ### Signature `getId(): string` ### Returns - **string** - A string value containing the Item Id. ``` -------------------------------- ### setUplinks(upLinks): Item Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.DocItem.html Replaces the uplinks of the Item. ```APIDOC ## setUplinks(upLinks): Item ### Description Replaces the current array of uplinks with a new one. ### Method setUplinks ### Parameters - **upLinks** (IReference[]) - Required - The new array of uplinks. ### Returns Item - the Item itself. ``` -------------------------------- ### constructor Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.LabelManager.html Creates a new LabelManager instance with the provided logger, JSON tools, and configuration getter. ```APIDOC ## constructor ### Description Creates a new LabelManager instance. ### Signature `new LabelManager(logger, json, getConfig): LabelManager` ### Parameters - **logger** (ILoggerTools) - Required - Logger tools for logging. - **json** (IJSONTools) - Required - JSON tools for JSON operations. - **getConfig** (GetItemConfigFunction) - Required - Function to get item configuration. ### Returns LabelManager ``` -------------------------------- ### getDownLinkTypes(category, required): string[] Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets the downlink types for a category. ```APIDOC ## getDownLinkTypes(category, required): string[] ### Description Gets the downlink types for a category. ### Parameters - **category** (string) - Required - The category. - **required** (boolean) - Required - Whether only required types are returned. ### Returns string[] ``` -------------------------------- ### getCategorySetting(category, setting): ICategorySetting Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.ItemConfiguration.html Gets a specific setting for a category. ```APIDOC ## getCategorySetting(category, setting): ICategorySetting ### Description Gets a specific setting for a category. ### Parameters - **category** (string) - Required - The category. - **setting** (string) - Required - The setting name. ### Returns ICategorySetting ``` -------------------------------- ### getNotificationCount Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/clientSdk.Notifications.html Gets the notification count. This method is part of the Notifications class. ```APIDOC ## getNotificationCount ### Description Gets the notification count. This method is part of the Notifications class. ### Method getNotificationCount ``` -------------------------------- ### setItemConfig(newItemConfig): void Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Sets a new item configuration. ```APIDOC ## setItemConfig(newItemConfig): void ### Description Sets a new item configuration. ### Method setItemConfig ### Parameters - **newItemConfig** (ItemConfiguration) - Required - The new item configuration. ### Returns void ``` -------------------------------- ### putServerSetting(key, value): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Puts a server setting (also called a customer setting). ```APIDOC ## putServerSetting(key, value): Promise ### Description Put a server setting (also called a customer setting). ### Parameters - **key** (string) - Required - the key to save the setting under - **value** (string) - Required - the value of the setting ### Returns Promise ``` -------------------------------- ### getTreeFromProject(projectName): Promise Source: https://matrixrequirements.github.io/matrix-sdk-docs/reference/classes/serverSdk.StandaloneMatrixSDK.html Gets the tree structure from a specified project. ```APIDOC ## getTreeFromProject(projectName): Promise ### Description Gets the tree structure from a specified project. ### Method SDK Method ### Parameters - **projectName** (string) - Required - The name of the project. ### Returns Promise - A promise that resolves to an array of title and ID pairs. ```