class NpmFacetImpl extends FacetSupport implements NpmFacet {

  @Nullable
  @Override
  public Asset putRepositoryRoot(final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes)
      throws IOException
  {
    final Repository repository = getRepository();
    final StorageTx tx = UnitOfWork.currentTx();
    final Bucket bucket = tx.findBucket(repository);
    Asset asset = NpmFacetUtils.findRepositoryRootAsset(tx, bucket);

    if (asset == null) {
      asset = tx.createAsset(bucket, repository.getFormat()).name(REPOSITORY_ROOT_ASSET);
      getEventManager().post(new NpmSearchIndexInvalidatedEvent(repository));
      saveAsset(tx, asset, assetBlob, REPOSITORY_ROOT, contentAttributes);
    }

    return asset;
  }

  @Inject public  NpmFacetImpl(final NpmPackageParser npmPackageParser);

}