Skip to content

Commit

Permalink
Update typedoc.json configurations and type exports (#119)
Browse files Browse the repository at this point in the history
## Problem
There are some basic configurations for TypeDoc we can provide to clean
up some of the documentation output. There were also a number of
warnings being output when running the utility calling out internals
that are represented in documentation, but not included due to not being
available as an export at the top level.

## Solution

- Update `typedoc.json` config to exclude `/v0/` code paths, include the
version number in the output, and hide the generator tagline at the
bottom of the page.
- Update the `{@link PineconeArgumentError}` doc strings to `{@link
Errors.PineconeArgumentError` to properly pull in the references.
- Export missing types: `IndexName`, `CollectionName`,
`DeleteManyByVectorIdOptions`, `DeleteManyByFilterOptions`, and
`QueryShared`.

## Type of Change
- [X] Infrastructure change (CI configs, etc)

## Test Plan
Make sure CI is green.
Validate documentation after it's been built and deployed:
https://pinecone-io.github.io/pinecone-ts-client/

The documentation CI step should also still show warnings for some of
the `pinecone-generated-ts-fetch` internals, and a few of the index
classes. I'm honestly unsure if those should be exported, and exporting
them at the top level pulled in additional pieces into warnings so it
may need a more thorough pass.

Current warnings should look like this:
<img width="1484" alt="Screenshot 2023-09-14 at 4 39 59 PM"
src="https://github.com/pinecone-io/pinecone-ts-client/assets/119623786/0a9568c3-1a50-40c2-a44b-c73e12aac618">
  • Loading branch information
austin-denoble authored Sep 14, 2023
1 parent 39db0a4 commit cd964fc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/control/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Index Operations
export type { IndexName } from './types';
export { configureIndex } from './configureIndex';
export type { ConfigureIndexOptions } from './configureIndex';
export { createIndex } from './createIndex';
Expand All @@ -11,6 +12,7 @@ export { listIndexes } from './listIndexes';
export type { IndexList, PartialIndexDescription } from './listIndexes';

// Collection Operations
export type { CollectionName } from './types';
export { createCollection } from './createCollection';
export type { CreateCollectionOptions } from './createCollection';

Expand Down
4 changes: 2 additions & 2 deletions src/data/deleteMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const DeleteManySchema = Type.Union([
DeleteManyByFilterSchema,
]);

export type DeleteManyByVectorIdOptions = Array<RecordId>;
export type DeleteManyByRecordIdOptions = Array<RecordId>;
export type DeleteManyByFilterOptions = object;
export type DeleteManyOptions =
| DeleteManyByVectorIdOptions
| DeleteManyByRecordIdOptions
| DeleteManyByFilterOptions;

export const deleteMany = (
Expand Down
7 changes: 6 additions & 1 deletion src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export type {
RecordMetadataValue,
} from './types';
export { PineconeConfigurationSchema } from './types';
export type { DeleteManyOptions } from './deleteMany';
export type {
DeleteManyOptions,
DeleteManyByFilterOptions,
DeleteManyByRecordIdOptions,
} from './deleteMany';
export type { DeleteOneOptions } from './deleteOne';
export type {
DescribeIndexStatsOptions,
Expand All @@ -41,6 +45,7 @@ export type {
QueryByVectorValues,
QueryOptions,
QueryResponse,
QueryShared,
} from './query';

export class Index<T extends RecordMetadata = RecordMetadata> {
Expand Down
2 changes: 1 addition & 1 deletion src/data/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const QueryByVectorValues = Type.Object(

const QuerySchema = Type.Union([QueryByRecordId, QueryByVectorValues]);

type QueryShared = {
export type QueryShared = {
topK: number;
includeValues?: boolean;
includeMetadata?: boolean;
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * as Errors from './errors';
export type {
CollectionDescription,
CollectionList,
CollectionName,
ConfigureIndexOptions,
CreateCollectionOptions,
CreateIndexOptions,
Expand All @@ -16,10 +17,13 @@ export type {
DescribeIndexOptions,
IndexDescription,
IndexList,
IndexName,
PartialIndexDescription,
PartialCollectionDescription,
} from './control';
export type {
DeleteManyByFilterOptions,
DeleteManyByRecordIdOptions,
DeleteManyOptions,
DeleteOneOptions,
DescribeIndexStatsOptions,
Expand All @@ -34,6 +38,7 @@ export type {
QueryByVectorValues,
QueryOptions,
QueryResponse,
QueryShared,
RecordId,
RecordMetadata,
RecordMetadataValue,
Expand Down
4 changes: 2 additions & 2 deletions src/pinecone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class Pinecone {
* @param options.sourceCollection - If creating an index from a collection, you can specify the name of the collection here.
* @see [Distance metrics](https://docs.pinecone.io/docs/indexes#distance-metrics)
* @see [Pod types and sizes](https://docs.pinecone.io/docs/indexes#pods-pod-types-and-pod-sizes)
* @throws {@link PineconeArgumentError} when invalid arguments are provided.
* @throws {@link Errors.PineconeArgumentError} when invalid arguments are provided.
*
* @returns A promise that resolves when the request to create the index is completed. Note that the index is not immediately ready to use. You can use the `describeIndex` function to check the status of the index.
*/
Expand All @@ -227,7 +227,7 @@ export class Pinecone {
*
* @param indexName - The name of the index to delete.
* @returns A promise that resolves when the request to delete the index is completed.
* @throws {@link PineconeArgumentError} when invalid arguments are provided
* @throws {@link Errors.PineconeArgumentError} when invalid arguments are provided
*/
deleteIndex: ReturnType<typeof deleteIndex>;

Expand Down
4 changes: 3 additions & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
// Comments are supported, like tsconfig.json
"entryPoints": ["src/index.ts"],
"exclude": ["**/v0/*"],
"hideGenerator": true,
"includeVersion": true,
"out": "docs"
}

0 comments on commit cd964fc

Please sign in to comment.