topmark.registry.machine.envelopes¶
topmark / registry / machine / envelopes
Envelope/record builders for registry machine-readable output.
This module is responsible for shaping registry payloads into TopMark's canonical machine-readable output envelopes.
Layers:
- topmark.registry.machine.payloads builds plain
JSON-serializable payloads.
- This module wraps those payloads into canonical envelopes / NDJSON record objects.
- topmark.registry.machine.serializers converts shaped
objects into JSON/NDJSON wire strings.
Conventions:
- JSON: one envelope object:
{"meta": ..., <payload_key>: ...}
- NDJSON: one record per entity:
{"kind": <kind>, "meta": ..., <payload>}
This module is Click-free and console-free.
build_filetypes_json_envelope ¶
Build the JSON envelope for topmark registry filetypes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
FileTypesPayload
|
List of file type entries. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
JSON envelope with keys |
Source code in src/topmark/registry/machine/envelopes.py
iter_filetypes_ndjson_records ¶
Iterate NDJSON record objects for topmark registry filetypes.
Produces one filetype record per file type entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
FileTypesPayload
|
List of file type entries. |
required |
Yields:
| Type | Description |
|---|---|
dict[str, object]
|
NDJSON record objects (not yet serialized to strings). |
Source code in src/topmark/registry/machine/envelopes.py
build_processors_json_envelope ¶
Build the JSON envelope for topmark registry processors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
ProcessorsPayload
|
List of processor entries. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
JSON envelope with keys |
Source code in src/topmark/registry/machine/envelopes.py
iter_processors_ndjson_records ¶
Iterate NDJSON record objects for topmark registry processors.
Emits:
- one processor record per processor entry
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
ProcessorsPayload
|
Processors payload. |
required |
Yields:
| Type | Description |
|---|---|
dict[str, object]
|
NDJSON record objects (not yet serialized to strings). |
Source code in src/topmark/registry/machine/envelopes.py
build_bindings_json_envelope ¶
Build the JSON envelope for topmark registry bindings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
BindingsPayload
|
Bindings payload. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
JSON envelope with keys |
Source code in src/topmark/registry/machine/envelopes.py
iter_bindings_ndjson_records ¶
Iterate NDJSON record objects for topmark registry bindings.
Emits:
- one binding record per binding entry
- one unbound_filetype record per unbound file type reference
- one unused_processor record per unused processor reference
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Machine metadata payload. |
required |
payload
|
BindingsPayload
|
Bindings payload. |
required |
Yields:
| Type | Description |
|---|---|
dict[str, object]
|
NDJSON record objects (not yet serialized to strings). |