Browse Source

fix: remote stream content array check

pull/24590/head
sumeyye 4 weeks ago
parent
commit
fd34dcc54b
  1. 5
      npm/ng-packs/packages/schematics/src/utils/methods.ts
  2. 18
      npm/ng-packs/packages/schematics/src/utils/service.ts

5
npm/ng-packs/packages/schematics/src/utils/methods.ts

@ -19,4 +19,9 @@ export const getParamValueName = (paramName: string, descriptorName: string) =>
export function isDictionaryType(type?: string, typeSimple?: string): boolean {
const haystacks = [type || '', typeSimple || ''];
return haystacks.some(t => /(^|\b)(System\.Collections\.Generic\.)?(I)?Dictionary\s*</.test(t));
}
export function isCollectionType(type?: string, typeSimple?: string): boolean {
const haystacks = [type || '', typeSimple || ''];
return haystacks.some(t => /(^|\b)(System\.Collections\.Generic\.)?(I)?(List|Enumerable|Collection)\s*</.test(t));
}

18
npm/ng-packs/packages/schematics/src/utils/service.ts

@ -14,6 +14,8 @@ import {
import { sortImports } from './import';
import { parseNamespace } from './namespace';
import { parseGenerics } from './tree';
import { extractGenerics } from './generics';
import { isCollectionType } from './methods';
import {
createTypeAdapter,
createTypeParser,
@ -144,7 +146,21 @@ export function isRemoteStreamContent(type: string) {
}
export function isRemoteStreamContentArray(type: string) {
return VOLO_REMOTE_STREAM_CONTENT.map(x => `${x}[]`).some(x => x === type);
// Check for array types like Volo.Abp.Content.IRemoteStreamContent[]
if (VOLO_REMOTE_STREAM_CONTENT.map(x => `${x}[]`).some(x => x === type)) {
return true;
}
// Check for collection types like List<T>, IEnumerable<T>, ICollection<T>, Collection<T>, IList<T>
// This matches any generic type from System.Collections.Generic that implements IEnumerable<T>
if (isCollectionType(type)) {
const { generics } = extractGenerics(type);
if (generics.length > 0 && VOLO_REMOTE_STREAM_CONTENT.includes(generics[0])) {
return true;
}
}
return false;
}
function getMethodNameFromAction(action: Action): string {

Loading…
Cancel
Save