Skip to content

Commit 77e80e1

Browse files
Upgrade: [dependabot] - bump typescript from 5.9.3 to 6.0.3 (#4611)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.3. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/microsoft/TypeScript/releases">typescript's releases</a>.</em></p> <blockquote> <h2>TypeScript 6.0.3</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/">release announcement blog post</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.0%22">fixed issues query for TypeScript 6.0.0 (Beta)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.1%22">fixed issues query for TypeScript 6.0.1 (RC)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.2%22">fixed issues query for TypeScript 6.0.2 (Stable)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.3%22">fixed issues query for TypeScript 6.0.3 (Stable)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> <h2>TypeScript 6.0</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/">release announcement blog post</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.0%22">fixed issues query for TypeScript 6.0.0 (Beta)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.1%22">fixed issues query for TypeScript 6.0.1 (RC)</a>.</li> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.2%22">fixed issues query for TypeScript 6.0.2 (Stable)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> <h2>TypeScript 6.0 Beta</h2> <p>For release notes, check out the <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/">release announcement</a>.</p> <ul> <li><a href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=milestone%3A%22TypeScript+6.0.0%22+is%3Aclosed+">fixed issues query for Typescript 6.0.0 (Beta)</a>.</li> </ul> <p>Downloads are available on:</p> <ul> <li><a href="https://www.npmjs.com/package/typescript">npm</a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/microsoft/TypeScript/commit/050880ce59e30b356b686bd3144efe24f875ebc8"><code>050880c</code></a> Bump version to 6.0.3 and LKG</li> <li><a href="https://github.com/microsoft/TypeScript/commit/eeae9dd0f17aa494658e4ec079dc002e02dd625e"><code>eeae9dd</code></a> 🤖 Pick PR <a href="https://redirect.github.com/microsoft/TypeScript/issues/63401">#63401</a> (Also check package name validity in...) into release-6.0 (#...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/ad1c695fada682764bb510dd680e8f175ae54094"><code>ad1c695</code></a> 🤖 Pick PR <a href="https://redirect.github.com/microsoft/TypeScript/issues/63368">#63368</a> (Harden ATA package name filtering) into release-6.0 (<a href="https://redirect.github.com/microsoft/TypeScript/issues/63372">#63372</a>)</li> <li><a href="https://github.com/microsoft/TypeScript/commit/0725fb4664a1d5ec94040b6d94db77dc1cc354e4"><code>0725fb4</code></a> 🤖 Pick PR <a href="https://redirect.github.com/microsoft/TypeScript/issues/63310">#63310</a> (Mark class property initializers as...) into release-6.0 (#...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/607a22a90d1a5a1b507ce01bb8cd7ec020f954e7"><code>607a22a</code></a> Bump version to 6.0.2 and LKG</li> <li><a href="https://github.com/microsoft/TypeScript/commit/9e72ab71b575e26795d0d9eac3d2d9957beed17c"><code>9e72ab7</code></a> 🤖 Pick PR <a href="https://redirect.github.com/microsoft/TypeScript/issues/63239">#63239</a> (Fix missing lib files in reused pro...) into release-6.0 (#...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/35ff23d4b0cc715691323ebe54f523c16fe6e3a5"><code>35ff23d</code></a> 🤖 Pick PR <a href="https://redirect.github.com/microsoft/TypeScript/issues/63163">#63163</a> (Port anyFunctionType subtype fix an...) into release-6.0 (#...</li> <li><a href="https://github.com/microsoft/TypeScript/commit/e175b69138038953d4e85bf6529afe88d56d8fbe"><code>e175b69</code></a> Bump version to 6.0.1-rc and LKG</li> <li><a href="https://github.com/microsoft/TypeScript/commit/af4caac0e91e838c46b3fdc1c9afacad68800f89"><code>af4caac</code></a> Update LKG</li> <li><a href="https://github.com/microsoft/TypeScript/commit/8efd7e8544d8b35c9b33bca44a3124aa2613bf09"><code>8efd7e8</code></a> Merge remote-tracking branch 'origin/main' into release-6.0</li> <li>Additional commits viewable in <a href="https://github.com/microsoft/TypeScript/compare/v5.9.3...v6.0.3">compare view</a></li> </ul> </details> <br /> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jim Wild <james.wild6@nhs.net>
1 parent 84c83d4 commit 77e80e1

16 files changed

Lines changed: 336 additions & 179 deletions

File tree

package-lock.json

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"globals": "^17.5.0",
4242
"jsdom": "^29.0.2",
4343
"ts-node": "^10.9.2",
44-
"typescript": "^5.9.3",
44+
"typescript": "^6.0.3",
4545
"vitest": "^4.1.4"
4646
}
4747
}

packages/cdk/tsconfig.json

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,52 @@
11
{
2-
"compilerOptions": {
3-
"incremental": true,
4-
"target": "ES2022",
5-
"declaration": true,
6-
"sourceMap": true,
7-
"composite": true,
8-
"moduleResolution": "node",
9-
"esModuleInterop": true,
10-
"skipLibCheck": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"preserveConstEnums": true,
13-
"resolveJsonModule": true,
14-
"allowJs": true,
15-
"module": "commonjs",
16-
"rootDir": ".",
17-
"outDir": "resources",
18-
"allowImportingTsExtensions": true,
19-
"noEmit": true,
20-
"strict": false,
21-
"lib": [
22-
"es2020"
23-
],
24-
"noImplicitAny": true,
25-
"strictNullChecks": true,
26-
"noImplicitThis": true,
27-
"alwaysStrict": true,
28-
"noUnusedLocals": false,
29-
"noUnusedParameters": false,
30-
"noImplicitReturns": true,
31-
"noFallthroughCasesInSwitch": false,
32-
"experimentalDecorators": true,
33-
"strictPropertyInitialization": false,
34-
"typeRoots": [
35-
"../../node_modules/@types"
36-
]
37-
},
38-
"references": [],
39-
"include": ["resources/**/*", "policies/**/*", "stacks/**/*", "tests/**/*", "nagSuppressions.ts", "constructs/**/*"],
40-
"exclude": ["node_modules", "cdk.out"]
41-
}
2+
"compilerOptions": {
3+
"incremental": true,
4+
"target": "ES2022",
5+
"declaration": true,
6+
"sourceMap": true,
7+
"composite": true,
8+
"moduleResolution": "bundler",
9+
"esModuleInterop": true,
10+
"skipLibCheck": true,
11+
"forceConsistentCasingInFileNames": true,
12+
"preserveConstEnums": true,
13+
"resolveJsonModule": true,
14+
"allowJs": true,
15+
"module": "commonjs",
16+
"rootDir": ".",
17+
"outDir": "resources",
18+
"allowImportingTsExtensions": true,
19+
"noEmit": true,
20+
"strict": false,
21+
"lib": [
22+
"es2020",
23+
"DOM"
24+
],
25+
"noImplicitAny": true,
26+
"strictNullChecks": true,
27+
"noImplicitThis": true,
28+
"alwaysStrict": true,
29+
"noUnusedLocals": false,
30+
"noUnusedParameters": false,
31+
"noImplicitReturns": true,
32+
"noFallthroughCasesInSwitch": false,
33+
"experimentalDecorators": true,
34+
"strictPropertyInitialization": false,
35+
"typeRoots": [
36+
"../../node_modules/@types"
37+
]
38+
},
39+
"references": [],
40+
"include": [
41+
"resources/**/*",
42+
"policies/**/*",
43+
"stacks/**/*",
44+
"tests/**/*",
45+
"nagSuppressions.ts",
46+
"constructs/**/*"
47+
],
48+
"exclude": [
49+
"node_modules",
50+
"cdk.out"
51+
]
52+
}

packages/coordinator/src/services/translation/common/getResourcesOfType.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ export function getContainedOrganizationViaReference<R extends fhir.Resource>(
164164
export function getPathedTelecoms(
165165
bundle: fhir.Bundle
166166
): Array<PathedResource<fhir.ContactPoint>> {
167-
type ResourceToValidate = fhir.Organization | fhir.Practitioner | fhir.PractitionerRole;
168-
const get_telecoms = (resource: PathedResource<ResourceToValidate>) => {
167+
const getTelecoms = (
168+
resource: PathedResource<fhir.Organization | fhir.Practitioner | fhir.PractitionerRole>
169+
) => {
169170
return (resource.resource.telecom ?? []).map((telecom, index) => {
170171
return {
171172
path: `${resource.path}.telecom[${index}]`,
@@ -174,12 +175,12 @@ export function getPathedTelecoms(
174175
})
175176
}
176177

177-
const organizations = getPathedResourcesOfType(bundle, "Organization")
178-
const practitioners = getPathedResourcesOfType(bundle, "Practitioner")
179-
const practitionerRoles = getPathedResourcesOfType(bundle, "PractitionerRole")
178+
const organizations = getPathedResourcesOfType<fhir.Organization>(bundle, "Organization")
179+
const practitioners = getPathedResourcesOfType<fhir.Practitioner>(bundle, "Practitioner")
180+
const practitionerRoles = getPathedResourcesOfType<fhir.PractitionerRole>(bundle, "PractitionerRole")
180181

181182
return organizations
182-
.concat(practitioners)
183-
.concat(practitionerRoles)
184-
.flatMap(get_telecoms)
183+
.flatMap(getTelecoms)
184+
.concat(practitioners.flatMap(getTelecoms))
185+
.concat(practitionerRoles.flatMap(getTelecoms))
185186
}

packages/coordinator/src/services/translation/common/index.ts

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,17 @@ export function onlyElement<T>(iterable: Iterable<T>, fhirPath: string, addition
4242
const iterator = iterable[Symbol.iterator]()
4343
const first = iterator.next()
4444
if (first.done) {
45-
throw new errors.TooFewValuesError(`Too few values submitted. Expected 1 element${
46-
additionalContext ? " where " : ""
47-
}${
48-
additionalContext ? additionalContext : ""
45+
throw new errors.TooFewValuesError(`Too few values submitted. Expected 1 element${additionalContext ? " where " : ""
46+
}${additionalContext ? additionalContext : ""
4947
}.`, fhirPath)
5048
}
5149
const value = first.value
5250
if (!iterator.next().done) {
53-
throw new errors.TooManyValuesError(`Too many values submitted. Expected 1 element${
54-
additionalContext ? " where " : ""
55-
}${
56-
additionalContext ? additionalContext : ""
57-
}.`, fhirPath)
51+
throw new errors.TooManyValuesError(
52+
`Too many values submitted. Expected 1 element${additionalContext ? " where " : ""
53+
}${additionalContext ? additionalContext : ""
54+
}.`, fhirPath
55+
)
5856
}
5957
return value
6058
}
@@ -66,11 +64,11 @@ export function onlyElementOrNull<T>(iterable: Iterable<T>, fhirPath: string, ad
6664
const iterator = iterable[Symbol.iterator]()
6765
const value = iterator.next().value
6866
if (!iterator.next().done) {
69-
throw new errors.TooManyValuesError(`Too many values submitted. Expected at most 1 element${
70-
additionalContext ? " where " : ""
71-
}${
72-
additionalContext ? additionalContext : ""
73-
}.`, fhirPath)
67+
throw new errors.TooManyValuesError(
68+
`Too many values submitted. Expected at most 1 element${additionalContext ? " where " : ""
69+
}${additionalContext ? additionalContext : ""
70+
}.`, fhirPath
71+
)
7472
}
7573
return value
7674
}
@@ -325,9 +323,12 @@ function getResourceParameterByName<R extends fhir.Resource>(
325323
}
326324

327325
const isPractitionerRoleParameter = (
328-
resourceParameter: fhir.ResourceParameter<fhir.Resource>
329-
): resourceParameter is fhir.ResourceParameter<fhir.PractitionerRole> => {
330-
return isPractitionerRole(resourceParameter.resource)
326+
body: unknown
327+
): body is fhir.ResourceParameter<fhir.PractitionerRole> => {
328+
return typeof body === "object"
329+
&& body !== null
330+
&& isResourceParameter(body as fhir.Parameter)
331+
&& isPractitionerRole((body as fhir.ResourceParameter<fhir.Resource>).resource)
331332
}
332333

333334
export function getAgentParameter(parameters: fhir.Parameters): fhir.ResourceParameter<fhir.PractitionerRole> {
@@ -339,9 +340,12 @@ export function getAgentParameter(parameters: fhir.Parameters): fhir.ResourcePar
339340
}
340341

341342
const isOrganizationParameter = (
342-
resourceParameter: fhir.ResourceParameter<fhir.Resource>
343-
): resourceParameter is fhir.ResourceParameter<fhir.Organization> => {
344-
return isOrganization(resourceParameter.resource)
343+
body: unknown
344+
): body is fhir.ResourceParameter<fhir.Organization> => {
345+
return typeof body === "object"
346+
&& body !== null
347+
&& isResourceParameter(body as fhir.Parameter)
348+
&& isOrganization((body as fhir.ResourceParameter<fhir.Resource>).resource)
345349
}
346350

347351
export function getOwnerParameter(parameters: fhir.Parameters): fhir.ResourceParameter<fhir.Organization> {
@@ -353,9 +357,12 @@ export function getOwnerParameter(parameters: fhir.Parameters): fhir.ResourcePar
353357
}
354358

355359
const isBundleParameter = (
356-
resourceParameter: fhir.ResourceParameter<fhir.Resource>
357-
): resourceParameter is fhir.ResourceParameter<fhir.Bundle> => {
358-
return isBundle(resourceParameter.resource)
360+
body: unknown
361+
): body is fhir.ResourceParameter<fhir.Bundle> => {
362+
return typeof body === "object"
363+
&& body !== null
364+
&& isResourceParameter(body as fhir.Parameter)
365+
&& isBundle((body as fhir.ResourceParameter<fhir.Resource>).resource)
359366
}
360367

361368
export function getBundleParameter(parameters: fhir.Parameters, name: string): fhir.ResourceParameter<fhir.Bundle> {

packages/coordinator/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4+
"rootDir": "..",
45
"types": [
56
"node"
67
]

packages/coordinator/tsconfig.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"module": "commonjs",
44
"esModuleInterop": true,
55
"allowSyntheticDefaultImports": true,
6+
"strictNullChecks": false,
7+
"useUnknownInCatchVariables": false,
8+
"strictPropertyInitialization": false,
9+
"noImplicitThis": false,
610
"types": [
711
"node",
812
"vitest/globals"
@@ -13,16 +17,16 @@
1317
"DOM"
1418
],
1519
"noImplicitAny": true,
16-
"moduleResolution": "node",
20+
"moduleResolution": "bundler",
1721
"resolveJsonModule": true,
1822
"sourceMap": true,
1923
// "strict": true,
24+
"rootDir": "..",
2025
"outDir": "dist",
21-
"baseUrl": ".",
2226
"paths": {
2327
"*": [
24-
"node_modules/*",
25-
"tests/*"
28+
"./node_modules/*",
29+
"./tests/*"
2630
],
2731
"@models": [
2832
"../models"

packages/e2e-tests/broker/oauth.ts

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,38 @@ export const VALID_APIGEE_ENVIRONMENTS = [
3636
"ref"
3737
]
3838

39+
function getRequiredEnvVar(name: string): string {
40+
const value = process.env[name]
41+
if (!value) {
42+
throw new Error(`Missing required environment variable: ${name}`)
43+
}
44+
45+
return value
46+
}
47+
48+
// Keep this structural type local so ESLint does not require DOM globals in this Node-targeted package.
49+
type AttributeReader = {
50+
getAttribute: (attributeName: string) => string | null
51+
}
52+
53+
function getRequiredAttribute(element: AttributeReader, attributeName: string): string {
54+
const value = element.getAttribute(attributeName)
55+
if (!value) {
56+
throw new Error(`Missing required attribute '${attributeName}'`)
57+
}
58+
59+
return value
60+
}
61+
62+
function getRequiredSearchParam(searchParams: URLSearchParams, name: string): string {
63+
const value = searchParams.get(name)
64+
if (!value) {
65+
throw new Error(`Missing required search parameter: ${name}`)
66+
}
67+
68+
return value
69+
}
70+
3971
type EnvironmentSecrets = {
4072
clientId: string
4173
clientSecret: string
@@ -68,7 +100,7 @@ export class AuthClient {
68100
}
69101

70102
getEnvironment(): string {
71-
const env = process.env.APIGEE_ENVIRONMENT
103+
const env = getRequiredEnvVar("APIGEE_ENVIRONMENT")
72104

73105
const isLocalEnv = process.env.NODE_ENV !== "production"
74106
const isValidEnv = VALID_APIGEE_ENVIRONMENTS.includes(env)
@@ -78,8 +110,8 @@ export class AuthClient {
78110
}
79111

80112
private getApiCredentials = (): EnvironmentSecrets => {
81-
const clientId = process.env["API_CLIENT_ID"]
82-
const clientSecret = process.env["API_CLIENT_SECRET"]
113+
const clientId = getRequiredEnvVar("API_CLIENT_ID")
114+
const clientSecret = getRequiredEnvVar("API_CLIENT_SECRET")
83115

84116
return {
85117
clientId,
@@ -121,6 +153,7 @@ export const getAuthForm = async (
121153
type FormInputs = {
122154
username?: string
123155
login?: string
156+
[key: string]: string | undefined
124157
}
125158

126159
type FormModel = {
@@ -132,15 +165,22 @@ type FormModel = {
132165
export const parseAuthForm = (htmlForm: string): FormModel => {
133166
const {document} = (new JSDOM(htmlForm)).window
134167
const form = document.getElementById("kc-form-login")
168+
if (!form) {
169+
throw new Error("Could not find login form")
170+
}
135171

136-
const formAction = form.getAttribute("action")
137-
const formMethod = form.getAttribute("method")
172+
const formAction = getRequiredAttribute(form, "action")
173+
const formMethod = getRequiredAttribute(form, "method")
138174
const formInputs = form.getElementsByTagName("input")
139175

140176
const inputs: FormInputs = {}
141177
for (const item of formInputs) {
142-
const name: string = item.getAttribute("name")
143-
const value: string = item.getAttribute("value")
178+
const name = item.getAttribute("name")
179+
if (!name) {
180+
continue
181+
}
182+
183+
const value = item.getAttribute("value") ?? ""
144184
inputs[name] = value
145185
}
146186

@@ -199,8 +239,8 @@ const parseAuthCallbackResponse = (authResponse: AxiosResponse): AuthCallbackRes
199239

200240
const searchParams = new URLSearchParams(responsePath.substring(2)) // skip the leading `/?`
201241
return {
202-
code: searchParams.get("code"),
203-
state: searchParams.get("state")
242+
code: getRequiredSearchParam(searchParams, "code"),
243+
state: getRequiredSearchParam(searchParams, "state")
204244
}
205245
}
206246

0 commit comments

Comments
 (0)