@genesislcap/ai-assistant 15.37.0 → 15.38.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/dist/custom-elements.json +638 -0
- package/dist/dts/genesis/calendar.d.ts +25 -0
- package/dist/dts/genesis/calendar.d.ts.map +1 -0
- package/dist/dts/genesis/config.d.ts +16 -0
- package/dist/dts/genesis/config.d.ts.map +1 -1
- package/dist/dts/genesis/criteria.d.ts +24 -2
- package/dist/dts/genesis/criteria.d.ts.map +1 -1
- package/dist/dts/genesis/event-fields.d.ts +84 -0
- package/dist/dts/genesis/event-fields.d.ts.map +1 -0
- package/dist/dts/genesis/filter-fields.d.ts +69 -5
- package/dist/dts/genesis/filter-fields.d.ts.map +1 -1
- package/dist/dts/genesis/index.d.ts +3 -0
- package/dist/dts/genesis/index.d.ts.map +1 -1
- package/dist/dts/genesis/register-genesis-assistant.d.ts +13 -0
- package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
- package/dist/dts/genesis/resource-tools.d.ts.map +1 -1
- package/dist/dts/genesis/review-model.d.ts +202 -0
- package/dist/dts/genesis/review-model.d.ts.map +1 -0
- package/dist/dts/genesis/row-source.d.ts +102 -0
- package/dist/dts/genesis/row-source.d.ts.map +1 -0
- package/dist/dts/genesis/serialisable.d.ts +25 -0
- package/dist/dts/genesis/serialisable.d.ts.map +1 -0
- package/dist/dts/genesis/server-text.d.ts +63 -0
- package/dist/dts/genesis/server-text.d.ts.map +1 -0
- package/dist/dts/genesis/type-name.d.ts +18 -0
- package/dist/dts/genesis/type-name.d.ts.map +1 -0
- package/dist/dts/genesis/types.d.ts +7 -0
- package/dist/dts/genesis/types.d.ts.map +1 -1
- package/dist/dts/genesis/value-compare.d.ts +19 -0
- package/dist/dts/genesis/value-compare.d.ts.map +1 -0
- package/dist/dts/genesis/write-commit.d.ts +53 -0
- package/dist/dts/genesis/write-commit.d.ts.map +1 -0
- package/dist/dts/genesis/write-outcome.d.ts +133 -0
- package/dist/dts/genesis/write-outcome.d.ts.map +1 -0
- package/dist/dts/genesis/write-payload.d.ts +129 -0
- package/dist/dts/genesis/write-payload.d.ts.map +1 -0
- package/dist/dts/genesis/write-plan.d.ts +109 -0
- package/dist/dts/genesis/write-plan.d.ts.map +1 -0
- package/dist/dts/genesis/write-review/write-review.d.ts +127 -0
- package/dist/dts/genesis/write-review/write-review.d.ts.map +1 -0
- package/dist/dts/genesis/write-review/write-review.styles.d.ts +2 -0
- package/dist/dts/genesis/write-review/write-review.styles.d.ts.map +1 -0
- package/dist/dts/genesis/write-review/write-review.template.d.ts +4 -0
- package/dist/dts/genesis/write-review/write-review.template.d.ts.map +1 -0
- package/dist/dts/genesis/write-tools.d.ts +99 -0
- package/dist/dts/genesis/write-tools.d.ts.map +1 -0
- package/dist/dts/react.d.ts +10 -0
- package/dist/esm/genesis/calendar.js +38 -0
- package/dist/esm/genesis/config.js +36 -1
- package/dist/esm/genesis/criteria.js +59 -55
- package/dist/esm/genesis/event-fields.js +158 -0
- package/dist/esm/genesis/filter-fields.js +111 -20
- package/dist/esm/genesis/index.js +2 -0
- package/dist/esm/genesis/register-genesis-assistant.js +76 -4
- package/dist/esm/genesis/resource-tools.js +21 -103
- package/dist/esm/genesis/review-model.js +248 -0
- package/dist/esm/genesis/row-source.js +127 -0
- package/dist/esm/genesis/serialisable.js +38 -0
- package/dist/esm/genesis/server-text.js +186 -0
- package/dist/esm/genesis/type-name.js +20 -0
- package/dist/esm/genesis/value-compare.js +87 -0
- package/dist/esm/genesis/write-commit.js +78 -0
- package/dist/esm/genesis/write-outcome.js +299 -0
- package/dist/esm/genesis/write-payload.js +632 -0
- package/dist/esm/genesis/write-plan.js +275 -0
- package/dist/esm/genesis/write-review/write-review.js +252 -0
- package/dist/esm/genesis/write-review/write-review.styles.js +214 -0
- package/dist/esm/genesis/write-review/write-review.template.js +182 -0
- package/dist/esm/genesis/write-tools.js +660 -0
- package/dist/react.cjs +7 -0
- package/dist/react.mjs +6 -0
- package/docs/genesis.md +152 -10
- package/package.json +18 -18
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The epoch millis, UTC, of a date and time given as its parts — or `undefined` when the parts do
|
|
3
|
+
* not name an instant that exists.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* `Date.UTC` never refuses a part. It carries one that is out of range into the next unit, so
|
|
7
|
+
* `2026-13-01` is 2027-01-01, `2026-02-30` is 2026-03-02 and `T25:00` is one o'clock the next
|
|
8
|
+
* day — each a real instant, written and reported `written`, with only the user's eye on the
|
|
9
|
+
* review between a typo and a record moved by a month. Range limits per part are not enough
|
|
10
|
+
* either: a day of 31 is valid, just not in September. So the instant is built and then read
|
|
11
|
+
* back, and anything that does not come back as the parts it was built from is refused. That
|
|
12
|
+
* one comparison covers every out-of-range part and every day a month does not have, leap years
|
|
13
|
+
* included.
|
|
14
|
+
*
|
|
15
|
+
* It also refuses a year below 100, on purpose: `Date.UTC` reads those as 19xx, so `0026-01-01`
|
|
16
|
+
* would be 1926. No trade is dated in the year 26, so the likelier reading is a typo, and
|
|
17
|
+
* refusing it beats writing either century.
|
|
18
|
+
*
|
|
19
|
+
* The one rule for the read path's criteria bounds and the write path's payloads, so a value is a
|
|
20
|
+
* date on both or on neither.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function utcMillisOf(year: string, month: string, day: string, hour?: string, minute?: string, second?: string): number | undefined;
|
|
25
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/genesis/calendar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,SAAM,EACV,MAAM,SAAM,EACZ,MAAM,SAAM,GACX,MAAM,GAAG,SAAS,CAcpB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GenesisEventOp } from './types';
|
|
1
2
|
/** The default read cap, and the ceiling the config may raise it to. */
|
|
2
3
|
export declare const DEFAULT_MAX_ROWS = 50;
|
|
3
4
|
export declare const MAX_ROWS_CEILING = 1000;
|
|
@@ -7,6 +8,21 @@ export declare const MAX_ROWS_CEILING = 1000;
|
|
|
7
8
|
* reaches the model through its description, not its name.
|
|
8
9
|
*/
|
|
9
10
|
export declare const toolNameOf: (resourceName: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* The op a resource's NAME declares, when it declares one.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Exported so the config validator and the write-tool factory apply one rule. A validator only
|
|
16
|
+
* the registration path reaches is not a guarantee: `createGenesisWriteTools` is exported and
|
|
17
|
+
* documented, and a mis-declared op there takes the insert branch — no row read, no merge, no
|
|
18
|
+
* staleness check — and replaces the record with every unnamed column null.
|
|
19
|
+
*
|
|
20
|
+
* A name that claims no operation is the app's own business: `EVENT_TRADE_AMEND` may well be a
|
|
21
|
+
* modify, and there is nothing in the name to contradict.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const opFromName: (resourceName: string) => GenesisEventOp | undefined;
|
|
10
26
|
/**
|
|
11
27
|
* Checks a generated AI config before anything is registered, returning every problem found.
|
|
12
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/genesis/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/genesis/config.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAEjB,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAMrC;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,cAAc,MAAM,KAAG,MAAoC,CAAC;AAEvF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,cAAc,MAAM,KAAG,cAAc,GAAG,SAGlE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CA6EjE"}
|
|
@@ -40,8 +40,30 @@ export type CriteriaResult = {
|
|
|
40
40
|
reason: string;
|
|
41
41
|
};
|
|
42
42
|
type FieldKind = 'string' | 'number' | 'boolean' | 'date' | 'datetime';
|
|
43
|
-
/**
|
|
44
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The kind a type filters as, or `undefined` for one this bridge does not know.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* The tail used to be `return 'string'`, which is the "unknown falls through to the loosest
|
|
48
|
+
* behaviour" shape in its if/else form. It is worse than loose here: an unrecognised type was
|
|
49
|
+
* filtered with a QUOTED literal, so a numeric or temporal column matched NOTHING and reported
|
|
50
|
+
* an empty result, and the refusal for a type-specific op read "X is a string field" — a
|
|
51
|
+
* confident wrong explanation the model acts on by rewording the query for ever.
|
|
52
|
+
*
|
|
53
|
+
* A type we cannot place is refused instead, by name. The cost is the same one the read path
|
|
54
|
+
* already accepts for a field the metadata leaves undescribed: the model reads more rows and
|
|
55
|
+
* narrows them itself, which is a slower right answer rather than a fast wrong one.
|
|
56
|
+
*
|
|
57
|
+
* **The `| undefined` is not checked by the compiler.** The monorepo builds with
|
|
58
|
+
* `strictNullChecks: false`, so a caller can use the result as a {@link FieldKind} without
|
|
59
|
+
* narrowing it, and nothing complains. Every caller narrows today: `fragmentFor` refuses the
|
|
60
|
+
* filter, `filterFieldsFrom` does not offer the field, and write-tools' key schema leaves it
|
|
61
|
+
* out. A new caller has to as well, by hand. `OPS_BY_KIND[undefined]` is `undefined`, and the
|
|
62
|
+
* first `.includes` on it throws.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare function fieldKindOf(type: string): FieldKind | undefined;
|
|
45
67
|
/**
|
|
46
68
|
* Each fragment builder answers only for the ops it knows, and `undefined` otherwise.
|
|
47
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../../src/genesis/criteria.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../../src/genesis/criteria.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,mGAAmG;AACnG,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,WAAW,GACX,eAAe,GACf,UAAU,GACV,cAAc,CAAC;AAEnB,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,kEAAkE;AAClE,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAiEvE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAQ/D;AAkED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,SAAS,CAWpB;AAcD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAejG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAGpB;AA0KD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAC9C,cAAc,CAmChB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Connect, Metadata } from '@genesislcap/foundation-comms';
|
|
2
|
+
/**
|
|
3
|
+
* The fields an event accepts, from the platform's metadata reply.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* An event publishes its metadata under its FULL name — `META_REQUEST {FEATURE:
|
|
7
|
+
* 'EVENT_TRADE_INSERT'}` answers, while `TRADE_INSERT` is "not mapped to a service" (404).
|
|
8
|
+
* That is the opposite of a request resource, whose metadata drops the `REQ_` prefix, and
|
|
9
|
+
* {@link metadataNameOf} already encodes both (it strips only `REQ_`). Verified on a live 8.15
|
|
10
|
+
* router.
|
|
11
|
+
*
|
|
12
|
+
* Each `FIELD` entry carries what a write needs without touching the JSON schema: the name, the
|
|
13
|
+
* Genesis type, the JSON type it travels as, and whether it is optional.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export interface GenesisEventField {
|
|
18
|
+
name: string;
|
|
19
|
+
/** The platform field type, e.g. STRING, ENUM, INT, DOUBLE, BIGDECIMAL, BOOLEAN, DATETIME. */
|
|
20
|
+
type: string;
|
|
21
|
+
/**
|
|
22
|
+
* How the value travels on the wire, which is NOT always what a JavaScript developer expects:
|
|
23
|
+
* a BIGDECIMAL is a `string` with a numeric pattern, a DATETIME is an `integer` of epoch
|
|
24
|
+
* millis. Sending a BIGDECIMAL through `Number` is a silent rounding of someone's money.
|
|
25
|
+
*/
|
|
26
|
+
jsonType: string;
|
|
27
|
+
/** False when the platform requires a value: those become the tool's required parameters. */
|
|
28
|
+
optional: boolean;
|
|
29
|
+
/** The server sets these; a write must not offer them to the model. */
|
|
30
|
+
readOnly: boolean;
|
|
31
|
+
/** Human label from the metadata, shown in the review table when it has one. */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** For ENUM fields: the values the server accepts. */
|
|
34
|
+
validValues?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type EventFieldsResult = {
|
|
38
|
+
status: 'ok';
|
|
39
|
+
fields: GenesisEventField[];
|
|
40
|
+
} | {
|
|
41
|
+
status: 'failed';
|
|
42
|
+
reason: string;
|
|
43
|
+
transient: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* True when asking again cannot change the answer this session. Connect caches every
|
|
46
|
+
* metadata reply that has any key — an ERROR reply included — and returns the cached one
|
|
47
|
+
* without reaching the server (foundation-comms connect.ts, `getMetadata`). So a refusal
|
|
48
|
+
* built from such a reply is settled, and asking again only repeats it in the log. A
|
|
49
|
+
* request that failed, or a reply with no keys (not cached: a resource still priming at
|
|
50
|
+
* start-up can answer properly next time), is not.
|
|
51
|
+
*/
|
|
52
|
+
settled?: boolean;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The fields, and the ones the reply named without typing.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* A field with no TYPE cannot be written: the type decides whether a value is converted to
|
|
59
|
+
* epoch millis, carried as digits, checked against an enum or sent as text, so calling an
|
|
60
|
+
* unknown one STRING is a guess that shows up as a schema NACK at best and a wrong value at
|
|
61
|
+
* worst. It is the same guess the read path made for the same reason, and it survived the fix
|
|
62
|
+
* there by hiding one level down.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export interface EventFieldsFrom {
|
|
67
|
+
fields: GenesisEventField[];
|
|
68
|
+
/** Named by the reply, but with no type — not writable, and named so the log can say which. */
|
|
69
|
+
untyped: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Typed, but with allowed values this module cannot read — see {@link allowedValuesOf}. Not
|
|
72
|
+
* writable: the value would go to the server unchecked, and the model is never told the list.
|
|
73
|
+
*/
|
|
74
|
+
unreadableValues: string[];
|
|
75
|
+
}
|
|
76
|
+
/** @internal */
|
|
77
|
+
export declare function eventFieldsFrom(metadata: Metadata): EventFieldsFrom;
|
|
78
|
+
/**
|
|
79
|
+
* Fetches the fields an event accepts. Never throws; bounded, for the same reason a read is.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export declare function loadEventFields(connect: Connect, resourceName: string, timeoutMs?: number): Promise<EventFieldsResult>;
|
|
84
|
+
//# sourceMappingURL=event-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis/event-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,+BAA+B,CAAC;AAMvF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,6FAA6F;IAC7F,QAAQ,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,GAC7C;IACE,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAkDN;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,+FAA+F;IAC/F,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,gBAAgB;AAChB,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,CA8BnE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAA4B,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAqE5B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Connect, Metadata } from '@genesislcap/foundation-comms';
|
|
2
|
-
import type
|
|
1
|
+
import type { Connect, Metadata, MetadataDetail } from '@genesislcap/foundation-comms';
|
|
2
|
+
import { type GenesisFilterField } from './criteria';
|
|
3
3
|
/**
|
|
4
4
|
* What a resource can be filtered on, from the platform's own metadata reply.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* `CRITERIA_FIELDS` is the platform's answer to "which fields may a criteria reference", which
|
|
8
8
|
* is exactly the allow-list the read tools need — the reply schema, by contrast, says what comes
|
|
9
|
-
* back, which is not the same set.
|
|
10
|
-
* is written into the expression, and an ENUM's `VALID_VALUES`, which the model is shown so
|
|
11
|
-
* does not guess.
|
|
9
|
+
* back, which is not the same set. The REPLY's field list carries the types that decide how a
|
|
10
|
+
* value is written into the expression, and an ENUM's `VALID_VALUES`, which the model is shown so
|
|
11
|
+
* it does not guess.
|
|
12
12
|
*
|
|
13
13
|
* A resource that reports no criteria fields gets a read tool with no filters, rather than a
|
|
14
14
|
* tool whose filters the server would refuse.
|
|
@@ -19,11 +19,60 @@ export type FilterFieldsResult = {
|
|
|
19
19
|
status: 'ok';
|
|
20
20
|
fields: Map<string, GenesisFilterField>;
|
|
21
21
|
published: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Every field the reply DESCRIBED and the type it gave it — not the same set as
|
|
24
|
+
* {@link fields}, because a resource can return a column it will not accept a criteria on.
|
|
25
|
+
* The write path needs both halves: the names to ask whether a row read here can carry a
|
|
26
|
+
* whole event payload, and the types to render a column the EVENT does not declare.
|
|
27
|
+
*/
|
|
28
|
+
described: Map<string, string>;
|
|
22
29
|
} | {
|
|
23
30
|
status: 'failed';
|
|
24
31
|
reason: string;
|
|
25
32
|
transient: boolean;
|
|
26
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* What a field's `VALID_VALUES` allows: no constraint, a list of values, or a list this module
|
|
36
|
+
* cannot read.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export type AllowedValues = {
|
|
41
|
+
status: 'ok';
|
|
42
|
+
values?: string[];
|
|
43
|
+
} | {
|
|
44
|
+
status: 'unreadable';
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A field's allowed values, for the read path and the write path alike.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* A live 8.15 request server sends them as an array (`VALID_VALUES: ["SELL", "BUY"]`), while
|
|
51
|
+
* grid-pro's enum filter reads a pipe-separated string, so both shapes are in use and both are
|
|
52
|
+
* accepted.
|
|
53
|
+
*
|
|
54
|
+
* Anything else is UNREADABLE, never "no values", and the field is refused rather than offered
|
|
55
|
+
* unchecked. "No values" is what this used to return for a shape it did not recognise, and it
|
|
56
|
+
* is silent: the model is never told what the field holds, the value is never checked, and a
|
|
57
|
+
* near miss like `SIDE equals 'buy'` goes out as a valid `(SIDE == 'buy')` that matches nothing
|
|
58
|
+
* — read by the model as "there are no buy trades". Two narrower forms of the same thing:
|
|
59
|
+
* - A list with ANY member that does not read is unreadable as a whole. Keeping the members that
|
|
60
|
+
* do would hand the model a wrong list: `['BUY', {…}]` read as `['BUY']` tells it, confidently,
|
|
61
|
+
* that SELL is not a value SIDE can hold.
|
|
62
|
+
* - An ENUM with no values at all — absent, `''` or `[]` — is unreadable too, because an enum's
|
|
63
|
+
* members are what it means. The live capture above carries them, but it is the showcase's
|
|
64
|
+
* HAND-WRITTEN request server; a Create-generated one with an ENUM has not been observed, and
|
|
65
|
+
* generated servers have differed before. So this is expected, not known, not to fire on a
|
|
66
|
+
* real app — and if it does, the log line names the resource and the field. On any OTHER type
|
|
67
|
+
* an empty or absent list is simply no constraint, which is what a column that is not an enum
|
|
68
|
+
* has, and refusing it would switch off every such column on a server that sent one.
|
|
69
|
+
*
|
|
70
|
+
* One definition, used by both paths: this was written out twice, identically, and a rule kept
|
|
71
|
+
* in two places is a rule that one day holds in only one of them.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare function allowedValuesOf(detail: MetadataDetail): AllowedValues;
|
|
27
76
|
/**
|
|
28
77
|
* The metadata name of a resource: `REQ_TRADE` is read as `REQ_TRADE`, but its metadata and
|
|
29
78
|
* schema are published under `TRADE`. Asking for the prefixed name answers
|
|
@@ -40,6 +89,21 @@ export declare const metadataNameOf: (resourceName: string) => string;
|
|
|
40
89
|
*/
|
|
41
90
|
export interface FilterFieldsFrom {
|
|
42
91
|
fields: Map<string, GenesisFilterField>;
|
|
92
|
+
/**
|
|
93
|
+
* Typed, but with a type this bridge cannot filter on. Not offered to the model — the read
|
|
94
|
+
* would refuse any filter on it — and named so the log can say which.
|
|
95
|
+
*/
|
|
96
|
+
unfilterable: string[];
|
|
97
|
+
/**
|
|
98
|
+
* Typed, but with allowed values this module cannot read — see {@link allowedValuesOf}. Not
|
|
99
|
+
* offered: a value it cannot check against the list would go out unchecked and match nothing.
|
|
100
|
+
*/
|
|
101
|
+
unreadableValues: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Every name the reply described and its type — `''` when it named the column without typing
|
|
104
|
+
* it — whether or not a criteria may reference it.
|
|
105
|
+
*/
|
|
106
|
+
described: Map<string, string>;
|
|
43
107
|
/**
|
|
44
108
|
* Criteria fields with no description anywhere in the reply, so their TYPE is unknown. Not
|
|
45
109
|
* offered to the model; named here so the log can say which, and an app can publish them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis/filter-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"filter-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis/filter-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGvF,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAWlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,GACD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAa3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAKrE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,cAAc,MAAM,KAAG,MAA2C,CAAC;AAElG;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxC;;;OAGG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAiFrE;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAA4B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAyD7B"}
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
export { GENESIS_AGENT_NAME, registerGenesisAssistant } from './register-genesis-assistant';
|
|
14
14
|
export type { GenesisFilter, GenesisFilterField, GenesisFilterOp } from './criteria';
|
|
15
15
|
export { createGenesisResourceTools, GENESIS_DATA_SOURCE } from './resource-tools';
|
|
16
|
+
export { createGenesisWriteTools } from './write-tools';
|
|
17
|
+
export type { GenesisWriteResult, GenesisWriteRowStatus, GenesisWriteToolsOptions, } from './write-tools';
|
|
18
|
+
export { GENESIS_WRITE_REVIEW, GenesisWriteReview } from './write-review/write-review';
|
|
16
19
|
export type { GenesisReadResult, GenesisResourceTools, GenesisResourceToolsOptions, GenesisToolError, } from './resource-tools';
|
|
17
20
|
export { GENESIS_EVENT_OPS } from './types';
|
|
18
21
|
export type { GenesisAiConfig, GenesisAiResource, GenesisAssistantExtensions, GenesisAssistantRegistration, GenesisEventOp, GenesisResourceKind, RegisterGenesisAssistantOptions, } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/genesis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnF,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EACd,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/genesis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACvF,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EACd,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,SAAS,CAAC"}
|
|
@@ -13,6 +13,19 @@ export declare const GENESIS_AGENT_NAME = "genesis-assistant";
|
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export declare const UNTRUSTED_DATA_PROMPT: string;
|
|
16
|
+
/**
|
|
17
|
+
* What the model has to know about a write that the code cannot enforce for it.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* The review is enforced in code — a write tool cannot commit anything the user did not select
|
|
21
|
+
* — so nothing here is load-bearing except the last sentence, which is. An `unknown` outcome
|
|
22
|
+
* means the row was SENT and no answer settled whether it was written, so a model that treats it
|
|
23
|
+
* as a failure and "tries again" may write it twice. Nothing downstream can tell those two writes
|
|
24
|
+
* apart.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare const WRITE_OUTCOME_PROMPT: string;
|
|
16
29
|
/**
|
|
17
30
|
* The exported app's own AI proxy: `<PUBLIC_PATH>/gwf/ai-service`.
|
|
18
31
|
* Unless the build names another base: a build-time `GENX_AI_CHAT_BASE` comes first.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-genesis-assistant.d.ts","sourceRoot":"","sources":["../../../src/genesis/register-genesis-assistant.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EACV,eAAe,EACf,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"register-genesis-assistant.d.ts","sourceRoot":"","sources":["../../../src/genesis/register-genesis-assistant.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EACV,eAAe,EACf,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAGN,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,QAI0C,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,MAAoB,GAAG,MAAM,CAI5E;AAgBD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,IAAI,CAAC,+BAA+B,EAAE,cAAc,GAAG,SAAS,CAAM,GAC9E,IAAI,CAAC,+BAA+B,EAAE,WAAW,CAAC,CAUpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,+BAA+B,GACvC,4BAA4B,CAuK9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-tools.d.ts","sourceRoot":"","sources":["../../../src/genesis/resource-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
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ChC;AAoGD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CA4FtB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { GenesisEventOp } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* What the review table shows, and the rules its buttons obey.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Kept apart from the component on purpose: every property worth guaranteeing here is about
|
|
7
|
+
* data, not rendering, and this way each one can be tested without a DOM.
|
|
8
|
+
*
|
|
9
|
+
* Two of those properties are the reason the review exists at all:
|
|
10
|
+
*
|
|
11
|
+
* - **Nothing is selected when it opens.** With rows pre-selected, the result of a mis-click on
|
|
12
|
+
* Write is "everything the model proposed gets written", which is the precise failure the
|
|
13
|
+
* review is there to prevent. Select-all keeps the good-batch case to one click — a
|
|
14
|
+
* deliberate one.
|
|
15
|
+
* - **The full resulting record is shown, not the changes.** A generated modify REPLACES the
|
|
16
|
+
* record, so the fields nobody mentioned are part of what gets written, and a table showing
|
|
17
|
+
* only the changed ones would ask for approval of something narrower than the write.
|
|
18
|
+
*/
|
|
19
|
+
export interface ReviewCell {
|
|
20
|
+
field: string;
|
|
21
|
+
/** Column heading: the metadata's label when it has one, else the field name. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** What to SHOW. Never read back into the payload — see {@link ReviewRow.details}. */
|
|
24
|
+
display: string;
|
|
25
|
+
/** The value as it stands now, for a modify; absent on an insert. */
|
|
26
|
+
previousDisplay?: string;
|
|
27
|
+
/** True when this write changes the field — the mark the user's eye needs. */
|
|
28
|
+
changed: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* True when this field is part of what the write actually SENDS to name the row, while the
|
|
31
|
+
* rest of the row is shown for context only.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* A delete renders the whole record — what is approved is the removal of a record — but it
|
|
35
|
+
* sends its key alone. Without this the two are indistinguishable on screen, and the one thing
|
|
36
|
+
* that decides which record disappears is the one thing the approver cannot see.
|
|
37
|
+
*/
|
|
38
|
+
identifying: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* True when either side of the cell is long enough to be wrapped rather than kept on one line.
|
|
41
|
+
* See {@link LONG_VALUE}.
|
|
42
|
+
*/
|
|
43
|
+
long: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Past this many characters a value wraps; at or under it, it stays on one line.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Wrapping every cell broke SHORT values mid-token in a squeezed table: `+ 101.2345` became
|
|
50
|
+
* `101.` over `2345`, and the first line could pass for the whole value, which is approving what
|
|
51
|
+
* you did not see again. A short value is kept whole on one line and the table scrolls; only a
|
|
52
|
+
* value long enough to push the change out of view wraps, where being on several lines is plain.
|
|
53
|
+
*/
|
|
54
|
+
export declare const LONG_VALUE = 24;
|
|
55
|
+
/** @internal */
|
|
56
|
+
export interface ReviewRow {
|
|
57
|
+
/** Position in the model's original list, carried through to the outcome. */
|
|
58
|
+
index: number;
|
|
59
|
+
/**
|
|
60
|
+
* The payload that will be committed, by REFERENCE — the frozen object the payload builder
|
|
61
|
+
* produced. Rendering never rebuilds it, and no display string is ever read back into it.
|
|
62
|
+
*/
|
|
63
|
+
details: Record<string, unknown>;
|
|
64
|
+
cells: ReviewCell[];
|
|
65
|
+
/**
|
|
66
|
+
* How this row is named out loud — "TRADE_ID TR1" rather than "row 3".
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* A checkbox labelled by POSITION tells a keyboard or screen-reader user nothing about what
|
|
70
|
+
* they are approving, and stops being true the moment rows are ordered differently. Built
|
|
71
|
+
* from the values that identify the record where there are any, and falling back to the
|
|
72
|
+
* position only when there is nothing better.
|
|
73
|
+
*/
|
|
74
|
+
label: string;
|
|
75
|
+
/** Why this row cannot be written, when the bridge refused it before the review. */
|
|
76
|
+
problems?: string[];
|
|
77
|
+
}
|
|
78
|
+
/** @internal */
|
|
79
|
+
export interface ReviewColumn {
|
|
80
|
+
field: string;
|
|
81
|
+
/** Heading: the metadata's label when it has one, else the field name. */
|
|
82
|
+
label: string;
|
|
83
|
+
}
|
|
84
|
+
/** @internal */
|
|
85
|
+
export interface ReviewModel {
|
|
86
|
+
resource: string;
|
|
87
|
+
op: GenesisEventOp;
|
|
88
|
+
/**
|
|
89
|
+
* The table's columns, and the order every row's cells are in.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Built here rather than from one row's keys, because rows legitimately differ: a refused row
|
|
93
|
+
* carries no payload at all, an insert may name a different subset of fields, and a field that
|
|
94
|
+
* is null in one row and set in another appears in only one of them. A header taken from the
|
|
95
|
+
* first row put those rows' values under the wrong headings — and a refused row at position
|
|
96
|
+
* one gave the table NO headings while every other row still rendered its values.
|
|
97
|
+
*
|
|
98
|
+
* Every declared field appears, even where no row carries a value for it. On a modify that is
|
|
99
|
+
* the honest rendering: the write replaces the record, so a field showing blank is a field
|
|
100
|
+
* being written blank, and it is precisely the column a user needs to see before approving.
|
|
101
|
+
*/
|
|
102
|
+
columns: ReviewColumn[];
|
|
103
|
+
rows: ReviewRow[];
|
|
104
|
+
/** Indexes a user may select: a row the bridge already refused is shown but not selectable. */
|
|
105
|
+
selectable: number[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A value as a person should read it.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* Driven by the field's DECLARED type, never by its name: `CREATED_AT` is a DATETIME and ends
|
|
112
|
+
* in neither "DATE" nor "TIME", so a name heuristic would show a user
|
|
113
|
+
* `CREATED_AT 1790001000000` and call it a review. Display only — a formatted date must never
|
|
114
|
+
* re-enter the payload, or the identity property is undone from the presentation side.
|
|
115
|
+
*
|
|
116
|
+
* Formatting is `foundation-utils`' own `formatTimestamp` rather than a local slice of an ISO
|
|
117
|
+
* string: it is the same rendering the rest of the platform's UI gives a DATE and a DATETIME, so
|
|
118
|
+
* a trade's date reads here the way it reads in a grid. It also shows SECONDS, which a local
|
|
119
|
+
* version cut to the minute — and seconds matter on this screen. Genesis does not truncate them
|
|
120
|
+
* (a capture shows `13:27:05` stored as sent), so two timestamps that differ only in seconds
|
|
121
|
+
* used to render identically to an approver and rely on the changed-mark alone to tell them
|
|
122
|
+
* apart.
|
|
123
|
+
*
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
export declare function displayValue(value: unknown, type?: string): string;
|
|
127
|
+
/**
|
|
128
|
+
* Builds what the table renders.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* `details` is carried by reference into each row, so the object shown is the object committed.
|
|
132
|
+
* The display strings are derived FROM it and never flow back: a formatted date re-entering the
|
|
133
|
+
* payload would undo the identity property from the presentation side.
|
|
134
|
+
*
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
export declare function buildReviewModel(options: {
|
|
138
|
+
resource: string;
|
|
139
|
+
op: GenesisEventOp;
|
|
140
|
+
/** The event's own fields, for labels and for the type that decides how a value is shown. */
|
|
141
|
+
fields?: ReadonlyArray<{
|
|
142
|
+
name: string;
|
|
143
|
+
title?: string;
|
|
144
|
+
type?: string;
|
|
145
|
+
}>;
|
|
146
|
+
rows: Array<{
|
|
147
|
+
index: number;
|
|
148
|
+
details: Record<string, unknown>;
|
|
149
|
+
/**
|
|
150
|
+
* What to RENDER, when that is not the payload. A delete sends its key alone, and what the
|
|
151
|
+
* user approves is the removal of a whole row — so the table shows the row while `details`
|
|
152
|
+
* stays the object that gets committed.
|
|
153
|
+
*/
|
|
154
|
+
display?: Record<string, unknown>;
|
|
155
|
+
preImage?: Record<string, unknown>;
|
|
156
|
+
problems?: string[];
|
|
157
|
+
}>;
|
|
158
|
+
}): ReviewModel;
|
|
159
|
+
/**
|
|
160
|
+
* The selection a freshly opened review starts with: none.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* Called by the component rather than duplicated there. A tested helper nothing uses is an
|
|
164
|
+
* orphaned guarantee — the next person to change the component's default would not fail its
|
|
165
|
+
* test.
|
|
166
|
+
*
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
export declare const initialSelection: () => number[];
|
|
170
|
+
/**
|
|
171
|
+
* The selection a still-open review resumes with when it is mounted again: what the user had
|
|
172
|
+
* ticked, as far as the model still offers it.
|
|
173
|
+
*
|
|
174
|
+
* @remarks
|
|
175
|
+
* A pending review is a fresh element on every remount — a reparent in the layout, a dock, a
|
|
176
|
+
* transcript re-render — so a selection held only on the element was dropped, and a user on a
|
|
177
|
+
* twenty-row review redid it with nothing to say why. What is parked survives on the
|
|
178
|
+
* interaction's context; what comes back through here is filtered to the selectable rows, in
|
|
179
|
+
* table order, so a refused row or anything that is not an index can never be restored into a
|
|
180
|
+
* selection. Anything that is not a list is nothing parked, and a fresh review starts empty.
|
|
181
|
+
*
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
export declare const restoredSelection: (model: ReviewModel | undefined, parked: unknown) => number[];
|
|
185
|
+
/**
|
|
186
|
+
* Whether Write may fire. False on an empty selection, so the button is disabled and the empty
|
|
187
|
+
* state cannot commit anything.
|
|
188
|
+
*
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
export declare const canWrite: (selection: readonly number[]) => boolean;
|
|
192
|
+
/**
|
|
193
|
+
* The rows a Write commits: the ones selected, in the order shown, each carrying the very
|
|
194
|
+
* object the table rendered.
|
|
195
|
+
*
|
|
196
|
+
* @internal
|
|
197
|
+
*/
|
|
198
|
+
export declare const selectedRows: (model: ReviewModel, selection: ReadonlySet<number>) => Array<{
|
|
199
|
+
index: number;
|
|
200
|
+
details: Record<string, unknown>;
|
|
201
|
+
}>;
|
|
202
|
+
//# sourceMappingURL=review-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-model.d.ts","sourceRoot":"","sources":["../../../src/genesis/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