@ecency/sdk 1.5.6 → 1.5.7

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.
@@ -158,35 +158,48 @@ var ConfigManager;
158
158
  return { safe: true };
159
159
  }
160
160
  function safeCompileRegex(pattern, maxLength = 200) {
161
+ const isDevelopment = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
161
162
  try {
162
163
  if (!pattern) {
163
- console.warn(`[SDK] DMCA pattern rejected: empty pattern`);
164
+ if (isDevelopment) {
165
+ console.warn(`[SDK] DMCA pattern rejected: empty pattern`);
166
+ }
164
167
  return null;
165
168
  }
166
169
  if (pattern.length > maxLength) {
167
- console.warn(`[SDK] DMCA pattern rejected: length ${pattern.length} exceeds max ${maxLength} - pattern: ${pattern.substring(0, 50)}...`);
170
+ if (isDevelopment) {
171
+ console.warn(`[SDK] DMCA pattern rejected: length ${pattern.length} exceeds max ${maxLength} - pattern: ${pattern.substring(0, 50)}...`);
172
+ }
168
173
  return null;
169
174
  }
170
175
  const staticAnalysis = analyzeRedosRisk(pattern);
171
176
  if (!staticAnalysis.safe) {
172
- console.warn(`[SDK] DMCA pattern rejected: static analysis failed (${staticAnalysis.reason}) - pattern: ${pattern.substring(0, 50)}...`);
177
+ if (isDevelopment) {
178
+ console.warn(`[SDK] DMCA pattern rejected: static analysis failed (${staticAnalysis.reason}) - pattern: ${pattern.substring(0, 50)}...`);
179
+ }
173
180
  return null;
174
181
  }
175
182
  let regex;
176
183
  try {
177
184
  regex = new RegExp(pattern);
178
185
  } catch (compileErr) {
179
- console.warn(`[SDK] DMCA pattern rejected: compilation failed - pattern: ${pattern.substring(0, 50)}...`, compileErr);
186
+ if (isDevelopment) {
187
+ console.warn(`[SDK] DMCA pattern rejected: compilation failed - pattern: ${pattern.substring(0, 50)}...`, compileErr);
188
+ }
180
189
  return null;
181
190
  }
182
191
  const runtimeTest = testRegexPerformance(regex);
183
192
  if (!runtimeTest.safe) {
184
- console.warn(`[SDK] DMCA pattern rejected: runtime test failed (${runtimeTest.reason}) - pattern: ${pattern.substring(0, 50)}...`);
193
+ if (isDevelopment) {
194
+ console.warn(`[SDK] DMCA pattern rejected: runtime test failed (${runtimeTest.reason}) - pattern: ${pattern.substring(0, 50)}...`);
195
+ }
185
196
  return null;
186
197
  }
187
198
  return regex;
188
199
  } catch (err) {
189
- console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${pattern.substring(0, 50)}...`, err);
200
+ if (isDevelopment) {
201
+ console.warn(`[SDK] DMCA pattern rejected: unexpected error - pattern: ${pattern.substring(0, 50)}...`, err);
202
+ }
190
203
  return null;
191
204
  }
192
205
  }
@@ -197,7 +210,8 @@ var ConfigManager;
197
210
  CONFIG.dmcaTagRegexes = tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
198
211
  CONFIG.dmcaPatternRegexes = [];
199
212
  const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
200
- if (!CONFIG._dmcaInitialized) {
213
+ const isDevelopment = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
214
+ if (!CONFIG._dmcaInitialized && isDevelopment) {
201
215
  console.log(`[SDK] DMCA configuration loaded:`);
202
216
  console.log(` - Accounts: ${accounts.length}`);
203
217
  console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${tags.length} compiled (${rejectedTagCount} rejected)`);
@@ -205,8 +219,8 @@ var ConfigManager;
205
219
  if (rejectedTagCount > 0) {
206
220
  console.warn(`[SDK] ${rejectedTagCount} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`);
207
221
  }
208
- CONFIG._dmcaInitialized = true;
209
222
  }
223
+ CONFIG._dmcaInitialized = true;
210
224
  }
211
225
  ConfigManager2.setDmcaLists = setDmcaLists;
212
226
  })(ConfigManager || (ConfigManager = {}));