@dforge-core/metadata 0.0.47 → 0.0.49

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.49] — 2026-11-03
9
+
10
+ ### Fixed
11
+
12
+ - **Query columns validate:** the column `oneOf` in `entity.schema.json` had no variant admitting `columnType: "Q"`, so every
13
+ Q column failed validation although the server installs it. A Q column now requires `params` and carries no
14
+ `dbDatatype`, `fieldTypeCd` or `link`.
15
+
16
+ ## [0.0.48] — 2026-11-02
17
+
18
+ ### Added
19
+
20
+ - **Query columns (`columnType: "Q"`):** `entity.schema.json` accepts a Q column — a read-only list of rows a record reads —
21
+ bound by `params` to a balance register as of the record's date (`register`, `asOf`, `dimensions`) or to a query written
22
+ in the column and filled from the record (`entity`, `query`, `params`), with an optional `viz`. The types
23
+ (`QueryColumnParams` and its two forms) are exported, and `QUERY_COLUMN_RECORD_SLOTS` / `isQueryColumnRecordSlot(path)`
24
+ say which paths inside `params` name a column of the record's entity, so an editor can offer that entity's columns there.
25
+ - The `Q` entry of the column-type registry now reads "Query rows".
26
+
8
27
  ## [0.0.47] — 2026-10-29
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;
@@ -1897,7 +1935,7 @@ interface JobDef {
1897
1935
  timeout: number;
1898
1936
  /** Max parallel runs (1–5; default 1). */
1899
1937
  concurrency?: number;
1900
- /** Idempotency key template, e.g. '{job_cd}:{run.month}'. */
1938
+ /** Reserved, not enforced: stored but never read by the scheduler. */
1901
1939
  idempotencyKey?: string;
1902
1940
  /** Routing class ('long_running' required for any timeout > 300s). */
1903
1941
  class?: "standard" | "long_running";
@@ -1984,6 +2022,8 @@ interface PrintPageSettings {
1984
2022
  size?: "A4" | "letter" | "legal";
1985
2023
  orientation?: "portrait" | "landscape";
1986
2024
  margins?: PrintMargins;
2025
+ /** The form's own culture ('uk-UA') for its numbers and dates, whoever prints it. */
2026
+ culture?: string;
1987
2027
  }
1988
2028
  /**
1989
2029
  * A print template or snippet (value in the print_templates map).
@@ -2117,4 +2157,4 @@ declare const flagDefs: readonly {
2117
2157
  label: string;
2118
2158
  }[];
2119
2159
 
2120
- 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 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, 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,