@openfn/language-fhir-fr 1.0.3 → 1.0.5

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.
package/dist/index.cjs CHANGED
@@ -1,13 +1,9 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
7
  var __commonJS = (cb, mod) => function __require() {
12
8
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
9
  };
@@ -31,7 +27,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
27
 
32
28
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
33
29
  var require_lodash = __commonJS({
34
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports2, module2) {
30
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports, module2) {
35
31
  (function() {
36
32
  var undefined2;
37
33
  var VERSION = "4.17.21";
@@ -357,7 +353,7 @@ var require_lodash = __commonJS({
357
353
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
358
354
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
359
355
  var root = freeGlobal || freeSelf || Function("return this")();
360
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
356
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
361
357
  var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
362
358
  var moduleExports = freeModule && freeModule.exports === freeExports;
363
359
  var freeProcess = moduleExports && freeGlobal.process;
@@ -2161,8 +2157,8 @@ var require_lodash = __commonJS({
2161
2157
  function createBind(func, bitmask, thisArg) {
2162
2158
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2163
2159
  function wrapper() {
2164
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2165
- return fn.apply(isBind ? thisArg : this, arguments);
2160
+ var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2161
+ return fn2.apply(isBind ? thisArg : this, arguments);
2166
2162
  }
2167
2163
  return wrapper;
2168
2164
  }
@@ -2228,8 +2224,8 @@ var require_lodash = __commonJS({
2228
2224
  arity - length
2229
2225
  );
2230
2226
  }
2231
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2232
- return apply(fn, this, args);
2227
+ var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2228
+ return apply(fn2, this, args);
2233
2229
  }
2234
2230
  return wrapper;
2235
2231
  }
@@ -2317,7 +2313,7 @@ var require_lodash = __commonJS({
2317
2313
  arity - length
2318
2314
  );
2319
2315
  }
2320
- var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
2316
+ var thisBinding = isBind ? thisArg : this, fn2 = isBindKey ? thisBinding[func] : func;
2321
2317
  length = args.length;
2322
2318
  if (argPos) {
2323
2319
  args = reorder(args, argPos);
@@ -2328,9 +2324,9 @@ var require_lodash = __commonJS({
2328
2324
  args.length = ary2;
2329
2325
  }
2330
2326
  if (this && this !== root && this instanceof wrapper) {
2331
- fn = Ctor || createCtor(fn);
2327
+ fn2 = Ctor || createCtor(fn2);
2332
2328
  }
2333
- return fn.apply(thisBinding, args);
2329
+ return fn2.apply(thisBinding, args);
2334
2330
  }
2335
2331
  return wrapper;
2336
2332
  }
@@ -2387,14 +2383,14 @@ var require_lodash = __commonJS({
2387
2383
  function createPartial(func, bitmask, thisArg, partials) {
2388
2384
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2389
2385
  function wrapper() {
2390
- var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2386
+ var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2391
2387
  while (++leftIndex < leftLength) {
2392
2388
  args[leftIndex] = partials[leftIndex];
2393
2389
  }
2394
2390
  while (argsLength--) {
2395
2391
  args[leftIndex++] = arguments[++argsIndex];
2396
2392
  }
2397
- return apply(fn, isBind ? thisArg : this, args);
2393
+ return apply(fn2, isBind ? thisArg : this, args);
2398
2394
  }
2399
2395
  return wrapper;
2400
2396
  }
@@ -4353,7 +4349,7 @@ var require_lodash = __commonJS({
4353
4349
  });
4354
4350
  return result2;
4355
4351
  }
4356
- var merge = createAssigner(function(object, source, srcIndex) {
4352
+ var merge2 = createAssigner(function(object, source, srcIndex) {
4357
4353
  baseMerge(object, source, srcIndex);
4358
4354
  });
4359
4355
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -5043,7 +5039,7 @@ var require_lodash = __commonJS({
5043
5039
  lodash.matches = matches;
5044
5040
  lodash.matchesProperty = matchesProperty;
5045
5041
  lodash.memoize = memoize;
5046
- lodash.merge = merge;
5042
+ lodash.merge = merge2;
5047
5043
  lodash.mergeWith = mergeWith;
5048
5044
  lodash.method = method;
5049
5045
  lodash.methodOf = methodOf;
@@ -5463,10 +5459,48 @@ var require_lodash = __commonJS({
5463
5459
  } else {
5464
5460
  root._ = _3;
5465
5461
  }
5466
- }).call(exports2);
5462
+ }).call(exports);
5467
5463
  }
5468
5464
  });
5469
5465
 
5466
+ // src/index.js
5467
+ var src_exports = {};
5468
+ __export(src_exports, {
5469
+ b: () => builders_exports,
5470
+ builders: () => builders_exports,
5471
+ cursor: () => import_language_common.cursor,
5472
+ dataPath: () => import_language_common.dataPath,
5473
+ dataValue: () => import_language_common.dataValue,
5474
+ dateFns: () => import_language_common.dateFns,
5475
+ default: () => src_default,
5476
+ each: () => import_language_common.each,
5477
+ field: () => import_language_common.field,
5478
+ fields: () => import_language_common.fields,
5479
+ fn: () => import_language_common.fn,
5480
+ lastReferenceValue: () => import_language_common.lastReferenceValue,
5481
+ merge: () => import_language_common.merge,
5482
+ sourceValue: () => import_language_common.sourceValue,
5483
+ util: () => utils_exports
5484
+ });
5485
+ module.exports = __toCommonJS(src_exports);
5486
+
5487
+ // src/Adaptor.js
5488
+ var Adaptor_exports = {};
5489
+ __export(Adaptor_exports, {
5490
+ cursor: () => import_language_common.cursor,
5491
+ dataPath: () => import_language_common.dataPath,
5492
+ dataValue: () => import_language_common.dataValue,
5493
+ dateFns: () => import_language_common.dateFns,
5494
+ each: () => import_language_common.each,
5495
+ field: () => import_language_common.field,
5496
+ fields: () => import_language_common.fields,
5497
+ fn: () => import_language_common.fn,
5498
+ lastReferenceValue: () => import_language_common.lastReferenceValue,
5499
+ merge: () => import_language_common.merge,
5500
+ sourceValue: () => import_language_common.sourceValue
5501
+ });
5502
+ var import_util = require("@openfn/language-common/util");
5503
+
5470
5504
  // src/utils.js
5471
5505
  var utils_exports = {};
5472
5506
  __export(utils_exports, {
@@ -5483,144 +5517,142 @@ __export(utils_exports, {
5483
5517
  reference: () => reference,
5484
5518
  setSystemMap: () => setSystemMap
5485
5519
  });
5486
- var import_lodash, systemMap, datetimeregex, mapSystems, setSystemMap, identifier, id, addExtension, findExtension, coding, concept, cc, reference, ref, composite;
5487
- var init_utils = __esm({
5488
- "src/utils.js"() {
5489
- import_lodash = __toESM(require_lodash(), 1);
5490
- systemMap = {
5491
- SmartCareID: "http://moh.gov.et/fhir/hiv/identifier/SmartCareID",
5492
- MRN: "http://moh.gov.et/fhir/hiv/identifier/MRN",
5493
- UAN: "http://moh.gov.et/fhir/hiv/identifier/UAN"
5494
- };
5495
- datetimeregex = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?/;
5496
- mapSystems = (obj) => {
5497
- if (Array.isArray(obj)) {
5498
- return obj.map(mapSystems);
5499
- }
5500
- if (obj.system in systemMap) {
5501
- return {
5502
- ...obj,
5503
- system: systemMap[obj.system]
5504
- };
5505
- }
5506
- return obj;
5507
- };
5508
- setSystemMap = (newMappings) => {
5509
- Object.assign(systemMap, newMappings);
5510
- };
5511
- identifier = (input, system) => {
5512
- if (Array.isArray(input)) {
5513
- return input.map((i) => identifier(i, system));
5514
- }
5515
- if (input) {
5516
- if (typeof input === "string") {
5517
- return mapSystems({
5518
- value: input,
5519
- system
5520
- });
5521
- } else if (system) {
5522
- return mapSystems({
5523
- system,
5524
- ...input
5525
- });
5526
- } else {
5527
- return mapSystems(input);
5528
- }
5529
- }
5530
- };
5531
- id = identifier;
5532
- addExtension = (resource, url, value) => {
5533
- const obj = {
5534
- url
5535
- };
5536
- composite(obj, "value", value);
5537
- resource.extension ?? (resource.extension = []);
5538
- resource.extension.push(obj);
5539
- };
5540
- findExtension = (obj, targetUrl, path) => {
5541
- var _a;
5542
- const result = (_a = obj.extension) == null ? void 0 : _a.find((ext) => ext.url === targetUrl);
5543
- if (result && path) {
5544
- return import_lodash.default.get(result, path);
5545
- }
5546
- return result;
5547
- };
5548
- coding = (code, system) => ({ code, system: mapSystems(system) });
5549
- concept = (text, ...codings) => {
5550
- const result = {};
5551
- let incomingCodings = codings;
5552
- if (typeof text === "string") {
5553
- result.text = text;
5554
- } else {
5555
- incomingCodings = [text].concat(codings);
5556
- }
5557
- const c = [];
5558
- for (const item of incomingCodings) {
5559
- if (Array.isArray(item)) {
5560
- c.push(coding(item[0], item[1]));
5561
- } else {
5562
- c.push(item);
5563
- }
5564
- }
5565
- result.coding = c;
5566
- return result;
5567
- };
5568
- cc = concept;
5569
- reference = (ref2, opts) => {
5570
- if (Array.isArray(ref2)) {
5571
- return ref2.map(reference, opts);
5572
- }
5573
- if (ref2.resourceType && ref2.id) {
5574
- return { reference: `${ref2.resourceType}/${ref2.id}` };
5575
- }
5576
- if (ref2.reference) {
5577
- return ref2;
5578
- }
5579
- const result = {};
5580
- if (typeof ref2 === "string") {
5581
- result.reference = ref2;
5582
- }
5583
- if (opts) {
5584
- Object.assign(result, opts);
5585
- }
5586
- return result;
5587
- };
5588
- ref = reference;
5589
- composite = (object, key, value) => {
5590
- const k = [key];
5591
- if (value.coding) {
5592
- k.push("CodeableConcept");
5593
- } else if (value.reference) {
5594
- k.push("Reference");
5595
- } else if (value.id && value.meta && value.resourceType) {
5596
- k.push("Reference");
5597
- value = reference(value);
5598
- } else if (value.start || value.end) {
5599
- k.push("Period");
5600
- } else if (value.dateTime) {
5601
- k.push("DateTime");
5602
- } else if (typeof value === "string") {
5603
- if (datetimeregex.test(value)) {
5604
- k.push("DateTime");
5605
- } else {
5606
- k.push("String");
5607
- }
5608
- } else if (typeof value === "boolean") {
5609
- k.push("Boolean");
5610
- } else if (typeof value === "number") {
5611
- k.push("Integer");
5612
- }
5613
- if (k.length === 2) {
5614
- const finalKey = k.join("");
5615
- object[finalKey] = value;
5616
- } else {
5617
- console.warn(
5618
- `WARNING: Failed to map ${key}: unrecognised data type (see utils.composite)`
5619
- );
5620
- }
5520
+ var import_lodash = __toESM(require_lodash(), 1);
5521
+ var systemMap = {
5522
+ SmartCareID: "http://moh.gov.et/fhir/hiv/identifier/SmartCareID",
5523
+ MRN: "http://moh.gov.et/fhir/hiv/identifier/MRN",
5524
+ UAN: "http://moh.gov.et/fhir/hiv/identifier/UAN"
5525
+ };
5526
+ var datetimeregex = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?/;
5527
+ var mapSystems = (obj) => {
5528
+ if (Array.isArray(obj)) {
5529
+ return obj.map(mapSystems);
5530
+ }
5531
+ if (obj.system in systemMap) {
5532
+ return {
5533
+ ...obj,
5534
+ system: systemMap[obj.system]
5621
5535
  };
5622
5536
  }
5623
- });
5537
+ return obj;
5538
+ };
5539
+ var setSystemMap = (newMappings) => {
5540
+ Object.assign(systemMap, newMappings);
5541
+ };
5542
+ var identifier = (input, system) => {
5543
+ if (Array.isArray(input)) {
5544
+ return input.map((i) => identifier(i, system));
5545
+ }
5546
+ if (input) {
5547
+ if (typeof input === "string") {
5548
+ return mapSystems({
5549
+ value: input,
5550
+ system
5551
+ });
5552
+ } else if (system) {
5553
+ return mapSystems({
5554
+ system,
5555
+ ...input
5556
+ });
5557
+ } else {
5558
+ return mapSystems(input);
5559
+ }
5560
+ }
5561
+ };
5562
+ var id = identifier;
5563
+ var addExtension = (resource, url, value) => {
5564
+ const obj = {
5565
+ url
5566
+ };
5567
+ composite(obj, "value", value);
5568
+ resource.extension ?? (resource.extension = []);
5569
+ resource.extension.push(obj);
5570
+ };
5571
+ var findExtension = (obj, targetUrl, path) => {
5572
+ var _a;
5573
+ const result = (_a = obj.extension) == null ? void 0 : _a.find((ext) => ext.url === targetUrl);
5574
+ if (result && path) {
5575
+ return import_lodash.default.get(result, path);
5576
+ }
5577
+ return result;
5578
+ };
5579
+ var coding = (code, system) => ({ code, system: mapSystems(system) });
5580
+ var concept = (text, ...codings) => {
5581
+ const result = {};
5582
+ let incomingCodings = codings;
5583
+ if (typeof text === "string") {
5584
+ result.text = text;
5585
+ } else {
5586
+ incomingCodings = [text].concat(codings);
5587
+ }
5588
+ const c = [];
5589
+ for (const item of incomingCodings) {
5590
+ if (Array.isArray(item)) {
5591
+ c.push(coding(item[0], item[1]));
5592
+ } else {
5593
+ c.push(item);
5594
+ }
5595
+ }
5596
+ result.coding = c;
5597
+ return result;
5598
+ };
5599
+ var cc = concept;
5600
+ var reference = (ref2, opts) => {
5601
+ if (Array.isArray(ref2)) {
5602
+ return ref2.map(reference, opts);
5603
+ }
5604
+ if (ref2.resourceType && ref2.id) {
5605
+ return { reference: `${ref2.resourceType}/${ref2.id}` };
5606
+ }
5607
+ if (ref2.reference) {
5608
+ return ref2;
5609
+ }
5610
+ const result = {};
5611
+ if (typeof ref2 === "string") {
5612
+ result.reference = ref2;
5613
+ }
5614
+ if (opts) {
5615
+ Object.assign(result, opts);
5616
+ }
5617
+ return result;
5618
+ };
5619
+ var ref = reference;
5620
+ var composite = (object, key, value) => {
5621
+ const k = [key];
5622
+ if (value.coding) {
5623
+ k.push("CodeableConcept");
5624
+ } else if (value.reference) {
5625
+ k.push("Reference");
5626
+ } else if (value.id && value.meta && value.resourceType) {
5627
+ k.push("Reference");
5628
+ value = reference(value);
5629
+ } else if (value.start || value.end) {
5630
+ k.push("Period");
5631
+ } else if (value.dateTime) {
5632
+ k.push("DateTime");
5633
+ } else if (typeof value === "string") {
5634
+ if (datetimeregex.test(value)) {
5635
+ k.push("DateTime");
5636
+ } else {
5637
+ k.push("String");
5638
+ }
5639
+ } else if (typeof value === "boolean") {
5640
+ k.push("Boolean");
5641
+ } else if (typeof value === "number") {
5642
+ k.push("Integer");
5643
+ }
5644
+ if (k.length === 2) {
5645
+ const finalKey = k.join("");
5646
+ object[finalKey] = value;
5647
+ } else {
5648
+ console.warn(
5649
+ `WARNING: Failed to map ${key}: unrecognised data type (see utils.composite)`
5650
+ );
5651
+ }
5652
+ };
5653
+
5654
+ // src/Adaptor.js
5655
+ var import_language_common = require("@openfn/language-common");
5624
5656
 
5625
5657
  // src/builders.js
5626
5658
  var builders_exports = {};
@@ -5643,6 +5675,7 @@ __export(builders_exports, {
5643
5675
  schedule: () => schedule,
5644
5676
  slot: () => slot
5645
5677
  });
5678
+ var import_lodash2 = __toESM(require_lodash(), 1);
5646
5679
  function address(type, props) {
5647
5680
  const mappings = {
5648
5681
  "fr-core-address": address_fr_core_address
@@ -11734,21 +11767,26 @@ function slot_fr_core_slot(props) {
11734
11767
  };
11735
11768
  return resource;
11736
11769
  }
11737
- var import_lodash2;
11738
- var init_builders = __esm({
11739
- "src/builders.js"() {
11740
- init_utils();
11741
- import_lodash2 = __toESM(require_lodash(), 1);
11742
- }
11743
- });
11744
11770
 
11745
11771
  // src/index.js
11746
- exports.__esModule = true;
11747
- exports.b = exports.builders = exports.util = void 0;
11748
- init_builders();
11749
- exports.util = (init_utils(), __toCommonJS(utils_exports));
11750
- exports.builders = (init_builders(), __toCommonJS(builders_exports));
11751
- exports.b = (init_builders(), __toCommonJS(builders_exports));
11772
+ var src_default = Adaptor_exports;
11773
+ // Annotate the CommonJS export names for ESM import in node:
11774
+ 0 && (module.exports = {
11775
+ b,
11776
+ builders,
11777
+ cursor,
11778
+ dataPath,
11779
+ dataValue,
11780
+ dateFns,
11781
+ each,
11782
+ field,
11783
+ fields,
11784
+ fn,
11785
+ lastReferenceValue,
11786
+ merge,
11787
+ sourceValue,
11788
+ util
11789
+ });
11752
11790
  /**
11753
11791
  * @license
11754
11792
  * Lodash <https://lodash.com/>
package/dist/index.js CHANGED
@@ -4,9 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __esm = (fn, res) => function __init() {
8
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
- };
10
7
  var __commonJS = (cb, mod) => function __require() {
11
8
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
9
  };
@@ -26,11 +23,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
23
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
24
  mod
28
25
  ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
26
 
31
27
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
32
28
  var require_lodash = __commonJS({
33
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports2, module) {
29
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports, module) {
34
30
  (function() {
35
31
  var undefined2;
36
32
  var VERSION = "4.17.21";
@@ -356,7 +352,7 @@ var require_lodash = __commonJS({
356
352
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
357
353
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
358
354
  var root = freeGlobal || freeSelf || Function("return this")();
359
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
355
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
360
356
  var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
361
357
  var moduleExports = freeModule && freeModule.exports === freeExports;
362
358
  var freeProcess = moduleExports && freeGlobal.process;
@@ -2160,8 +2156,8 @@ var require_lodash = __commonJS({
2160
2156
  function createBind(func, bitmask, thisArg) {
2161
2157
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2162
2158
  function wrapper() {
2163
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2164
- return fn.apply(isBind ? thisArg : this, arguments);
2159
+ var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2160
+ return fn2.apply(isBind ? thisArg : this, arguments);
2165
2161
  }
2166
2162
  return wrapper;
2167
2163
  }
@@ -2227,8 +2223,8 @@ var require_lodash = __commonJS({
2227
2223
  arity - length
2228
2224
  );
2229
2225
  }
2230
- var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2231
- return apply(fn, this, args);
2226
+ var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2227
+ return apply(fn2, this, args);
2232
2228
  }
2233
2229
  return wrapper;
2234
2230
  }
@@ -2316,7 +2312,7 @@ var require_lodash = __commonJS({
2316
2312
  arity - length
2317
2313
  );
2318
2314
  }
2319
- var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
2315
+ var thisBinding = isBind ? thisArg : this, fn2 = isBindKey ? thisBinding[func] : func;
2320
2316
  length = args.length;
2321
2317
  if (argPos) {
2322
2318
  args = reorder(args, argPos);
@@ -2327,9 +2323,9 @@ var require_lodash = __commonJS({
2327
2323
  args.length = ary2;
2328
2324
  }
2329
2325
  if (this && this !== root && this instanceof wrapper) {
2330
- fn = Ctor || createCtor(fn);
2326
+ fn2 = Ctor || createCtor(fn2);
2331
2327
  }
2332
- return fn.apply(thisBinding, args);
2328
+ return fn2.apply(thisBinding, args);
2333
2329
  }
2334
2330
  return wrapper;
2335
2331
  }
@@ -2386,14 +2382,14 @@ var require_lodash = __commonJS({
2386
2382
  function createPartial(func, bitmask, thisArg, partials) {
2387
2383
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2388
2384
  function wrapper() {
2389
- var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2385
+ var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2390
2386
  while (++leftIndex < leftLength) {
2391
2387
  args[leftIndex] = partials[leftIndex];
2392
2388
  }
2393
2389
  while (argsLength--) {
2394
2390
  args[leftIndex++] = arguments[++argsIndex];
2395
2391
  }
2396
- return apply(fn, isBind ? thisArg : this, args);
2392
+ return apply(fn2, isBind ? thisArg : this, args);
2397
2393
  }
2398
2394
  return wrapper;
2399
2395
  }
@@ -4352,7 +4348,7 @@ var require_lodash = __commonJS({
4352
4348
  });
4353
4349
  return result2;
4354
4350
  }
4355
- var merge = createAssigner(function(object, source, srcIndex) {
4351
+ var merge2 = createAssigner(function(object, source, srcIndex) {
4356
4352
  baseMerge(object, source, srcIndex);
4357
4353
  });
4358
4354
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -5042,7 +5038,7 @@ var require_lodash = __commonJS({
5042
5038
  lodash.matches = matches;
5043
5039
  lodash.matchesProperty = matchesProperty;
5044
5040
  lodash.memoize = memoize;
5045
- lodash.merge = merge;
5041
+ lodash.merge = merge2;
5046
5042
  lodash.mergeWith = mergeWith;
5047
5043
  lodash.method = method;
5048
5044
  lodash.methodOf = methodOf;
@@ -5462,10 +5458,27 @@ var require_lodash = __commonJS({
5462
5458
  } else {
5463
5459
  root._ = _3;
5464
5460
  }
5465
- }).call(exports2);
5461
+ }).call(exports);
5466
5462
  }
5467
5463
  });
5468
5464
 
5465
+ // src/Adaptor.js
5466
+ var Adaptor_exports = {};
5467
+ __export(Adaptor_exports, {
5468
+ cursor: () => cursor,
5469
+ dataPath: () => dataPath,
5470
+ dataValue: () => dataValue,
5471
+ dateFns: () => dateFns,
5472
+ each: () => each,
5473
+ field: () => field,
5474
+ fields: () => fields,
5475
+ fn: () => fn,
5476
+ lastReferenceValue: () => lastReferenceValue,
5477
+ merge: () => merge,
5478
+ sourceValue: () => sourceValue
5479
+ });
5480
+ import { expandReferences } from "@openfn/language-common/util";
5481
+
5469
5482
  // src/utils.js
5470
5483
  var utils_exports = {};
5471
5484
  __export(utils_exports, {
@@ -5482,144 +5495,154 @@ __export(utils_exports, {
5482
5495
  reference: () => reference,
5483
5496
  setSystemMap: () => setSystemMap
5484
5497
  });
5485
- var import_lodash, systemMap, datetimeregex, mapSystems, setSystemMap, identifier, id, addExtension, findExtension, coding, concept, cc, reference, ref, composite;
5486
- var init_utils = __esm({
5487
- "src/utils.js"() {
5488
- import_lodash = __toESM(require_lodash(), 1);
5489
- systemMap = {
5490
- SmartCareID: "http://moh.gov.et/fhir/hiv/identifier/SmartCareID",
5491
- MRN: "http://moh.gov.et/fhir/hiv/identifier/MRN",
5492
- UAN: "http://moh.gov.et/fhir/hiv/identifier/UAN"
5493
- };
5494
- datetimeregex = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?/;
5495
- mapSystems = (obj) => {
5496
- if (Array.isArray(obj)) {
5497
- return obj.map(mapSystems);
5498
- }
5499
- if (obj.system in systemMap) {
5500
- return {
5501
- ...obj,
5502
- system: systemMap[obj.system]
5503
- };
5504
- }
5505
- return obj;
5506
- };
5507
- setSystemMap = (newMappings) => {
5508
- Object.assign(systemMap, newMappings);
5509
- };
5510
- identifier = (input, system) => {
5511
- if (Array.isArray(input)) {
5512
- return input.map((i) => identifier(i, system));
5513
- }
5514
- if (input) {
5515
- if (typeof input === "string") {
5516
- return mapSystems({
5517
- value: input,
5518
- system
5519
- });
5520
- } else if (system) {
5521
- return mapSystems({
5522
- system,
5523
- ...input
5524
- });
5525
- } else {
5526
- return mapSystems(input);
5527
- }
5528
- }
5529
- };
5530
- id = identifier;
5531
- addExtension = (resource, url, value) => {
5532
- const obj = {
5533
- url
5534
- };
5535
- composite(obj, "value", value);
5536
- resource.extension ?? (resource.extension = []);
5537
- resource.extension.push(obj);
5538
- };
5539
- findExtension = (obj, targetUrl, path) => {
5540
- var _a;
5541
- const result = (_a = obj.extension) == null ? void 0 : _a.find((ext) => ext.url === targetUrl);
5542
- if (result && path) {
5543
- return import_lodash.default.get(result, path);
5544
- }
5545
- return result;
5546
- };
5547
- coding = (code, system) => ({ code, system: mapSystems(system) });
5548
- concept = (text, ...codings) => {
5549
- const result = {};
5550
- let incomingCodings = codings;
5551
- if (typeof text === "string") {
5552
- result.text = text;
5553
- } else {
5554
- incomingCodings = [text].concat(codings);
5555
- }
5556
- const c = [];
5557
- for (const item of incomingCodings) {
5558
- if (Array.isArray(item)) {
5559
- c.push(coding(item[0], item[1]));
5560
- } else {
5561
- c.push(item);
5562
- }
5563
- }
5564
- result.coding = c;
5565
- return result;
5566
- };
5567
- cc = concept;
5568
- reference = (ref2, opts) => {
5569
- if (Array.isArray(ref2)) {
5570
- return ref2.map(reference, opts);
5571
- }
5572
- if (ref2.resourceType && ref2.id) {
5573
- return { reference: `${ref2.resourceType}/${ref2.id}` };
5574
- }
5575
- if (ref2.reference) {
5576
- return ref2;
5577
- }
5578
- const result = {};
5579
- if (typeof ref2 === "string") {
5580
- result.reference = ref2;
5581
- }
5582
- if (opts) {
5583
- Object.assign(result, opts);
5584
- }
5585
- return result;
5586
- };
5587
- ref = reference;
5588
- composite = (object, key, value) => {
5589
- const k = [key];
5590
- if (value.coding) {
5591
- k.push("CodeableConcept");
5592
- } else if (value.reference) {
5593
- k.push("Reference");
5594
- } else if (value.id && value.meta && value.resourceType) {
5595
- k.push("Reference");
5596
- value = reference(value);
5597
- } else if (value.start || value.end) {
5598
- k.push("Period");
5599
- } else if (value.dateTime) {
5600
- k.push("DateTime");
5601
- } else if (typeof value === "string") {
5602
- if (datetimeregex.test(value)) {
5603
- k.push("DateTime");
5604
- } else {
5605
- k.push("String");
5606
- }
5607
- } else if (typeof value === "boolean") {
5608
- k.push("Boolean");
5609
- } else if (typeof value === "number") {
5610
- k.push("Integer");
5611
- }
5612
- if (k.length === 2) {
5613
- const finalKey = k.join("");
5614
- object[finalKey] = value;
5615
- } else {
5616
- console.warn(
5617
- `WARNING: Failed to map ${key}: unrecognised data type (see utils.composite)`
5618
- );
5619
- }
5498
+ var import_lodash = __toESM(require_lodash(), 1);
5499
+ var systemMap = {
5500
+ SmartCareID: "http://moh.gov.et/fhir/hiv/identifier/SmartCareID",
5501
+ MRN: "http://moh.gov.et/fhir/hiv/identifier/MRN",
5502
+ UAN: "http://moh.gov.et/fhir/hiv/identifier/UAN"
5503
+ };
5504
+ var datetimeregex = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?/;
5505
+ var mapSystems = (obj) => {
5506
+ if (Array.isArray(obj)) {
5507
+ return obj.map(mapSystems);
5508
+ }
5509
+ if (obj.system in systemMap) {
5510
+ return {
5511
+ ...obj,
5512
+ system: systemMap[obj.system]
5620
5513
  };
5621
5514
  }
5622
- });
5515
+ return obj;
5516
+ };
5517
+ var setSystemMap = (newMappings) => {
5518
+ Object.assign(systemMap, newMappings);
5519
+ };
5520
+ var identifier = (input, system) => {
5521
+ if (Array.isArray(input)) {
5522
+ return input.map((i) => identifier(i, system));
5523
+ }
5524
+ if (input) {
5525
+ if (typeof input === "string") {
5526
+ return mapSystems({
5527
+ value: input,
5528
+ system
5529
+ });
5530
+ } else if (system) {
5531
+ return mapSystems({
5532
+ system,
5533
+ ...input
5534
+ });
5535
+ } else {
5536
+ return mapSystems(input);
5537
+ }
5538
+ }
5539
+ };
5540
+ var id = identifier;
5541
+ var addExtension = (resource, url, value) => {
5542
+ const obj = {
5543
+ url
5544
+ };
5545
+ composite(obj, "value", value);
5546
+ resource.extension ?? (resource.extension = []);
5547
+ resource.extension.push(obj);
5548
+ };
5549
+ var findExtension = (obj, targetUrl, path) => {
5550
+ var _a;
5551
+ const result = (_a = obj.extension) == null ? void 0 : _a.find((ext) => ext.url === targetUrl);
5552
+ if (result && path) {
5553
+ return import_lodash.default.get(result, path);
5554
+ }
5555
+ return result;
5556
+ };
5557
+ var coding = (code, system) => ({ code, system: mapSystems(system) });
5558
+ var concept = (text, ...codings) => {
5559
+ const result = {};
5560
+ let incomingCodings = codings;
5561
+ if (typeof text === "string") {
5562
+ result.text = text;
5563
+ } else {
5564
+ incomingCodings = [text].concat(codings);
5565
+ }
5566
+ const c = [];
5567
+ for (const item of incomingCodings) {
5568
+ if (Array.isArray(item)) {
5569
+ c.push(coding(item[0], item[1]));
5570
+ } else {
5571
+ c.push(item);
5572
+ }
5573
+ }
5574
+ result.coding = c;
5575
+ return result;
5576
+ };
5577
+ var cc = concept;
5578
+ var reference = (ref2, opts) => {
5579
+ if (Array.isArray(ref2)) {
5580
+ return ref2.map(reference, opts);
5581
+ }
5582
+ if (ref2.resourceType && ref2.id) {
5583
+ return { reference: `${ref2.resourceType}/${ref2.id}` };
5584
+ }
5585
+ if (ref2.reference) {
5586
+ return ref2;
5587
+ }
5588
+ const result = {};
5589
+ if (typeof ref2 === "string") {
5590
+ result.reference = ref2;
5591
+ }
5592
+ if (opts) {
5593
+ Object.assign(result, opts);
5594
+ }
5595
+ return result;
5596
+ };
5597
+ var ref = reference;
5598
+ var composite = (object, key, value) => {
5599
+ const k = [key];
5600
+ if (value.coding) {
5601
+ k.push("CodeableConcept");
5602
+ } else if (value.reference) {
5603
+ k.push("Reference");
5604
+ } else if (value.id && value.meta && value.resourceType) {
5605
+ k.push("Reference");
5606
+ value = reference(value);
5607
+ } else if (value.start || value.end) {
5608
+ k.push("Period");
5609
+ } else if (value.dateTime) {
5610
+ k.push("DateTime");
5611
+ } else if (typeof value === "string") {
5612
+ if (datetimeregex.test(value)) {
5613
+ k.push("DateTime");
5614
+ } else {
5615
+ k.push("String");
5616
+ }
5617
+ } else if (typeof value === "boolean") {
5618
+ k.push("Boolean");
5619
+ } else if (typeof value === "number") {
5620
+ k.push("Integer");
5621
+ }
5622
+ if (k.length === 2) {
5623
+ const finalKey = k.join("");
5624
+ object[finalKey] = value;
5625
+ } else {
5626
+ console.warn(
5627
+ `WARNING: Failed to map ${key}: unrecognised data type (see utils.composite)`
5628
+ );
5629
+ }
5630
+ };
5631
+
5632
+ // src/Adaptor.js
5633
+ import {
5634
+ dataPath,
5635
+ dataValue,
5636
+ dateFns,
5637
+ cursor,
5638
+ each,
5639
+ field,
5640
+ fields,
5641
+ fn,
5642
+ lastReferenceValue,
5643
+ merge,
5644
+ sourceValue
5645
+ } from "@openfn/language-common";
5623
5646
 
5624
5647
  // src/builders.js
5625
5648
  var builders_exports = {};
@@ -5642,6 +5665,7 @@ __export(builders_exports, {
5642
5665
  schedule: () => schedule,
5643
5666
  slot: () => slot
5644
5667
  });
5668
+ var import_lodash2 = __toESM(require_lodash(), 1);
5645
5669
  function address(type, props) {
5646
5670
  const mappings = {
5647
5671
  "fr-core-address": address_fr_core_address
@@ -11733,21 +11757,26 @@ function slot_fr_core_slot(props) {
11733
11757
  };
11734
11758
  return resource;
11735
11759
  }
11736
- var import_lodash2;
11737
- var init_builders = __esm({
11738
- "src/builders.js"() {
11739
- init_utils();
11740
- import_lodash2 = __toESM(require_lodash(), 1);
11741
- }
11742
- });
11743
11760
 
11744
11761
  // src/index.js
11745
- exports.__esModule = true;
11746
- exports.b = exports.builders = exports.util = void 0;
11747
- init_builders();
11748
- exports.util = (init_utils(), __toCommonJS(utils_exports));
11749
- exports.builders = (init_builders(), __toCommonJS(builders_exports));
11750
- exports.b = (init_builders(), __toCommonJS(builders_exports));
11762
+ var src_default = Adaptor_exports;
11763
+ export {
11764
+ builders_exports as b,
11765
+ builders_exports as builders,
11766
+ cursor,
11767
+ dataPath,
11768
+ dataValue,
11769
+ dateFns,
11770
+ src_default as default,
11771
+ each,
11772
+ field,
11773
+ fields,
11774
+ fn,
11775
+ lastReferenceValue,
11776
+ merge,
11777
+ sourceValue,
11778
+ utils_exports as util
11779
+ };
11751
11780
  /**
11752
11781
  * @license
11753
11782
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-fhir-fr",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "OpenFn fhir-fr adaptor",
5
5
  "author": "Open Function Group",
6
6
  "license": "LGPLv3",
@@ -11,11 +11,11 @@
11
11
  "webUrl": "https://hl7.fr/ig/fhir/core",
12
12
  "specDate": "2024-03-25",
13
13
  "specUrl": "https://hl7.fr/ig/fhir/core/2.0.0/definitions.json.zip",
14
- "adaptorGeneratedDate": "2024-11-30T12:30:54.911Z",
14
+ "adaptorGeneratedDate": "2024-12-01T15:19:38.395Z",
15
15
  "generatorVersion": "0.2.1"
16
16
  },
17
17
  "dependencies": {
18
- "@openfn/language-common": "2.1.1"
18
+ "@openfn/language-common": "2.2.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "assertion-error": "2.0.0",
package/types/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import './builders';
2
+ import * as Adaptor from './Adaptor';
3
+ export default Adaptor;
2
4
  export * as util from './utils';
3
5
  export * as builders from './builders';
4
6
  export * as b from './builders';