### Install Dependencies and Start App Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/022_framework-integration/003_integration-react.mdx Installs project dependencies using npm and starts the application in development mode. ```shell npm run bootstrap ``` ```shell npm run dev ``` -------------------------------- ### Base Store Setup Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/01_foundation-store/examples.mdx This snippet shows the basic setup for a store, which is a prerequisite for the examples. Ensure your project has a similar store configuration. ```javascript import { writable } from 'svelte/store'; export const count = writable(0); ``` -------------------------------- ### Start a Process with Custom Arguments Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx This example shows how a process is started with specific JVM arguments, system properties, and logging levels, as defined in the processes.xml file. ```bash java -Xmx256m -DXSD_VALIDATE=false global.genesis.process.GenesisProcessBootstrap -name GENESIS_AUTH_DATASERVER -scan global.genesis.dataserver.pal -module genesis-pal-dataserver -script genesis-dataserver.kts -loggingLevel INFO,DATADUMP_OFF >/dev/null 2> $L/GENESIS_AUTH_DATASERVER.log.err & ``` -------------------------------- ### Basic Store Setup Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/01_foundation-store/index.mdx Illustrates the basic structure for setting up a root store. This example is intended to provide a general idea of store configuration. ```typescript // React and angular stores require a layer to work with the dependency injection. See later code snippet in this file ``` -------------------------------- ### Foundation Store Legacy Setup Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/01_foundation-store/legacy-setup.mdx This code demonstrates the setup and lifecycle management for a legacy Foundation Store integration. It includes event subscriptions, component registration, and custom event dispatching. ```typescript router.events.subscribe((event: any) => { if (event instanceof NavigationEnd) { this.layoutName = getLayoutNameByRoute(event.urlAfterRedirects); } }); } ngOnInit() { this.addEventListeners(); this.readyStore(); registerStylesTarget(this.el.nativeElement, 'main'); this.loadRemotes(); } ngOnDestroy() { this.removeEventListeners(); this.disconnectStore(); } async loadRemotes() { await registerComponents(); } addEventListeners() { this.el.nativeElement.addEventListener('store-connected', this.store.onConnected); } removeEventListeners() { this.el.nativeElement.removeEventListener('store-connected', this.store.onConnected); } readyStore() { this.dispatchCustomEvent('store-connected', this.el.nativeElement); this.dispatchCustomEvent('store-ready', true); } disconnectStore() { this.dispatchCustomEvent('store-disconnected'); } dispatchCustomEvent(type: string, detail?: any) { this.el.nativeElement.dispatchEvent(customEventFactory(type, detail)); } ngAfterViewInit() { } } ``` -------------------------------- ### Global Service Definitions Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/017_runtime-configuration/04_service-definition/index.mdx An example of a `global-service-definitions.xml` file after installing multiple products, showing various services and their configurations. ```xml ``` -------------------------------- ### Custom Install Hook Script Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx An example of an install hook script that calls a Kotlin script to update database records. The install hook script itself is a bash script. ```bash #!/bin/bash echo "InstallHook migrating EXCHANGE records with CODE null or empty, to be 'N/A'" GenesisRun exchangeCodeNA-script.kts exit $? ``` -------------------------------- ### Custom JSDOM Setup Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/024_testing/index.mdx Provides an example of how to set up custom JSDOM configurations for testing. ```typescript // custom code export * from '@genesislcap/foundation-testing/jsdom'; ``` -------------------------------- ### Full Example: Testing a Web Component Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/002_server-communications/11_testing.mdx A comprehensive example demonstrating the setup and execution of tests for a custom web component, including defining test components, configuring mocks, and writing test cases using `createComponentSuite`. ```typescript import { customElement, html, ref } from '@microsoft/fast-element'; import { assert, createComponentSuite, sinon, testSpy } from '@genesislcap/foundation-testing'; import { GridProGenesisDatasource } from './grid-pro-genesis-datasource'; import { AuthMock, ConnectMock, DatasourceMock, SocketMock } from '@genesislcap/foundation-comms'; import { Registration } from '@microsoft/fast-foundation'; // Step 1: Define your test components by extending the components to be tested @customElement({ name: 'my-example-component-test', }) @testSpy export class MyExampleComponentTest extends MyExampleComponent {} // Step 2: Configure the required mocks for services your component depends on const authMock = new AuthMock(); const connectMock = new ConnectMock(); const datasourceMock = new DatasourceMock(); const socketMock = new SocketMock(); connectMock.nextMetadata = { TYPE: 'DATASERVER' }; connectMock.socket = socketMock; // Configuring mocks and test component registration const mocks = [ Registration.instance(Auth, authMock), Registration.instance(Connect, connectMock), Registration.instance(Datasource, datasourceMock), Registration.instance(Socket, socketMock), ]; // Step 3: Write test cases using createComponentSuite to define your test suite const Suite = createComponentSuite( 'MyExampleComponent Tests', () => new MyExampleComponentTest(), null, mocks, ); // Example test case: Verify component creation in the DOM Suite('Can be created in the DOM', async ({ element }) => { assert.ok(element, 'Component did not initialize in the DOM'); // Additional assertions and interactions with the test component }); // Additional test cases as needed... Suite.run(); // Don't forget to execute the test suite ``` -------------------------------- ### Foundation Store Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/02_foundation-redux/index.mdx Illustrates manual immutability handling and custom event setup in the foundation store. ```typescript this.createListener( StoreEvents.DeleteViewDerivedField, ({ view, field }) => { const { [field]: fieldToDelete, ...rest } = this.commit.genesisCreateConfig.views.views[view]?.derivedFields || {}; if (fieldToDelete) { this.commit.genesisCreateConfig = { ...this.genesisCreateConfig, views: { views: { ...this.genesisCreateConfig.views.views, [view]: { ...this.genesisCreateConfig.views.views[view], derivedFields: { ...rest, }, }, }, }, }; } }, ); ``` -------------------------------- ### Example processes.xml Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/017_runtime-configuration/03_processes/index.mdx This XML snippet shows a complete configuration for an application with multiple processes including Data Server, Request Server, Event Handler, Consolidator, Streamer, and Streamer Client. It details various tags like groupId, start, options, module, package, script, description, language, classpath, config, and dependency. ```xml POSITION_APP true -Xmx256m genesis-pal-dataserver global.genesis.dataserver.pal Displays real-time details pal quickfixj-core-*.jar POSITION_APP true -Xmx256m genesis-pal-requestserver global.genesis.requestreply.pal Server one-shot requests for details pal POSITION_APP true -Xmx256m -DRedirectStreamsToLog=true genesis-pal-eventhandler global.genesis.eventhandler.pal Handles events position_app-messages*,position_app-eventhandler* pal POSITION_APP true -Xmx256m -DRedirectStreamsToLog=true -DXSD_VALIDATE=false consolidator2 global.genesis.consolidator2 position_app-consolidator2.xml INFO,DATADUMP_OFF POSITION_APP_EVENT_HANDLER true -Xmx128m -DXSD_VALIDATE=false genesis-pal-streamerclient global.genesis.streamerclient.pal true -Xmx128m -DXSD_VALIDATE=false genesis-pal-streamer global.genesis.streamer.pal /home/genesis/appstreamer.properties ``` -------------------------------- ### Running Genesis Start with Local Gradle Distribution Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/002_launchpad/running-locally.mdx If the Gradle Wrapper was excluded, use this command to run genesisStart with a locally installed Gradle distribution. Ensure your Gradle version is 8.10.2 or higher. ```bash /path/to/gradle-8.10.2/bin/gradle genesisStart ``` -------------------------------- ### Start the Server Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx This is the basic command to start the server. Ensure any prerequisites like daemon script controller are enabled if using specific options. ```bash startServer ``` -------------------------------- ### Example System Definition with DbHost Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/017_runtime-configuration/07_database-configuration/index.mdx An example of a complete system definition block including the DbHost item for PostgreSQL. ```kotlin systems { system(name = "DEV") { hosts { host(name = "genesis-serv") } item(name = "DbHost", value = "jdbc:postgresql://localhost:5432/postgres?user=postgres&password=Password5432") item(name = "DbNamespace", value = "genesis") item(name = "ClusterPort", value = "6000") item(name = "Location", value = "LO") item(name = "LogFramework", value = "LOG4J2") item(name = "LogFrameworkConfig", value = "log4j2-default.xml") } } ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/README.md Run this command to install all necessary project dependencies. ```bash npm i ``` -------------------------------- ### Start DbMon Session Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/02_dbmon.mdx Initiates a DbMon session by typing 'DbMon' at the command prompt after switching to the Genesis installation owner user. ```javascript [titian] /home/titian >DbMon ================================== Genesis database Monitor Enter 'help' for a list of commands ================================== DbMon> ``` -------------------------------- ### Install Dependencies Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/022_framework-integration/002_integration-angular.mdx Run this command from your project's root folder to install all necessary project dependencies. ```shell npm run bootstrap ``` -------------------------------- ### Global Environment Indicator Configuration Setup Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/025_env-files/environment-indicator.mdx Provides an example of how to globally configure the environment indicator using dependency injection. This sets up default or custom configurations for the entire application. ```typescript import { configureEnvironmentIndicator } from '@genesislcap/foundation-ui'; // Configure environment indicator with custom configs await configureEnvironmentIndicator({ currentLevel: 'dev', configs: [ { level: 'dev', label: 'DEVELOPMENT', backgroundColor: '#ff6b35', textColor: '#ffffff', showIcon: true, icon: 'code', size: 'sm' }, { level: 'test', label: 'TESTING', backgroundColor: '#ffc107', textColor: '#000000', showIcon: true, icon: 'flask', size: 'sm' }, { level: 'prod', label: 'PRODUCTION', backgroundColor: '#28a745', textColor: '#ffffff', showIcon: true, icon: 'check-circle', size: 'sm' } ] }); ``` -------------------------------- ### Run Genesis App with Database Install Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/02_deploy/002_hosting-infrastructure/06_containers/index.mdx Initializes the database by setting the GENESIS_DB_INSTALL environment variable. The container exits after installation. ```bash docker run -e GENESIS_DB_INSTALL=true genesis/appname:1.0.0-SNAPSHOT ``` -------------------------------- ### Start a Process Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx Use this command to start a specific process by its name. The script looks in the processes.xml file to find out how to start the process. ```bash startProcess APP_EVALUATOR ``` -------------------------------- ### Build and Run Docker Images Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/static/snippet/_environment_setup_docker.mdx Build the project's Docker images and start the containers in detached mode. Ensure you have Docker and Rancher Desktop installed and running. ```shell ./gradlew assemble docker-compose build docker-compose up -d ``` -------------------------------- ### GPAL Data Server Script Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/001_gpal-standards/migration-guide-script-to-compiled.mdx This is an example of a Data Server definition written in a GPAL script file. ```kotlin query("ALL_TRADES", TRADE_VIEW) { config { compression = true } indices { unique("BY_ID") { TRADE_ID } } } ``` -------------------------------- ### Usage Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/002_server-communications/02_authentication.mdx Provides a JavaScript example demonstrating how to use the authentication methods. ```APIDOC ## Usage Example ```javascript import { Auth, BasicAuthInfo, AuthType } from '@genesislcap/foundation-comms'; export class MyExampleClass { @Auth auth: Auth; async function loginUser() { const credentials: BasicAuthInfo = { type: AuthType.BASIC, username: 'user@example.com', password: 'password123', }; try { const result = await this.auth.login(credentials); console.log('Login successful:', result); } catch (error) { console.error('Login failed:', error); } } async function logoutUser() { try { await this.auth.logout(); console.log('Logout successful'); } catch (error) { console.error('Logout failed:', error); } } async function reAuthenticateUser() { try { await this.auth.reAuthFromSession(); console.log('Re-authentication successful'); } catch (error) { console.error('Re-authentication failed:', error); } } } ``` ``` -------------------------------- ### PopulateHolidays Command Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx Example of using the PopulateHolidays command with year, country, and region arguments. ```bash PopulateHolidays -y 2020,2021 -c BR,GB -r rj,en ``` -------------------------------- ### Example URLTargetingParams Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/010_filters/docs/api/foundation-filters.urltargetingparams.md An example configuration for URL targeting, specifying allowed schemes and hosts. ```json { "schemes": ["https"], "hosts": ["neptx.genesislab.global", "neptune-uat2-axes-server2"] } ``` -------------------------------- ### Start Local Development Server Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/README.md Starts a local development server. Changes are often reflected live without a server restart. ```bash npm run start ``` -------------------------------- ### Unpack and Launch Genesis Start Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/002_launchpad/running-locally.mdx Navigate to your workspace, unzip the project archive, change directory to the server, make the Gradle wrapper executable, and run the genesisStart task. ```bash cd /path/to/workspace unzip ~/Downloads/my-application.zip cd my-application/server chmod +x gradlew* ./gradlew genesisStart ``` -------------------------------- ### TimeWindowParams with ISO 8601 Start Date Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/010_filters/docs/api/foundation-filters.timewindowparams.md Example of TimeWindowParams specifying only the start date using the ISO 8601 format with timezone offset. ```json { "start": "2023-01-01T00:00:00.000+00:00" } ``` -------------------------------- ### Custom Endpoint Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/011_integrations/04_custom-endpoints/index.mdx This example demonstrates a GET request to a custom endpoint '/trade-service/trades' with a query parameter 'trade-id' and its corresponding successful response. ```APIDOC ## GET /trade-service/trades?trade-id=1 ### Description Retrieves trade information based on the provided trade ID. ### Method GET ### Endpoint /trade-service/trades?trade-id=1 ### Parameters #### Query Parameters - **trade-id** (integer) - Required - The ID of the trade to retrieve. ### Request Example ```http GET /trade-service/trades?trade-id=1 HTTP/1.1 Host: localhost:9064 Content-Type: application/json SESSION_AUTH_TOKEN: 83eLYBnlqjIWt1tqtJhKwTXJj2IL2WA0 ``` ### Response #### Success Response (200) - **TRADE_ID** (integer) - The unique identifier for the trade. - **TRADE_PRICE** (number) - The price of the trade. - **DIRECTION** (string) - The direction of the trade (e.g., BUY). - **QUANTITY** (integer) - The quantity of the instrument traded. - **DATE** (integer) - The timestamp of the trade. - **COUNTERPARTY_ID** (integer) - The ID of the counterparty. - **COUNTERPARTY_CODE** (string) - The code of the counterparty. - **COUNTERPARTY_NAME** (string) - The name of the counterparty. - **INSTRUMENT_NAME** (string) - The name of the instrument traded. - **NOTIONAL** (integer) - The notional value of the trade. #### Response Example ```json { "TRADE_ID" : 1, "TRADE_PRICE" : 224.34, "DIRECTION" : "BUY", "QUANTITY" : 1000, "DATE" : 1730678400000, "COUNTERPARTY_ID" : 1, "COUNTERPARTY_CODE" : "GEN", "COUNTERPARTY_NAME" : "Genesis", "INSTRUMENT_NAME" : "AAPL", "NOTIONAL" : 224340 } ``` ``` -------------------------------- ### Start Development Server Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/022_framework-integration/002_integration-angular.mdx Execute this command to launch the application in development mode. The server will be available on localhost. ```shell npm run dev ``` -------------------------------- ### Migrate Dictionary Install Hook Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/03_operate/002_commands/index.mdx An install hook script that executes the MigrateDictionary command with the DB destination. This is an example of a shell script calling another utility. ```shell #!/bin/bash MigrateDictionary -dst DB exit $? ``` -------------------------------- ### Run Genesis Start on Windows Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/003_genesis-start/index.mdx Execute the Genesis Start command on a Windows environment. Navigate to your project's `server` directory before running. ```shell .\gradlew.bat genesisStart ``` -------------------------------- ### Time Window Filter Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/010_filters/index.mdx Demonstrates the usage of the `timeWindow` filter with dynamically set start and end dates. This example is interactive and allows users to test the filter's behavior. ```javascript import FiltersDemo from '../../../../examples/ui/client-capabilities/filters/filters.js'; ``` -------------------------------- ### Install Server Distribution (Change Directory) Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/02_deploy/002_hosting-infrastructure/03_initial-application-install/index.mdx Install a server distribution by changing to the target directory first, then unzipping the archive. Ensure the `runUser` and `installDate` variables are set correctly. ```shell installDir=$(date +%Y%m%d) runUser= cd /data/${runUser}/server/${installDate}/run; unzip ``` -------------------------------- ### Global and Query Configuration Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/004_real-time-queries-data-server/index.mdx Demonstrates setting global Data Server configurations and overriding specific settings at the query level. Global settings like lmdbAllocateSize and compression are defined first, followed by query-specific configurations such as defaultCriteria. ```kotlin dataServer { config { lmdbAllocateSize = 512.MEGA_BYTE() // top level only setting // Items below can be overridden in individual query definitions compression = true chunkLargeMessages = true defaultStringSize = 40 maxBytesPerCharacter = 1 batchingPeriod = 500 linearScan = true excludedEmitters = listOf("PurgeTables") enableTypeAwareCriteriaEvaluator = true serializationType = SerializationType.KRYO // Available from version 7.0.0 onwards serializationBufferMode = SerializationBufferMode.ON_HEAP // Available from version 7.0.0 onwards directBufferSize = 8096 // Available from version 7.0.0 onwards importEntityIndices = false } query("SIMPLE_QUERY", SIMPLE_TABLE) { config { // Items below only available in query level config defaultCriteria = "SIMPLE_PRICE > 0" backwardsJoins = false disableAuthUpdates = false } } } ``` -------------------------------- ### Basic Store Setup with Redux Toolkit Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/02_foundation-redux/index.mdx Demonstrates setting up a Redux store with slices, actions, selectors, and subscribing to store changes in a Genesis component. ```typescript import { createStore } from '@genesislcap/foundation-redux'; import { createSlice } from '@reduxjs/toolkit'; import { customElement, GenesisElement, observable } from '@genesislcap/web-core'; // Define your slices const userSlice = createSlice({ name: 'user', initialState: { name: '', email: '' }, reducers: { setUser: (state, action) => { state.name = action.payload.name; state.email = action.payload.email; }, clearUser: (state) => { state.name = ''; state.email = ''; }, }, selectors: { getUserName: (state) => state.name, getUserEmail: (state) => state.email, }, }); // Create the store const { store, actions, selectors } = createStore([userSlice], {}); @customElement({ name: 'user-component', template: html`
Hello ${(x) => x.userName}!
`, }) export class UserComponent extends GenesisElement { @observable userName = ''; connectedCallback() { super.connectedCallback(); // Subscribe to store changes store.subscribeKey( (state) => state.user.name, (state) => { this.userName = state.user.name; } ); } handleLogin() { actions.user.setUser({ name: 'John Doe', email: 'john@example.com' }); } } ``` -------------------------------- ### Install Custom Reporting Component in Header (Genesis Syntax) Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/04_business-components/03_reporting/02_developer-guide/index.mdx Example of how to install a custom reporting component into the application header using Genesis syntax. This involves copying and altering an existing route configuration. ```json { path: 'reporting', element: PBCReporting, title: 'Reporting', name: 'reporting', navItems: [ { title: 'Reporting', icon: { name: 'cog', variant: 'solid', }, permission: '', }, ], } ``` -------------------------------- ### Optimistic Concurrency Startup Logging Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/003_data-access-apis/index.mdx Shows the format of log output when optimistic concurrency is enabled, detailing the global mode and table-specific configurations. ```text Optimistic concurrency check enabled. Configuration: Global mode = STRICT Strict tables = [TRADE, ORDER] Lax tables = [INSTRUMENT, COUNTERPARTY] None tables = [SYSTEM_CONFIG] ``` -------------------------------- ### Install Server Distribution (Specify Directory) Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/02_deploy/002_hosting-infrastructure/03_initial-application-install/index.mdx Install a server distribution by specifying the target directory using the `-d` flag with the `unzip` command. Ensure the `runUser` and `installDate` variables are set correctly. ```shell unzip -d /data/${runUser}/server/${installDate}/run ``` -------------------------------- ### Example DatasourceConfiguration Object Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/002_entity-manager/docs/api/foundation-entity-management.datasourceconfiguration.md An example object illustrating the properties that can be set for DatasourceConfiguration, such as criteria, fields, and various view and polling options. ```javascript type DatasourceConfiguration = { criteria?: string; fields?: string; isSnapshot?: boolean; maxRows?: number; maxView?: number; movingView?: boolean; pollingInterval?: number; orderBy?: string; reverse?: boolean; } ``` -------------------------------- ### init(options, fetchMeta, startStream) Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/002_server-communications/docs/api/foundation-comms.defaultdatasource.md Initializes the datasource with provided options, fetch metadata, and stream start configuration. ```APIDOC ## init(options, fetchMeta, startStream) ### Description Initializes the datasource. ### Method Not specified (likely a method call on an object instance) ### Endpoint N/A (SDK method) ### Parameters * **options** (any) - Required - Configuration options for initialization. * **fetchMeta** (any) - Required - Metadata for fetching resources. * **startStream** (any) - Required - Configuration for starting the stream. ### Request Example N/A ### Response N/A ``` -------------------------------- ### System Definition Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/012_custom-components/index.mdx Example of a genesis-system-definition.kts file showing how to define global items with names and values. ```kotlin systemDefinition { global { item(name = "CONFIG_FILE_NAME", value = "/data/") // other params omitted for simplicity } } ``` -------------------------------- ### Override Process XML Settings Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/017_runtime-configuration/02_system-definition/index.mdx Example of overriding the 'start' property for a process named 'GENESIS_AUTH_PERMS' using a system definition property in genesis-system-definition.kts. ```xml AUTH true true -Xmx256m -DXSD_VALIDATE=false auth-perms global.genesis.auth.perms Manages entity level user authorisation ``` ```kotlin item(name = "GENESIS_AUTH_PERMS_PROCESS_START", value = "false") ``` -------------------------------- ### Running a Launch Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/002_launchpad/02_genesis-cloud-workspace/index.mdx To run a launch configuration, navigate to the 'Run and Debug' panel, select the desired command from the dropdown, and click the start button. ```bash 1. Click on the `Run and Debug` button on the side menu at the left to display the `RUN AND DEBUG` panel at the top left of the VSCode window. 2. Click in the `RUN AND DEBUG` field and select a command from the dropdown list. 3. Click on the start button to the left of the field. ``` -------------------------------- ### React: Simple GridPro Column Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/003_grid-pro/grid-pro_03_cell_and_column.mdx Shows a basic GridPro column setup in React, passing a single column definition and its renderer/params to the components. ```tsx export function MyElement() { const colDefs: ColDef[] = customColDefs; // refer to above example return ( ); }; ``` -------------------------------- ### Example genesis-system-definition.kts Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/017_runtime-configuration/02_system-definition/index.mdx This snippet shows a complete example of a genesis-system-definition.kts file for an application named 'position', demonstrating global, system, and host configurations. ```kotlin package genesis.cfg systemDefinition { global { item(name = "DEPLOYED_PRODUCT", value = "position") item(name = "MqLayer", value = "ZeroMQ") item(name = "DbLayer", value = "H2") item(name = "DictionarySource", value = "DB") item(name = "AliasSource", value = "DB") item(name = "MetricsEnabled", value = "false") item(name = "ZeroMQProxyInboundPort", value = "5001") item(name = "ZeroMQProxyOutboundPort", value = "5000") item(name = "DbHost", value = "localhost") item(name = "DbMode", value = "POSTGRESQL") item(name = "GenesisNetProtocol", value = "V2") item(name = "ResourcePollerTimeout", value = "5") item(name = "ReqRepTimeout", value = "60") item(name = "MetadataChronicleMapAverageKeySizeBytes", value = "128") item(name = "MetadataChronicleMapAverageValueSizeBytes", value = "1024") item(name = "MetadataChronicleMapEntriesCount", value = "512") item(name = "DaemonServerPort", value = "4568") item( name = "JVM_OPTIONS", value = "-XX:MaxHeapFreeRatio=70 -XX:MinHeapFreeRatio=30 -XX:+UseG1GC -XX:+UseStringDeduplication -XX:OnOutOfMemoryError=\"handleOutOfMemoryError.sh %p\"" ) } systems { system(name = "DEV") { hosts { host(name = "genesis-serv") } item(name = "DbNamespace", value = "genesis") item(name = "ClusterPort", value = "6000") item(name = "Location", value = "LO") item(name = "LogFramework", value = "LOG4J2") item(name = "LogFrameworkConfig", value = "log4j2-default.xml") } } } ``` -------------------------------- ### Genesis: Simple GridPro Column Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/003_grid-pro/grid-pro_03_cell_and_column.mdx Demonstrates a simple GridPro column setup in Genesis, binding a single column definition and its cell renderer/params. ```typescript @customElement({ name: 'my-element', template: html` `, }) export class MyElement extends GenesisElement { @observable colDefs: ColDef[] = customColDefs; // refer to above example } ``` -------------------------------- ### Data Server Integration Test Setup Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/004_real-time-queries-data-server/index.mdx Sets up the test environment for the Data Server using AbstractGenesisTestSupport. Includes package names, Genesis home, script file, and initial data file. ```kotlin class DataServerTests : AbstractGenesisTestSupport>( GenesisTestConfig { addPackageName("global.genesis.dataserver.pal") genesisHome = "/GenesisHome/" scriptFileName = "positions-app-tutorial-dataserver.kts" initialDataFile = "seed-data.csv" } ) { private var ackReceived = false private var initialData: GenesisSet = GenesisSet() private var updateData: GenesisSet = GenesisSet() @Before fun before() { ackReceived = false initialData = GenesisSet() updateData = GenesisSet() messageClient.handler.addListener { set, _ -> println(set) if ("LOGON_ACK" == set.getString(MessageType.MESSAGE_TYPE)) { ackReceived = true } if ("QUERY_UPDATE" == set.getString(MessageType.MESSAGE_TYPE)) { if (initialData.isEmpty) { initialData = set } else { updateData = set } } } } ``` -------------------------------- ### Get the current value of MulticolumnDropdown Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/003_grid-pro/docs/api/grid-pro.multicolumndropdown.value.md Use the getter to retrieve the current string value selected in the MulticolumnDropdown. No setup is required beyond having an instance of the component. ```typescript get value(): string; ``` -------------------------------- ### Angular AppComponent Store Initialization Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/018_state-management/01_foundation-store/legacy-setup.mdx Example of an Angular AppComponent demonstrating store initialization. This snippet focuses on the component's lifecycle hooks and initial setup. ```typescript @Component({ selector: 'fixedincome-root', templateUrl: './app.component.html', styleUrl: './app.component.css', }) export class AppComponent implements OnInit, OnDestroy, AfterViewInit { layoutName?: LayoutComponentName; title = 'Fixed Income'; store = getStore(); constructor( private el: ElementRef, router: Router, ) { configureFoundationLogin({ router }); // Set layout componet based on route ``` -------------------------------- ### Serve Production Bundle Locally Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/007_genx/index.mdx The serve command previews a production bundle locally by starting a static HTTP server in the dist folder. Specify a port with `--port` or it defaults to the one in package.json. ```bash genx serve --port 6060 ``` ```bash genx serve --help ``` -------------------------------- ### Register Reporting UI as a Custom Element Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/04_business-components/03_reporting/02_developer-guide/index.mdx Use this example to install and use the Reporting UI as a custom component, which is useful for specific styling customizations. Ensure the component is registered. ```typescript // Register the component. You could instead do this in a file such as components.ts import { RapidReporting } from '@genesislcap/pbc-reporting-ui' RapidReporting; @customElement({ name: 'reporting-pbc', template: html``, }) export class PBCReporting extends GenesisElement { } ``` -------------------------------- ### Example Configuration Precedence Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/003_data-access-apis/index.mdx Illustrates how table-specific and global configurations are applied based on precedence rules. ```properties DbOptimisticConcurrencyMode=STRICT DbOptimisticConcurrencyTable_TRADE=LAX DbOptimisticConcurrencyTable_SYSTEM_CONFIG=NONE ``` -------------------------------- ### Accordion Usage in Angular Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/008_interaction/accordian.mdx Example of integrating the Accordion component within an Angular application. This snippet illustrates the setup for multiple accordion items, including an initially expanded one. ```typescript import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; @Component({ selector: 'my-root', template: ` Panel one Panel one content Panel two Panel two content Panel three Panel three content `, standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class AppComponent { } ``` -------------------------------- ### Configure Foundation Form with JSON Schema Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/007_forms/002_smart-forms/index.mdx Integrate the foundation-form component by binding a JSON schema to the `jsonSchema` input. This example demonstrates basic setup within an Angular component. ```typescript import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core"; import { FormsModule } from "@angular/forms"; import { uiSchemaExample } from "./ui-schema-example"; import { jsonSchemaExample } from "./json-schema-example"; @Component({ selector: "app-root", template: ` `, standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], imports: [FormsModule], }) export class AppComponent { uiSchema = uiSchemaExample; jsonSchema = jsonSchemaExample; } ``` -------------------------------- ### Initialize New Project Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/007_genx/index.mdx Creates a new project with the specified name. The command prompts for basic project configuration. ```terminal npx -y @genesislcap/genx@latest init ``` -------------------------------- ### Custom REST API Request Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/011_integrations/04_custom-endpoints/index.mdx Demonstrates an HTTP GET request to a custom trade service endpoint, including host, content type, and session authentication token. ```http GET /trade-service/trades?trade-id=1 HTTP/1.1 Host: localhost:9064 Content-Type: application/json SESSION_AUTH_TOKEN: 83eLYBnlqjIWt1tqtJhKwTXJj2IL2WA0 ``` -------------------------------- ### Configure Document Management Route Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/04_business-components/04_doc-management/02_initial-config.mdx Set up a route for the Document Management component in `client/src/routes/config.ts` to make it visible in your application. This example shows basic route configuration and navigation item setup. ```typescript { title: 'Document Management', path: 'document-management', name: 'document-management', element: async () => (await import('@genesislcap/pbc-documents-ui')).FoundationDocumentManager, settings: { autoAuth: true, maxRows: 500 }, navItems: [ { navId: 'header', title: 'Document Management', icon: { name: 'file-csv', variant: 'solid', }, placementIndex: 35, }, { navId: 'side', title: 'Special Document Manager', routePath: 'document-management/foo', // < example if there were child routes icon: { name: 'file-csv', variant: 'solid', }, }, ] } ``` -------------------------------- ### Dynamic Authorization Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/011_integrations/04_custom-endpoints/index.mdx This Java snippet demonstrates how to make an HTTP request with custom headers for dynamic authorization. It uses `HttpClient` to send a GET request to a trade service endpoint. ```java var httpClient = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder(new URI("http://localhost:9064/trade-service/trades?trade-id=TR1")) .version(HttpClient.Version.HTTP_1_1) .header("USER_NAME", "JohnDoe") .header("SESSION_AUTH_TOKEN", "123") .GET() .build(); var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); assertEquals("", response.body()); } } ``` -------------------------------- ### Import WSL 2 Training Distro Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/static/snippet/_environment_setup_wls.mdx Import the downloaded Genesis WSL training distro into a local folder. Ensure the command is run from the folder containing the distro files. ```bash wsl --import TrainingCentOS . training-wsl-fdb.backup ``` -------------------------------- ### Install Web Code (Change Directory) Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/003_build-deploy-operate/02_deploy/002_hosting-infrastructure/03_initial-application-install/index.mdx Install web code by changing to the target directory first, then unzipping the archive. Ensure the `runUser` and `installDate` variables are set correctly. ```shell installDir=$(date +%Y%m%d) runUser= cd /data/${runUser}/web-${installDate}; unzip ``` -------------------------------- ### Basic Mock Component with Lifecycle Callbacks Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/015_layout-management/layout_07_troubleshooting.mdx A basic example of a Genesis Element component demonstrating `connectedCallback` and `disconnectedCallback` without lifecycle optimization. Use this as a starting point to understand component lifecycle. ```typescript @customElement({ name: 'mock-connected', }) export class MockConnected extends GenesisElement { @observable resource = ''; async connectedCallback(): Promise { super.connectedCallback(); // Simulate doing some work with an external service } async disconnectedCallback(): Promise { super.disconnectedCallback(); // Simulate cleaning an external service } } ``` -------------------------------- ### Using Object Methods for String Criteria Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/002_server-communications/05_criteria-matching.mdx Build criteria by calling Java methods directly on fields. This example demonstrates checking if a STRING field's content starts with a specific prefix. ```groovy DESCRIPTION.startsWith('This') ``` -------------------------------- ### Custom Request Server Syntax Example Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/005_snapshot-queries-request-server/index.mdx Provides a comprehensive syntax example for defining a custom request server, including optional naming, input/output classes, permissioning, and different reply types (reply, replySingle, replyList). ```kotlin // The name is optional, if none is provided, then request will be based on the output class, e.g. REQ_OUTPUT_CLASS // Set [InputClass] to `Unit` if you don't need the client to send any request data. requestReply<[InputClass], [OutputClass]> ("{optional name}") { // permissioning is optional permissioning { // multiple auth blocks can be combined with the and operator and the or operator auth("{map name}") { // use a single field of output_class authKey { key(data.fieldName) } // or use multiple fields of output_class authKey { key(data.fieldNameA, data.fieldNameB) } // or use multiple fields of output_class as well as the username authKeyWithUserName { key(data.fieldNameA, data.fieldNameB, userName) } // hide fields are supported hideFields { listOf("FIELD_NAME_A") } // predicates are supported filter { } } } // a reply tag is required; there are three types. // the reply tag will have a single parameter, the request, which will be of type // [input class] // all three have these fields available: // 1. db - readonly entity database // 2. userName - the name of the user who made the request // 3. details - Request.Details from the inbound request: orderBy, offset, viewNumber, maxRows, criteriaMatch // 4. LOG - logger with name: global.genesis.requestreply.pal.{request name} // either: reply { } // or: replySingle { } // or: replyList { } } ``` -------------------------------- ### Initialize Project Skipping Optional Prompts Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/007_genx/index.mdx Creates a new project using default configurations by skipping all optional prompts. Use either the short or long flag. ```terminal npx -y @genesislcap/genx@latest init myApp -x ``` ```terminal npx -y @genesislcap/genx@latest init myApp --skip-optional-prompts ``` -------------------------------- ### Angular Foundation Login Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/003_login/index.mdx Configure Foundation Login for an Angular application. This example shows the initial setup for the login component, including importing necessary modules and defining configuration options. ```typescript import {configure, define} from '@genesislcap/foundation-login'; import type { Router } from '@angular/router'; import { getUser } from '@genesislcap/foundation-user'; import { css, DI } from '@genesislcap/web-core'; import { AUTH_PATH } from '../app.config'; import logo from '../../assets/logo.svg'; export const configureFoundationLogin = ({ router, }: { ``` -------------------------------- ### setupPaginationAndStatusBar Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/003_grid-pro/docs/api/grid-pro.gridpro.md Sets up pagination and the status bar for the grid. ```APIDOC ## setupPaginationAndStatusBar(gridOptions) ### Description Sets up pagination and the status bar for the grid. ### Method `setupPaginationAndStatusBar` ### Parameters #### Path Parameters - **gridOptions** (object) - Required - The grid options object. ``` -------------------------------- ### Actions Menu Renderer Configuration Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/03_client-capabilities/005_grids/003_grid-pro/grid-pro_04_renderers.mdx Define column definitions for the actions menu renderer to display multiple actions for a grid row. This example shows how to get the menu definition and integrate it into the column definitions. ```typescript const actionsColDefs = getActionsMenuDef([ { name: 'View', callback: (rowData) => viewDetails(rowData) }, { name: 'Delete', callback: (rowData) => deleteRow(rowData) } ]); const columnDefs = [ { field: 'name' }, // other defs actionsColDefs ]; ``` ```typescript const actionsMenuRendererColDef: ColDef = { cellRenderer: GridProRendererTypes.actionsMenu, cellRendererParams: { actions, buttonAppearance, isVertical, buttonText: customActionsOpenerName, }, // other column options }; ``` -------------------------------- ### Complex Authorization and Data Retrieval for AltInstrumentId Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/02_server-capabilities/005_snapshot-queries-request-server/index.mdx Handle complex authorization logic and retrieve data from 'ALT_INSTRUMENT_ID' table. This example shows conditional data retrieval based on input, using 'getBulk', 'getRange', or 'get'. ```kotlin requestReply { permissioning { auth("INSTRUMENT") { authKey { key(data.instrumentId) } } } reply { when { byAlternateTypeAlternateCode.alternateType == "*" -> db.getBulk(ALT_INSTRUMENT_ID) byAlternateTypeAlternateCode.alternateCode == "*" -> db.getRange(byAlternateTypeAlternateCode, 1) else -> db.get(byAlternateTypeAlternateCode).flow() } } } ``` -------------------------------- ### Apply Genesis Start Plugin to build.gradle.kts Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/003_genesis-start/index.mdx In your project's `server/build.gradle.kts` file, add the `global.genesis.genesis-start-gui` plugin with the specified version. This enables the Genesis Start functionality for your project. ```kotlin plugins { // other plugins.. id("global.genesis.genesis-start-gui") version "0.1.6" } ``` -------------------------------- ### Configure VSCode for Local TypeScript Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/001_develop/01_development-environment/006_custom-elements-lsp/index.mdx Configure VSCode to use the local TypeScript version installed in your project's node_modules. This ensures the Custom Elements LSP plugin utilizes your project's specific TypeScript setup. ```json { "typescript.tsdk": "node_modules/typescript/lib" } ``` -------------------------------- ### Example Step Definitions in TypeScript Source: https://github.com/genesiscommunitysuccess/docs/blob/preprod/docs/002_how-to/22_web-e2e-test.mdx Implement step definitions in TypeScript that correspond to Gherkin steps. This example uses Playwright and foundation-testing utilities to interact with an example page. ```typescript import { expect } from '@genesislcap/foundation-testing/e2e'; import { Given, When, Then } from '../fixtures'; Given('I am on the example page', async ({ examplePage }) => { await examplePage.goto(); }); When('I perform an example action', async ({ examplePage }) => { await examplePage.performAction(); }); Then('I should see the expected result', async ({ examplePage }) => { const result = await examplePage.getResult(); expect(result).toBe('Expected Result'); }); ```