Skip to content

Commit

Permalink
Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-ignatov committed Jul 27, 2019
1 parent 09a4438 commit 52eb597
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 55 deletions.
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ It works both in browsers (IE10+) and on the server (NodeJS).

Install from npm:
```sh
# v2 is still in beta! To give it a try do:
npm i https://github.com/smart-on-fhir/client-js

# To install the current version do:
npm i fhirclient
```

Expand All @@ -29,6 +25,41 @@ The documentation for the older (current) version is at [http://docs.smarthealth

<br/>

## Contributing and Development

### NPM Scripts

After you `cd` into to the project folder and run `npm i`, you can use npm scripts to handle any project-related task:

```sh
# run tests
npm test

# Build everything
npm run build

# Build all bundles
npm run pack

# Only build the minified bundle for production
npm run pack:prod

# Only build the pure (no polyfills included) minified bundle for production
npm run pack:prod:pure

# Only build non-minified bundle for development
npm run pack:dev

# Only build the pure (no polyfills included) bundle for development
npm run pack:dev:pure

# Only build non-minified bundle for development and rebuild on change
npm run build:dev

# Build the CommonJS modules (for Node and bundlers)
npm run build:module
```

## License
Apache 2.0

Expand Down
8 changes: 8 additions & 0 deletions dist/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## v2.1.0
- Added convenience wrappers for the FHIR create/update/delete operations #56
- Added patient context aware request wrapper #57
- Fixed a refresh issue in Firefox #58
- Improved fake token flow #59
- Added `getFhirVersion` and `getFhirRelease` client methods
- Few other minor fixes and improvements

## v2.0.7
- See http://docs.smarthealthit.org/client-js/v2.html

Expand Down
60 changes: 47 additions & 13 deletions dist/lib/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,23 @@ declare namespace fhirclient {
/**
* The current state including options and tokenResponse
*/
state: object;
environment: object;
api?: object;
state: JsonObject;
environment: JsonObject;
api?: JsonObject;
patient: {
id: string;
api?: object;
read(): Promise<object>;
api?: JsonObject;
read(): Promise<JsonObject>;
};
encounter: {
id: string;
read(): Promise<object>;
read(): Promise<JsonObject>;
};
user: {
id: string;
fhirUser: string;
resourceType: string;
read(): Promise<object>;
read(): Promise<JsonObject>;
}

/**
Expand Down Expand Up @@ -200,6 +200,24 @@ declare namespace fhirclient {
getAuthorizationHeader(): string|null;
_clearState(): Promise<void>;

/**
* Wrapper for `client.request` implementing the FHIR resource create operation
* @param {Object} resource A FHIR resource to be created
*/
create(resource: object): Promise<RequestResult>

/**
* Wrapper for `client.request` implementing the FHIR resource update operation
* @param {Object} resource A FHIR resource to be updated
*/
update(resource: object): Promise<RequestResult>

/**
* Wrapper for `client.request` implementing the FHIR resource delete operation
* @param {String} uri Relative URI of the FHIR resource to be deleted (format: `resourceType/id`)
*/
delete(uri: string): Promise<RequestResult>

/**
* Use this method to query the FHIR server
* @param uri Either the full url, or a path that will be rooted at the FHIR baseUrl.
Expand All @@ -221,6 +239,22 @@ declare namespace fhirclient {
* Resolves with the updated state or rejects with an error.
*/
refresh(): Promise<object>;

/**
* Returns a promise that will be resolved with the fhir version as defined
* in the conformance statement.
*/
getFhirVersion(): Promise<string>;

/**
* Returns a promise that will be resolved with the numeric fhir version
* - 2 for DSTU2
* - 3 for STU3
* - 4 for R4
* - 0 if the version is not known
*/
getFhirRelease(): Promise<number>;

byCode(observations: object|object[], property: string): object[];
byCodes(observations: object|object[], property: string): (codes: string[]) => object[];
units: any;
Expand Down Expand Up @@ -255,7 +289,7 @@ declare namespace fhirclient {
* Describes the state that should be passed to the Client constructor.
* Everything except `serverUrl` is optional
*/
declare interface ClientState {
interface ClientState {
/**
* The base URL of the Fhir server. The library should have detected it
* at authorization time from request query params of from config options.
Expand Down Expand Up @@ -333,7 +367,7 @@ declare namespace fhirclient {
/**
* Authorization parameters that can be passed to `authorize` or `init`
*/
declare interface AuthorizeParams {
interface AuthorizeParams {

/**
* This is the URL of the service you are connecting to.
Expand Down Expand Up @@ -430,7 +464,7 @@ declare namespace fhirclient {
* Additional options that can be passed to `client.request` to control its
* behavior
*/
declare interface FhirOptions {
interface FhirOptions {

/**
* When you request a Bundle, the result will typically come back in pages
Expand Down Expand Up @@ -538,7 +572,7 @@ declare namespace fhirclient {
* additional properties.
* @see http://docs.smarthealthit.org/authorization/
*/
declare interface TokenResponse {
interface TokenResponse {

/**
* If present, this tells the app that it is being rendered within an
Expand Down Expand Up @@ -614,10 +648,10 @@ declare namespace fhirclient {
/**
* Other properties might be passed by the server
*/
[key?: string]: any;
[key: string]: any;
}

declare interface JsonObject {
interface JsonObject {
[key: string]: any
}
}
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fhirclient",
"version": "2.0.7",
"version": "2.1.0",
"description": "JavaScript client for Fast Healthcare Interoperability Resources",
"author": "SMART Health IT <support@smarthealthit.org> (https://smarthealthit.org/)",
"contributors": [
Expand Down
36 changes: 0 additions & 36 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ FHIR.oauth2.ready().then(client => client.api.search({ type: "Patient" }))
</script>
```


#### NodeJS Integration
There are no global variables to detect so you'll have to link it manually using
the dedicated `connect(fhirJs)` method of the client:
Expand All @@ -233,41 +232,6 @@ app.get("/", async (req, res) => {
});
```

## Contributing and Development

### NPM Scripts

After you `cd` into to the project folder and run `npm i`, you can use npm scripts to handle any project-related task:

```sh
# run tests
npm test

# Build everything
npm run build

# Build all bundles
npm run pack

# Only build the minified bundle for production
npm run pack:prod

# Only build the pure (no polyfills included) minified bundle for production
npm run pack:prod:pure

# Only build non-minified bundle for development
npm run pack:dev

# Only build the pure (no polyfills included) bundle for development
npm run pack:dev:pure

# Only build non-minified bundle for development and rebuild on change
npm run build:dev

# Build the CommonJS modules (for Node and bundlers)
npm run build:module
```

## Debugging
This library uses the [debug](https://www.npmjs.com/package/debug) module.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fhirclient",
"version": "2.0.0",
"version": "2.1.0",
"description": "JavaScript client for Fast Healthcare Interoperability Resources",
"author": "SMART Health IT <support@smarthealthit.org> (https://smarthealthit.org/)",
"contributors": [
Expand Down
16 changes: 16 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,22 @@ declare namespace fhirclient {
* Resolves with the updated state or rejects with an error.
*/
refresh(): Promise<object>;

/**
* Returns a promise that will be resolved with the fhir version as defined
* in the conformance statement.
*/
getFhirVersion(): Promise<string>;

/**
* Returns a promise that will be resolved with the numeric fhir version
* - 2 for DSTU2
* - 3 for STU3
* - 4 for R4
* - 0 if the version is not known
*/
getFhirRelease(): Promise<number>;

byCode(observations: object|object[], property: string): object[];
byCodes(observations: object|object[], property: string): (codes: string[]) => object[];
units: any;
Expand Down

0 comments on commit 52eb597

Please sign in to comment.