```
--------------------------------
### 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');
});
```