Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/api/articleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,7 +22,7 @@ interface ArticleParams {
articleId: string;
}

const client = createAuthClient<openapi.paths>();
const client = createAuthClient<paths>();

export const fetchTransformedContent = async (
article: ArticleV2DTO,
Expand Down
4 changes: 2 additions & 2 deletions src/api/audioApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export async function fetchAudio(context: Context, audioId: number | string): Promise<AudioMetaInformationDTO | null> {
const response = await client.GET("/audio-api/v1/audio/{audio-id}", {
Expand Down
4 changes: 2 additions & 2 deletions src/api/conceptApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export async function searchConcepts(
params: {
Expand Down
4 changes: 2 additions & 2 deletions src/api/externalApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export const fetchExternalOembed = async (embed: OembedEmbedData, context: Context): Promise<OembedProxyData> => {
return await fetchOembedUrl(embed.url, context);
Expand Down
4 changes: 2 additions & 2 deletions src/api/folderApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
*/

import {
paths,
MyNDLAUserDTO,
FolderDTO,
FolderDataDTO,
ResourceDTO,
UserFolderDTO,
ResourceType,
openapi,
FolderStatus,
ResourceConnectionDTO,
} from "@ndla/types-backend/myndla-api";
Expand Down Expand Up @@ -42,7 +42,7 @@ import {
} from "../types/schema";
import { createAuthClient, resolveJsonOATS, resolveOATS } from "../utils/openapi-fetch/utils";

const client = createAuthClient<openapi.paths>({ disableCache: true });
const client = createAuthClient<paths>({ disableCache: true });

export async function fetchFolders(
{ includeResources, includeSubfolders }: GQLQueryFoldersArgs,
Expand Down
4 changes: 2 additions & 2 deletions src/api/frontpageApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export interface IMovieMeta {
title: string;
Expand Down
4 changes: 2 additions & 2 deletions src/api/h5pApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
*/

import { openapi } from "@ndla/types-backend/oembed-proxy";
import { paths } from "@ndla/types-backend/oembed-proxy";
import {
H5pEmbedData,
H5pPreviewResponse,
Expand All @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

const H5P_HOST_URL = h5pHostUrl();

Expand Down
4 changes: 2 additions & 2 deletions src/api/imageApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export async function fetchImageV3(imageId: number | string, context: Context): Promise<ImageMetaInformationV3DTO> {
return client
Expand Down
6 changes: 3 additions & 3 deletions src/api/learningpathApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {
openapi,
paths,
LearningPathV2DTO,
LearningStepV2DTO,
AuthorDTO,
Expand All @@ -27,8 +27,8 @@ import {
import { getNumberIdOrThrow } from "../utils/apiHelpers";
import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils";

const client = createAuthClient<openapi.paths>();
const cachelessClient = createAuthClient<openapi.paths>({ disableCache: true });
const client = createAuthClient<paths>();
const cachelessClient = createAuthClient<paths>({ disableCache: true });

export async function fetchLearningpaths(
learningpathIds: number[],
Expand Down
4 changes: 2 additions & 2 deletions src/api/myndlaApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export const fetchConfig = async (configKey: string, _context: Context): Promise<ConfigMetaRestrictedDTO> => {
return client
Expand Down
4 changes: 2 additions & 2 deletions src/api/oembedApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<openapi.paths>();
const client = createAuthClient<paths>();

export async function fetchOembed(url: string, _context: Context): Promise<OEmbedDTO | null> {
const result = await client.GET("/oembed-proxy/v1/oembed", { params: { query: { url } } });
Expand Down
7 changes: 4 additions & 3 deletions src/api/searchApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import {
openapi,
paths,
operations,
GrepSearchInputDTO,
GrepSearchResultsDTO,
MultiSearchSummaryDTO,
Expand All @@ -28,15 +29,15 @@ import {
} from "../types/schema";
import { createAuthClient, resolveJsonOATS } from "../utils/openapi-fetch/utils";

const client = createAuthClient<openapi.paths>();
const client = createAuthClient<paths>();

function commaSeparatedStringToArray(input: string | string[] | undefined): string[] | undefined {
if (!input) return;
if (Array.isArray(input)) return input;
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 {
Expand Down
4 changes: 2 additions & 2 deletions src/api/taxonomyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/

import {
paths,
Node,
NodeChild,
Version,
SearchResult,
openapi,
ResourceType,
NodeType,
NodeConnectionType,
Expand All @@ -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<openapi.paths>({ baseUrl: `${apiUrl}/taxonomy`, useTaxonomyCache: true });
const client = createAuthClient<paths>({ baseUrl: `${apiUrl}/taxonomy`, useTaxonomyCache: true });

export async function fetchResourceTypes(context: Context): Promise<ResourceType[]> {
return client.GET("/v1/resource-types", { params: { query: { language: context.language } } }).then(resolveJsonOATS);
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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"
Expand Down