@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
@@ -1,5 +1,6 @@
1
- import { Operation } from 'fast-json-patch';
2
- import { BatchInput, Bundle, FhirResource } from '../..';
1
+ import { Address as AddressR4B, HumanName as HumanNameR4B } from 'fhir/r4b';
2
+ import { Address as AddressR5, HumanName as HumanNameR5 } from 'fhir/r5';
3
+ import { BatchInput, Bundle, FhirCreateParams, FhirDeleteParams, FhirGetParams, FhirHistoryGetParams, FhirHistorySearchParams, FhirPatchParams, FhirResource, FhirSearchParams, FhirUpdateParams } from '../..';
3
4
  import { FhirFetcherResponse, OystehrClientRequest, SDKResource } from '../../client/client';
4
5
  /**
5
6
  * Optional parameter that can be passed to the client methods. It allows
@@ -22,37 +23,25 @@ export interface OystehrFHIRUpdateClientRequest extends OystehrClientRequest {
22
23
  * @param request optional OystehrClientRequest object
23
24
  * @returns FHIR Bundle resource
24
25
  */
25
- export declare function search<T extends FhirResource>(this: SDKResource, { resourceType, params }: {
26
- resourceType: string;
27
- params?: {
28
- name: string;
29
- value: string | number;
30
- }[];
31
- }, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
32
- export declare function create<T extends FhirResource>(this: SDKResource, params: T, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
33
- export declare function get<T extends FhirResource>(this: SDKResource, { resourceType, id }: {
34
- resourceType: string;
35
- id: string;
36
- }, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
37
- export declare function update<T extends FhirResource>(this: SDKResource, params: T, request?: OystehrFHIRUpdateClientRequest): Promise<FhirFetcherResponse<T>>;
38
- export declare function patch<T extends FhirResource>(this: SDKResource, { resourceType, id, operations }: {
39
- resourceType: string;
40
- id: string;
41
- operations: Operation[];
42
- }, request?: OystehrFHIRUpdateClientRequest): Promise<FhirFetcherResponse<T>>;
43
- declare function del<T extends FhirResource>(this: SDKResource, { resourceType, id }: {
44
- resourceType: string;
45
- id: string;
46
- }, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
26
+ export declare function search<T extends FhirResource>(this: SDKResource, params: FhirSearchParams, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
27
+ export declare function create<T extends FhirResource>(this: SDKResource, params: FhirCreateParams<T>, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
28
+ export declare function get<T extends FhirResource>(this: SDKResource, { resourceType, id }: FhirGetParams, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
29
+ export declare function update<T extends FhirResource>(this: SDKResource, params: FhirUpdateParams<T>, request?: OystehrFHIRUpdateClientRequest): Promise<FhirFetcherResponse<T>>;
30
+ export declare function patch<T extends FhirResource>(this: SDKResource, { resourceType, id, operations }: FhirPatchParams, request?: OystehrFHIRUpdateClientRequest): Promise<FhirFetcherResponse<T>>;
31
+ declare function del<T extends FhirResource>(this: SDKResource, { resourceType, id }: FhirDeleteParams, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
47
32
  export { del as delete };
48
- export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id }: {
49
- resourceType: string;
50
- id: string;
51
- }, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
52
- export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id, versionId }: {
53
- resourceType: string;
54
- id: string;
55
- versionId: string;
56
- }, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
33
+ export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id }: FhirHistorySearchParams, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
34
+ export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id, versionId }: FhirHistoryGetParams, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
57
35
  export declare const batch: <BundleContentType extends FhirResource>(this: SDKResource, input: BatchInput<BundleContentType>, request?: OystehrClientRequest) => Promise<Bundle<BundleContentType>>;
58
36
  export declare const transaction: <BundleContentType extends FhirResource>(this: SDKResource, input: BatchInput<BundleContentType>, request?: OystehrClientRequest) => Promise<Bundle<BundleContentType>>;
37
+ export declare function formatAddress(address: AddressR4B | AddressR5, options?: {
38
+ all?: boolean;
39
+ use?: boolean;
40
+ lineSeparator?: string;
41
+ }): string;
42
+ export declare function formatHumanName(name: HumanNameR4B | HumanNameR5, options?: {
43
+ all?: boolean;
44
+ prefix?: boolean;
45
+ suffix?: boolean;
46
+ use?: boolean;
47
+ }): string;
@@ -8,11 +8,12 @@ import { addParamsToSearch } from '../../client/client.js';
8
8
  * @param request optional OystehrClientRequest object
9
9
  * @returns FHIR Bundle resource
10
10
  */
11
- function search({ resourceType, params }, request) {
11
+ function search(params, request) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
+ const { resourceType, params: searchParams } = params;
13
14
  let paramMap;
14
- if (params) {
15
- paramMap = Object.entries(params).reduce((acc, [_, param]) => {
15
+ if (searchParams) {
16
+ paramMap = Object.entries(searchParams).reduce((acc, [_, param]) => {
16
17
  if (!acc[param.name]) {
17
18
  acc[param.name] = [];
18
19
  }
@@ -21,7 +22,7 @@ function search({ resourceType, params }, request) {
21
22
  }, {});
22
23
  }
23
24
  const requestBundle = yield this.fhirRequest(`/${resourceType}/_search`, 'POST')(paramMap, Object.assign(Object.assign({}, request), { contentType: 'application/x-www-form-urlencoded' }));
24
- const bundle = Object.assign(Object.assign({}, requestBundle), { unbundle: function () {
25
+ const bundle = Object.assign(Object.assign({}, requestBundle), { entry: requestBundle.entry, unbundle: function () {
25
26
  var _a, _b;
26
27
  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 : [];
27
28
  } });
@@ -125,6 +126,48 @@ function bundleRequest(type) {
125
126
  }
126
127
  const batch = bundleRequest('batch');
127
128
  const transaction = bundleRequest('transaction');
129
+ function formatAddress(address, options) {
130
+ const builder = [];
131
+ if (address.line) {
132
+ builder.push(...address.line);
133
+ }
134
+ if (address.city || address.state || address.postalCode) {
135
+ const cityStateZip = [];
136
+ if (address.city) {
137
+ cityStateZip.push(address.city);
138
+ }
139
+ if (address.state) {
140
+ cityStateZip.push(address.state);
141
+ }
142
+ if (address.postalCode) {
143
+ cityStateZip.push(address.postalCode);
144
+ }
145
+ builder.push(cityStateZip.join(', '));
146
+ }
147
+ if (address.use && ((options === null || options === void 0 ? void 0 : options.all) || (options === null || options === void 0 ? void 0 : options.use))) {
148
+ builder.push('[' + address.use + ']');
149
+ }
150
+ return builder.join((options === null || options === void 0 ? void 0 : options.lineSeparator) || ', ').trim();
151
+ }
152
+ function formatHumanName(name, options) {
153
+ const builder = [];
154
+ if (name.prefix && (options === null || options === void 0 ? void 0 : options.prefix) !== false) {
155
+ builder.push(...name.prefix);
156
+ }
157
+ if (name.given) {
158
+ builder.push(...name.given);
159
+ }
160
+ if (name.family) {
161
+ builder.push(name.family);
162
+ }
163
+ if (name.suffix && (options === null || options === void 0 ? void 0 : options.suffix) !== false) {
164
+ builder.push(...name.suffix);
165
+ }
166
+ if (name.use && ((options === null || options === void 0 ? void 0 : options.all) || (options === null || options === void 0 ? void 0 : options.use))) {
167
+ builder.push('[' + name.use + ']');
168
+ }
169
+ return builder.join(' ').trim();
170
+ }
128
171
 
129
- export { batch, create, del as delete, get, history, patch, search, transaction, update };
172
+ export { batch, create, del as delete, formatAddress, formatHumanName, get, history, patch, search, transaction, update };
130
173
  //# sourceMappingURL=fhir-ext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fhir-ext.js","sources":["../../../../src/resources/classes/fhir-ext.ts"],"sourcesContent":["import { Operation } from 'fast-json-patch';\nimport { BatchInput, BatchInputRequest, Binary, Bundle, BundleEntry, FhirBundle, FhirResource } from '../..';\nimport { addParamsToSearch, FhirFetcherResponse, OystehrClientRequest, SDKResource } from '../../client/client';\n\n/**\n * Optional parameter that can be passed to the client methods. It allows\n * overriding the access token or project ID, and setting various headers,\n * such as 'Content-Type'. Also support enabling optimistic locking.\n */\nexport interface OystehrFHIRUpdateClientRequest extends OystehrClientRequest {\n /**\n * Enable optimistic locking for the request. If set to a version ID, the request will\n * include the 'If-Match' header with that value in the FHIR optimistic-locking format.\n * If the resource has been updated since the version provided, the request\n * will fail with a 412 Precondition Failed error.\n */\n optimisticLockingVersionId?: string;\n}\n\n/**\n * Performs a FHIR search and returns the results as a Bundle resource\n *\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\nexport async function search<T extends FhirResource>(\n this: SDKResource,\n { resourceType, params }: { resourceType: string; params?: { name: string; value: string | number }[] },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>> {\n let paramMap: Record<string, (string | number)[]> | undefined;\n if (params) {\n paramMap = Object.entries(params).reduce((acc, [_, param]) => {\n if (!acc[param.name]) {\n acc[param.name] = [];\n }\n acc[param.name].push(param.value);\n return acc;\n }, {} as Record<string, (string | number)[]>);\n }\n const requestBundle = await this.fhirRequest<FhirBundle<T>>(`/${resourceType}/_search`, 'POST')(paramMap, {\n ...request,\n contentType: 'application/x-www-form-urlencoded',\n });\n const bundle: Bundle<T> = {\n ...requestBundle,\n unbundle: function (this: Bundle<T>) {\n return this.entry?.map((entry) => entry.resource).filter((entry): entry is T => entry !== undefined) ?? [];\n },\n };\n return bundle;\n}\n\nexport async function create<T extends FhirResource>(\n this: SDKResource,\n params: T,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { resourceType } = params;\n return this.fhirRequest(`/${resourceType}`, 'POST')(params as unknown as Record<string, unknown>, request);\n}\n\nexport async function get<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: { resourceType: string; id: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest<T>(`/${resourceType}/${id}`, 'GET')({}, request);\n}\n\nexport async function update<T extends FhirResource>(\n this: SDKResource,\n params: T,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { id, resourceType } = params;\n return this.fhirRequest(`/${resourceType}/${id}`, 'PUT')(params as unknown as Record<string, unknown>, {\n ...request,\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nexport async function patch<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, operations }: { resourceType: string; id: string; operations: Operation[] },\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'PATCH')(operations, {\n ...request,\n contentType: 'application/json-patch+json',\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nasync function del<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: { resourceType: string; id: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'DELETE')({}, request);\n}\nexport { del as delete };\n\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: { resourceType: string; id: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: { resourceType: string; id: string; versionId: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: { resourceType: string; id: string; versionId?: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>> | FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}/_history${versionId ? `/${versionId}` : ''}`, 'GET')({}, request);\n}\n\nfunction batchInputRequestToBundleEntryItem<T extends FhirResource>(\n request: BatchInputRequest<T>\n): BundleEntry<T | Binary<T>> {\n const { method, url } = request;\n const baseRequest = {\n request: {\n method,\n url,\n },\n };\n\n // Escape query string parameters in entry.request.url\n if (url.split('?').length > 1) {\n const [resource, query] = url.split('?');\n const params = query\n .split('&')\n .map((param) => {\n const [name, value] = param.split('=');\n return { name, value };\n })\n .reduce((acc, { name, value }) => {\n acc[name] = value;\n return acc;\n }, {} as Record<string, string>);\n const search = new URLSearchParams();\n addParamsToSearch(params, search);\n baseRequest.request.url = `${resource}?${search.toString()}`;\n }\n\n // GET, DELETE, and HEAD require no further parameters\n if (['GET', 'DELETE', 'HEAD'].includes(method)) {\n return baseRequest as BundleEntry<T>;\n }\n\n // PUT updates require a full resource\n if (method === 'PUT') {\n const { resource } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n } as BundleEntry<T>;\n }\n\n // PATCH can be Binary resource or JSON patch\n if (method === 'PATCH') {\n if ('resource' in request) {\n return {\n ...baseRequest,\n resource: request.resource,\n } as BundleEntry<Binary<T>>;\n }\n return {\n ...baseRequest,\n resource: {\n resourceType: 'Binary',\n contentType: 'application/json-patch+json',\n data: Buffer.from(JSON.stringify(request.operations), 'utf8').toString('base64'),\n },\n } as BundleEntry<Binary<T>>;\n }\n\n // POST creates require a full resource\n if (method === 'POST') {\n const { resource, fullUrl } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n fullUrl,\n } as BundleEntry<T>;\n }\n throw new Error('Unrecognized method');\n}\n\nfunction bundleRequest(type: 'batch' | 'transaction') {\n return async function <BundleContentType extends FhirResource>(\n this: SDKResource,\n input: BatchInput<BundleContentType>,\n request?: OystehrClientRequest\n ): Promise<FhirFetcherResponse<Bundle<BundleContentType>>> {\n return this.fhirRequest('/', 'POST')(\n {\n resourceType: 'Bundle',\n type,\n entry: input.requests.map(batchInputRequestToBundleEntryItem),\n },\n request\n );\n };\n}\n\nexport const batch = bundleRequest('batch');\nexport const transaction = bundleRequest('transaction');\n"],"names":[],"mappings":";;;AAmBA;;;;;;AAMG;AACG,SAAgB,MAAM,CAE1B,EAAE,YAAY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AAA;KAAA,CAAC;AACJ,CAAC;MAEY,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE;MAC/B,WAAW,GAAG,aAAa,CAAC,aAAa;;;;"}
1
+ {"version":3,"file":"fhir-ext.js","sources":["../../../../src/resources/classes/fhir-ext.ts"],"sourcesContent":["import { Address as AddressR4B, HumanName as HumanNameR4B } from 'fhir/r4b';\nimport { Address as AddressR5, HumanName as HumanNameR5 } from 'fhir/r5';\nimport {\n BatchInput,\n BatchInputRequest,\n Binary,\n Bundle,\n BundleEntry,\n FhirBundle,\n FhirCreateParams,\n FhirDeleteParams,\n FhirGetParams,\n FhirHistoryGetParams,\n FhirHistorySearchParams,\n FhirPatchParams,\n FhirResource,\n FhirSearchParams,\n FhirUpdateParams,\n} from '../..';\nimport { addParamsToSearch, FhirFetcherResponse, OystehrClientRequest, SDKResource } from '../../client/client';\n\n/**\n * Optional parameter that can be passed to the client methods. It allows\n * overriding the access token or project ID, and setting various headers,\n * such as 'Content-Type'. Also support enabling optimistic locking.\n */\nexport interface OystehrFHIRUpdateClientRequest extends OystehrClientRequest {\n /**\n * Enable optimistic locking for the request. If set to a version ID, the request will\n * include the 'If-Match' header with that value in the FHIR optimistic-locking format.\n * If the resource has been updated since the version provided, the request\n * will fail with a 412 Precondition Failed error.\n */\n optimisticLockingVersionId?: string;\n}\n\n/**\n * Performs a FHIR search and returns the results as a Bundle resource\n *\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\nexport async function search<T extends FhirResource>(\n this: SDKResource,\n params: FhirSearchParams,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>> {\n const { resourceType, params: searchParams } = params;\n let paramMap: Record<string, (string | number)[]> | undefined;\n if (searchParams) {\n paramMap = Object.entries(searchParams).reduce((acc, [_, param]) => {\n if (!acc[param.name]) {\n acc[param.name] = [];\n }\n acc[param.name].push(param.value);\n return acc;\n }, {} as Record<string, (string | number)[]>);\n }\n const requestBundle = await this.fhirRequest<FhirBundle<T>>(`/${resourceType}/_search`, 'POST')(paramMap, {\n ...request,\n contentType: 'application/x-www-form-urlencoded',\n });\n const bundle: Bundle<T> = {\n ...requestBundle,\n entry: requestBundle.entry as Array<BundleEntry<T>> | undefined,\n unbundle: function (this: { entry?: Array<BundleEntry<T>> | undefined }) {\n return this.entry?.map((entry) => entry.resource).filter((entry): entry is T => entry !== undefined) ?? [];\n },\n };\n return bundle;\n}\n\nexport async function create<T extends FhirResource>(\n this: SDKResource,\n params: FhirCreateParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { resourceType } = params;\n return this.fhirRequest(`/${resourceType}`, 'POST')(params as unknown as Record<string, unknown>, request);\n}\n\nexport async function get<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirGetParams,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest<T>(`/${resourceType}/${id}`, 'GET')({}, request);\n}\n\nexport async function update<T extends FhirResource>(\n this: SDKResource,\n params: FhirUpdateParams<T>,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { id, resourceType } = params;\n return this.fhirRequest(`/${resourceType}/${id}`, 'PUT')(params as unknown as Record<string, unknown>, {\n ...request,\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nexport async function patch<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, operations }: FhirPatchParams,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'PATCH')(operations, {\n ...request,\n contentType: 'application/json-patch+json',\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nasync function del<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirDeleteParams,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'DELETE')({}, request);\n}\nexport { del as delete };\n\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirHistorySearchParams,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: FhirHistoryGetParams,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: { resourceType: string; id: string; versionId?: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>> | FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}/_history${versionId ? `/${versionId}` : ''}`, 'GET')({}, request);\n}\n\nfunction batchInputRequestToBundleEntryItem<T extends FhirResource>(\n request: BatchInputRequest<T>\n): BundleEntry<T | Binary<T>> {\n const { method, url } = request;\n const baseRequest = {\n request: {\n method,\n url,\n },\n };\n\n // Escape query string parameters in entry.request.url\n if (url.split('?').length > 1) {\n const [resource, query] = url.split('?');\n const params = query\n .split('&')\n .map((param) => {\n const [name, value] = param.split('=');\n return { name, value };\n })\n .reduce((acc, { name, value }) => {\n acc[name] = value;\n return acc;\n }, {} as Record<string, string>);\n const search = new URLSearchParams();\n addParamsToSearch(params, search);\n baseRequest.request.url = `${resource}?${search.toString()}`;\n }\n\n // GET, DELETE, and HEAD require no further parameters\n if (['GET', 'DELETE', 'HEAD'].includes(method)) {\n return baseRequest as BundleEntry<T>;\n }\n\n // PUT updates require a full resource\n if (method === 'PUT') {\n const { resource } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n } as BundleEntry<T>;\n }\n\n // PATCH can be Binary resource or JSON patch\n if (method === 'PATCH') {\n if ('resource' in request) {\n return {\n ...baseRequest,\n resource: request.resource,\n } as BundleEntry<Binary<T>>;\n }\n return {\n ...baseRequest,\n resource: {\n resourceType: 'Binary',\n contentType: 'application/json-patch+json',\n data: Buffer.from(JSON.stringify(request.operations), 'utf8').toString('base64'),\n },\n } as BundleEntry<Binary<T>>;\n }\n\n // POST creates require a full resource\n if (method === 'POST') {\n const { resource, fullUrl } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n fullUrl,\n } as BundleEntry<T>;\n }\n throw new Error('Unrecognized method');\n}\n\nfunction bundleRequest(type: 'batch' | 'transaction') {\n return async function <BundleContentType extends FhirResource>(\n this: SDKResource,\n input: BatchInput<BundleContentType>,\n request?: OystehrClientRequest\n ): Promise<FhirFetcherResponse<Bundle<BundleContentType>>> {\n return this.fhirRequest('/', 'POST')(\n {\n resourceType: 'Bundle',\n type,\n entry: input.requests.map(batchInputRequestToBundleEntryItem),\n },\n request\n );\n };\n}\n\nexport const batch = bundleRequest('batch');\nexport const transaction = bundleRequest('transaction');\n\nexport function formatAddress(\n address: AddressR4B | AddressR5,\n options?: { all?: boolean; use?: boolean; lineSeparator?: string }\n): string {\n const builder = [];\n\n if (address.line) {\n builder.push(...address.line);\n }\n\n if (address.city || address.state || address.postalCode) {\n const cityStateZip = [];\n if (address.city) {\n cityStateZip.push(address.city);\n }\n if (address.state) {\n cityStateZip.push(address.state);\n }\n if (address.postalCode) {\n cityStateZip.push(address.postalCode);\n }\n builder.push(cityStateZip.join(', '));\n }\n\n if (address.use && (options?.all || options?.use)) {\n builder.push('[' + address.use + ']');\n }\n\n return builder.join(options?.lineSeparator || ', ').trim();\n}\n\nexport function formatHumanName(\n name: HumanNameR4B | HumanNameR5,\n options?: {\n all?: boolean;\n prefix?: boolean;\n suffix?: boolean;\n use?: boolean;\n }\n): string {\n const builder = [];\n\n if (name.prefix && options?.prefix !== false) {\n builder.push(...name.prefix);\n }\n\n if (name.given) {\n builder.push(...name.given);\n }\n\n if (name.family) {\n builder.push(name.family);\n }\n\n if (name.suffix && options?.suffix !== false) {\n builder.push(...name.suffix);\n }\n\n if (name.use && (options?.all || options?.use)) {\n builder.push('[' + name.use + ']');\n }\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,GAAA,OAAO,CAAE,GAAG,MAAI,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,GAAG,CAAA,CAAC,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;AACpC,KAAA;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC;;;;"}
@@ -18,4 +18,6 @@ export declare class Fhir extends SDKResource {
18
18
  history: typeof ext.history;
19
19
  batch: <BundleContentType extends import("..").FhirResource>(this: SDKResource, input: import("..").BatchInput<BundleContentType>, request?: import("../../client/client").OystehrClientRequest | undefined) => Promise<import("..").Bundle<BundleContentType>>;
20
20
  transaction: <BundleContentType extends import("..").FhirResource>(this: SDKResource, input: import("..").BatchInput<BundleContentType>, request?: import("../../client/client").OystehrClientRequest | undefined) => Promise<import("..").Bundle<BundleContentType>>;
21
+ formatAddress: typeof ext.formatAddress;
22
+ formatHumanName: typeof ext.formatHumanName;
21
23
  }
@@ -1,5 +1,5 @@
1
1
  import { SDKResource } from '../../client/client.js';
2
- import { search, create, get, update, patch, delete as del, history, batch, transaction } from './fhir-ext.js';
2
+ import { search, create, get, update, patch, delete as del, history, batch, transaction, formatAddress, formatHumanName } from './fhir-ext.js';
3
3
 
4
4
  // AUTOGENERATED -- DO NOT EDIT
5
5
  class Fhir extends SDKResource {
@@ -20,6 +20,8 @@ class Fhir extends SDKResource {
20
20
  this.history = history;
21
21
  this.batch = batch;
22
22
  this.transaction = transaction;
23
+ this.formatAddress = formatAddress;
24
+ this.formatHumanName = formatHumanName;
23
25
  }
24
26
  }
25
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"fhir.js","sources":["../../../../src/resources/classes/fhir.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\nimport * as ext from './fhir-ext';\n\nexport class Fhir extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n /**\n * Performs a FHIR search and returns the results as a Bundle resource\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\n search = ext.search;\n create = ext.create;\n get = ext.get;\n update = ext.update;\n patch = ext.patch;\n delete = ext.delete;\n history = ext.history;\n batch = ext.batch;\n transaction = ext.transaction;\n}\n"],"names":["ext.search","ext.create","ext.get","ext.update","ext.patch","ext.delete","ext.history","ext.batch","ext.transaction"],"mappings":";;;AAAA;AAMM,MAAO,IAAK,SAAQ,WAAW,CAAA;AACnC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;AAEhB;;;;;AAKG;AACH,QAAA,IAAA,CAAA,MAAM,GAAGA,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,MAAM,GAAGC,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,GAAG,GAAGC,GAAO,CAAC;AACd,QAAA,IAAA,CAAA,MAAM,GAAGC,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,KAAK,GAAGC,KAAS,CAAC;AAClB,QAAA,IAAA,CAAA,MAAM,GAAGC,GAAU,CAAC;AACpB,QAAA,IAAA,CAAA,OAAO,GAAGC,OAAW,CAAC;AACtB,QAAA,IAAA,CAAA,KAAK,GAAGC,KAAS,CAAC;AAClB,QAAA,IAAA,CAAA,WAAW,GAAGC,WAAe,CAAC;KAf7B;AAgBF;;;;"}
1
+ {"version":3,"file":"fhir.js","sources":["../../../../src/resources/classes/fhir.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\nimport * as ext from './fhir-ext';\n\nexport class Fhir extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n /**\n * Performs a FHIR search and returns the results as a Bundle resource\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\n search = ext.search;\n create = ext.create;\n get = ext.get;\n update = ext.update;\n patch = ext.patch;\n delete = ext.delete;\n history = ext.history;\n batch = ext.batch;\n transaction = ext.transaction;\n formatAddress = ext.formatAddress;\n formatHumanName = ext.formatHumanName;\n}\n"],"names":["ext.search","ext.create","ext.get","ext.update","ext.patch","ext.delete","ext.history","ext.batch","ext.transaction","ext.formatAddress","ext.formatHumanName"],"mappings":";;;AAAA;AAMM,MAAO,IAAK,SAAQ,WAAW,CAAA;AACnC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;AAEhB;;;;;AAKG;AACH,QAAA,IAAA,CAAA,MAAM,GAAGA,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,MAAM,GAAGC,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,GAAG,GAAGC,GAAO,CAAC;AACd,QAAA,IAAA,CAAA,MAAM,GAAGC,MAAU,CAAC;AACpB,QAAA,IAAA,CAAA,KAAK,GAAGC,KAAS,CAAC;AAClB,QAAA,IAAA,CAAA,MAAM,GAAGC,GAAU,CAAC;AACpB,QAAA,IAAA,CAAA,OAAO,GAAGC,OAAW,CAAC;AACtB,QAAA,IAAA,CAAA,KAAK,GAAGC,KAAS,CAAC;AAClB,QAAA,IAAA,CAAA,WAAW,GAAGC,WAAe,CAAC;AAC9B,QAAA,IAAA,CAAA,aAAa,GAAGC,aAAiB,CAAC;AAClC,QAAA,IAAA,CAAA,eAAe,GAAGC,eAAmB,CAAC;KAjBrC;AAkBF;;;;"}
@@ -20,6 +20,7 @@ import { Z3 } from './z3';
20
20
  import { Zambda } from './zambda';
21
21
  import { ZambdaLogStream } from './zambdaLogStream';
22
22
  export declare class Oystehr {
23
+ readonly config: OystehrConfig;
23
24
  readonly application: Application;
24
25
  readonly developer: Developer;
25
26
  readonly m2m: M2m;
@@ -22,6 +22,7 @@ import { ZambdaLogStream } from './zambdaLogStream.js';
22
22
  // AUTOGENERATED -- DO NOT EDIT
23
23
  let Oystehr$1 = class Oystehr {
24
24
  constructor(config) {
25
+ this.config = config;
25
26
  this.application = new Application(config);
26
27
  this.developer = new Developer(config);
27
28
  this.m2m = new M2m(config);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/resources/classes/index.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport { OystehrConfig } from '../../config';\nimport { Application } from './application';\nimport { Charge } from './charge';\nimport { Conversation } from './conversation';\nimport { Developer } from './developer';\nimport { Erx } from './erx';\nimport { Fhir } from './fhir';\nimport { M2m } from './m2m';\nimport { Messaging } from './messaging';\nimport { PaymentMethod } from './paymentMethod';\nimport { Project } from './project';\nimport { Rcm } from './rcm';\nimport { Role } from './role';\nimport { Secret } from './secret';\nimport { Telemed } from './telemed';\nimport { TransactionalSMS } from './transactionalSMS';\nimport { User } from './user';\nimport { Version } from './version';\nimport { Z3 } from './z3';\nimport { Zambda } from './zambda';\nimport { ZambdaLogStream } from './zambdaLogStream';\n\nexport class Oystehr {\n readonly application: Application;\n readonly developer: Developer;\n readonly m2m: M2m;\n readonly messaging: Messaging;\n readonly conversation: Conversation;\n readonly transactionalSMS: TransactionalSMS;\n readonly paymentMethod: PaymentMethod;\n readonly charge: Charge;\n readonly project: Project;\n readonly rcm: Rcm;\n readonly erx: Erx;\n readonly role: Role;\n readonly secret: Secret;\n readonly telemed: Telemed;\n readonly user: User;\n readonly version: Version;\n readonly z3: Z3;\n readonly zambda: Zambda;\n readonly zambdaLogStream: ZambdaLogStream;\n readonly fhir: Fhir;\n constructor(config: OystehrConfig) {\n this.application = new Application(config);\n this.developer = new Developer(config);\n this.m2m = new M2m(config);\n this.messaging = new Messaging(config);\n this.conversation = new Conversation(config);\n this.transactionalSMS = new TransactionalSMS(config);\n this.paymentMethod = new PaymentMethod(config);\n this.charge = new Charge(config);\n this.project = new Project(config);\n this.rcm = new Rcm(config);\n this.erx = new Erx(config);\n this.role = new Role(config);\n this.secret = new Secret(config);\n this.telemed = new Telemed(config);\n this.user = new User(config);\n this.version = new Version(config);\n this.z3 = new Z3(config);\n this.zambda = new Zambda(config);\n this.zambdaLogStream = new ZambdaLogStream(config);\n this.fhir = new Fhir(config);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;sBAwBa,OAAO,CAAA;AAqBlB,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;KAC9B;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/resources/classes/index.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport { OystehrConfig } from '../../config';\nimport { Application } from './application';\nimport { Charge } from './charge';\nimport { Conversation } from './conversation';\nimport { Developer } from './developer';\nimport { Erx } from './erx';\nimport { Fhir } from './fhir';\nimport { M2m } from './m2m';\nimport { Messaging } from './messaging';\nimport { PaymentMethod } from './paymentMethod';\nimport { Project } from './project';\nimport { Rcm } from './rcm';\nimport { Role } from './role';\nimport { Secret } from './secret';\nimport { Telemed } from './telemed';\nimport { TransactionalSMS } from './transactionalSMS';\nimport { User } from './user';\nimport { Version } from './version';\nimport { Z3 } from './z3';\nimport { Zambda } from './zambda';\nimport { ZambdaLogStream } from './zambdaLogStream';\n\nexport class Oystehr {\n readonly config: OystehrConfig;\n readonly application: Application;\n readonly developer: Developer;\n readonly m2m: M2m;\n readonly messaging: Messaging;\n readonly conversation: Conversation;\n readonly transactionalSMS: TransactionalSMS;\n readonly paymentMethod: PaymentMethod;\n readonly charge: Charge;\n readonly project: Project;\n readonly rcm: Rcm;\n readonly erx: Erx;\n readonly role: Role;\n readonly secret: Secret;\n readonly telemed: Telemed;\n readonly user: User;\n readonly version: Version;\n readonly z3: Z3;\n readonly zambda: Zambda;\n readonly zambdaLogStream: ZambdaLogStream;\n readonly fhir: Fhir;\n constructor(config: OystehrConfig) {\n this.config = config;\n this.application = new Application(config);\n this.developer = new Developer(config);\n this.m2m = new M2m(config);\n this.messaging = new Messaging(config);\n this.conversation = new Conversation(config);\n this.transactionalSMS = new TransactionalSMS(config);\n this.paymentMethod = new PaymentMethod(config);\n this.charge = new Charge(config);\n this.project = new Project(config);\n this.rcm = new Rcm(config);\n this.erx = new Erx(config);\n this.role = new Role(config);\n this.secret = new Secret(config);\n this.telemed = new Telemed(config);\n this.user = new User(config);\n this.version = new Version(config);\n this.z3 = new Z3(config);\n this.zambda = new Zambda(config);\n this.zambdaLogStream = new ZambdaLogStream(config);\n this.fhir = new Fhir(config);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;sBAwBa,OAAO,CAAA;AAsBlB,IAAA,WAAA,CAAY,MAAqB,EAAA;AAC/B,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;KAC9B;AACF;;;;"}
@@ -2,6 +2,6 @@ export interface AccessPolicy {
2
2
  rule: {
3
3
  resource?: string[];
4
4
  action?: string[];
5
- effect?: string;
5
+ effect?: 'Allow' | 'Deny';
6
6
  }[];
7
7
  }
@@ -5,14 +5,14 @@ import { ClaimDateWithQualifier } from './ClaimDateWithQualifier';
5
5
  import { ClaimId } from './ClaimId';
6
6
  import { ClaimName } from './ClaimName';
7
7
  export interface ClaimCMS1500 {
8
- _1_insuranceProgram: string;
8
+ _1_insuranceProgram: 'MEDICARE' | 'MEDICAID' | 'TRICARE' | 'CHAMPVA' | 'GROUP_HEALTH_PLAN' | 'FECA_BLK_LUNG' | 'OTHER';
9
9
  _1a_insuredIdNumber: string;
10
10
  _2_patientName: ClaimName;
11
11
  _3_patientBirthDate: ClaimDate;
12
- _3_patientSex: string;
12
+ _3_patientSex: 'M' | 'F';
13
13
  _4_insuredName?: ClaimName;
14
14
  _5_patientAddress: ClaimAddress;
15
- _6_patientRelationshipToInsured?: string;
15
+ _6_patientRelationshipToInsured?: 'Self' | 'Spouse' | 'Child' | 'Other';
16
16
  _7_insuredAddress?: ClaimAddress;
17
17
  _9_otherInsuredName?: ClaimName;
18
18
  _9a_otherInsuredPolicyOrGroupNumber?: string;
@@ -26,7 +26,7 @@ export interface ClaimCMS1500 {
26
26
  _10d_claimCodes?: string[];
27
27
  _11_insuredPolicyGroupOrFecaNumber?: string;
28
28
  _11a_insuredDateOfBirth?: ClaimDate;
29
- _11a_insuredSex?: string;
29
+ _11a_insuredSex?: 'M' | 'F';
30
30
  _11b_otherClaimId?: string;
31
31
  _11c_insurancePlanNameOrProgramName?: string;
32
32
  _11d_anotherHealthBenefitPlan: boolean;
@@ -78,7 +78,7 @@ export interface ClaimCMS1500 {
78
78
  }[];
79
79
  _25_federalTaxIdNumber: {
80
80
  value: string;
81
- type: string;
81
+ type: 'SSN' | 'EIN';
82
82
  };
83
83
  _26_patientAccountNumber?: string;
84
84
  _27_acceptAssignment?: boolean;
@@ -11,7 +11,7 @@ export interface ConversationAddParticipantParams {
11
11
  /**
12
12
  * The channel to use to communicate with the participant. The `chat` channel allows the Developer or User whose `profile` resource is in `participantReference` to join the Conversation via the Twilio Conversations SDK which enables web and native mobile chat. If channel is `sms` then `phoneNumber` must be supplied. The participant's phone number, specified in the `phoneNumber`, is added to the Conversation. They will receive SMS messages from the Conversation, and replies to the phone number from which they receive the messages will be sent to the Conversation.
13
13
  */
14
- channel: string;
14
+ channel: 'sms' | 'chat';
15
15
  /**
16
16
  * The phone number of the participant. Required if `channel` is `sms`.
17
17
  */
@@ -24,9 +24,9 @@ export interface ErxMedicationSearchResponse {
24
24
  /**
25
25
  * Null implies a medication can not be prescribed
26
26
  */
27
- type?: string | null;
28
- concept: string;
29
- schedule?: string | null;
27
+ type?: ('RX' | 'OTC') | null;
28
+ concept: 'DRUG' | 'PRODUCT' | 'PACKAGE';
29
+ schedule?: ('I' | 'II' | 'III' | 'IV' | 'V') | null;
30
30
  controlled: boolean;
31
31
  brandName?: string | null;
32
32
  genericName?: string | null;
@@ -13,5 +13,5 @@ export interface Project {
13
13
  sandbox: boolean;
14
14
  defaultPatientRole?: RoleStub;
15
15
  defaultSSOUserRole?: RoleStub;
16
- fhirVersion: string;
16
+ fhirVersion: 'r4' | 'r5';
17
17
  }
@@ -5,7 +5,7 @@ export interface VersionGetResponse {
5
5
  /**
6
6
  * Always "project"
7
7
  */
8
- api: string;
8
+ api: 'project';
9
9
  /**
10
10
  * The project API version
11
11
  */
@@ -13,5 +13,5 @@ export interface VersionGetResponse {
13
13
  /**
14
14
  * Always "production"
15
15
  */
16
- environment: string;
16
+ environment: 'production';
17
17
  }
@@ -1,5 +1,5 @@
1
1
  export interface Z3GetPresignedUrlParams {
2
- action: string;
2
+ action: 'upload' | 'download';
3
3
  /**
4
4
  * An optional parameter that determines which type of S3 object should be created.
5
5
  */
@@ -7,6 +7,6 @@ export interface ZambdaCreateParams {
7
7
  /**
8
8
  * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
9
9
  */
10
- triggerMethod: string;
10
+ triggerMethod?: 'http_auth' | 'http_open' | 'subscription' | 'cron';
11
11
  schedule?: ZambdaSchedule;
12
12
  }
@@ -12,11 +12,11 @@ export interface ZambdaFunction {
12
12
  /**
13
13
  * The Zambda Function status provides information about the Functions state including whether it is ready to be invoked.
14
14
  */
15
- status: string;
15
+ status: 'Draft' | 'Pending' | 'Active' | 'Failed' | 'Inactive' | 'Validating';
16
16
  /**
17
17
  * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
18
18
  */
19
- triggerMethod: string;
19
+ triggerMethod: 'http_auth' | 'http_open' | 'subscription' | 'cron';
20
20
  schedule?: ZambdaSchedule;
21
21
  /**
22
22
  * Info about the zip file that was uploaded for the Zambda Function.
@@ -7,11 +7,11 @@ export interface ZambdaUpdateParams {
7
7
  /**
8
8
  * The trigger method for the Zambda Function determines how the Function is invoked. Learn more about the different types here, https://docs.oystehr.com/services/zambda/#types-of-zambdas.
9
9
  */
10
- triggerMethod?: string;
10
+ triggerMethod?: 'http_auth' | 'http_open' | 'subscription' | 'cron';
11
11
  schedule?: ZambdaSchedule;
12
12
  /**
13
13
  * The runtime to use for the Zambda Function. This property is optional and defaults to "nodejs20.x".
14
14
  */
15
- runtime?: string;
15
+ runtime?: 'nodejs18.x' | 'nodejs20.x';
16
16
  id: string;
17
17
  }
@@ -3,12 +3,48 @@ import type { Binary as BinaryR4B, Bundle as BundleR4B, BundleEntry as BundleEnt
3
3
  import type { Binary as BinaryR5, Bundle as BundleR5, BundleEntry as BundleEntryR5, FhirResource as FhirResourceR5, OperationOutcome as OperationOutcomeR5 } from 'fhir/r5';
4
4
  export type FhirResource = FhirResourceR4B | FhirResourceR5;
5
5
  export type FhirBundle<F extends FhirResource> = F extends FhirResourceR4B ? BundleR4B<F> : BundleR5<F>;
6
- export type Bundle<F extends FhirResource> = FhirBundle<F> & {
7
- unbundle: (this: Bundle<F>) => F[];
6
+ export type EntrylessFhirBundle<F extends FhirResource> = F extends FhirResourceR4B ? Omit<BundleR4B<F>, 'entry'> : Omit<BundleR5<F>, 'entry'>;
7
+ export type Bundle<F extends FhirResource> = EntrylessFhirBundle<F> & {
8
+ entry?: Array<BundleEntry<F>> | undefined;
9
+ unbundle: (this: {
10
+ entry?: Array<BundleEntry<F>>;
11
+ }) => F[];
8
12
  };
9
13
  export type BundleEntry<F extends FhirResource> = F extends FhirResourceR4B ? BundleEntryR4B<F> : BundleEntryR5<F>;
10
14
  export type Binary<F extends FhirResource> = F extends FhirResourceR4B ? BinaryR4B : BinaryR5;
11
15
  export type OperationOutcome = OperationOutcomeR4B | OperationOutcomeR5;
16
+ export type SearchParam = {
17
+ name: string;
18
+ value: string | number;
19
+ };
20
+ export interface FhirSearchParams {
21
+ resourceType: string;
22
+ params?: SearchParam[];
23
+ }
24
+ export interface FhirGetParams {
25
+ resourceType: string;
26
+ id: string;
27
+ }
28
+ export type FhirCreateParams<T extends FhirResource> = T;
29
+ export type FhirUpdateParams<T extends FhirResource> = T;
30
+ export interface FhirPatchParams {
31
+ resourceType: string;
32
+ id: string;
33
+ operations: Operation[];
34
+ }
35
+ export interface FhirDeleteParams {
36
+ resourceType: string;
37
+ id: string;
38
+ }
39
+ export interface FhirHistorySearchParams {
40
+ resourceType: string;
41
+ id: string;
42
+ }
43
+ export interface FhirHistoryGetParams {
44
+ resourceType: string;
45
+ id: string;
46
+ versionId: string;
47
+ }
12
48
  interface BatchInputBaseRequest {
13
49
  url: string;
14
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oystehr/sdk",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Oystehr SDK",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
@@ -55,7 +55,7 @@ export class SDKResource {
55
55
  this.config = config;
56
56
  }
57
57
 
58
- request(path: string, method: string): FetcherFunction {
58
+ protected request(path: string, method: string): FetcherFunction {
59
59
  return async (params: any, request?: InternalClientRequest): Promise<FetcherResponse> => {
60
60
  const baseUrlThunk = (): string => this.config.projectApiUrl ?? defaultProjectApiUrl;
61
61
  const configThunk = (): OystehrConfig => this.config;
@@ -68,7 +68,7 @@ export class SDKResource {
68
68
  };
69
69
  }
70
70
 
71
- fhirRequest<T extends FhirResource = any>(path: string, method: string) {
71
+ protected fhirRequest<T extends FhirResource = any>(path: string, method: string) {
72
72
  return async (params: any, request?: InternalClientRequest): Promise<FhirFetcherResponse<T>> => {
73
73
  try {
74
74
  const baseUrlThunk = (): string => this.config.fhirApiUrl ?? defaultFhirApiUrl;