serverless-plugin-module-registry 1.0.9 → 1.0.10-alpha.0

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
@@ -155,7 +155,9 @@ declare function generateAbacTags(
155
155
  declare function getRequiredModulePolicyArns(
156
156
  selectedFeatures: SelectedFeature[],
157
157
  accountId: string,
158
- policyPrefix: string
158
+ service: string,
159
+ stage: string,
160
+ region: string
159
161
  ): Promise<string[]>
160
162
 
161
163
  /**
@@ -171,9 +173,9 @@ declare function createModuleRegistryLogger(context: string): {
171
173
  * AI-powered Registry Generation
172
174
  */
173
175
  interface Logger {
174
- info: (message: string) => void;
175
- warning: (message: string) => void;
176
- error: (message: string) => void;
176
+ info: (_message: string) => void;
177
+ warning: (_message: string) => void;
178
+ error: (_message: string) => void;
177
179
  }
178
180
  interface FunctionAnalysis {
179
181
  handler: string;
@@ -270,9 +272,9 @@ interface CreateTenantRolesParams {
270
272
  policyPrefix: string;
271
273
  };
272
274
  logger: {
273
- info: (message: string, data?: any) => void;
274
- warning: (message: string, data?: any) => void;
275
- error: (message: string, error?: any) => void;
275
+ info: (_message: string, _data?: any) => void;
276
+ warning: (_message: string, _data?: any) => void;
277
+ error: (_message: string, _error?: any) => void;
276
278
  };
277
279
  }
278
280
  interface TenantRoleArns {
package/dist/index.js CHANGED
@@ -8861,9 +8861,9 @@ var DynamoDBManager = class {
8861
8861
  this.logger.error(` Error Name: ${error.name}`);
8862
8862
  this.logger.error(` Error Message: ${error.message}`);
8863
8863
  if (error.name === "ResourceNotFoundException") {
8864
- this.logger.error(` \u2139\uFE0F Table does not exist yet`);
8865
- this.logger.error(` \u2139\uFE0F The table should be created by the internal infrastructure stack`);
8866
- this.logger.error(` \u2139\uFE0F Ensure internalInfrastructure.enabled is set to true in your configuration`);
8864
+ this.logger.error(" \u2139\uFE0F Table does not exist yet");
8865
+ this.logger.error(" \u2139\uFE0F The table should be created by the internal infrastructure stack");
8866
+ this.logger.error(" \u2139\uFE0F Ensure internalInfrastructure.enabled is set to true in your configuration");
8867
8867
  throw new Error(
8868
8868
  `Table '${tableName}' does not exist. The table should be created by the internal infrastructure stack. Ensure internalInfrastructure.enabled is set to true in your configuration.`
8869
8869
  );
@@ -9064,7 +9064,7 @@ var DynamoDBManager = class {
9064
9064
  }));
9065
9065
  await this.batchWrite(deleteOperations);
9066
9066
  } else {
9067
- this.logger.info(` No stale entries to clean up`);
9067
+ this.logger.info(" No stale entries to clean up");
9068
9068
  }
9069
9069
  } catch (error) {
9070
9070
  this.logger.error(` \u274C Error during stale entry cleanup: ${error.message}`);
@@ -9115,7 +9115,7 @@ var DynamoDBManager = class {
9115
9115
  this.logger.error(` Attempts: ${error.$metadata.attempts || "N/A"}`);
9116
9116
  }
9117
9117
  if (moduleEntries.length > 0 || featureEntries.length > 0) {
9118
- this.logger.error(` Failed to write:`);
9118
+ this.logger.error(" Failed to write:");
9119
9119
  this.logger.error(` - ${moduleEntries.length} module entries`);
9120
9120
  this.logger.error(` - ${featureEntries.length} feature entries`);
9121
9121
  if (moduleEntries.length > 0) {
@@ -16842,7 +16842,7 @@ var PackageGenerateCommand = class {
16842
16842
  * Execute the package generation command
16843
16843
  */
16844
16844
  async execute(options = {}) {
16845
- const { force = false, verbose = false } = options;
16845
+ const { force = false } = options;
16846
16846
  this.logger.info("Generating Module Registry service package...");
16847
16847
  this.logger.info(`Force regeneration: ${force ? "YES" : "NO"}`);
16848
16848
  try {
@@ -17260,8 +17260,9 @@ var AbacMetadataWriter = class {
17260
17260
  var import_client_cloudformation = require("@aws-sdk/client-cloudformation");
17261
17261
  var import_client_api_gateway = require("@aws-sdk/client-api-gateway");
17262
17262
  var PluginOrchestrator = class {
17263
- constructor(serverless, config, logger) {
17264
- this.serverless = serverless;
17263
+ // eslint-disable-next-line no-unused-vars
17264
+ constructor(_serverless, config, logger) {
17265
+ this._serverless = _serverless;
17265
17266
  this.config = config;
17266
17267
  this.logger = logger;
17267
17268
  this.dynamoManager = null;
@@ -18110,8 +18111,8 @@ var generateAbacTags = async (selectedFeatures) => {
18110
18111
  return tags;
18111
18112
  }, "generateAbacTags");
18112
18113
  };
18113
- var getRequiredModulePolicyArns = async (selectedFeatures, accountId, service, stage) => {
18114
- const params = validateParams({ selectedFeatures, accountId, service, stage }, ["selectedFeatures", "accountId", "service", "stage"]);
18114
+ var getRequiredModulePolicyArns = async (selectedFeatures, accountId, service, stage, region) => {
18115
+ const params = validateParams({ selectedFeatures, accountId, service, stage, region }, ["selectedFeatures", "accountId", "service", "stage", "region"]);
18115
18116
  return withErrorHandling(async () => {
18116
18117
  const logger = createModuleRegistryLogger("getRequiredModulePolicyArns");
18117
18118
  if (!Array.isArray(params.selectedFeatures)) {
@@ -18120,7 +18121,7 @@ var getRequiredModulePolicyArns = async (selectedFeatures, accountId, service, s
18120
18121
  logger.info(`Getting required module policy ARNs for ${params.selectedFeatures.length} selected features`);
18121
18122
  const moduleNames = [...new Set(params.selectedFeatures.map((f) => f.moduleName).filter(Boolean))];
18122
18123
  const policyArns = moduleNames.map(
18123
- (moduleName) => `arn:aws:iam::${params.accountId}:policy/${params.service}-${moduleName}-${params.stage}-abac`
18124
+ (moduleName) => `arn:aws:iam::${params.accountId}:policy/${params.service}-${moduleName}-${params.stage}-${params.region}-abac`
18124
18125
  );
18125
18126
  logger.info(`Required module-specific ABAC policy ARNs for modules [${moduleNames.join(", ")}]: ${JSON.stringify(policyArns)}`);
18126
18127
  return policyArns;
@@ -18998,11 +18999,12 @@ var ServerlessModuleRegistryPlugin = class {
18998
18999
  };
18999
19000
  });
19000
19001
  const policyResourceName = `${this.toPascalCase(moduleName)}AbacPolicy`;
19002
+ const policyName = `${this.configManager.config.policyPrefix}-${moduleName}-${region}-abac`;
19001
19003
  policyResources[policyResourceName] = {
19002
19004
  Type: "AWS::IAM::ManagedPolicy",
19003
19005
  Properties: {
19004
- ManagedPolicyName: `${this.configManager.config.policyPrefix}-abac`,
19005
- Description: `${this.configManager.config.policyPrefix}-abac`,
19006
+ ManagedPolicyName: policyName,
19007
+ Description: `${this.configManager.config.policyPrefix}-${moduleName}-${region}-abac`,
19006
19008
  PolicyDocument: {
19007
19009
  Version: "2012-10-17",
19008
19010
  Statement: statements.map((statement) => ({
@@ -19184,7 +19186,7 @@ var ServerlessModuleRegistryPlugin = class {
19184
19186
  this.logger.error(` Error name: ${error.name || "Unknown"}`);
19185
19187
  this.logger.error(` Error message: ${error.message}`);
19186
19188
  if (error.$metadata) {
19187
- this.logger.error(` AWS SDK metadata:`);
19189
+ this.logger.error(" AWS SDK metadata:");
19188
19190
  this.logger.error(` - HTTP Status: ${error.$metadata.httpStatusCode || "N/A"}`);
19189
19191
  this.logger.error(` - Request ID: ${error.$metadata.requestId || "N/A"}`);
19190
19192
  this.logger.error(` - Attempts: ${error.$metadata.attempts || "N/A"}`);
@@ -19193,7 +19195,7 @@ var ServerlessModuleRegistryPlugin = class {
19193
19195
  this.logger.error(` Error code: ${error.code}`);
19194
19196
  }
19195
19197
  if (error.stack) {
19196
- this.logger.error(` Stack trace (first 500 chars):`);
19198
+ this.logger.error(" Stack trace (first 500 chars):");
19197
19199
  this.logger.error(` ${error.stack.substring(0, 500)}`);
19198
19200
  }
19199
19201
  if (totalEntries > 0) {