@ecency/sdk 1.5.17 → 1.5.18
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/browser/index.d.ts +7 -4
- package/dist/browser/index.js +20 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +20 -9
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +20 -9
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -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 -
|
|
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 accounts - DMCA lists object containing accounts/tags/posts arrays
|
|
878
881
|
*/
|
|
879
|
-
function setDmcaLists(accounts?:
|
|
882
|
+
function setDmcaLists(accounts?: DmcaListsInput): void;
|
|
880
883
|
}
|
|
881
884
|
|
|
882
885
|
declare function makeQueryClient(): QueryClient;
|
package/dist/browser/index.js
CHANGED
|
@@ -216,18 +216,24 @@ var ConfigManager;
|
|
|
216
216
|
return null;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
function setDmcaLists(accounts =
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
function setDmcaLists(accounts = {}) {
|
|
220
|
+
const coerceList = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
221
|
+
const resolved = {
|
|
222
|
+
accounts: coerceList(accounts.accounts),
|
|
223
|
+
tags: coerceList(accounts.tags),
|
|
224
|
+
patterns: coerceList(accounts.posts)
|
|
225
|
+
};
|
|
226
|
+
CONFIG.dmcaAccounts = resolved.accounts;
|
|
227
|
+
CONFIG.dmcaTags = resolved.tags;
|
|
228
|
+
CONFIG.dmcaPatterns = resolved.patterns;
|
|
229
|
+
CONFIG.dmcaTagRegexes = resolved.tags.map((pattern) => safeCompileRegex(pattern)).filter((r) => r !== null);
|
|
224
230
|
CONFIG.dmcaPatternRegexes = [];
|
|
225
|
-
const rejectedTagCount = tags.length - CONFIG.dmcaTagRegexes.length;
|
|
231
|
+
const rejectedTagCount = resolved.tags.length - CONFIG.dmcaTagRegexes.length;
|
|
226
232
|
if (!CONFIG._dmcaInitialized && isDevelopment) {
|
|
227
233
|
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)`);
|
|
234
|
+
console.log(` - Accounts: ${resolved.accounts.length}`);
|
|
235
|
+
console.log(` - Tag patterns: ${CONFIG.dmcaTagRegexes.length}/${resolved.tags.length} compiled (${rejectedTagCount} rejected)`);
|
|
236
|
+
console.log(` - Post patterns: ${resolved.patterns.length} (using exact string matching)`);
|
|
231
237
|
if (rejectedTagCount > 0) {
|
|
232
238
|
console.warn(`[SDK] ${rejectedTagCount} DMCA tag patterns were rejected due to security validation. Check warnings above for details.`);
|
|
233
239
|
}
|
|
@@ -2718,6 +2724,11 @@ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError)
|
|
|
2718
2724
|
["accounts", "relations", reference, target],
|
|
2719
2725
|
data
|
|
2720
2726
|
);
|
|
2727
|
+
if (target) {
|
|
2728
|
+
getQueryClient().invalidateQueries(
|
|
2729
|
+
getAccountFullQueryOptions(target)
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2721
2732
|
}
|
|
2722
2733
|
});
|
|
2723
2734
|
}
|