Core composer and primitive field types for berhtjan UI contributions
  • Lua 98.9%
  • Shell 0.8%
  • Makefile 0.3%
Find a file
2026-10-17 11:35:31 +02:00
.github chore(README): update Readme 2026-08-11 17:33:12 +02:00
config chore(README): update Readme 2026-08-11 17:33:12 +02:00
docs docs: add release notes for v2.2.0 2026-10-17 11:32:17 +02:00
i18n fix(i18n): add the schema field required by daw_i18n/v1 2026-10-16 18:13:07 +02:00
scanner fix(scanner): preserve command provenance, reject name collisions in build_index() 2026-09-25 07:16:50 +02:00
scripts Initial commit 2026-05-04 10:00:43 +02:00
test fix(i18n): add the schema field required by daw_i18n/v1 2026-10-16 18:13:07 +02:00
.fragjan fix(scanner): propagate flags_def through build_index 2026-05-24 08:34:59 +02:00
.gitignore fix: route requires through pcall, remove os.getenv from lang 2026-06-02 08:05:17 +02:00
.merkwerk fix(scanner): propagate flags_def through build_index 2026-05-24 08:34:59 +02:00
.version_history chore: merkwerk auto-update 2026-10-17 11:35:31 +02:00
composer.lua feat(i18n): switch contribution labels to daw_i18n/v1 resource identities 2026-09-24 20:46:20 +02:00
init.lua feat(resources): add build-time logic for the per-language resource catalogs 2026-10-16 13:54:39 +02:00
lang.lua feat(lang): per-language catalogs for resolve_resource(), add language_chain() 2026-10-16 07:17:11 +02:00
LICENSE fix: route requires through pcall, remove os.getenv from lang 2026-06-02 08:05:17 +02:00
loader.lua feat(i18n): switch contribution labels to daw_i18n/v1 resource identities 2026-09-24 20:46:20 +02:00
Makefile feat(i18n): add resource_id and daw_i18n/v1 resources to types and scanner/roots 2026-09-21 21:00:10 +02:00
README.md docs(readme): align Contributing section with GitHub Issues policy 2026-09-22 14:11:29 +02:00
resources.lua feat(resources): add build-time logic for the per-language resource catalogs 2026-10-16 13:54:39 +02:00
types.lua feat(i18n): add resource_id and daw_i18n/v1 resources to types and scanner/roots 2026-09-21 21:00:10 +02:00
VERSION chore: bump version to 2.2.0 2026-10-17 11:35:31 +02:00

daw-modul-berhtjan-core

Composer and field type registry for berhtjan UI contributions.

daw-modul-berhtjan-core loads, validates and composes contribution.json declarations from Dragons@Work modules, and resolves field types against the daw_field_type/v1 contract -- no field type name is hardcoded in Core itself, not even a "primitive" one.

Status: In development · Lua: 5.1 / 5.4 · License: ISC

❤️ Contribute and support our work

What is daw-modul-berhtjan-core?

daw-modul-berhtjan-core is the foundation of the berhtjan UI layer in the Dragons@Work ecosystem. It knows no concrete field types itself -- not text, not number, not any name at all. Instead it structurally validates field type definitions against the open daw_field_type/v1 contract and resolves them at runtime from a registry that modules and host programs populate.

Renderers (CLI, web, desktop, API) receive fully composed field definitions from berhtjan-core and decide themselves how to present a given value.kind/acquisition combination.

What problem does it solve?

berhtjan-core originally hardcoded six field types directly in code (text, textarea, number, boolean, select, date). A new field type meant a code change to Core -- and usually to every renderer that needed to display it.

With daw_field_type/v1, a new field type is pure data: value semantics (value.kind, open vocabulary) are separated from acquisition paths (direct, selection, resource). A module can introduce a completely new field type without Core or an existing renderer being touched -- as long as the type is built from the known acquisition mechanisms.

Status

  • In active development, Lua 5.1 and 5.4 supported
  • Fully migrated to daw_error/v1 (structured error objects instead of error strings) and daw_field_type/v1 (field type registry instead of hardcoded primitives)
  • Known open questions: where the ecosystem's base field types are shipped from as data, constraint vocabulary keys are closed but minimal (see daw-contracts)

Installation

daw-modul-berhtjan-core is included as a git dependency, not installed via a package manager:

git clone https://smida.dragons-at-work.de/DAW/daw-modul-berhtjan-core.git \
  lib/daw/berhtjan_core

Usage

local core = require("daw.berhtjan_core")

-- parse a contribution and its type definitions
local contrib, err   = core.parse_contribution(raw_json)
local types, err2    = core.parse_types(raw_types_json)  -- validated against daw_field_type/v1
local registry, err3 = core.merge_types({ types_a, types_b })

-- compose for a host (nil = all groups)
local composed, err4 = core.compose(contrib, registry, { "core", "prices" })

-- resolve a single field type
local def, err5 = core.resolve_type("text", registry)

-- resolve language/label -- no silent fallback, a missing label is an error
local lang, err6  = core.resolve_lang(ctx)
local label, err7 = core.resolve_label(field.label, lang, ctx.default_lang)

Every public function follows the daw_error/v1 contract: value, nil | nil, daw_error/v1 -- never a raw error string.

Documentation

Development and Testing

Requirements: Lua 5.1 or 5.4, daw-lua-common.

git clone https://smida.dragons-at-work.de/DAW/daw-modul-berhtjan-core.git
cd daw-modul-berhtjan-core
git clone https://smida.dragons-at-work.de/DAW/daw-lua-common.git lib/daw/common
make test
echo "DAW_LUA_VERSION = 5.1" > config/local.mk && make test  # check against Lua 5.1

Contributing

Bug reports, tests, feedback, and contributions are welcome.

The primary development repository is on Forgejo: Development repository

The GitHub repository is a public mirror for better discoverability. Bug reports, questions, suggestions, and other feedback are welcome through GitHub Issues and are handled there. There is no need to report them again in the primary Forgejo repository.

Development planning and project coordination stay in the primary Forgejo repository. Contributions and pull requests are still submitted there.

Open Knowledge Needs People

We develop ideas, share knowledge, and build open source software and tools. Projects like this one don't grow on their own -- they live because people ask questions, experiment, share knowledge, find bugs, and help make things better.

You can contribute in different ways:

  • reporting bugs
  • reviewing code
  • testing on other platforms
  • improving documentation
  • translating content
  • or, if you like, supporting us financially

Every contribution helps us keep developing open knowledge and open source software.

Contribute and support our work →

License

Released under the ISC License as part of the Dragons@Work open source ecosystem.