@flexpa/node-sdk
v0.0.4
Published
The NodeSDK simplifies the process of integrating Flexpa by providing a strongly-typed client for calling Flexpa APIs.
Downloads
107
Readme
@flexpa/node-sdk
The NodeSDK simplifies the process of integrating Flexpa by providing a strongly-typed client for calling Flexpa APIs.
Installation
With yarn:
yarn add @flexpa/node-sdk
With npm:
npm install @flexpa/node-sdk
With pnpm:
pnpm install @flexpa/node-sdk
Usage
Initialize FlexpaClient (from Link Exchange)
import FlexpaClient, { IntrospectResponse } from '@flexpa/node-sdk';
const flexpaClient = await FlexpaClient.fromExchange(myPublicToken, mySecretKey, 'https://api.flexpa.com');
const tokenData: IntrospectResponse = await flexpaClient.introspect();
Initialize FlexpaClient (from Access Token)
import FlexpaClient from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
// Or: const flexpaClient = new FlexpaClient(myAccessToken, "https://api.flexpa.com");
Reading a FHIR Resource
import * as r4 from 'fhir/r4';
import { FlexpaClient } from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
const patient: r4.Patient = await flepxaClient.read('Patient', '$PATIENT_ID');
Searching a FHIR Resource
import * as r4 from 'fhir/r4';
import { FlexpaClient } from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
const bundle: r4.Bundle = await flepxaClient.search('Patient', { given: 'john', family: 'doe' });
Publishing to NPM
- Run
yarn version patch | minor | major
to update the package's version. Head to the git repo on Github and create a new release. - Add a tag to the release with the command
git tag
, matching the patternnode-sdk-<major>.<minor>.<patch>
. The full command would begit tag node-sdk-<major>.<minor>.<patch>
. - Push to the new tagged branch with
git push origin node-sdk-<major>.<minor>.<patch>
. Once a release has been created thePublish @flexpa/node-sdk
github action will be triggered, and handles publishing the new version tonpm
(See.github/workflows/node-sdk-npm-registry.yml
).
FAQ
| Topic | Answer | Comments |
| ----------- | ------------ | ------------ |
| Runtime | Node |
| Build | Through yarn | yarn build
|