Skip to content

Commit 7762ba5

Browse files
committed
v0.9.1 — CollectorRequestSection round-trip for customFieldKeys[]
CollectorRequestSection lacked a customFieldKeys field, so the section's reference into request.customFields[] was lost on serialize/deserialize. Added private #customFieldKeys plus public customFieldKeys getter, setCustomFieldKeys(keys) and addCustomFieldKey(key) setters, parsing in setContent() and serialization in getData(). Discovered during Phase 6 mcp-chrome smoke test of an uploaded AppTemplate — request had customFields but the per-section pointers were dropped.
1 parent 28ab72a commit 7762ba5

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [0.9.1] - 2026-04-28
6+
7+
### Fixed — `CollectorRequestSection` round-trip for `customFieldKeys[]`
8+
9+
`CollectorRequestSection` lacked a `customFieldKeys` field, so the section's reference into `request.customFields[]` was lost on serialize/deserialize. Added private `#customFieldKeys` plus public `customFieldKeys` getter, `setCustomFieldKeys(keys)` and `addCustomFieldKey(key)` setters, parsing in `setContent()` and serialization in `getData()`. Discovered during Phase 6 mcp-chrome smoke test — a template uploaded via `loadTemplate()` had its custom fields surfaced on the request but the per-section pointers dropped.
10+
511
## [0.9.0] - 2026-04-28
612

713
### Added — custom fields & template loader (45-custom-fields-appTemplates Phase 3 + 3.5)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hds-lib",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "Health Data Safe - Library",
55
"type": "module",
66
"engines": {

ts/appTemplates/CollectorRequest.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ export class CollectorRequest {
133133
section.setItemCustomization(itemKey, customization as Record<string, unknown>);
134134
}
135135
}
136+
if (Array.isArray(sectionData.customFieldKeys)) {
137+
section.setCustomFieldKeys(sectionData.customFieldKeys);
138+
}
136139
}
137140
delete futureContent.sections;
138141
}
@@ -435,12 +438,14 @@ class CollectorRequestSection implements CollectorSectionInterface {
435438
#key: string;
436439
#itemKeys: Array<string>;
437440
#itemCustomizations: Record<string, Record<string, unknown>>;
441+
#customFieldKeys: Array<string>;
438442

439443
constructor (key: string, type: RequestSectionType) {
440444
this.#key = key;
441445
this.#type = type;
442446
this.#itemKeys = [];
443447
this.#itemCustomizations = {};
448+
this.#customFieldKeys = [];
444449
this.#name = {
445450
en: ''
446451
};
@@ -493,6 +498,19 @@ class CollectorRequestSection implements CollectorSectionInterface {
493498
return this.#itemCustomizations[key];
494499
}
495500

501+
// Plan 45 — section's reference into request.customFields[]
502+
get customFieldKeys (): Array<string> { return this.#customFieldKeys; }
503+
setCustomFieldKeys (keys: Array<string>) {
504+
if (!Array.isArray(keys)) throw new HDSLibError('customFieldKeys must be an array', keys);
505+
this.#customFieldKeys = keys.slice();
506+
}
507+
508+
addCustomFieldKey (key: string) {
509+
if (typeof key !== 'string' || key.length === 0) throw new HDSLibError('customFieldKey must be a non-empty string', key);
510+
if (this.#customFieldKeys.includes(key)) return;
511+
this.#customFieldKeys.push(key);
512+
}
513+
496514
getData () {
497515
const data: any = {
498516
key: this.key,
@@ -503,6 +521,9 @@ class CollectorRequestSection implements CollectorSectionInterface {
503521
if (Object.keys(this.#itemCustomizations).length > 0) {
504522
data.itemCustomizations = this.#itemCustomizations;
505523
}
524+
if (this.#customFieldKeys.length > 0) {
525+
data.customFieldKeys = this.#customFieldKeys;
526+
}
506527
return data;
507528
}
508529
}

0 commit comments

Comments
 (0)