@ecency/sdk 1.5.17 → 1.5.19

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.
@@ -241,18 +241,25 @@ exports.ConfigManager = void 0;
241
241
  return null;
242
242
  }
243
243
  }
244
- function setDmcaLists(accounts = [], tags = [], patterns = []) {
245
- CONFIG.dmcaAccounts = accounts;
246
- CONFIG.dmcaTags = tags;
247
- CONFIG.dmcaPatterns = patterns;
248
- CONFIG.dmcaTagRegexes = tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
244
+ function setDmcaLists(lists = {}) {
245
+ const coerceList = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
246
+ const input = lists || {};
247
+ const resolved = {
248
+ accounts: coerceList(input.accounts),
249
+ tags: coerceList(input.tags),
250
+ patterns: coerceList(input.posts)
251
+ };
252
+ CONFIG.dmcaAccounts = resolved.accounts;
253
+ CONFIG.dmcaTags = resolved.tags;
254
+ CONFIG.dmcaPatterns = resolved.patterns;
255
+ CONFIG.dmcaTagRegexes = resolved.tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
249
256
  CONFIG.dmcaPatternRegexes = [];
250
- const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
257
+ const rejectedTagCount = resolved.tags.length - CONFIG.dmcaTagRegexes.length;
251
258
  if (!CONFIG._dmcaInitialized && isDevelopment) {
252
259
  console.log(`[SDK] DMCA configuration loaded:`);
253
- console.log(` - Accounts: ${accounts.length}`);
254
- console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${tags.length} compiled (${rejectedTagCount} rejected)`);
255
- console.log(` - Post patterns: ${patterns.length} (using exact string matching)`);
260
+ console.log(` - Accounts: ${resolved.accounts.length}`);
261
+ console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${resolved.tags.length} compiled (${rejectedTagCount} rejected)`);
262
+ console.log(` - Post patterns: ${resolved.patterns.length} (using exact string matching)`);
256
263
  if (rejectedTagCount > 0) {
257
264
  console.warn(`[SDK] ${rejectedTagCount} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`);
258
265
  }
@@ -1867,7 +1874,7 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1867
1874
  ...pageParam.permlink ? { start_permlink: pageParam.permlink } : {}
1868
1875
  };
1869
1876
  try {
1870
- if (CONFIG.dmcaAccounts.includes(username)) return [];
1877
+ if (CONFIG.dmcaAccounts && CONFIG.dmcaAccounts.includes(username)) return [];
1871
1878
  const resp = await CONFIG.hiveClient.call(
1872
1879
  "bridge",
1873
1880
  "get_account_posts",
@@ -2743,6 +2750,11 @@ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError)
2743
2750
  ["accounts", "relations", reference, target],
2744
2751
  data
2745
2752
  );
2753
+ if (target) {
2754
+ getQueryClient().invalidateQueries(
2755
+ getAccountFullQueryOptions(target)
2756
+ );
2757
+ }
2746
2758
  }
2747
2759
  });
2748
2760
  }