diff --git a/src/source.ts b/src/source.ts index 5823d172b..1b1c49ee9 100644 --- a/src/source.ts +++ b/src/source.ts @@ -1,4 +1,12 @@ -import { MarkupSource, MirSource, OutputType, Context, Kind, EventEmitter } from './types.js' +import { + MarkupSource, + MirSource, + OutputType, + Context, + Kind, + EventEmitter, + KindOptions, +} from './types.js' import { KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from './constants.js' import { Cache } from './structures.js' import { Script } from './script.js' @@ -7,10 +15,10 @@ import { OutgoingHttpHeaders } from 'http' export class Source { public kind: Kind - public kindOptions: { [key in Kind]: string } + public kindOptions: KindOptions public url: string public contentType: string - public contentTypeOptions: { [key in Kind]: string } + public contentTypeOptions: KindOptions public headers: OutgoingHttpHeaders public body?: object public script: Script diff --git a/src/types.ts b/src/types.ts index f85c1b728..24371ba2b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -189,14 +189,16 @@ export type MarkupArgumentScript = { hierarchicalType: MarkupHierarchicalType.Argument } +export type KindOptions = Record + export type MarkupSource = { kind: Kind - kindOptions: { [key in Kind]: string } + kindOptions: KindOptions headers: OutgoingHttpHeaders body?: object url: string contentType: string - contentTypeOptions: { [key in Kind]: string } + contentTypeOptions: KindOptions script: MarkupScript scriptId: number } @@ -374,10 +376,10 @@ export type MirSource = { kind: Kind headers: OutgoingHttpHeaders body?: object - kindOptions: { [key in Kind]: string } + kindOptions: KindOptions url: string contentType: string - contentTypeOptions: { [key in Kind]: string } + contentTypeOptions: KindOptions script: MirScript } diff --git a/test/src/radon.spec.ts b/test/src/radon.spec.ts index 6e2810ed4..97a92d21b 100755 --- a/test/src/radon.spec.ts +++ b/test/src/radon.spec.ts @@ -3616,6 +3616,7 @@ describe('Radon', () => { expect(updatedSource.kind).toBe(2) expect(updatedSource.contentType).toBe('JSON API') }) + it('update to rng protocol kind', () => { const mirRequest: MirRequest = { timelock: 0,