From 20f37fd2a82a54e2c0d5af17d3b97c61a5b86b59 Mon Sep 17 00:00:00 2001 From: Gunnar Velle Date: Wed, 18 Feb 2026 09:58:26 +0100 Subject: [PATCH] Update backend type imports --- package.json | 4 ++-- src/api/articleApi.ts | 4 ++-- src/api/audioApi.ts | 4 ++-- src/api/conceptApi.ts | 4 ++-- src/api/externalApi.ts | 4 ++-- src/api/folderApi.ts | 4 ++-- src/api/frontpageApi.ts | 4 ++-- src/api/h5pApi.ts | 4 ++-- src/api/imageApi.ts | 4 ++-- src/api/learningpathApi.ts | 6 +++--- src/api/myndlaApi.ts | 4 ++-- src/api/oembedApi.ts | 4 ++-- src/api/searchApi.ts | 7 ++++--- src/api/taxonomyApi.ts | 4 ++-- yarn.lock | 20 ++++++++++---------- 15 files changed, 41 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index a01f4978..868909fc 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,9 @@ "@graphql-codegen/typescript-resolvers": "^5.1.5", "@graphql-eslint/eslint-plugin": "^4.4.0", "@graphql-tools/mock": "^9.1.5", - "@ndla/types-backend": "^1.0.102", + "@ndla/types-backend": "^1.0.104", "@ndla/types-embed": "^5.0.20-alpha.0", - "@ndla/types-taxonomy": "^1.0.47", + "@ndla/types-taxonomy": "^1.0.50", "@types/compression": "^1.8.1", "@types/cors": "^2.8.19", "@types/graphql": "^14.5.0", diff --git a/src/api/articleApi.ts b/src/api/articleApi.ts index 11eb95b2..ee3a7d62 100644 --- a/src/api/articleApi.ts +++ b/src/api/articleApi.ts @@ -6,7 +6,7 @@ * */ -import { ArticleV2DTO, openapi } from "@ndla/types-backend/article-api"; +import { paths, ArticleV2DTO } from "@ndla/types-backend/article-api"; import { ndlaUrl } from "../config"; import { GQLArticleTransformedContentArgs, @@ -22,7 +22,7 @@ interface ArticleParams { articleId: string; } -const client = createAuthClient(); +const client = createAuthClient(); export const fetchTransformedContent = async ( article: ArticleV2DTO, diff --git a/src/api/audioApi.ts b/src/api/audioApi.ts index d15a74bb..c7e6d7a8 100644 --- a/src/api/audioApi.ts +++ b/src/api/audioApi.ts @@ -7,16 +7,16 @@ */ import { + paths, AudioMetaInformationDTO, AudioSummarySearchResultDTO, SeriesDTO, - openapi, SeriesSummarySearchResultDTO, } from "@ndla/types-backend/audio-api"; import { getNumberIdOrThrow } from "../utils/apiHelpers"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export async function fetchAudio(context: Context, audioId: number | string): Promise { const response = await client.GET("/audio-api/v1/audio/{audio-id}", { diff --git a/src/api/conceptApi.ts b/src/api/conceptApi.ts index a577384e..a88da989 100644 --- a/src/api/conceptApi.ts +++ b/src/api/conceptApi.ts @@ -6,11 +6,11 @@ * */ -import { ConceptSearchResultDTO, ConceptDTO, openapi } from "@ndla/types-backend/concept-api"; +import { paths, ConceptSearchResultDTO, ConceptDTO } from "@ndla/types-backend/concept-api"; import { getNumberIdOrThrow } from "../utils/apiHelpers"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export async function searchConcepts( params: { diff --git a/src/api/externalApi.ts b/src/api/externalApi.ts index 8e093f4f..6292a18b 100644 --- a/src/api/externalApi.ts +++ b/src/api/externalApi.ts @@ -7,14 +7,14 @@ */ import { youtube } from "@googleapis/youtube"; -import { openapi } from "@ndla/types-backend/oembed-proxy"; +import { paths } from "@ndla/types-backend/oembed-proxy"; import { OembedEmbedData, OembedProxyData } from "@ndla/types-embed"; import openGraph from "open-graph-scraper"; import { googleApiKey } from "../config"; import { GQLExternalOpengraph } from "../types/schema"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export const fetchExternalOembed = async (embed: OembedEmbedData, context: Context): Promise => { return await fetchOembedUrl(embed.url, context); diff --git a/src/api/folderApi.ts b/src/api/folderApi.ts index 4b5ddef0..408a1c0b 100644 --- a/src/api/folderApi.ts +++ b/src/api/folderApi.ts @@ -7,13 +7,13 @@ */ import { + paths, MyNDLAUserDTO, FolderDTO, FolderDataDTO, ResourceDTO, UserFolderDTO, ResourceType, - openapi, FolderStatus, ResourceConnectionDTO, } from "@ndla/types-backend/myndla-api"; @@ -42,7 +42,7 @@ import { } from "../types/schema"; import { createAuthClient, resolveJsonOATS, resolveOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient({ disableCache: true }); +const client = createAuthClient({ disableCache: true }); export async function fetchFolders( { includeResources, includeSubfolders }: GQLQueryFoldersArgs, diff --git a/src/api/frontpageApi.ts b/src/api/frontpageApi.ts index 0043189b..5838c9c7 100644 --- a/src/api/frontpageApi.ts +++ b/src/api/frontpageApi.ts @@ -6,10 +6,10 @@ * */ -import { openapi, FrontPageDTO, FilmFrontPageDTO, SubjectPageDTO } from "@ndla/types-backend/frontpage-api"; +import { paths, FrontPageDTO, FilmFrontPageDTO, SubjectPageDTO } from "@ndla/types-backend/frontpage-api"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export interface IMovieMeta { title: string; diff --git a/src/api/h5pApi.ts b/src/api/h5pApi.ts index 73354b33..a6703c8b 100644 --- a/src/api/h5pApi.ts +++ b/src/api/h5pApi.ts @@ -6,7 +6,7 @@ * */ -import { openapi } from "@ndla/types-backend/oembed-proxy"; +import { paths } from "@ndla/types-backend/oembed-proxy"; import { H5pEmbedData, H5pPreviewResponse, @@ -20,7 +20,7 @@ import { resolveJson } from "../utils/apiHelpers"; import { externalFetch } from "../utils/fetch"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); const H5P_HOST_URL = h5pHostUrl(); diff --git a/src/api/imageApi.ts b/src/api/imageApi.ts index 0de1c420..b1331016 100644 --- a/src/api/imageApi.ts +++ b/src/api/imageApi.ts @@ -6,12 +6,12 @@ * */ -import { openapi, ImageMetaInformationV3DTO, SearchResultV3DTO } from "@ndla/types-backend/image-api"; +import { paths, ImageMetaInformationV3DTO, SearchResultV3DTO } from "@ndla/types-backend/image-api"; import { GQLImageLicense, GQLQueryImageSearchArgs } from "../types/schema"; import { getNumberIdOrThrow } from "../utils/apiHelpers"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export async function fetchImageV3(imageId: number | string, context: Context): Promise { return client diff --git a/src/api/learningpathApi.ts b/src/api/learningpathApi.ts index 62f82816..e985b1c8 100644 --- a/src/api/learningpathApi.ts +++ b/src/api/learningpathApi.ts @@ -7,7 +7,7 @@ */ import { - openapi, + paths, LearningPathV2DTO, LearningStepV2DTO, AuthorDTO, @@ -27,8 +27,8 @@ import { import { getNumberIdOrThrow } from "../utils/apiHelpers"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); -const cachelessClient = createAuthClient({ disableCache: true }); +const client = createAuthClient(); +const cachelessClient = createAuthClient({ disableCache: true }); export async function fetchLearningpaths( learningpathIds: number[], diff --git a/src/api/myndlaApi.ts b/src/api/myndlaApi.ts index cf242916..5bd612db 100644 --- a/src/api/myndlaApi.ts +++ b/src/api/myndlaApi.ts @@ -6,10 +6,10 @@ * */ -import { ConfigMetaRestrictedDTO, openapi, ConfigKey } from "@ndla/types-backend/myndla-api"; +import { paths, ConfigMetaRestrictedDTO, ConfigKey } from "@ndla/types-backend/myndla-api"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export const fetchConfig = async (configKey: string, _context: Context): Promise => { return client diff --git a/src/api/oembedApi.ts b/src/api/oembedApi.ts index 8359e781..f085aa98 100644 --- a/src/api/oembedApi.ts +++ b/src/api/oembedApi.ts @@ -6,10 +6,10 @@ * */ -import { openapi, OEmbedDTO } from "@ndla/types-backend/oembed-proxy"; +import { paths, OEmbedDTO } from "@ndla/types-backend/oembed-proxy"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); export async function fetchOembed(url: string, _context: Context): Promise { const result = await client.GET("/oembed-proxy/v1/oembed", { params: { query: { url } } }); diff --git a/src/api/searchApi.ts b/src/api/searchApi.ts index cd7d1975..673c115d 100644 --- a/src/api/searchApi.ts +++ b/src/api/searchApi.ts @@ -7,7 +7,8 @@ */ import { - openapi, + paths, + operations, GrepSearchInputDTO, GrepSearchResultsDTO, MultiSearchSummaryDTO, @@ -28,7 +29,7 @@ import { } from "../types/schema"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient(); +const client = createAuthClient(); function commaSeparatedStringToArray(input: string | string[] | undefined): string[] | undefined { if (!input) return; @@ -36,7 +37,7 @@ function commaSeparatedStringToArray(input: string | string[] | undefined): stri return input.split(",").map((s) => s.trim()); } -type SearchQueryParams = openapi.operations["getSearch-apiV1Search"]["parameters"]["query"]; +type SearchQueryParams = operations["getSearch-apiV1Search"]["parameters"]["query"]; const convertQuery = (searchQuery: GQLQuerySearchArgs): SearchQueryParams => { return { diff --git a/src/api/taxonomyApi.ts b/src/api/taxonomyApi.ts index 29332a3b..d5297b44 100644 --- a/src/api/taxonomyApi.ts +++ b/src/api/taxonomyApi.ts @@ -7,11 +7,11 @@ */ import { + paths, Node, NodeChild, Version, SearchResult, - openapi, ResourceType, NodeType, NodeConnectionType, @@ -20,7 +20,7 @@ import { apiUrl } from "../config"; import { withCustomContext } from "../utils/context/contextStore"; import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils"; -const client = createAuthClient({ baseUrl: `${apiUrl}/taxonomy`, useTaxonomyCache: true }); +const client = createAuthClient({ baseUrl: `${apiUrl}/taxonomy`, useTaxonomyCache: true }); export async function fetchResourceTypes(context: Context): Promise { return client.GET("/v1/resource-types", { params: { query: { language: context.language } } }).then(resolveJsonOATS); diff --git a/yarn.lock b/yarn.lock index 67bc2e87..b49b00b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1933,10 +1933,10 @@ __metadata: languageName: node linkType: hard -"@ndla/types-backend@npm:^1.0.102": - version: 1.0.102 - resolution: "@ndla/types-backend@npm:1.0.102" - checksum: 10c0/0b372197790998c29d0c5e46967db0d3789d200427100320ae9bb95b6b55932c9d55cf0b7d9290c851dd3523676c16fba3511912e8a0fe71daa00dc0436794d8 +"@ndla/types-backend@npm:^1.0.104": + version: 1.0.104 + resolution: "@ndla/types-backend@npm:1.0.104" + checksum: 10c0/428aad00464ccbba71aa1c72799431f59be571bab67a0f12f355033ad1c53d3c359daa7b737917a501be5af9ed569477d3007dd9f966a0ccbb5b10d707e1b7f9 languageName: node linkType: hard @@ -1947,10 +1947,10 @@ __metadata: languageName: node linkType: hard -"@ndla/types-taxonomy@npm:^1.0.47": - version: 1.0.47 - resolution: "@ndla/types-taxonomy@npm:1.0.47" - checksum: 10c0/6c8cb8f20e49fb2ec128c99c7320f258d40724e80f935ff3159a11b1de1af2bc26fd3c00f8f2505c294cac619e9b91d70a7befb6d0ad20acdf73c5e59dfac352 +"@ndla/types-taxonomy@npm:^1.0.50": + version: 1.0.50 + resolution: "@ndla/types-taxonomy@npm:1.0.50" + checksum: 10c0/849d371760d7f0110e49ed2da79ba786162f49b173b8d3bfbf709d8f75c7b99fe513a1d422f2a807542c2c5217ef2ac003203c68a078e7ff608467b0d1e25f08 languageName: node linkType: hard @@ -6700,9 +6700,9 @@ __metadata: "@graphql-tools/mock": "npm:^9.1.5" "@graphql-tools/schema": "npm:^10.0.31" "@ndla/licenses": "npm:^9.0.3" - "@ndla/types-backend": "npm:^1.0.102" + "@ndla/types-backend": "npm:^1.0.104" "@ndla/types-embed": "npm:^5.0.20-alpha.0" - "@ndla/types-taxonomy": "npm:^1.0.47" + "@ndla/types-taxonomy": "npm:^1.0.50" "@types/compression": "npm:^1.8.1" "@types/cors": "npm:^2.8.19" "@types/graphql": "npm:^14.5.0"