@openfn/language-fhir-fr 1.0.1 → 1.0.3

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.js CHANGED
@@ -4,6 +4,9 @@ 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
+ };
7
10
  var __commonJS = (cb, mod) => function __require() {
8
11
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
12
  };
@@ -23,10 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
26
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
27
  mod
25
28
  ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
30
 
27
31
  // ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js
28
32
  var require_lodash = __commonJS({
29
- "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports, module) {
33
+ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(exports2, module) {
30
34
  (function() {
31
35
  var undefined2;
32
36
  var VERSION = "4.17.21";
@@ -352,7 +356,7 @@ var require_lodash = __commonJS({
352
356
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
353
357
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
354
358
  var root = freeGlobal || freeSelf || Function("return this")();
355
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
359
+ var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
356
360
  var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
357
361
  var moduleExports = freeModule && freeModule.exports === freeExports;
358
362
  var freeProcess = moduleExports && freeGlobal.process;
@@ -2156,8 +2160,8 @@ var require_lodash = __commonJS({
2156
2160
  function createBind(func, bitmask, thisArg) {
2157
2161
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2158
2162
  function wrapper() {
2159
- var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2160
- return fn2.apply(isBind ? thisArg : this, arguments);
2163
+ var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2164
+ return fn.apply(isBind ? thisArg : this, arguments);
2161
2165
  }
2162
2166
  return wrapper;
2163
2167
  }
@@ -2223,8 +2227,8 @@ var require_lodash = __commonJS({
2223
2227
  arity - length
2224
2228
  );
2225
2229
  }
2226
- var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
2227
- return apply(fn2, this, args);
2230
+ var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
2231
+ return apply(fn, this, args);
2228
2232
  }
2229
2233
  return wrapper;
2230
2234
  }
@@ -2312,7 +2316,7 @@ var require_lodash = __commonJS({
2312
2316
  arity - length
2313
2317
  );
2314
2318
  }
2315
- var thisBinding = isBind ? thisArg : this, fn2 = isBindKey ? thisBinding[func] : func;
2319
+ var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
2316
2320
  length = args.length;
2317
2321
  if (argPos) {
2318
2322
  args = reorder(args, argPos);
@@ -2323,9 +2327,9 @@ var require_lodash = __commonJS({
2323
2327
  args.length = ary2;
2324
2328
  }
2325
2329
  if (this && this !== root && this instanceof wrapper) {
2326
- fn2 = Ctor || createCtor(fn2);
2330
+ fn = Ctor || createCtor(fn);
2327
2331
  }
2328
- return fn2.apply(thisBinding, args);
2332
+ return fn.apply(thisBinding, args);
2329
2333
  }
2330
2334
  return wrapper;
2331
2335
  }
@@ -2382,14 +2386,14 @@ var require_lodash = __commonJS({
2382
2386
  function createPartial(func, bitmask, thisArg, partials) {
2383
2387
  var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
2384
2388
  function wrapper() {
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;
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;
2386
2390
  while (++leftIndex < leftLength) {
2387
2391
  args[leftIndex] = partials[leftIndex];
2388
2392
  }
2389
2393
  while (argsLength--) {
2390
2394
  args[leftIndex++] = arguments[++argsIndex];
2391
2395
  }
2392
- return apply(fn2, isBind ? thisArg : this, args);
2396
+ return apply(fn, isBind ? thisArg : this, args);
2393
2397
  }
2394
2398
  return wrapper;
2395
2399
  }
@@ -4348,7 +4352,7 @@ var require_lodash = __commonJS({
4348
4352
  });
4349
4353
  return result2;
4350
4354
  }
4351
- var merge2 = createAssigner(function(object, source, srcIndex) {
4355
+ var merge = createAssigner(function(object, source, srcIndex) {
4352
4356
  baseMerge(object, source, srcIndex);
4353
4357
  });
4354
4358
  var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
@@ -5038,7 +5042,7 @@ var require_lodash = __commonJS({
5038
5042
  lodash.matches = matches;
5039
5043
  lodash.matchesProperty = matchesProperty;
5040
5044
  lodash.memoize = memoize;
5041
- lodash.merge = merge2;
5045
+ lodash.merge = merge;
5042
5046
  lodash.mergeWith = mergeWith;
5043
5047
  lodash.method = method;
5044
5048
  lodash.methodOf = methodOf;
@@ -5458,27 +5462,10 @@ var require_lodash = __commonJS({
5458
5462
  } else {
5459
5463
  root._ = _3;
5460
5464
  }
5461
- }).call(exports);
5465
+ }).call(exports2);
5462
5466
  }
5463
5467
  });
5464
5468
 
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
-
5482
5469
  // src/utils.js
5483
5470
  var utils_exports = {};
5484
5471
  __export(utils_exports, {
@@ -5495,154 +5482,144 @@ __export(utils_exports, {
5495
5482
  reference: () => reference,
5496
5483
  setSystemMap: () => setSystemMap
5497
5484
  });
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]
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
+ }
5513
5620
  };
5514
5621
  }
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";
5622
+ });
5646
5623
 
5647
5624
  // src/builders.js
5648
5625
  var builders_exports = {};
@@ -5665,7 +5642,6 @@ __export(builders_exports, {
5665
5642
  schedule: () => schedule,
5666
5643
  slot: () => slot
5667
5644
  });
5668
- var import_lodash2 = __toESM(require_lodash(), 1);
5669
5645
  function address(type, props) {
5670
5646
  const mappings = {
5671
5647
  "fr-core-address": address_fr_core_address
@@ -11757,26 +11733,21 @@ function slot_fr_core_slot(props) {
11757
11733
  };
11758
11734
  return resource;
11759
11735
  }
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
+ });
11760
11743
 
11761
11744
  // src/index.js
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
- };
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));
11780
11751
  /**
11781
11752
  * @license
11782
11753
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@openfn/language-fhir-fr",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "OpenFn fhir-fr adaptor",
5
5
  "author": "Open Function Group",
6
6
  "license": "LGPLv3",
7
7
  "type": "module",
8
8
  "fhir": {
9
- "spec": "https://hl7.fr/ig/fhir/core/2.0.0/definitions.json.zip",
10
- "adaptorGeneratedDate": "2024-11-28T13:38:53.488Z",
11
9
  "name": "hl7.fhir.fr.core",
12
- "specVersion": "4.0.1",
13
- "specDate": "2024-03-25"
10
+ "igVersion": "4.0.1",
11
+ "webUrl": "https://hl7.fr/ig/fhir/core",
12
+ "specDate": "2024-03-25",
13
+ "specUrl": "https://hl7.fr/ig/fhir/core/2.0.0/definitions.json.zip",
14
+ "adaptorGeneratedDate": "2024-11-30T12:30:54.911Z",
15
+ "generatorVersion": "0.2.1"
14
16
  },
15
17
  "dependencies": {
16
18
  "@openfn/language-common": "2.1.1"
@@ -22,6 +24,7 @@
22
24
  "esno": "^0.16.3",
23
25
  "mocha": "^10.7.3",
24
26
  "rimraf": "3.0.2",
27
+ "typescript": "4.8.4",
25
28
  "undici": "^5.22.1"
26
29
  },
27
30
  "repository": {
@@ -45,12 +48,12 @@
45
48
  "configuration-schema.json"
46
49
  ],
47
50
  "scripts": {
48
- "build": "pnpm clean && build-adaptor fhir-fr",
51
+ "build": "pnpm clean && build-adaptor fhir-fr src ast docs",
49
52
  "build:src": "pnpm generate-fhir fhir-fr",
50
53
  "build:spec": "pnpm generate-fhir fhir-fr --respec",
51
54
  "test": "mocha --experimental-specifier-resolution=node --no-warnings",
52
55
  "test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
53
- "clean": "rimraf dist types docs",
56
+ "clean": "rimraf dist docs",
54
57
  "pack": "pnpm pack --pack-destination ../../dist",
55
58
  "lint": "eslint src"
56
59
  }