Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more exports to client #507

Merged
merged 3 commits into from
Jul 23, 2024
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
5 changes: 5 additions & 0 deletions .changeset/spotty-onions-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/client": minor
---

Adding more package exports
13 changes: 9 additions & 4 deletions etc/client.report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import { ActionValidationResponse } from '@osdk/client.api';
import { ApplyActionOptions } from '@osdk/client.api';
import { ApplyBatchActionOptions } from '@osdk/client.api';
import type { Attachment } from '@osdk/client.api';
import type { AttachmentUpload } from '@osdk/client.api';
import type { GreaterThan } from 'type-fest';
import type { GreaterThanOrEqual } from 'type-fest';
import type { InterfaceDefinition } from '@osdk/api';
import { InterfaceObjectSet } from '@osdk/client.api';
import type { IsEqual } from 'type-fest';
import { isOk } from '@osdk/client.api';
import type { LessThan } from 'type-fest';
import type { Logger } from 'pino';
import { NOOP } from '@osdk/client.api';
Expand All @@ -31,6 +33,7 @@ import { PageResult } from '@osdk/client.api';
import { PalantirApiError } from '@osdk/shared.net.errors';
import type { QueryDefinition } from '@osdk/api';
import type { QuerySignatureFromDef } from '@osdk/client.api';
import { Result } from '@osdk/client.api';
import type { SharedClient } from '@osdk/shared.client';
import { SharedClientContext } from '@osdk/shared.client';
import type { VersionBound } from '@osdk/api';
Expand Down Expand Up @@ -70,6 +73,9 @@ export interface Client extends SharedClient<MinimalClient> {
// @public (undocumented)
export function createAttachmentFromRid(client: MinimalClient, rid: string): Attachment;

// @public (undocumented)
export function createAttachmentUpload(data: Blob, name: string): AttachmentUpload;

// @public (undocumented)
export const createClient: (baseUrl: string, ontologyRid: string | Promise<string>, tokenProvider: () => Promise<string>, options?: {
logger?: Logger;
Expand All @@ -85,10 +91,7 @@ export function createPlatformClient(baseUrl: string, tokenProvider: () => Promi

export { InterfaceObjectSet }

// @public (undocumented)
export function isOk(result: ResultOrError<any>): result is {
type: "ok";
};
export { isOk }

export { NOOP }

Expand All @@ -104,6 +107,8 @@ export { PageResult }

export { PalantirApiError }

export { Result }

// @public (undocumented)
export type ResultOrError<T extends object> = ({
type: "ok";
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ export type {
OsdkActionParameters,
OsdkObject,
PageResult,
Result,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone uses fetchPageWithError the type is wrapped with Result, so thought it best to expose here

WhereClause,
} from "@osdk/client.api";

export { isOk } from "@osdk/client.api";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below on why this got swapped

export { PalantirApiError } from "@osdk/shared.net.errors";

export type { Client } from "./Client.js";
export { createClient } from "./createClient.js";
export { createPlatformClient } from "./createPlatformClient.js";

export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this if someone wants to upload a blob to an action. The AttachmentUpload type should also accept the File object from FileApi but we need to provide this helper for now because that doesn't come standard yet


export { ActionValidationError } from "./actions/ActionValidationError.js";
export { isOk } from "./ResultOrError.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we originally exporting this which I don't think we're actually using anywhere?

export function isOk(result: ResultOrError<any>): result is { type: "ok" } {
changed it to use this:
export function isOk<X>(a: Result<X>): a is OkResult<X> {

export type { ResultOrError } from "./ResultOrError.js";