@genesislcap/mock-server 15.68.0 → 15.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -552,10 +552,11 @@ of this yourself — no watchdog is started.
552
552
  ## Platform preset
553
553
 
554
554
  A real GSF app runs beside the platform's processes: auth (users, profiles,
555
- rights, the key-value store), notify, file storage, reporting and more. Their
556
- resources are in its `RESOURCES_REQUEST_ACK`, and its login ack carries the
557
- rights the auth seed gives the user. `platformPreset()` serves that part, so an
558
- app's config only has to describe the app:
555
+ rights, the key-value store), and whichever of notify, reporting, file storage
556
+ and reconciliation it includes. Their resources are in its
557
+ `RESOURCES_REQUEST_ACK`, and its login ack carries the rights the auth seed
558
+ gives the user. `platformPreset()` serves that part, so an app's config only
559
+ has to describe the app:
559
560
 
560
561
  ```ts
561
562
  import { createMockServer } from '@genesislcap/mock-server';
@@ -569,6 +570,8 @@ const server = createMockServer(
569
570
  // The app's own data/*.csv rows for the platform tables.
570
571
  seed: { RIGHT: [{ CODE: 'TradeView', DESCRIPTION: 'View trades' }],
571
572
  PROFILE_RIGHT: [{ PROFILE_NAME: 'USER_ADMIN', RIGHT_CODE: 'TradeView' }] },
573
+ // Default: all four. GSF and auth are always in.
574
+ products: ['genesis-notify', 'file-server'],
572
575
  }),
573
576
  appConfig,
574
577
  ),
@@ -584,12 +587,109 @@ What it provides:
584
587
  | Dataservers `ALL_USERS` (`USER_VIEW`), `ALL_PROFILES`, `ALL_RIGHTS`, `ALL_PROFILE_RIGHTS`, `ALL_PROFILE_USERS`, `ALL_NOTIFY_ALERT_RECORDS` (the user's own alerts) | `auth-dataserver.kts`, `genesis-notify-rules-dataserver.kts` |
585
588
  | Request servers `RIGHT`, `PROFILE`, `KEY_VALUE_LIST`, `KEY_VALUE_READ` (`VALUE` in base64, as a RAW column goes out) | `auth-reqrep.kts` |
586
589
  | Events `EVENT_KEY_VALUE_PUT` / `_DELETE`, `EVENT_DISMISS_NOTIFY_ALERT` / `_DISMISS_ALL_NOTIFY_ALERT`, with the real handlers' NACK texts | `auth-key-value-eventhandler.kts`, `genesis-notify-eventhandler.kts` |
587
- | `additionalResources`: the 177 platform resources a real 8.15.29 server lists (the recorded 207 minus the showcase app's own) | `test/conformance/recordings/showcase-real/resources-request.json` |
588
-
589
- Most platform resources in that list have no backing yet (reporting, file
590
- storage, reconciliation, notify routes and rules, approvals, cron rules): they
591
- are listed as the real server lists them, and a `DATA_LOGON` or `REQ_` for one
592
- gets the unknown-resource reply until a config serves it.
590
+ | `ALL_TOAST_NOTIFICATIONS`: the user's `NEW` alerts with `SHOW_TOAST` | `genesis-notify-rules-dataserver.kts` |
591
+ | Per included product, every query and request server that reads a table or view, over those tables (empty, but for notify's two seeded screen routes) and views, with their dictionary columns; see [Products](#products) | the products' dictionaries and scripts |
592
+ | `additionalResources`: the platform resources a real 8.15.29 server lists (the recorded 207 minus the showcase app's own: 177 with every product) for GSF, auth and the included products | `test/conformance/recordings/showcase-real/resources-request.json` |
593
+
594
+ A listed resource with no backing (see [the gaps](#what-isnt-backed)) gets the
595
+ router's 404, as an unknown one does, until a config serves it.
596
+
597
+ ### Products
598
+
599
+ `products` names the platform products the app includes beside GSF and auth,
600
+ which are always in, by GSF product name: `'genesis-notify'`, `'reporting'`,
601
+ `'file-server'` (Create's Document Management) and `'reconciliation'`
602
+ (`PlatformProduct`; `PLATFORM_PRODUCTS` lists them). Default: all four, which is
603
+ what the showcase config and the conformance suite run. The preset lists and
604
+ serves only GSF's, auth's and those products' resources; another product's get
605
+ the router's 404, as on a real server without it. A product's screen may read
606
+ another's: reporting's reads file-server's `FILE_STORAGE_TEMPLATES`, and
607
+ reconciliation's reads `ALL_FILE_STORAGES`. `seed.NOTIFY_ALERT` needs
608
+ `'genesis-notify'`; an unknown name throws.
609
+
610
+ **Attribution.** `src/presets/platform/resources.json` gives each resource the
611
+ product whose script registers it (`PRODUCT`): GSF `genesis` 22, `auth` 44,
612
+ `genesis-notify` 53, `reporting` 27, `file-server` 7, `reconciliation` 24. A
613
+ query, request server or event handler is found in the scripts by the name GSF
614
+ registers it under: `query(TABLE)` is `ALL_<TABLE>S`, `requestReply(TABLE)` is
615
+ `TABLE`, a typed one with no name takes its class's (`requestReply<Unit,
616
+ ValidTimeZone>` is `VALID_TIME_ZONE`, reporting's), an event handler is
617
+ `EVENT_<name>`. GSF registers 20 in its own code (status dataservers; cron,
618
+ dynamic-rule and approval events; the default `EVENT_INSERT` / `_MODIFY` /
619
+ `_DELETE`), cited by file in `generate.ts`. Generation fails if any recorded
620
+ resource is left unattributed or claimed twice.
621
+
622
+ **Backing.** For each query and request server in a product's scripts that
623
+ reads a table or view, `src/presets/platform/backing.json` holds the engine's
624
+ definition, the script and line it comes from, and the tables it reads:
625
+
626
+ - Tables and views come from GSF's own compilation of the product's
627
+ dictionaries (its `<product>-dictionary-cache` jar), not from re-parsing
628
+ Kotlin. A column keeps its type, ENUM values, default (an inline enum's first
629
+ value when it names none), size (but GSF's default 64 and `dbMaxSize`) and
630
+ not-null (key, index, `not null` and dictionary not-null fields, as
631
+ `VerifiedTable.getNotNullFields` makes them). A view keeps its joins (type,
632
+ `backwardsJoin`), renamed columns and derived fields' types.
633
+ - A query's `fields { }` and `indices { }`; a request server's `request { }`,
634
+ `request(TABLE.BY_...)` (that index's fields) and `reply { }`. With no request
635
+ block it is keyed by its source's first index, as
636
+ `RequestReplyServer.getRequestFields` does (a view's: its base table's), so
637
+ `NOTIFY_DESTINATIONS` asks for `ID`. A view has its base table's key even when
638
+ it doesn't list it, as GSF adds it (the dictionary's `PRIMARY-KEY` imports).
639
+ A typed `requestReply<Unit, SomeView>` serves that view's rows with no request
640
+ (`GENERATED_REPORTS`, whose Kotlin reply sends only the newest report).
641
+ - Rows: none, but a product's own seed data (notify's `NOTIFY_ROUTE.csv` and
642
+ `SCREEN_NOTIFY_ROUTE_EXT.csv`), the columns a row leaves out taking their
643
+ defaults as GSF's data load does.
644
+ - GSF's and auth's are served only over the tables the preset fills (users,
645
+ profiles, rights): `USER`, `USER_DETAILS`, `PROFILE_USER`, `PROFILE_USERS`
646
+ and `PROFILE_RIGHT`. The pieces `platform.ts` writes out (`ALL_USERS`, the
647
+ key-value store, the alerts) replace generated ones of the same name.
648
+
649
+ What each product's screens read, and so what is now served (zero rows unless
650
+ said):
651
+
652
+ | Product | Dataservers | Request servers |
653
+ | --- | --- | --- |
654
+ | auth | `ALL_USERS`, `ALL_PROFILES` (rows: the users, profiles) | `USER`, `RIGHT`, `PROFILE_RIGHT`, `PROFILE_USER` (rows: the users, rights); also `USER_DETAILS`, `PROFILE_USERS` |
655
+ | genesis-notify | `ALL_DYNAMIC_NOTIFY_RULES`, `ALL_RULE_TEMPLATES`, `ALL_SCREEN_ROUTES` (2 rows), `ALL_EMAIL_DISTRIBUTION_ROUTES`, `ALL_EMAIL_USER_ROUTES`, `ALL_LOG_ROUTES`, `ALL_MS_TEAMS_ROUTES`, `ALL_SLACK_ROUTES`, `ALL_NOTIFY_ALERT_RECORDS`; also `ALL_NOTIFY_RECORDS`, `ALL_TOAST_NOTIFICATIONS` | `NOTIFICATION_RULE`, `NOTIFICATION_RULE_TEMPLATE` |
656
+ | reporting | `ALL_REPORT_CONFIGS`, `ALL_SAVED_REPORTS` | `GENERATED_REPORTS`, `NOTIFY_DESTINATIONS`; also `SAVED_REPORTS`, `REPORT_CONFIGS`, `SFTP_DESTINATIONS` |
657
+ | file-server | `ALL_FILE_STORAGES` | `FILE_STORAGE`, `FILE_STORAGE_TEMPLATES`, `FILE_STORAGE_ASSETS` |
658
+ | reconciliation | `ALL_RECONCILIATION_VIEWS`, `ALL_RECONCILIATION_RECORD_RESULTS_VIEW`, `ALL_RECONCILIATION_RULE_RESULTS`, `RECONCILIATION_SUMMARY` | `RECONCILIATION_CONFIG`, `RECONCILIATION_RULE`, `DATASOURCE_CONFIG`, `DATA_DICTIONARY`, `DATA_DICTIONARY_FIELD`, `RECONCILIATION_RULE_RESULT` |
659
+
660
+ #### What isn't backed
661
+
662
+ Listed, and answered with the router's 404:
663
+
664
+ - **Writes.** Every product event (route, rule, template, report, destination,
665
+ file, reconciliation and user/profile events): only the key-value and alert
666
+ events have handlers. A screen's save or delete fails.
667
+ - **Request servers that compute their reply** (a typed `requestReply<In, Out>`
668
+ whose Kotlin builds it): `SYSTEM_ENTITY` and `SYSTEM_ENTITY_FIELDS` (GSF), and
669
+ notify's `NOTIFY_SYSTEM_ENTITY` (every table and view of the full dictionary,
670
+ which the mock doesn't have); reporting's `VALID_TIME_ZONE` (the JVM's zone
671
+ ids), `ALL_REPORT_DATASOURCES` (the cluster's request servers),
672
+ `REPORTING_DATA_PIPELINES`, `REPORT_CONFIG_DETAILS`,
673
+ `REPORT_PARAMETER_DETAILS`; notify's `CONFIGURED_NOTIFY_ROUTES`,
674
+ `NOTIFICATION_RULE_DETAILS`, `NOTIFICATION_RULE_TEMPLATE_DETAILS`,
675
+ `NOTIFY_ROUTE_TOPICS`, `NOTIFY_ALERT_SOUND`; file-server's
676
+ `ASSETS_FOR_TEMPLATE`; reconciliation's `RECONCILIATION_DATA_PIPELINES`,
677
+ `RECONCILIATION_DATA_SOURCE_PAIRS`, `RECONCILIATION_RECORD_PAIR_RESULT`,
678
+ `FIELD_TYPE_TOLERANCES`, `ACTIVE_RECONCILIATION_CONFIG_IDS`.
679
+ - **Audit tables**, which GSF generates from `audit = details(...)` rather than
680
+ a dictionary: notify's `NOTIFY_ALERT` request server, auth's
681
+ `ALL_APPROVAL_ALERTS_AUDITS`, `ALL_USER_AUDITS`, `USER_ATTRIBUTES_AUDIT`.
682
+ - **GSF's and auth's over tables platform processes fill at runtime**, where an
683
+ empty table would be a wrong answer: `ALL_USER_RIGHTS` (`RIGHT_SUMMARY`),
684
+ `ALL_USER_LOGIN_AUDITS` and `USER_LOGIN_AUDIT`, `ALL_APPROVAL_ALERTS`,
685
+ `ALL_CRON_RULES`, `TAG`; GSF's `ALL_PROCESSES_STATUS` and `ALL_SYSTEM_STATUS`.
686
+ Auth's `USER_PROFILES` renames a column in its reply block.
687
+
688
+ Not modelled in what is served: `where` / `filter` clauses (their tables start
689
+ empty, and generation refuses one over a seeded table), permissioning
690
+ (permission codes, auth maps, as elsewhere in the preset), derived view fields
691
+ (declared and typed, always null), `GENERATED_REPORTS`'s Kotlin reply, and
692
+ UUID keys (`FILE_STORAGE_ID`), which only an insert would need.
593
693
 
594
694
  **Composing.** `mergeConfigs(...configs)` merges later configs over earlier
595
695
  ones: tables, views, queries, request servers, event handlers and event
@@ -615,9 +715,19 @@ with the key of a platform row replaces it, as the real data load upserts.
615
715
 
616
716
  **Regenerating the data.** `src/presets/platform/*.json` is generated:
617
717
  `npm run preset:generate` reads the recordings, the showcase server's scripts
618
- and seeds, and `scripts/platform-preset/seeds/<pbc>@<version>/` (each PBC's
619
- `PROFILE.csv`, `PROFILE_RIGHT.csv` and `RIGHT.csv`, copied verbatim from its
620
- repository at the version the showcase server pins). Re-record, re-copy, rerun.
718
+ and seeds, and `scripts/platform-preset/seeds/<product>@<version>/`, at the
719
+ versions the showcase server pins (GSF itself is `genesis@8.15.29`):
720
+
721
+ - `PROFILE.csv`, `PROFILE_RIGHT.csv`, `RIGHT.csv` and any other seed data
722
+ (notify's routes), verbatim from the product's repository or config jar.
723
+ - `dictionary/<product>-{fields,tables,view}-dictionary.kts.json`, verbatim
724
+ (formatted) from `<product>-dictionary-cache-<version>.jar`'s
725
+ `META-INF/global/genesis/genesis-script-file-cache/`.
726
+ - `scripts/*.kts`: the product's dataserver, request-server and event-handler
727
+ scripts, verbatim from its config jar (GSF's `system-info-reqrep.kts` from
728
+ genesis-server's `genesis-console`).
729
+
730
+ It then formats the output with oxfmt. Re-record, re-copy, rerun.
621
731
 
622
732
  ## Extension points
623
733
 
@@ -1,3 +1,4 @@
1
1
  export { parseSeedCsv } from './csv.ts';
2
2
  export { mergeConfigs } from './merge.ts';
3
3
  export { platformPreset, type PlatformPresetOptions, type PlatformSeed, type PlatformUser, } from './platform.ts';
4
+ export { PLATFORM_PRODUCTS, type PlatformProduct } from './products.ts';
@@ -1,3 +1,4 @@
1
1
  export { parseSeedCsv } from "./csv.js";
2
2
  export { mergeConfigs } from "./merge.js";
3
3
  export { platformPreset, } from "./platform.js";
4
+ export { PLATFORM_PRODUCTS } from "./products.js";