@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.
@@ -845,6 +845,11 @@ declare const CONFIG: {
845
845
  dmcaPatternRegexes: RegExp[];
846
846
  _dmcaInitialized: boolean;
847
847
  };
848
+ type DmcaListsInput = {
849
+ accounts?: string[];
850
+ tags?: string[];
851
+ posts?: string[];
852
+ };
848
853
  declare namespace ConfigManager {
849
854
  function setQueryClient(client: QueryClient): void;
850
855
  /**
@@ -872,11 +877,9 @@ declare namespace ConfigManager {
872
877
  function setImageHost(host: string): void;
873
878
  /**
874
879
  * Set DMCA filtering lists
875
- * @param accounts - List of account usernames to filter (plain strings)
876
- * @param tags - List of tag patterns (regex strings) to filter
877
- * @param patterns - List of post patterns (plain strings) like "@author/permlink" for exact matching
880
+ * @param lists - DMCA lists object containing accounts/tags/posts arrays
878
881
  */
879
- function setDmcaLists(accounts?: string[], tags?: string[], patterns?: string[]): void;
882
+ function setDmcaLists(lists?: DmcaListsInput): void;
880
883
  }
881
884
 
882
885
  declare function makeQueryClient(): QueryClient;
@@ -216,18 +216,25 @@ var ConfigManager;
216
216
  return null;
217
217
  }
218
218
  }
219
- function setDmcaLists(accounts = [], tags = [], patterns = []) {
220
- CONFIG.dmcaAccounts = accounts;
221
- CONFIG.dmcaTags = tags;
222
- CONFIG.dmcaPatterns = patterns;
223
- CONFIG.dmcaTagRegexes = tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
219
+ function setDmcaLists(lists = {}) {
220
+ const coerceList = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
221
+ const input = lists || {};
222
+ const resolved = {
223
+ accounts: coerceList(input.accounts),
224
+ tags: coerceList(input.tags),
225
+ patterns: coerceList(input.posts)
226
+ };
227
+ CONFIG.dmcaAccounts = resolved.accounts;
228
+ CONFIG.dmcaTags = resolved.tags;
229
+ CONFIG.dmcaPatterns = resolved.patterns;
230
+ CONFIG.dmcaTagRegexes = resolved.tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
224
231
  CONFIG.dmcaPatternRegexes = [];
225
- const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
232
+ const rejectedTagCount = resolved.tags.length - CONFIG.dmcaTagRegexes.length;
226
233
  if (!CONFIG._dmcaInitialized && isDevelopment) {
227
234
  console.log(`[SDK] DMCA configuration loaded:`);
228
- console.log(` - Accounts: ${accounts.length}`);
229
- console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${tags.length} compiled (${rejectedTagCount} rejected)`);
230
- console.log(` - Post patterns: ${patterns.length} (using exact string matching)`);
235
+ console.log(` - Accounts: ${resolved.accounts.length}`);
236
+ console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${resolved.tags.length} compiled (${rejectedTagCount} rejected)`);
237
+ console.log(` - Post patterns: ${resolved.patterns.length} (using exact string matching)`);
231
238
  if (rejectedTagCount > 0) {
232
239
  console.warn(`[SDK] ${rejectedTagCount} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`);
233
240
  }
@@ -1842,7 +1849,7 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1842
1849
  ...pageParam.permlink ? { start_permlink: pageParam.permlink } : {}
1843
1850
  };
1844
1851
  try {
1845
- if (CONFIG.dmcaAccounts.includes(username)) return [];
1852
+ if (CONFIG.dmcaAccounts && CONFIG.dmcaAccounts.includes(username)) return [];
1846
1853
  const resp = await CONFIG.hiveClient.call(
1847
1854
  "bridge",
1848
1855
  "get_account_posts",
@@ -2718,6 +2725,11 @@ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError)
2718
2725
  ["accounts", "relations", reference, target],
2719
2726
  data
2720
2727
  );
2728
+ if (target) {
2729
+ getQueryClient().invalidateQueries(
2730
+ getAccountFullQueryOptions(target)
2731
+ );
2732
+ }
2721
2733
  }
2722
2734
  });
2723
2735
  }