@dforge-core/metadata 0.0.46 → 0.0.48

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/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to `@dforge-core/metadata` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.48] — 2026-11-02
9
+
10
+ ### Added
11
+
12
+ - **Query columns (`columnType: "Q"`):** `entity.schema.json` accepts a Q column — a read-only list of rows a record reads —
13
+ bound by `params` to a balance register as of the record's date (`register`, `asOf`, `dimensions`) or to a query written
14
+ in the column and filled from the record (`entity`, `query`, `params`), with an optional `viz`. The types
15
+ (`QueryColumnParams` and its two forms) are exported, and `QUERY_COLUMN_RECORD_SLOTS` / `isQueryColumnRecordSlot(path)`
16
+ say which paths inside `params` name a column of the record's entity, so an editor can offer that entity's columns there.
17
+ - The `Q` entry of the column-type registry now reads "Query rows".
18
+
19
+ ## [0.0.47] — 2026-10-29
20
+
21
+ ### Added
22
+
23
+ - **Grid and list grouping in `data_views.schema.json`:** a `grid` or `list` view's `viewConfig` accepts
24
+ `groupByField`, `groupByOptions` and `collapsedGroups` (and `inlineAdd` on a list). The new types are exported
25
+ from `data-views.ts`.
26
+
8
27
  ## [0.0.46] — 2026-10-25
9
28
 
10
29
  ### Added
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface NamedKind {
8
8
  /** Horizontal alignment for a column's display (authored via `params.align`). */
9
9
  type AlignType = "left" | "right" | "center";
10
10
  /** Column kind letter as stored in entity JSON / the `column` metadata table. */
11
- type ColumnTypeCd = "D" | "R" | "S" | "F" | "A" | "L" | "G";
11
+ type ColumnTypeCd = "D" | "R" | "S" | "F" | "A" | "L" | "G" | "Q";
12
12
  /** Abstract data type code from the `base_datatype` table. */
13
13
  type BaseDatatypeCd = "binary" | "bool" | "culture" | "cuid" | "date" | "guid" | "json" | "link" | "number" | "project" | "ref" | "set" | "string" | "time" | "timestamp" | "xml";
14
14
  /** Column flag letters, in any order. V=Visible, E=Editable (display/interaction),
@@ -787,6 +787,44 @@ interface EntityDef {
787
787
  views?: Record<string, EntityViewDef>;
788
788
  }
789
789
 
790
+ /** How the card shows the rows: a report visualization by its type and config. Unset: a table. */
791
+ interface QueryColumnViz {
792
+ type: string;
793
+ config?: Record<string, unknown>;
794
+ }
795
+ /** The balance of a register as of the record's date, narrowed by the record's own columns. */
796
+ interface RegisterQueryColumnParams {
797
+ /** `module_cd.register_cd` of a balance register. */
798
+ register: string;
799
+ /** Date column of the record the balance is taken on. */
800
+ asOf: string;
801
+ /** Register dimension → column of the record that narrows it. */
802
+ dimensions?: Record<string, string>;
803
+ viz?: QueryColumnViz;
804
+ }
805
+ /** A query written in the column, its `@name` filter values filled from the record. */
806
+ interface EntityQueryColumnParams {
807
+ /** `module_cd.entity_cd` the query reads. */
808
+ entity: string;
809
+ /** The query, in the shape `query.run` takes. */
810
+ query: {
811
+ columns?: unknown[];
812
+ filter?: unknown;
813
+ sort?: unknown[];
814
+ };
815
+ /** Query parameter name → column of the record that fills it. */
816
+ params?: Record<string, string>;
817
+ viz?: QueryColumnViz;
818
+ }
819
+ type QueryColumnParams = RegisterQueryColumnParams | EntityQueryColumnParams;
820
+ /**
821
+ * The places in a Q column's `params` that name a column of the entity the column is on, so an
822
+ * editor can offer that entity's columns there. `*` matches any key.
823
+ */
824
+ declare const QUERY_COLUMN_RECORD_SLOTS: readonly (readonly string[])[];
825
+ /** Whether a path inside a Q column's `params` names a column of the record's entity. */
826
+ declare function isQueryColumnRecordSlot(path: readonly (string | number)[]): boolean;
827
+
790
828
  /** `{ field, target }` for each Reference (R) column that declares a link. */
791
829
  declare function getLinks(entity: EntityDef): Array<{
792
830
  field: string;
@@ -848,6 +886,14 @@ interface CalendarViewConfig {
848
886
  /** Column whose value drives the event pill color. */
849
887
  colorField?: string;
850
888
  }
889
+ interface GridViewConfig {
890
+ /** Dropdown, reference or user column the rows are grouped by under header rows. */
891
+ groupByField?: string;
892
+ /** Columns the Group by menu offers; must include `groupByField`. */
893
+ groupByOptions?: string[];
894
+ /** Option values of `groupByField` whose groups start collapsed. */
895
+ collapsedGroups?: string[];
896
+ }
851
897
  interface TreeGridViewConfig {
852
898
  /** Self-referencing FK column (parent record). */
853
899
  parentField: string;
@@ -869,6 +915,14 @@ interface ListViewConfig {
869
915
  subtitleField?: string;
870
916
  /** Hierarchical child levels for expandable list rows. */
871
917
  levels?: ListLevelConfig[];
918
+ /** Dropdown, reference or user column the rows are grouped by. */
919
+ groupByField?: string;
920
+ /** Columns the user may regroup by; includes `groupByField`. */
921
+ groupByOptions?: string[];
922
+ /** Option values of `groupByField` whose groups start collapsed. */
923
+ collapsedGroups?: string[];
924
+ /** Show an add row in each group (at the top when ungrouped). */
925
+ inlineAdd?: boolean;
872
926
  }
873
927
  interface DiagramViewConfig {
874
928
  /** Column to group diagram nodes by. */
@@ -891,7 +945,7 @@ interface DataViewDef {
891
945
  /** Default sort order. */
892
946
  order?: unknown;
893
947
  /** View-type-specific configuration. */
894
- viewConfig?: KanbanViewConfig | CalendarViewConfig | TreeGridViewConfig | ListViewConfig | DiagramViewConfig | Record<string, unknown>;
948
+ viewConfig?: GridViewConfig | KanbanViewConfig | CalendarViewConfig | TreeGridViewConfig | ListViewConfig | DiagramViewConfig | Record<string, unknown>;
895
949
  }
896
950
  /** A `ui/data_views.json` file: data view code → definition. */
897
951
  type DataViewsFile = Record<string, DataViewDef>;
@@ -1881,7 +1935,7 @@ interface JobDef {
1881
1935
  timeout: number;
1882
1936
  /** Max parallel runs (1–5; default 1). */
1883
1937
  concurrency?: number;
1884
- /** Idempotency key template, e.g. '{job_cd}:{run.month}'. */
1938
+ /** Reserved, not enforced: stored but never read by the scheduler. */
1885
1939
  idempotencyKey?: string;
1886
1940
  /** Routing class ('long_running' required for any timeout > 300s). */
1887
1941
  class?: "standard" | "long_running";
@@ -1968,6 +2022,8 @@ interface PrintPageSettings {
1968
2022
  size?: "A4" | "letter" | "legal";
1969
2023
  orientation?: "portrait" | "landscape";
1970
2024
  margins?: PrintMargins;
2025
+ /** The form's own culture ('uk-UA') for its numbers and dates, whoever prints it. */
2026
+ culture?: string;
1971
2027
  }
1972
2028
  /**
1973
2029
  * A print template or snippet (value in the print_templates map).
@@ -2101,4 +2157,4 @@ declare const flagDefs: readonly {
2101
2157
  label: string;
2102
2158
  }[];
2103
2159
 
2104
- export { AGG_TYPE_LIST, type AccumulationConfig, AggType, type AlignType, type AuditHistoryLevel, type BaseDatatypeCd, type CalendarViewConfig, type CardFieldDef, type CardFieldEntry, type CardLayout, type CardLayoutDef, type CardLayoutsFile, type CardSection, type CardSetConfig, type CardTabRef, type ColumnDef, type ColumnGroupSection, type ColumnTypeCd, type ColumnTypeDef, DEP_COLUMN_TYPES, type DataSource, type DataViewDef, type DataViewsFile, type Dataset, type DepColumn, type DepColumnMode, type DepColumnType, type DepEntity, type DepProvenance, type DepProvenanceKind, type DepsFile, type DeriveOptions, type DiagramDef, type DiagramDetail, type DiagramEntity, type DiagramFile, type DiagramRelation, type DiagramViewConfig, type DomainDef, type DomainsFile, type EntityDef, type EntityEvent, type EntityReaction, type EntityReference, type EntityViewColumnDef, type EntityViewDef, FILTER_GROUP_OPERATORS, FILTER_OPERATORS, type FieldDef, type FieldLink, type FieldOption, type FieldTypeCd, type FieldTypeDef, type Filter, type FilterCondition, type FilterGroup, type FilterGroupOperator, type FilterOperator, type FlagCd, type FolderDef, type FolderEntityBinding, type FoldersFile, type JobDef, type JobsFile, type KanbanViewConfig, type LedgerRegistryEntry, type ListLevelConfig, type ListViewConfig, type ManifestAuthor, type ManifestDef, type MenuDef, type MenuItemDef, type MenuItemType, type MenusFile, type ModuleDependency, type ModuleFeature, NUMERIC_TOTAL, type NamedKind, type NumberSequenceDef, type ParamDef, type ParamDefBase, type PeriodConfig, type PrintMargins, type PrintPageSettings, type PrintTemplateDef, type PrintTemplatesFile, REGISTER_CODE, REGISTER_COLUMN_NAME, REGISTER_COLUMN_SLOTS, REGISTER_KINDS, REGISTER_TOTALS_PERIODS, type RegisterBindingParams, type RegisterBindingTarget, type RegisterColumnHost, type RegisterColumnSlot, type RegisterCompositionDef, type RegisterDef, type RegisterEntityInfo, type RegisterEntityLookup, type RegisterHosts, type RegisterIssue, type RegisterKind, type RegisterMapValue, type RegisterResourceDef, type RegisterSource, type RegisterTotalsDef, type RegisterTotalsPeriod, type RegistersFile, type ReportDef, type ReportEntityAttachment, type ReportLayout, type ReportPanel, type ReportQuery, type ReportsFile, type ResolvedColumnSlot, type RoleDef, type RolesFile, type SeedDataFile, type SeedDataRepeat, type SetSection, type SettingBaseDatatype, type SettingConstraintDef, type SettingDef, type SettingsFile, type SignConfig, type SortClause, type SpColumnDef, type SpParamDef, type StoredProcedureDef, type StoredProceduresFile, type TabGroupSection, type TraitCd, type TraitDef, type TraitFieldConflict, type TraitsFile, type TranslatedAction, type TranslatedEntity, type TranslatedMenu, type TranslatedOption, type TranslatedReport, type TranslatedWithOptions, type TranslationsFile, type TreeGridViewConfig, type TriggerDef, type TriggersFile, type ViewColumn, type ViewType, type VizType, type WebhookPayload, type WebhookSubscription, type WebhooksFile, baseDatatypes, baseToDbDatatype, chartTypes, checkRegister, checkRegisterBinding, checkRegisters, columnTypes, dataViewKinds, defaultParams, deriveBaseDatatype, deriveDbDatatype, expandTrait, expandTraits, fieldTypeCds, fieldTypes, fieldTypesByColumnType, flagDefs, getColumnType, getFieldType, getIdentityKeys, getLinks, getPrimaryKeys, getTrait, isFieldTypeCd, isNumericDatatype, isPlainColumnRef, isRegisterKind, registerCarrier, registerColumnHost, registerColumnSlot, registerDimensions, registerLineMode, registerRefusedProps, registerRequiredProps, registerResourceShape, registerResources, settingDefsOf, traitFieldConflicts, traits, vizTypes };
2160
+ export { AGG_TYPE_LIST, type AccumulationConfig, AggType, type AlignType, type AuditHistoryLevel, type BaseDatatypeCd, type CalendarViewConfig, type CardFieldDef, type CardFieldEntry, type CardLayout, type CardLayoutDef, type CardLayoutsFile, type CardSection, type CardSetConfig, type CardTabRef, type ColumnDef, type ColumnGroupSection, type ColumnTypeCd, type ColumnTypeDef, DEP_COLUMN_TYPES, type DataSource, type DataViewDef, type DataViewsFile, type Dataset, type DepColumn, type DepColumnMode, type DepColumnType, type DepEntity, type DepProvenance, type DepProvenanceKind, type DepsFile, type DeriveOptions, type DiagramDef, type DiagramDetail, type DiagramEntity, type DiagramFile, type DiagramRelation, type DiagramViewConfig, type DomainDef, type DomainsFile, type EntityDef, type EntityEvent, type EntityQueryColumnParams, type EntityReaction, type EntityReference, type EntityViewColumnDef, type EntityViewDef, FILTER_GROUP_OPERATORS, FILTER_OPERATORS, type FieldDef, type FieldLink, type FieldOption, type FieldTypeCd, type FieldTypeDef, type Filter, type FilterCondition, type FilterGroup, type FilterGroupOperator, type FilterOperator, type FlagCd, type FolderDef, type FolderEntityBinding, type FoldersFile, type GridViewConfig, type JobDef, type JobsFile, type KanbanViewConfig, type LedgerRegistryEntry, type ListLevelConfig, type ListViewConfig, type ManifestAuthor, type ManifestDef, type MenuDef, type MenuItemDef, type MenuItemType, type MenusFile, type ModuleDependency, type ModuleFeature, NUMERIC_TOTAL, type NamedKind, type NumberSequenceDef, type ParamDef, type ParamDefBase, type PeriodConfig, type PrintMargins, type PrintPageSettings, type PrintTemplateDef, type PrintTemplatesFile, QUERY_COLUMN_RECORD_SLOTS, type QueryColumnParams, type QueryColumnViz, REGISTER_CODE, REGISTER_COLUMN_NAME, REGISTER_COLUMN_SLOTS, REGISTER_KINDS, REGISTER_TOTALS_PERIODS, type RegisterBindingParams, type RegisterBindingTarget, type RegisterColumnHost, type RegisterColumnSlot, type RegisterCompositionDef, type RegisterDef, type RegisterEntityInfo, type RegisterEntityLookup, type RegisterHosts, type RegisterIssue, type RegisterKind, type RegisterMapValue, type RegisterQueryColumnParams, type RegisterResourceDef, type RegisterSource, type RegisterTotalsDef, type RegisterTotalsPeriod, type RegistersFile, type ReportDef, type ReportEntityAttachment, type ReportLayout, type ReportPanel, type ReportQuery, type ReportsFile, type ResolvedColumnSlot, type RoleDef, type RolesFile, type SeedDataFile, type SeedDataRepeat, type SetSection, type SettingBaseDatatype, type SettingConstraintDef, type SettingDef, type SettingsFile, type SignConfig, type SortClause, type SpColumnDef, type SpParamDef, type StoredProcedureDef, type StoredProceduresFile, type TabGroupSection, type TraitCd, type TraitDef, type TraitFieldConflict, type TraitsFile, type TranslatedAction, type TranslatedEntity, type TranslatedMenu, type TranslatedOption, type TranslatedReport, type TranslatedWithOptions, type TranslationsFile, type TreeGridViewConfig, type TriggerDef, type TriggersFile, type ViewColumn, type ViewType, type VizType, type WebhookPayload, type WebhookSubscription, type WebhooksFile, baseDatatypes, baseToDbDatatype, chartTypes, checkRegister, checkRegisterBinding, checkRegisters, columnTypes, dataViewKinds, defaultParams, deriveBaseDatatype, deriveDbDatatype, expandTrait, expandTraits, fieldTypeCds, fieldTypes, fieldTypesByColumnType, flagDefs, getColumnType, getFieldType, getIdentityKeys, getLinks, getPrimaryKeys, getTrait, isFieldTypeCd, isNumericDatatype, isPlainColumnRef, isQueryColumnRecordSlot, isRegisterKind, registerCarrier, registerColumnHost, registerColumnSlot, registerDimensions, registerLineMode, registerRefusedProps, registerRequiredProps, registerResourceShape, registerResources, settingDefsOf, traitFieldConflicts, traits, vizTypes };
package/dist/index.js CHANGED
@@ -103,6 +103,7 @@ var columnTypes = [
103
103
  { cd: "F", name: "Formula", description: "A virtual value calculated from a formula expression." },
104
104
  { cd: "G", name: "Generated", description: "A physical column auto-maintained by the database (aggregate or expression)." },
105
105
  { cd: "A", name: "Accumulation register", description: "Posts this document into a balance entity (single direction)." },
106
+ { cd: "Q", name: "Query rows", description: "A read-only list of rows this record reads: a register's balance as of its date, or a query filled from its columns." },
106
107
  { cd: "L", name: "Ledger register", description: "Posts document lines into movements + balances (double entry)." }
107
108
  ];
108
109
  var byCd2 = new Map(columnTypes.map((ct) => [ct.cd, ct]));
@@ -331,6 +332,16 @@ var FILTER_OPERATORS = [
331
332
  ];
332
333
  var FILTER_GROUP_OPERATORS = ["and", "or", "!and", "nAnd", "!or", "nOr"];
333
334
 
335
+ // src/query-column.ts
336
+ var QUERY_COLUMN_RECORD_SLOTS = [
337
+ ["asOf"],
338
+ ["dimensions", "*"],
339
+ ["params", "*"]
340
+ ];
341
+ function isQueryColumnRecordSlot(path) {
342
+ return QUERY_COLUMN_RECORD_SLOTS.some((slot2) => slot2.length === path.length && slot2.every((segment, i) => segment === "*" || segment === path[i]));
343
+ }
344
+
334
345
  // src/entity-meta.ts
335
346
  function getLinks(entity) {
336
347
  const links = [];
@@ -1202,6 +1213,7 @@ export {
1202
1213
  FILTER_GROUP_OPERATORS,
1203
1214
  FILTER_OPERATORS,
1204
1215
  NUMERIC_TOTAL,
1216
+ QUERY_COLUMN_RECORD_SLOTS,
1205
1217
  REGISTER_CODE,
1206
1218
  REGISTER_COLUMN_NAME,
1207
1219
  REGISTER_COLUMN_SLOTS,
@@ -1233,6 +1245,7 @@ export {
1233
1245
  isFieldTypeCd,
1234
1246
  isNumericDatatype,
1235
1247
  isPlainColumnRef,
1248
+ isQueryColumnRecordSlot,
1236
1249
  isRegisterKind,
1237
1250
  registerCarrier,
1238
1251
  registerColumnHost,