serverless-plugin-module-registry 1.0.12-alpha.2 → 1.0.12-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -458,6 +458,18 @@ declare class ServerlessModuleRegistryPlugin {
458
458
  * Runs BEFORE main deployment to ensure table exists
459
459
  */
460
460
  private deployInternalInfrastructure;
461
+ /**
462
+ * Standalone command handler: deploy module registry infrastructure
463
+ * Bypasses the `enabled: false` check — deploys the DynamoDB table, EventBridge bus, SQS, and Lambda processors.
464
+ * Usage: `npx serverless@4 registryDeployInfra --stage dev --region sa-east-1`
465
+ */
466
+ private registryDeployInfraHandler;
467
+ /**
468
+ * Standalone command handler: validate/package module registry infrastructure
469
+ * Validates configuration and checks that internal-infrastructure directory exists.
470
+ * Usage: `npx serverless@4 registryPackageInfra --stage dev --region sa-east-1`
471
+ */
472
+ private registryPackageInfraHandler;
461
473
  /**
462
474
  * Handler for the registryGenerate command
463
475
  */
package/dist/index.js CHANGED
@@ -16069,6 +16069,42 @@ var PLUGIN_COMMANDS = {
16069
16069
  type: "boolean"
16070
16070
  }
16071
16071
  }
16072
+ },
16073
+ registryDeployInfra: {
16074
+ usage: "Deploy the module registry internal infrastructure stack (DynamoDB, EventBridge, SQS, Lambda)",
16075
+ lifecycleEvents: ["deploy"],
16076
+ options: {
16077
+ module: {
16078
+ usage: "Scope composer plugin to a single module during init (avoids loading all modules)",
16079
+ shortcut: "m",
16080
+ required: false,
16081
+ type: "string"
16082
+ },
16083
+ force: {
16084
+ usage: "Force deploy even if internalInfrastructure.enabled is false",
16085
+ shortcut: "f",
16086
+ required: false,
16087
+ type: "boolean"
16088
+ }
16089
+ }
16090
+ },
16091
+ registryPackageInfra: {
16092
+ usage: "Validate and package the module registry internal infrastructure",
16093
+ lifecycleEvents: ["package"],
16094
+ options: {
16095
+ module: {
16096
+ usage: "Scope composer plugin to a single module during init",
16097
+ shortcut: "m",
16098
+ required: false,
16099
+ type: "string"
16100
+ },
16101
+ verbose: {
16102
+ usage: "Show detailed validation information",
16103
+ shortcut: "v",
16104
+ required: false,
16105
+ type: "boolean"
16106
+ }
16107
+ }
16072
16108
  }
16073
16109
  };
16074
16110
  var PLUGIN_HOOKS = {
@@ -16076,7 +16112,9 @@ var PLUGIN_HOOKS = {
16076
16112
  "before:package:initialize": "processModuleRegistryWithVariableResolution",
16077
16113
  "after:aws:deploy:deploy:updateStack": "ensureTableAndUpdateData",
16078
16114
  "registryGenerate:generate": "registryGenerateHandler",
16079
- "registryGeneratePackage:create": "generateServicePackageCommand"
16115
+ "registryGeneratePackage:create": "generateServicePackageCommand",
16116
+ "registryDeployInfra:deploy": "registryDeployInfraHandler",
16117
+ "registryPackageInfra:package": "registryPackageInfraHandler"
16080
16118
  };
16081
16119
 
16082
16120
  // src/core/config.ts
@@ -19590,6 +19628,90 @@ var ServerlessModuleRegistryPlugin = class {
19590
19628
  throw new Error(`Infrastructure deployment failed: ${errorMessage}`);
19591
19629
  }
19592
19630
  }
19631
+ /**
19632
+ * Standalone command handler: deploy module registry infrastructure
19633
+ * Bypasses the `enabled: false` check — deploys the DynamoDB table, EventBridge bus, SQS, and Lambda processors.
19634
+ * Usage: `npx serverless@4 registryDeployInfra --stage dev --region sa-east-1`
19635
+ */
19636
+ async registryDeployInfraHandler() {
19637
+ var _a4;
19638
+ this.pluginLogger.trackHookCall("registryDeployInfra:deploy");
19639
+ try {
19640
+ this.logger.info("\u{1F680} Force-deploying Module Registry internal infrastructure...");
19641
+ const config = this.configManager.config;
19642
+ const serviceName = this.serverless.service.service;
19643
+ const stage = this.serverless.service.provider.stage || "dev";
19644
+ const region = config.region || this.serverless.service.provider.region || "us-east-1";
19645
+ const accountId = await this.getAwsAccountId();
19646
+ const tableName = config.tableName;
19647
+ const policyPrefix = config.policyPrefix || "";
19648
+ const infraStackName = ((_a4 = config.internalInfrastructure) == null ? void 0 : _a4.stackName) || `${serviceName}-${stage}-module-registry`;
19649
+ this.logger.info(` Service: ${serviceName}`);
19650
+ this.logger.info(` Stack: ${infraStackName}`);
19651
+ this.logger.info(` Stage: ${stage}`);
19652
+ this.logger.info(` Region: ${region}`);
19653
+ this.logger.info(` Table: ${tableName}`);
19654
+ this.logger.info(` Account: ${accountId || "(auto-detect)"}`);
19655
+ const updatedInfraConfig = {
19656
+ enabled: true,
19657
+ stackName: infraStackName,
19658
+ stage,
19659
+ region,
19660
+ tableName,
19661
+ tableArn: `arn:aws:dynamodb:${region}:${accountId}:table/${tableName}`
19662
+ };
19663
+ this.configManager._config.internalInfrastructure = updatedInfraConfig;
19664
+ if (accountId) {
19665
+ process.env.AWS_ACCOUNT_ID = accountId;
19666
+ }
19667
+ const metadata = await deployInternalInfrastructure(this.configManager.config, this.logger);
19668
+ this.logger.info("\u2705 Module Registry infrastructure deployed successfully");
19669
+ this.logger.info(` Stack: ${metadata.stackName}`);
19670
+ this.logger.info(` Stream ARN: ${metadata.streamArn}`);
19671
+ this.logger.info(` Queue URL: ${metadata.queueUrl}`);
19672
+ } catch (error) {
19673
+ const errorMessage = error.message || String(error);
19674
+ this.logger.error(`\u274C Module Registry infrastructure deployment failed: ${errorMessage}`);
19675
+ throw new Error(`Module Registry infrastructure deployment failed: ${errorMessage}`);
19676
+ }
19677
+ }
19678
+ /**
19679
+ * Standalone command handler: validate/package module registry infrastructure
19680
+ * Validates configuration and checks that internal-infrastructure directory exists.
19681
+ * Usage: `npx serverless@4 registryPackageInfra --stage dev --region sa-east-1`
19682
+ */
19683
+ async registryPackageInfraHandler() {
19684
+ var _a4;
19685
+ this.pluginLogger.trackHookCall("registryPackageInfra:package");
19686
+ try {
19687
+ this.logger.info("\u{1F4E6} Validating Module Registry infrastructure configuration...");
19688
+ const config = this.configManager.config;
19689
+ const serviceName = this.serverless.service.service;
19690
+ const stage = this.serverless.service.provider.stage || "dev";
19691
+ const region = config.region || this.serverless.service.provider.region || "us-east-1";
19692
+ const tableName = config.tableName;
19693
+ const infraStackName = ((_a4 = config.internalInfrastructure) == null ? void 0 : _a4.stackName) || `${serviceName}-${stage}-module-registry`;
19694
+ this.logger.info(` Service: ${serviceName}`);
19695
+ this.logger.info(` Stack: ${infraStackName}`);
19696
+ this.logger.info(` Stage: ${stage}`);
19697
+ this.logger.info(` Region: ${region}`);
19698
+ this.logger.info(` Table: ${tableName}`);
19699
+ const infraDir = import_path7.default.join(__dirname, "..", "src", "internal-infrastructure");
19700
+ if (!import_fs7.default.existsSync(infraDir)) {
19701
+ throw new Error(`Internal infrastructure directory not found at: ${infraDir}. Ensure src/internal-infrastructure/ is included in the plugin package.`);
19702
+ }
19703
+ const slsYml = import_path7.default.join(infraDir, "serverless.yml");
19704
+ if (!import_fs7.default.existsSync(slsYml)) {
19705
+ throw new Error(`serverless.yml not found at: ${slsYml}`);
19706
+ }
19707
+ this.logger.info(` Infrastructure dir: ${infraDir}`);
19708
+ this.logger.info("\u2705 Infrastructure configuration validated \u2014 ready for deploy");
19709
+ } catch (error) {
19710
+ const errorMessage = error.message || String(error);
19711
+ this.logger.error(`\u274C Infrastructure validation failed: ${errorMessage}`);
19712
+ throw error;
19713
+ }
19714
+ }
19593
19715
  /**
19594
19716
  * Handler for the registryGenerate command
19595
19717
  */