Skip to content

Commit

Permalink
feat: add $wait(milliseconds) function
Browse files Browse the repository at this point in the history
  • Loading branch information
mechanik-daniel committed Sep 8, 2024
1 parent dd8c3d8 commit 4b9a79f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/helpers/jsonataFunctions/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const transform = async (input, expression: string, extraBindings: Record
bindings.__finalize = runtime.finalize;
bindings.__castToFhir = runtime.castToFhir;
bindings.__flashMerge = runtime.flashMerge;
bindings.wait = runtime.wait;
bindings.reference = fhirFuncs.reference;
bindings.resourceId = fhirFuncs.resourceId;
bindings.initCap = stringFuncs.initCap;
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { castToFhir } from './castToFhir';
import { checkResourceId } from './checkResourceId';
import { finalize } from './finalize';
import { flashMerge } from './flashMerge';
import { wait } from './wait';

export type { CastToFhirOptions } from './castToFhir';
export type { flashMerge, FlashMergeOptions } from './flashMerge';
Expand All @@ -15,5 +16,6 @@ export default {
castToFhir,
checkResourceId,
flashMerge,
finalize
finalize,
wait
};
8 changes: 8 additions & 0 deletions src/helpers/runtime/wait.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* © Copyright Outburn Ltd. 2022-2024 All Rights Reserved
* Project name: FUME-COMMUNITY
*/

export const wait = async (milliseconds: number) => {
return await new Promise(resolve => setTimeout(resolve, milliseconds));
};

0 comments on commit 4b9a79f

Please sign in to comment.