Fix blocking collection matching with large plugins
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
import { getVersion, listScripts } from './scripts.js';
|
||||
import { getVersion, getVersionMetadata, listScripts } from './scripts.js';
|
||||
|
||||
/** Published file artifacts shared by provisioning and drift reconciliation. */
|
||||
export function promotedArtifacts(game: string | null, map: string | null) {
|
||||
function selectedArtifacts<Version>(game: string | null, map: string | null, readVersion: (id: number) => Version | undefined) {
|
||||
return (['script', 'plugin'] as const).flatMap((kind) =>
|
||||
listScripts(kind).flatMap((script) => {
|
||||
const scopeMatches = script.scope_type === 'game' ? script.scope_value === game
|
||||
: script.scope_type === 'map' ? script.scope_value === map : false;
|
||||
if (!scopeMatches || !script.current_version_id) return [];
|
||||
const version = getVersion(script.current_version_id);
|
||||
const version = readVersion(script.current_version_id);
|
||||
return version ? [{ kind, script, version }] : [];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/** Published file artifacts shared by provisioning and drift reconciliation. */
|
||||
export function promotedArtifacts(game: string | null, map: string | null) {
|
||||
return selectedArtifacts(game, map, getVersion);
|
||||
}
|
||||
|
||||
/** Metadata uses the same promotion and scope rules without reading file content. */
|
||||
export function promotedArtifactMetadata(game: string | null, map: string | null) {
|
||||
return selectedArtifacts(game, map, getVersionMetadata);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user