@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.
@@ -5815,10 +5815,25 @@ function wrapTokenInShape(shape, value) {
5815
5815
  return { [shape.field]: [{ [shape.subfield]: value }] };
5816
5816
  }
5817
5817
  }
5818
+ function wrapTokenWithSystem(shape, systemSubfield, parsed) {
5819
+ if (shape.kind !== "array-of-objects") {
5820
+ throw new Error(
5821
+ `Token predicate option "systemSubfield" requires an array-of-objects JSONPath ("$.field[*].subfield"); got shape "${shape.kind}".`
5822
+ );
5823
+ }
5824
+ const entry = {};
5825
+ if (parsed.system !== void 0) {
5826
+ entry[systemSubfield] = parsed.system;
5827
+ }
5828
+ if (parsed.system === void 0 || parsed.code.length > 0) {
5829
+ entry[shape.subfield] = parsed.code;
5830
+ }
5831
+ return { [shape.field]: [entry] };
5832
+ }
5818
5833
  function emitTokenPredicate(opts) {
5819
5834
  const shape = jsonbPathToTokenShape(opts.jsonbPath);
5820
- const { code } = parseTokenValue(opts.rawValue);
5821
- const payload = wrapTokenInShape(shape, code);
5835
+ const parsed = parseTokenValue(opts.rawValue);
5836
+ const payload = opts.systemSubfield !== void 0 ? wrapTokenWithSystem(shape, opts.systemSubfield, parsed) : wrapTokenInShape(shape, parsed.code);
5822
5837
  const sql = `resource @> :${opts.paramName}::jsonb`;
5823
5838
  const params = [
5824
5839
  { name: opts.paramName, value: JSON.stringify(payload) }
@@ -5892,6 +5907,7 @@ function emitOne(opts) {
5892
5907
  rawValue,
5893
5908
  paramName,
5894
5909
  modifier: effectiveModifier,
5910
+ systemSubfield: param.systemSubfield,
5895
5911
  context
5896
5912
  });
5897
5913
  if (!negate) {
@@ -5913,6 +5929,7 @@ function emitForType(opts) {
5913
5929
  jsonbPath: opts.jsonbPath,
5914
5930
  rawValue: opts.rawValue,
5915
5931
  paramName: opts.paramName,
5932
+ systemSubfield: opts.systemSubfield,
5916
5933
  context: opts.context
5917
5934
  });
5918
5935
  case "date":
@@ -6098,7 +6115,12 @@ var APPOINTMENT_SEARCH_PARAMETERS = [
6098
6115
  jsonbPath: "$.appointmentType"
6099
6116
  },
6100
6117
  { code: "slot", type: "reference", jsonbPath: "$.slot[*]" },
6101
- { code: "identifier", type: "token", jsonbPath: "$.identifier[*].value" }
6118
+ {
6119
+ code: "identifier",
6120
+ type: "token",
6121
+ jsonbPath: "$.identifier[*].value",
6122
+ systemSubfield: "system"
6123
+ }
6102
6124
  ];
6103
6125
 
6104
6126
  // src/data/search/registry/chargeitem-search-parameters.ts
@@ -6349,7 +6371,12 @@ var ENCOUNTER_SEARCH_PARAMETERS = [
6349
6371
  type: "reference",
6350
6372
  jsonbPath: "$.episodeOfCare[*]"
6351
6373
  },
6352
- { code: "identifier", type: "token", jsonbPath: "$.identifier[*].value" }
6374
+ {
6375
+ code: "identifier",
6376
+ type: "token",
6377
+ jsonbPath: "$.identifier[*].value",
6378
+ systemSubfield: "system"
6379
+ }
6353
6380
  ];
6354
6381
 
6355
6382
  // src/data/search/registry/endpoint-search-parameters.ts