|
3 | 3 | ClientScenario, |
4 | 4 | ClientScenarioForAuthorizationServer, |
5 | 5 | SpecVersion, |
| 6 | + ScenarioSpecTag, |
6 | 7 | DATED_SPEC_VERSIONS, |
| 8 | + DRAFT_PROTOCOL_VERSION, |
7 | 9 | LATEST_SPEC_VERSION |
8 | 10 | } from '../types'; |
9 | 11 | import { InitializeScenario } from './client/initialize'; |
@@ -258,31 +260,35 @@ export function listDraftScenarios(): string[] { |
258 | 260 | export { listMetadataScenarios }; |
259 | 261 |
|
260 | 262 | // All valid spec versions, used by the CLI to validate --spec-version input. |
| 263 | +// 'extension' is intentionally excluded — extension scenarios are off-timeline |
| 264 | +// and selected via `--suite extensions`, not `--spec-version`. |
261 | 265 | export const ALL_SPEC_VERSIONS: SpecVersion[] = [ |
262 | 266 | ...DATED_SPEC_VERSIONS, |
263 | | - 'draft', |
264 | | - 'extension' |
| 267 | + DRAFT_PROTOCOL_VERSION |
265 | 268 | ]; |
266 | 269 |
|
267 | 270 | export function resolveSpecVersion(value: string): SpecVersion { |
| 271 | + if (value === 'draft') return DRAFT_PROTOCOL_VERSION; |
268 | 272 | if (ALL_SPEC_VERSIONS.includes(value as SpecVersion)) { |
269 | 273 | return value as SpecVersion; |
270 | 274 | } |
271 | 275 | console.error(`Unknown spec version: ${value}`); |
272 | | - console.error(`Valid versions: ${ALL_SPEC_VERSIONS.join(', ')}`); |
| 276 | + console.error( |
| 277 | + `Valid versions: ${ALL_SPEC_VERSIONS.join(', ')} (or 'draft' as an alias for ${DRAFT_PROTOCOL_VERSION})` |
| 278 | + ); |
273 | 279 | process.exit(1); |
274 | 280 | } |
275 | 281 |
|
276 | | -// `draft` selects everything in the latest dated release plus scenarios tagged |
277 | | -// draft-only, so SEP authors can run the full suite against an SDK tracking the |
278 | | -// in-progress spec without retagging core scenarios. |
| 282 | +// The draft version selects everything in the latest dated release plus |
| 283 | +// scenarios tagged draft-only, so SEP authors can run the full suite against an |
| 284 | +// SDK tracking the in-progress spec without retagging core scenarios. |
279 | 285 | function matchesSpecVersion( |
280 | | - scenario: { specVersions: SpecVersion[] }, |
| 286 | + scenario: { specVersions: ScenarioSpecTag[] }, |
281 | 287 | version: SpecVersion |
282 | 288 | ): boolean { |
283 | | - if (version === 'draft') { |
| 289 | + if (version === DRAFT_PROTOCOL_VERSION) { |
284 | 290 | return ( |
285 | | - scenario.specVersions.includes('draft') || |
| 291 | + scenario.specVersions.includes(DRAFT_PROTOCOL_VERSION) || |
286 | 292 | scenario.specVersions.includes(LATEST_SPEC_VERSION) |
287 | 293 | ); |
288 | 294 | } |
@@ -311,12 +317,12 @@ export function listClientScenariosForAuthorizationServerForSpec( |
311 | 317 |
|
312 | 318 | export function getScenarioSpecVersions( |
313 | 319 | name: string |
314 | | -): SpecVersion[] | undefined { |
| 320 | +): ScenarioSpecTag[] | undefined { |
315 | 321 | return ( |
316 | 322 | scenarios.get(name)?.specVersions ?? |
317 | 323 | clientScenarios.get(name)?.specVersions ?? |
318 | 324 | clientScenariosForAuthorizationServer.get(name)?.specVersions |
319 | 325 | ); |
320 | 326 | } |
321 | 327 |
|
322 | | -export type { SpecVersion }; |
| 328 | +export type { SpecVersion, ScenarioSpecTag }; |
0 commit comments