Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
feat!: add methods to support FHIR Subscriptions (#100)
Browse files Browse the repository at this point in the history
* feat: add getActiveSubscriptions interface (#95)
* feat!: search and validate update for subscription data validation(#94)
* feat: Validator change (#97)

Co-authored-by: Sukeerth Vegaraju <ssvegaraju@yahoo.co.in>
Co-authored-by: Yanyu Zheng <yz2690@columbia.edu>

BREAKING CHANGE: add new required methods `getActiveSubscriptions` and `validateSubscriptionSearchCriteria`
  • Loading branch information
carvantes authored Mar 3, 2022
1 parent 7255805 commit a980196
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,10 @@ export interface Persistence {
* the appropriate action to take.
*/
conditionalDeleteResource(request: ConditionalDeleteResourceRequest, queryParams: any): Promise<GenericResponse>;

/**
* Returns an array of all active Subscriptions.
* If tenantId is supplied, this method will only return Subscriptions owned by that tenant.
*/
getActiveSubscriptions(params: { tenantId?: string }): Promise<Record<string, any>[]>;
}
4 changes: 4 additions & 0 deletions src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ export interface Search {
* See https://www.hl7.org/fhir/capabilitystatement.html
*/
getCapabilities(): Promise<SearchCapabilityStatement>;
/**
* Verify that a search string used as criteria in Subscription resource is valid
*/
validateSubscriptionSearchCriteria(searchCriteria: string): void;
}
8 changes: 8 additions & 0 deletions src/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export module stubs {
globalSearch(request) {
throw new Error('Method not implemented.');
},

validateSubscriptionSearchCriteria(searchCriteria) {
throw new Error('Method not implemented.');
},
};

export const history: History = {
Expand Down Expand Up @@ -258,6 +262,10 @@ export module stubs {
conditionalDeleteResource(request, queryParams) {
throw new Error('Method not implemented.');
},

getActiveSubscriptions(params: { tenantId: string }) {
throw new Error('Method not implemented.');
},
};

export const bulkDataAccess: BulkDataAccess = {
Expand Down
7 changes: 6 additions & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { TypeOperation } from './constants';

export interface Validator {
/**
* returns a resolved Promise if the resource is valid. Otherwise throws an error
* @throws InvalidResourceError
*/
validate(resource: any): Promise<void>;
validate(
resource: any,
{ tenantId, typeOperation }: { tenantId?: string; typeOperation?: TypeOperation },
): Promise<void>;
}

0 comments on commit a980196

Please sign in to comment.