/** * State object * @typedef {Object} OnaFHIRState * @property data - the parsed response body * @property response - the response from the HTTP server, including headers, statusCode, body, etc * @property references - an array of all previous data objects used in the Job **/ /** * Options provided to Ona fhir request * @typedef {Object} RequestOptions * @public * @property {object} query - An object of query parameters to be encoded into the URL. * @property {object} headers - An object of headers to append to the request. */ /** * Execute a sequence of operations. * Wraps `language-common/execute` to make working with this API easier. * @example * execute( * create('foo'), * delete('bar') * )(state) * @private * @param {Operations} operations - Operations to be performed. * @returns {Operation} */ export function execute(...operations: Operations): Operation; /** * Read a resource * The response body will be returned to `state.data` as JSON. * Paginated responses will be fully downloaded and returned as a single array, _unless_ a `getpagesoffset` is passed. * @example Read server metadata * read('metadata'); * @example Search for recently updated Patients — auto-paginates through all pages * read('Patient', { * query: { * '_lastUpdated': 'gt2026-07-01T00:00:00Z', * '_sort': '_lastUpdated', * '_count': 50, * } * }); * @example Fetch a specific page — auto-pagination disabled when _getpagesoffset is set * read('Patient', { * query: { * '_getpagesoffset': 100, * '_count': 50, * } * }); * @function * @public * @param {string} path - Path to resource * @param {RequestOptions} options - Optional request options. Set `query._getpagesoffset` to fetch a specific page without auto-pagination. * @returns {Operation} * @state {OnaFHIRState} */ export function read(path: string, options?: RequestOptions): Operation; /** * Create a resource * @example Create a Patient using builders (see [fhir-4 docs](https://docs.openfn.org/adaptors/packages/fhir-4-docs#functions)) * create('Patient', builders.patient({ * identifier: [ * builders.identifier({ * use: 'official', * system: 'http://ohie.org/National_Id', * value: 'NIN-TEST-001', * }), * ], * name: [{ use: 'official', family: 'Nakamura', given: ['Aiko'], text: 'Aiko Nakamura' }], * gender: 'female', * birthDate: '1992-04-10', * active: true, * telecom: [{ system: 'phone', value: '0712345678' }], * })); * @example Create a Patient without builders * create('Patient', { * resourceType: 'Patient', * active: true, * identifier: [ * { use: 'official', system: 'http://ohie.org/National_Id', value: 'NIN-TEST-001' }, * ], * name: [{ use: 'official', family: 'Nakamura', given: ['Aiko'] }], * gender: 'female', * birthDate: '1992-04-10', * telecom: [{ system: 'phone', value: '0712345678' }], * }); * @function * @public * @param {string} path - Path to resource * @param {object} body - Object which will be attached to the POST body * @param {RequestOptions} options - Optional request options * @returns {Operation} * @state {OnaFHIRState} */ export function create(path: string, body: object, options: RequestOptions): Operation; /** * Update a resource * @example Update a Patient by ID * update('Patient/0181038e-682b-4c7c-a946-e3757d2fa2f7', { * resourceType: 'Patient', * id: '0181038e-682b-4c7c-a946-e3757d2fa2f7', * active: true, * name: [{ use: 'official', family: 'Mathenge', given: ['Monica'] }], * gender: 'female', * birthDate: '1990-07-07', * telecom: [{ system: 'phone', value: '0712010203' }], * managingOrganization: { reference: 'Organization/eb4963c3-3d6e-4ea9-bde8-6a5b638bc4f8' }, * }); * @function * @public * @param {string} path - Path to resource * @param {object} body - Object which will be attached to the POST body * @param {RequestOptions} options - Optional request options * @returns {Operation} * @state {OnaFHIRState} */ export function update(path: string, body: object, options: RequestOptions): Operation; /** * Make a general HTTP request * @example Search Observations for a specific patient * request('GET', 'Observation', null, { * query: { 'subject': 'Patient/0181038e-682b-4c7c-a946-e3757d2fa2f7' } * }); * @example Update a Patient resource * request('PUT', 'Patient/0181038e-682b-4c7c-a946-e3757d2fa2f7', { * resourceType: 'Patient', * id: '0181038e-682b-4c7c-a946-e3757d2fa2f7', * active: false, * name: [{ use: 'official', family: 'Mathenge', given: ['Monica'] }], * gender: 'female', * birthDate: '1990-07-07', * }); * @function * @public * @param {string} method - HTTP method to use * @param {string} path - Path to resource * @param {object} body - Object which will be attached to the POST body * @param {RequestOptions} options - Optional request options * @returns {Operation} * @state {OnaFHIRState} */ export function request(method: string, path: string, body: object, options?: RequestOptions): Operation; export { builders } from "@openfn/language-fhir-4"; /** * State object */ export type OnaFHIRState = { /** * - the parsed response body */ data: any; /** * - the response from the HTTP server, including headers, statusCode, body, etc */ response: any; /** * - an array of all previous data objects used in the Job */ references: any; }; /** * Options provided to Ona fhir request */ export type RequestOptions = any; /** * Delete a resource * @example Delete a Patient by ID * delete('Patient/97597'); * @function * @public * @alias delete * @param {string} path - Path to resource * @param {RequestOptions} options - Optional request options * @returns {Operation} * @state {OnaFHIRState} */ declare function _delete(path: string, options: RequestOptions): Operation; export { _delete as delete, _delete as delete }; export { as, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, group, lastReferenceValue, map, merge, scrubEmojis, sourceValue, util } from "@openfn/language-common";