@oystehr/sdk 3.0.0 → 3.0.2

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.
Files changed (68) hide show
  1. package/dist/cjs/client/client.d.ts +2 -2
  2. package/dist/cjs/index.cjs +50 -4
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.min.cjs +1 -1
  5. package/dist/cjs/index.min.cjs.map +1 -1
  6. package/dist/cjs/resources/classes/fhir-ext.d.ts +22 -33
  7. package/dist/cjs/resources/classes/fhir.d.ts +2 -0
  8. package/dist/cjs/resources/classes/index.d.ts +1 -0
  9. package/dist/cjs/resources/types/AccessPolicy.d.ts +1 -1
  10. package/dist/cjs/resources/types/ClaimCMS1500.d.ts +5 -5
  11. package/dist/cjs/resources/types/ConversationAddParticipantParams.d.ts +1 -1
  12. package/dist/cjs/resources/types/ErxMedicationSearchResponse.d.ts +3 -3
  13. package/dist/cjs/resources/types/Project.d.ts +1 -1
  14. package/dist/cjs/resources/types/VersionGetResponse.d.ts +2 -2
  15. package/dist/cjs/resources/types/Z3GetPresignedUrlParams.d.ts +1 -1
  16. package/dist/cjs/resources/types/ZambdaCreateParams.d.ts +1 -1
  17. package/dist/cjs/resources/types/ZambdaFunction.d.ts +2 -2
  18. package/dist/cjs/resources/types/ZambdaUpdateParams.d.ts +2 -2
  19. package/dist/cjs/resources/types/fhir.d.ts +38 -2
  20. package/dist/esm/client/client.d.ts +2 -2
  21. package/dist/esm/client/client.js.map +1 -1
  22. package/dist/esm/index.min.js +1 -1
  23. package/dist/esm/index.min.js.map +1 -1
  24. package/dist/esm/resources/classes/fhir-ext.d.ts +22 -33
  25. package/dist/esm/resources/classes/fhir-ext.js +48 -5
  26. package/dist/esm/resources/classes/fhir-ext.js.map +1 -1
  27. package/dist/esm/resources/classes/fhir.d.ts +2 -0
  28. package/dist/esm/resources/classes/fhir.js +3 -1
  29. package/dist/esm/resources/classes/fhir.js.map +1 -1
  30. package/dist/esm/resources/classes/index.d.ts +1 -0
  31. package/dist/esm/resources/classes/index.js +1 -0
  32. package/dist/esm/resources/classes/index.js.map +1 -1
  33. package/dist/esm/resources/types/AccessPolicy.d.ts +1 -1
  34. package/dist/esm/resources/types/ClaimCMS1500.d.ts +5 -5
  35. package/dist/esm/resources/types/ConversationAddParticipantParams.d.ts +1 -1
  36. package/dist/esm/resources/types/ErxMedicationSearchResponse.d.ts +3 -3
  37. package/dist/esm/resources/types/Project.d.ts +1 -1
  38. package/dist/esm/resources/types/VersionGetResponse.d.ts +2 -2
  39. package/dist/esm/resources/types/Z3GetPresignedUrlParams.d.ts +1 -1
  40. package/dist/esm/resources/types/ZambdaCreateParams.d.ts +1 -1
  41. package/dist/esm/resources/types/ZambdaFunction.d.ts +2 -2
  42. package/dist/esm/resources/types/ZambdaUpdateParams.d.ts +2 -2
  43. package/dist/esm/resources/types/fhir.d.ts +38 -2
  44. package/package.json +1 -1
  45. package/src/client/client.ts +2 -2
  46. package/src/resources/classes/fhir-ext.ts +97 -13
  47. package/src/resources/classes/fhir.ts +2 -0
  48. package/src/resources/classes/index.ts +2 -0
  49. package/src/resources/types/AccessPolicy.ts +1 -1
  50. package/src/resources/types/ClaimCMS1500.ts +12 -5
  51. package/src/resources/types/ConversationAddParticipantParams.ts +1 -1
  52. package/src/resources/types/ErxMedicationSearchResponse.ts +3 -3
  53. package/src/resources/types/Project.ts +1 -1
  54. package/src/resources/types/VersionGetResponse.ts +2 -2
  55. package/src/resources/types/Z3GetPresignedUrlParams.ts +1 -1
  56. package/src/resources/types/ZambdaCreateParams.ts +1 -1
  57. package/src/resources/types/ZambdaFunction.ts +2 -2
  58. package/src/resources/types/ZambdaUpdateParams.ts +2 -2
  59. package/src/resources/types/fhir.ts +56 -1
  60. package/dist/cjs/fhir/fhir-types.d.ts +0 -9
  61. package/dist/cjs/fhir/index.d.ts +0 -2
  62. package/dist/cjs/fhir/utils.d.ts +0 -14
  63. package/dist/esm/fhir/fhir-types.d.ts +0 -9
  64. package/dist/esm/fhir/index.d.ts +0 -2
  65. package/dist/esm/fhir/utils.d.ts +0 -14
  66. package/src/fhir/fhir-types.ts +0 -15
  67. package/src/fhir/index.ts +0 -2
  68. package/src/fhir/utils.ts +0 -68
@@ -31,8 +31,8 @@ export type FhirFetcherResponse<T extends FhirData<FhirResource> = any> = T;
31
31
  export declare class SDKResource {
32
32
  private readonly config;
33
33
  constructor(config: OystehrConfig);
34
- request(path: string, method: string): FetcherFunction;
35
- fhirRequest<T extends FhirResource = any>(path: string, method: string): (params: any, request?: InternalClientRequest) => Promise<FhirFetcherResponse<T>>;
34
+ protected request(path: string, method: string): FetcherFunction;
35
+ protected fhirRequest<T extends FhirResource = any>(path: string, method: string): (params: any, request?: InternalClientRequest) => Promise<FhirFetcherResponse<T>>;
36
36
  }
37
37
  export type FetcherError = {
38
38
  message: string;
@@ -576,11 +576,12 @@ class Erx extends SDKResource {
576
576
  * @param request optional OystehrClientRequest object
577
577
  * @returns FHIR Bundle resource
578
578
  */
579
- function search({ resourceType, params }, request) {
579
+ function search(params, request) {
580
580
  return __awaiter(this, void 0, void 0, function* () {
581
+ const { resourceType, params: searchParams } = params;
581
582
  let paramMap;
582
- if (params) {
583
- paramMap = Object.entries(params).reduce((acc, [_, param]) => {
583
+ if (searchParams) {
584
+ paramMap = Object.entries(searchParams).reduce((acc, [_, param]) => {
584
585
  if (!acc[param.name]) {
585
586
  acc[param.name] = [];
586
587
  }
@@ -589,7 +590,7 @@ function search({ resourceType, params }, request) {
589
590
  }, {});
590
591
  }
591
592
  const requestBundle = yield this.fhirRequest(`/${resourceType}/_search`, 'POST')(paramMap, Object.assign(Object.assign({}, request), { contentType: 'application/x-www-form-urlencoded' }));
592
- const bundle = Object.assign(Object.assign({}, requestBundle), { unbundle: function () {
593
+ const bundle = Object.assign(Object.assign({}, requestBundle), { entry: requestBundle.entry, unbundle: function () {
593
594
  var _a, _b;
594
595
  return (_b = (_a = this.entry) === null || _a === void 0 ? void 0 : _a.map((entry) => entry.resource).filter((entry) => entry !== undefined)) !== null && _b !== void 0 ? _b : [];
595
596
  } });
@@ -693,6 +694,48 @@ function bundleRequest(type) {
693
694
  }
694
695
  const batch = bundleRequest('batch');
695
696
  const transaction = bundleRequest('transaction');
697
+ function formatAddress(address, options) {
698
+ const builder = [];
699
+ if (address.line) {
700
+ builder.push(...address.line);
701
+ }
702
+ if (address.city || address.state || address.postalCode) {
703
+ const cityStateZip = [];
704
+ if (address.city) {
705
+ cityStateZip.push(address.city);
706
+ }
707
+ if (address.state) {
708
+ cityStateZip.push(address.state);
709
+ }
710
+ if (address.postalCode) {
711
+ cityStateZip.push(address.postalCode);
712
+ }
713
+ builder.push(cityStateZip.join(', '));
714
+ }
715
+ if (address.use && ((options === null || options === void 0 ? void 0 : options.all) || (options === null || options === void 0 ? void 0 : options.use))) {
716
+ builder.push('[' + address.use + ']');
717
+ }
718
+ return builder.join((options === null || options === void 0 ? void 0 : options.lineSeparator) || ', ').trim();
719
+ }
720
+ function formatHumanName(name, options) {
721
+ const builder = [];
722
+ if (name.prefix && (options === null || options === void 0 ? void 0 : options.prefix) !== false) {
723
+ builder.push(...name.prefix);
724
+ }
725
+ if (name.given) {
726
+ builder.push(...name.given);
727
+ }
728
+ if (name.family) {
729
+ builder.push(name.family);
730
+ }
731
+ if (name.suffix && (options === null || options === void 0 ? void 0 : options.suffix) !== false) {
732
+ builder.push(...name.suffix);
733
+ }
734
+ if (name.use && ((options === null || options === void 0 ? void 0 : options.all) || (options === null || options === void 0 ? void 0 : options.use))) {
735
+ builder.push('[' + name.use + ']');
736
+ }
737
+ return builder.join(' ').trim();
738
+ }
696
739
 
697
740
  // AUTOGENERATED -- DO NOT EDIT
698
741
  class Fhir extends SDKResource {
@@ -713,6 +756,8 @@ class Fhir extends SDKResource {
713
756
  this.history = history;
714
757
  this.batch = batch;
715
758
  this.transaction = transaction;
759
+ this.formatAddress = formatAddress;
760
+ this.formatHumanName = formatHumanName;
716
761
  }
717
762
  }
718
763
 
@@ -1301,6 +1346,7 @@ class ZambdaLogStream extends SDKResource {
1301
1346
  // AUTOGENERATED -- DO NOT EDIT
1302
1347
  let Oystehr$1 = class Oystehr {
1303
1348
  constructor(config) {
1349
+ this.config = config;
1304
1350
  this.application = new Application(config);
1305
1351
  this.developer = new Developer(config);
1306
1352
  this.m2m = new M2m(config);