@openhi/constructs 0.0.183 → 0.0.184

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.
@@ -11247,10 +11247,25 @@ function wrapTokenInShape(shape, value) {
11247
11247
  return { [shape.field]: [{ [shape.subfield]: value }] };
11248
11248
  }
11249
11249
  }
11250
+ function wrapTokenWithSystem(shape, systemSubfield, parsed) {
11251
+ if (shape.kind !== "array-of-objects") {
11252
+ throw new Error(
11253
+ `Token predicate option "systemSubfield" requires an array-of-objects JSONPath ("$.field[*].subfield"); got shape "${shape.kind}".`
11254
+ );
11255
+ }
11256
+ const entry = {};
11257
+ if (parsed.system !== void 0) {
11258
+ entry[systemSubfield] = parsed.system;
11259
+ }
11260
+ if (parsed.system === void 0 || parsed.code.length > 0) {
11261
+ entry[shape.subfield] = parsed.code;
11262
+ }
11263
+ return { [shape.field]: [entry] };
11264
+ }
11250
11265
  function emitTokenPredicate(opts) {
11251
11266
  const shape = jsonbPathToTokenShape(opts.jsonbPath);
11252
- const { code } = parseTokenValue(opts.rawValue);
11253
- const payload = wrapTokenInShape(shape, code);
11267
+ const parsed = parseTokenValue(opts.rawValue);
11268
+ const payload = opts.systemSubfield !== void 0 ? wrapTokenWithSystem(shape, opts.systemSubfield, parsed) : wrapTokenInShape(shape, parsed.code);
11254
11269
  const sql = `resource @> :${opts.paramName}::jsonb`;
11255
11270
  const params = [
11256
11271
  { name: opts.paramName, value: JSON.stringify(payload) }
@@ -11324,6 +11339,7 @@ function emitOne(opts) {
11324
11339
  rawValue,
11325
11340
  paramName,
11326
11341
  modifier: effectiveModifier,
11342
+ systemSubfield: param.systemSubfield,
11327
11343
  context
11328
11344
  });
11329
11345
  if (!negate) {
@@ -11345,6 +11361,7 @@ function emitForType(opts) {
11345
11361
  jsonbPath: opts.jsonbPath,
11346
11362
  rawValue: opts.rawValue,
11347
11363
  paramName: opts.paramName,
11364
+ systemSubfield: opts.systemSubfield,
11348
11365
  context: opts.context
11349
11366
  });
11350
11367
  case "date":
@@ -11530,7 +11547,12 @@ var APPOINTMENT_SEARCH_PARAMETERS = [
11530
11547
  jsonbPath: "$.appointmentType"
11531
11548
  },
11532
11549
  { code: "slot", type: "reference", jsonbPath: "$.slot[*]" },
11533
- { code: "identifier", type: "token", jsonbPath: "$.identifier[*].value" }
11550
+ {
11551
+ code: "identifier",
11552
+ type: "token",
11553
+ jsonbPath: "$.identifier[*].value",
11554
+ systemSubfield: "system"
11555
+ }
11534
11556
  ];
11535
11557
 
11536
11558
  // src/data/search/registry/chargeitem-search-parameters.ts
@@ -11781,7 +11803,12 @@ var ENCOUNTER_SEARCH_PARAMETERS = [
11781
11803
  type: "reference",
11782
11804
  jsonbPath: "$.episodeOfCare[*]"
11783
11805
  },
11784
- { code: "identifier", type: "token", jsonbPath: "$.identifier[*].value" }
11806
+ {
11807
+ code: "identifier",
11808
+ type: "token",
11809
+ jsonbPath: "$.identifier[*].value",
11810
+ systemSubfield: "system"
11811
+ }
11785
11812
  ];
11786
11813
 
11787
11814
  // src/data/search/registry/endpoint-search-parameters.ts