Flask application initialization.

        Initialize:

        * The CLI commands.

        * Initialize the logger (Default: `app.debug`).

        * Initialize the default admin object link endpoint.
            (Default: `{"rec": "recordmetadata.details_view"}` if
            `invenio-records` is installed, otherwise `{}`).

        * Register the `pid_exists` template filter.

        * Initialize extension state.

        :param app: The Flask application
        :param minters_entry_point_group: The minters entry point group
            (Default: None).
        :param fetchers_entry_point_group: The fetchers entry point group
            (Default: None).
        :returns: PIDStore state application.

def init_app(self, app, minters_entry_point_group=None,
                 fetchers_entry_point_group=None):
        """Flask application initialization.

        Initialize:

        * The CLI commands.

        * Initialize the logger (Default: `app.debug`).

        * Initialize the default admin object link endpoint.
            (Default: `{"rec": "recordmetadata.details_view"}` if
            `invenio-records` is installed, otherwise `{}`).

        * Register the `pid_exists` template filter.

        * Initialize extension state.

        :param app: The Flask application
        :param minters_entry_point_group: The minters entry point group
            (Default: None).
        :param fetchers_entry_point_group: The fetchers entry point group
            (Default: None).
        :returns: PIDStore state application.
        """
        self.init_config(app)
        # Initialize CLI
        app.cli.add_command(cmd)

        # Initialize logger
        app.config.setdefault('PIDSTORE_APP_LOGGER_HANDLERS', app.debug)
        if app.config['PIDSTORE_APP_LOGGER_HANDLERS']:
            for handler in app.logger.handlers:
                logger.addHandler(handler)

        # Initialize admin object link endpoints.
        try:
            pkg_resources.get_distribution('invenio-records')
            app.config.setdefault('PIDSTORE_OBJECT_ENDPOINTS', dict(
                rec='recordmetadata.details_view',
            ))
        except pkg_resources.DistributionNotFound:
            app.config.setdefault('PIDSTORE_OBJECT_ENDPOINTS', {})

        # Register template filter
        app.jinja_env.filters['pid_exists'] = pid_exists

        # Initialize extension state.
        state = _PIDStoreState(
            app=app,
            minters_entry_point_group=minters_entry_point_group,
            fetchers_entry_point_group=fetchers_entry_point_group,
        )
        app.extensions['invenio-pidstore'] = state
        return state