@peopl-health/nexus 5.71.35 → 5.71.36

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.
@@ -3,12 +3,17 @@ const { Config_ID } = require('../../config/airtableConfig');
3
3
  const { getRecordByFilter } = require('../../services/airtableService');
4
4
 
5
5
  const { safeParse, safeParseArray } = require('../../utils/jsonUtils');
6
+ const { logger } = require('../../utils/logger');
6
7
 
7
8
  const FHIR_CONFIG_TABLE = 'fhir';
9
+ // Every stored resource key, extension url and code system is built on these. They are identity, not
10
+ // configuration: an edited base would fork the corpus into duplicates and orphan every stored extension.
11
+ const BASES = {
12
+ IDENT_BASE: 'https://peopl.health/fhir/identifier',
13
+ EXT_BASE: 'https://peopl.health/fhir/StructureDefinition',
14
+ CODESYSTEM_BASE: 'https://peopl.health/fhir/CodeSystem',
15
+ };
8
16
  const REQUIRED_KEYS = [
9
- 'IDENT_BASE',
10
- 'EXT_BASE',
11
- 'CODESYSTEM_BASE',
12
17
  'SYSTEMS',
13
18
  'SUSPECTED_GRADE_DISPLAYS',
14
19
  'QUESTIONNAIRE_CANONICAL_URL',
@@ -18,9 +23,6 @@ const REQUIRED_KEYS = [
18
23
  ];
19
24
 
20
25
  const state = {
21
- identBase: null,
22
- extBase: null,
23
- codesystemBase: null,
24
26
  systems: null,
25
27
  suspectedGradeDisplays: null,
26
28
  questionnaireCanonicalUrl: null,
@@ -43,9 +45,11 @@ async function initialize() {
43
45
  const suspectedGradeDisplays = safeParseArray(byKey.SUSPECTED_GRADE_DISPLAYS, null);
44
46
  if (!suspectedGradeDisplays) throw new Error('fhir config SUSPECTED_GRADE_DISPLAYS is not a JSON array');
45
47
 
46
- state.identBase = byKey.IDENT_BASE;
47
- state.extBase = byKey.EXT_BASE;
48
- state.codesystemBase = byKey.CODESYSTEM_BASE;
48
+ for (const [key, value] of Object.entries(BASES)) {
49
+ if (byKey[key] && byKey[key] !== value) {
50
+ logger.error('[fhirConfig] Config base value ignored: FHIR identity bases are fixed in code', { key, configured: byKey[key], used: value });
51
+ }
52
+ }
49
53
  state.systems = systems;
50
54
  state.suspectedGradeDisplays = suspectedGradeDisplays;
51
55
  state.questionnaireCanonicalUrl = byKey.QUESTIONNAIRE_CANONICAL_URL;
@@ -60,9 +64,9 @@ function assertLoaded() {
60
64
 
61
65
  module.exports = {
62
66
  initialize,
63
- getIdentBase: () => { assertLoaded(); return state.identBase; },
64
- getExtBase: () => { assertLoaded(); return state.extBase; },
65
- getCodesystemBase: () => { assertLoaded(); return state.codesystemBase; },
67
+ getIdentBase: () => BASES.IDENT_BASE,
68
+ getExtBase: () => BASES.EXT_BASE,
69
+ getCodesystemBase: () => BASES.CODESYSTEM_BASE,
66
70
  getSystems: () => { assertLoaded(); return state.systems; },
67
71
  getSuspectedGradeDisplays: () => { assertLoaded(); return state.suspectedGradeDisplays; },
68
72
  getQuestionnaireCanonicalUrl: () => { assertLoaded(); return state.questionnaireCanonicalUrl; },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.71.35",
3
+ "version": "5.71.36",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",