mirror of
https://gitea.redwind.top/Austin/subscription
synced 2024-11-16 16:12:21 +08:00
chore: deprecatedKeys
This commit is contained in:
parent
0410162897
commit
c4635e2fc4
10
src/file.ts
10
src/file.ts
|
@ -88,8 +88,18 @@ export const validSnapshotUrl = (s: string) => {
|
|||
export const checkConfig = (newConfig: SubscriptionConfig) => {
|
||||
// check duplicated group key
|
||||
newConfig.apps?.forEach((app) => {
|
||||
const deprecatedKeys = app.deprecatedKeys || [];
|
||||
const keys = new Set<number>();
|
||||
app.groups?.forEach((g) => {
|
||||
if (deprecatedKeys.includes(g.key)) {
|
||||
console.error({
|
||||
configName: newConfig.name,
|
||||
appId: app.id,
|
||||
groupName: g.name,
|
||||
groupKey: g.key,
|
||||
});
|
||||
throw new Error('invalid deprecated group key');
|
||||
}
|
||||
if (keys.has(g.key)) {
|
||||
console.error({
|
||||
configName: newConfig.name,
|
||||
|
|
|
@ -103,6 +103,11 @@ export type AppConfig = {
|
|||
*/
|
||||
name: string;
|
||||
groups?: GroupConfig[];
|
||||
|
||||
/**
|
||||
* 某些规则组被移除不使用时, 为了避免 key 在后续被复用, 需要将已经删除的规则组的 key 填入此数组做校验使用
|
||||
*/
|
||||
deprecatedKeys?: number[];
|
||||
} & CommonProps;
|
||||
|
||||
export type AppConfigMudule = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user