Skip to content

Commit 1eba988

Browse files
authored
Merge pull request #78 from Pocket/MC-952
chore(packages): [MC-952] Re-enable code generation in pre-commit hook
2 parents 0d2e23f + d641dc0 commit 1eba988

File tree

2 files changed

+163
-1
lines changed

2 files changed

+163
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "dist/main.js",
66
"scripts": {
77
"build": "rm -rf dist && tsc",
8-
"codegen": "npm run codegen:graphql-types",
8+
"codegen": "npm run codegen:graphql-types && npm run codegen:openapi-types",
99
"codegen:graphql-types": "graphql-codegen",
1010
"codegen:openapi-types": "openapi-typescript ./openapi.yml -o ./src/generated/openapi/types.ts",
1111
"docs": "redocly preview-docs openapi.yml",

src/generated/graphql/types.ts

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type Scalars = {
1919
Date: any;
2020
DateString: any;
2121
FunctionalBoostValue: any;
22+
HtmlString: any;
2223
ISOString: any;
2324
Markdown: any;
2425
Max300CharString: any;
@@ -273,6 +274,13 @@ export type CollectionsResult = {
273274
pagination: Pagination;
274275
};
275276

277+
/** Content type classification for a corpus item */
278+
export enum CorpusContentType {
279+
Article = 'ARTICLE',
280+
Collection = 'COLLECTION',
281+
Video = 'VIDEO'
282+
}
283+
276284
/**
277285
* Represents an item that is in the Corpus and its associated manually edited metadata.
278286
* TODO: CorpusItem to implement PocketResource when it becomes available.
@@ -352,6 +360,134 @@ export type CorpusRecommendation = {
352360
tileId: Scalars['Float'];
353361
};
354362

363+
/** Paginated corpus search result connection */
364+
export type CorpusSearchConnection = {
365+
__typename?: 'CorpusSearchConnection';
366+
edges: Array<CorpusSearchEdge>;
367+
pageInfo: PageInfo;
368+
totalCount: Scalars['Int'];
369+
};
370+
371+
/** An edge in a CorpusSearchConnection result */
372+
export type CorpusSearchEdge = {
373+
__typename?: 'CorpusSearchEdge';
374+
cursor: Scalars['String'];
375+
node: CorpusSearchNode;
376+
};
377+
378+
/** Fields that can be searched using query strings */
379+
export enum CorpusSearchFields {
380+
/** Search all possible fields */
381+
All = 'ALL',
382+
/**
383+
* (Default) Search the fields which relate to the content
384+
* of the resource (title, article, excerpt, extracted content)
385+
* rather than the metadata (publisher).
386+
*/
387+
AllContentful = 'ALL_CONTENTFUL',
388+
/** Search terms in excerpt fields */
389+
Excerpt = 'EXCERPT',
390+
/** Search terms in parsed, extracted content fields */
391+
ExtractedContent = 'EXTRACTED_CONTENT',
392+
/** Search terms in publisher fields */
393+
Publisher = 'PUBLISHER',
394+
/** Search terms in title fields */
395+
Title = 'TITLE'
396+
}
397+
398+
/** Filters to refine corpus search results. */
399+
export type CorpusSearchFilters = {
400+
/** When the content was added to Pocket's corpus */
401+
addedDateRange?: InputMaybe<DateFilter>;
402+
/** The author's name */
403+
author?: InputMaybe<Scalars['String']>;
404+
/**
405+
* Filter to limit the result set to specific content types.
406+
* Multiple types are combined with OR.
407+
* Can use this to search collections only.
408+
*/
409+
contentType?: InputMaybe<Array<CorpusContentType>>;
410+
/** Set to true to exclude collections from the results. */
411+
excludeCollections?: InputMaybe<Scalars['Boolean']>;
412+
/** Set to true to exclude ML-generated recommendations from the results. */
413+
excludeML?: InputMaybe<Scalars['Boolean']>;
414+
/** The language of the corpus to search (letter code) */
415+
language: CorpusLanguage;
416+
/**
417+
* Filter for when an article was published. Can provide
418+
* upper/lower bounds with 'before' or 'after', or use both
419+
* both to create a time range.
420+
*/
421+
publishedDateRange?: InputMaybe<DateFilter>;
422+
/**
423+
* The publisher's name. This is an exact match for filtering.
424+
* To use publisher in search, use the publisher field in the query
425+
* string.
426+
*/
427+
publisher?: InputMaybe<Scalars['String']>;
428+
/**
429+
* The topic (use getTopics query to retrieve valid topics).
430+
* Multiple topics are combined with OR.
431+
*/
432+
topic?: InputMaybe<Array<Scalars['String']>>;
433+
};
434+
435+
/**
436+
* Highlighted snippets from fields in the search results
437+
* so clients can show users where the query matches are.
438+
* Each field, if available, contains an array of html text
439+
* snippets that contain a match to the search term.
440+
* The matching text is wrapped in <em> tags, e.g.
441+
* ["Hiss at <em>vacuum</em> cleaner if it fits i sits"]
442+
*/
443+
export type CorpusSearchHighlights = {
444+
__typename?: 'CorpusSearchHighlights';
445+
excerpt?: Maybe<Array<Maybe<Scalars['HtmlString']>>>;
446+
fullText?: Maybe<Array<Maybe<Scalars['HtmlString']>>>;
447+
publisher?: Maybe<Array<Maybe<Scalars['HtmlString']>>>;
448+
title?: Maybe<Array<Maybe<Scalars['HtmlString']>>>;
449+
};
450+
451+
/** A node in a CorpusSearchConnection result */
452+
export type CorpusSearchNode = {
453+
__typename?: 'CorpusSearchNode';
454+
/** The preview of the search result */
455+
preview: PocketMetadata;
456+
/** Search highlights */
457+
searchHighlights?: Maybe<CorpusSearchHighlights>;
458+
};
459+
460+
/** A search query for the corpus */
461+
export type CorpusSearchQueryString = {
462+
/**
463+
* A specific field to search on (e.g. title),
464+
* or ALL to search all available text content fields.
465+
* If missing, defaults to 'ALL_CONTENTFUL'
466+
*/
467+
field?: InputMaybe<CorpusSearchFields>;
468+
/** The query string to search. */
469+
query: Scalars['String'];
470+
};
471+
472+
/** Sort scheme for Corpus Search. Defaults to showing most relevant results first. */
473+
export type CorpusSearchSort = {
474+
sortBy: CorpusSearchSortBy;
475+
sortOrder?: InputMaybe<SearchItemsSortOrder>;
476+
};
477+
478+
/** Sortable properties for Corpus Search */
479+
export enum CorpusSearchSortBy {
480+
/** When the content was added to the corpus */
481+
DateAddedToCorpus = 'DATE_ADDED_TO_CORPUS',
482+
/**
483+
* When the content was originally published
484+
* (Note: this data is sparse/nullable)
485+
*/
486+
DatePublished = 'DATE_PUBLISHED',
487+
/** Relevance score computed by search algorithm */
488+
Relevance = 'RELEVANCE'
489+
}
490+
355491
/** This is the same as Slate but in this type all recommendations are backed by CorpusItems. This means that the editorial team has editorial control over the items served by this endpoint. */
356492
export type CorpusSlate = {
357493
__typename?: 'CorpusSlate';
@@ -513,6 +649,18 @@ export type CurationCategory = {
513649
slug: Scalars['String'];
514650
};
515651

652+
/**
653+
* Filter to get documents added/published before or after a date,
654+
* or provide both for a range of [after, before)
655+
* Before is exclusive, after is inclusive.
656+
*/
657+
export type DateFilter = {
658+
/** Inclusive date -- results must be at or after than this time. */
659+
after?: InputMaybe<Scalars['ISOString']>;
660+
/** Exclusive date -- results must be exclusively before this time. */
661+
before?: InputMaybe<Scalars['ISOString']>;
662+
};
663+
516664
export type DeleteSavedItemTagsInput = {
517665
/** The id of the SavedItem from which to delete a Tag association */
518666
savedItemId: Scalars['ID'];
@@ -2017,6 +2165,8 @@ export type Query = {
20172165
/** List all topics that the user can express a preference for. */
20182166
recommendationPreferenceTopics: Array<Topic>;
20192167
scheduledSurface: ScheduledSurface;
2168+
/** Search Pocket's corpus of recommendations and collections. */
2169+
searchCorpus?: Maybe<CorpusSearchConnection>;
20202170
/**
20212171
* Resolve data for a Shared link, or return a Not Found
20222172
* message if the share does not exist.
@@ -2180,6 +2330,18 @@ export type QueryScheduledSurfaceArgs = {
21802330
};
21812331

21822332

2333+
/**
2334+
* Default root level query type. All authorization checks are done in these queries.
2335+
* TODO: These belong in a seperate User Service that provides a User object (the user settings will probably exist there too)
2336+
*/
2337+
export type QuerySearchCorpusArgs = {
2338+
filter: CorpusSearchFilters;
2339+
pagination?: InputMaybe<PaginationInput>;
2340+
search: CorpusSearchQueryString;
2341+
sort?: InputMaybe<CorpusSearchSort>;
2342+
};
2343+
2344+
21832345
/**
21842346
* Default root level query type. All authorization checks are done in these queries.
21852347
* TODO: These belong in a seperate User Service that provides a User object (the user settings will probably exist there too)

0 commit comments

Comments
 (0)