1
This commit is contained in:
@@ -1,14 +1,65 @@
|
||||
import {
|
||||
buildCompiledCustomWorldProfile,
|
||||
normalizeCustomWorldProfile,
|
||||
} from '../modules/custom-world/runtimeProfile.js';
|
||||
} from '../modules/custom-world/runtime-profile/index.js';
|
||||
import type {
|
||||
RpgCreationPreview,
|
||||
RpgCreationPreviewEnvelope,
|
||||
RpgCreationPreviewSource,
|
||||
} from '../../../packages/shared/src/contracts/rpgCreationPreview.js';
|
||||
import type { CustomWorldProfile } from '../modules/custom-world/runtimeTypes.js';
|
||||
|
||||
/**
|
||||
* 工作包 A 先建立 RPG 世界预览编译器的新命名 façade。
|
||||
* 当前仍桥接旧 runtime profile 编译能力,后续工作包 G 会把正式 preview compiler 收口到这个入口。
|
||||
* 工作包 G 把服务端结果预览编译入口收口到这里。
|
||||
* Phase 5 后当前 preview 正式作为 session_preview 主链输出,
|
||||
* 编译边界已经从 foundation draft 流程中抽离。
|
||||
*/
|
||||
export type RpgWorldPreviewProfile = CustomWorldProfile;
|
||||
|
||||
export const buildRpgWorldPreviewProfile = buildCompiledCustomWorldProfile;
|
||||
export const normalizeRpgWorldPreviewProfile = normalizeCustomWorldProfile;
|
||||
const RPG_WORLD_PREVIEW_SOURCE: RpgCreationPreviewSource =
|
||||
'session_preview';
|
||||
|
||||
function toRpgCreationPreview(
|
||||
profile: RpgWorldPreviewProfile,
|
||||
): RpgCreationPreview {
|
||||
return profile as unknown as RpgCreationPreview;
|
||||
}
|
||||
|
||||
export function buildRpgWorldPreviewProfile(
|
||||
raw: unknown,
|
||||
settingText: string,
|
||||
): RpgWorldPreviewProfile {
|
||||
return buildCompiledCustomWorldProfile(raw, settingText);
|
||||
}
|
||||
|
||||
export function normalizeRpgWorldPreviewProfile(
|
||||
raw: unknown,
|
||||
settingText: string,
|
||||
): RpgWorldPreviewProfile {
|
||||
return normalizeCustomWorldProfile(raw, settingText);
|
||||
}
|
||||
|
||||
export function buildRpgWorldPreviewEnvelope(
|
||||
raw: unknown,
|
||||
settingText: string,
|
||||
): RpgCreationPreviewEnvelope {
|
||||
return {
|
||||
preview: toRpgCreationPreview(buildRpgWorldPreviewProfile(raw, settingText)),
|
||||
source: RPG_WORLD_PREVIEW_SOURCE,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeRpgWorldPreviewEnvelope(
|
||||
raw: unknown,
|
||||
settingText: string,
|
||||
): RpgCreationPreviewEnvelope {
|
||||
return {
|
||||
preview: toRpgCreationPreview(
|
||||
buildRpgWorldPreviewProfile(
|
||||
normalizeRpgWorldPreviewProfile(raw, settingText),
|
||||
settingText,
|
||||
),
|
||||
),
|
||||
source: RPG_WORLD_PREVIEW_SOURCE,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user