import { importShared } from './__federation_fn_import-C3oBjoRC.js';
import { a as createRateLimitPartialDefinition, c as createRateLimitPluginDefinitionSchema } from './plugin-definition-D40BqcHC.js';

const {createPluginModelSyncChecker,FeatureUtils,PluginUtils} = await importShared('@baseplate-dev/project-builder-lib');
function createRateLimitSchemaChecker(pluginKey) {
  return createPluginModelSyncChecker({
    pluginKey,
    pluginLabel: "Rate Limit",
    buildPartialDef: (container) => {
      const pluginConfig = PluginUtils.configByKey(
        container.definition,
        pluginKey
      );
      const featureRef = pluginConfig?.rateLimitFeatureRef;
      if (!featureRef) return void 0;
      try {
        const featureName = FeatureUtils.getFeaturePathByIdOrThrow(
          container.definition,
          featureRef
        );
        return createRateLimitPartialDefinition(featureName);
      } catch {
        return void 0;
      }
    }
  });
}

const {createPluginModule,definitionIssueCheckerSpec,pluginConfigSpec} = await importShared('@baseplate-dev/project-builder-lib');
const common = createPluginModule({
  name: "common",
  dependencies: {
    pluginConfig: pluginConfigSpec,
    issueCheckers: definitionIssueCheckerSpec
  },
  initialize: ({ pluginConfig, issueCheckers }, { pluginKey }) => {
    pluginConfig.schemas.set(pluginKey, createRateLimitPluginDefinitionSchema);
    issueCheckers.checkers.set(
      pluginKey,
      createRateLimitSchemaChecker(pluginKey)
    );
  }
});

export { common as default };
//# sourceMappingURL=__federation_expose_rate-limitCoreCommon-CVLKsf5A.js.map
