synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
31 lines (30 loc) • 887 B
JavaScript
import { allowNotFoundError as l } from "../../../synapse-client/SynapseClientUtils.js";
import { convertToEntityType as c, entityTypeToFriendlyName as s } from "../../functions/EntityTypeUtils.js";
async function d(i, n, o, r) {
const t = (await l(
() => o.entityServicesClient.postRepoV1EntityChild({
entityLookupRequest: {
parentId: n,
entityName: i
}
})
))?.id ?? null;
if (t == null)
return t;
const e = await o.entityServicesClient.getRepoV1EntityId({
id: t
});
if (e.concreteType != "org.sagebionetworks.repo.model.FileEntity") {
const y = c(e.concreteType);
throw new Error(
`A(n) ${s(
y
)} named "${i}" already exists in this location (${n}).${r ? ` ${r}` : ""}`
);
}
return e.id;
}
export {
d as getFileEntityIdWithSameName
};
//# sourceMappingURL=getFileEntityIdWithSameName.js.map