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