in src/router/bundle/bundleParser.ts [423:446]
private static getResourceType(entry: any, operation: TypeOperation | SystemOperation) {
let resourceType = '';
if (operation === 'create' || operation === 'update' || operation === 'patch') {
resourceType = entry.resource.resourceType;
} else if (
operation === 'read' ||
operation === 'vread' ||
operation === 'search-type' ||
operation === 'history-type' ||
operation === 'history-instance' ||
operation === 'delete'
) {
const { url } = entry.request;
const match = url.match(captureResourceTypeRegExp);
if (!match) {
throw new Error(`Bundle entry does not contain valid url format: ${url}`);
}
// IDs are in the form <resource-type>/id
// exp. Patient/abcd1234
// eslint-disable-next-line prefer-destructuring
resourceType = match[1];
}
return resourceType;
}