diff --git a/.changeset/weak-flies-do.md b/.changeset/weak-flies-do.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/weak-flies-do.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.monorepolint.config.mjs b/.monorepolint.config.mjs index c7153f578..6cdbad01a 100644 --- a/.monorepolint.config.mjs +++ b/.monorepolint.config.mjs @@ -35,15 +35,15 @@ const DELETE_SCRIPT_ENTRY = { options: [undefined], fixValue: undefined }; const nonStandardPackages = [ "@osdk/examples.*", "@osdk/foundry-sdk-generator", - "@osdk/monorepo.*", + "@osdk/monorepo.*", // internal monorepo packages "@osdk/e2e.sandbox.*", // sandboxes for manual e2e testing "@osdk/e2e.generated.*", // generated sdks for e2e testing - "@osdk/shared.client", - "@osdk/create-app.template.*", - "@osdk/monorepo.cspell", + "@osdk/shared.client", // hand written package that only exposes a symbol + "@osdk/create-app.template.*", // template packages for create-app "@osdk/tests.*", ]; +// Any package that is in the dependency chain of `legacy-client` needs to be in this list const legacyPackages = [ "@osdk/api", "@osdk/gateway", @@ -56,10 +56,9 @@ const legacyPackages = [ const esmOnlyPackages = [ "@osdk/cli.*", "@osdk/cli", + "@osdk/client.*", "@osdk/client", - "@osdk/client.api", - "@osdk/client.unstable", - "@osdk/client.unstable.osw", + "@osdk/create-app.template-packager", "@osdk/create-app", "@osdk/example-generator", "@osdk/foundry.*", @@ -73,11 +72,14 @@ const esmOnlyPackages = [ "@osdk/shared.net.platformapi", "@osdk/tool.release", "@osdk/version-updater", - "@osdk/client.test.ontology", - "@osdk/create-app.template-packager", // "@osdk/examples.*", but they have their own config cause they are nonstandard ]; +const checkApiPackages = [ + "@osdk/client", + "@osdk/client.api", +]; + /** * We don't want to allow `workspace:^` in our dependencies because our current release branch * strategy only allows for patch changes in the release branch and minors elsewhere. @@ -514,6 +516,8 @@ NOTE: DO NOT EDIT THIS README BY HAND. It is generated by monorepolint. skipTsconfigReferences: true, }), + ...rulesForPackagesWithChecKApiTask(), + packageEntry({ options: { entries: { @@ -602,3 +606,42 @@ package you do so at your own risk. }), ], }; + +/** + * Rules for packages that do api checks / docs generation + * @returns {import("@monorepolint/config").RuleModule[]} + */ +function rulesForPackagesWithChecKApiTask() { + return [ + packageScript({ + includePackages: checkApiPackages, + options: { + scripts: { + "check-api": "api-extractor run --verbose --local", + }, + }, + }), + requireDependency({ + includePackages: checkApiPackages, + options: { + devDependencies: { + "@osdk/monorepo.api-extractor": "workspace:~", + "@microsoft/api-documenter": "^7.25.3", + "@microsoft/api-extractor": "^7.47.0", + }, + }, + }), + fileContents({ + includePackages: checkApiPackages, + options: { + file: "api-extractor.json", + template: `{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "@osdk/monorepo.api-extractor/base.json", + "mainEntryPointFilePath": "/build/esm/index.d.ts" +} +`, + }, + }), + ]; +} diff --git a/packages/client.api/etc/client.api.report.api.md b/etc/client.api.report.api.md similarity index 100% rename from packages/client.api/etc/client.api.report.api.md rename to etc/client.api.report.api.md diff --git a/etc/client.report.api.md b/etc/client.report.api.md new file mode 100644 index 000000000..d83a16fde --- /dev/null +++ b/etc/client.report.api.md @@ -0,0 +1,121 @@ +## API Report File for "@osdk/client" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { ActionDefinition } from '@osdk/api'; +import { ActionEditResponse } from '@osdk/client.api'; +import { ActionReturnTypeForOptions } from '@osdk/client.api'; +import type { ActionSignatureFromDef } from '@osdk/client.api'; +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 { 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 type { LessThan } from 'type-fest'; +import type { Logger } from 'pino'; +import { NOOP } from '@osdk/client.api'; +import type { ObjectOrInterfaceDefinition } from '@osdk/api'; +import { ObjectSet } from '@osdk/client.api'; +import type { ObjectSet as ObjectSet_2 } from '@osdk/internal.foundry'; +import type { ObjectTypeDefinition } from '@osdk/api'; +import { Osdk } from '@osdk/client.api'; +import { OsdkActionParameters } from '@osdk/client.api'; +import { OsdkObject } from '@osdk/client.api'; +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 type { SharedClient } from '@osdk/shared.client'; +import { SharedClientContext } from '@osdk/shared.client'; +import type { VersionBound } from '@osdk/api'; +import { WhereClause } from '@osdk/client.api'; + +export { ActionEditResponse } + +export { ActionReturnTypeForOptions } + +// @public (undocumented) +export class ActionValidationError extends Error { + constructor(validation: ActionValidationResponse); + // (undocumented) + validation: ActionValidationResponse; +} + +export { ActionValidationResponse } + +export { ApplyActionOptions } + +export { ApplyBatchActionOptions } + +// Warning: (ae-forgotten-export) The symbol "MinimalClient" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface Client extends SharedClient { + // Warning: (ae-forgotten-export) The symbol "CheckVersionBound" needs to be exported by the entry point index.d.ts + // + // (undocumented) + & VersionBound)>(o: CheckVersionBound): ObjectSet; + // (undocumented) + >(o: CheckVersionBound): ActionSignatureFromDef; + // (undocumented) + >(o: CheckVersionBound): QuerySignatureFromDef; +} + +// @public (undocumented) +export function createAttachmentFromRid(client: MinimalClient, rid: string): Attachment; + +// @public (undocumented) +export const createClient: (baseUrl: string, ontologyRid: string | Promise, tokenProvider: () => Promise, options?: { + logger?: Logger; +} | undefined, fetchFn?: typeof fetch | undefined) => Client; + +// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen +// +// @public +export function createPlatformClient(baseUrl: string, tokenProvider: () => Promise, options?: undefined, fetchFn?: typeof globalThis.fetch): SharedClientContext; + +export { InterfaceObjectSet } + +// @public (undocumented) +export function isOk(result: ResultOrError): result is { + type: "ok"; +}; + +export { NOOP } + +export { ObjectSet } + +export { Osdk } + +export { OsdkActionParameters } + +export { OsdkObject } + +export { PageResult } + +export { PalantirApiError } + +// @public (undocumented) +export type ResultOrError = ({ + type: "ok"; + err?: never; +} & T) | { + type: "err"; + data?: never; + err?: unknown; +}; + +export { WhereClause } + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/client.api/package.json b/packages/client.api/package.json index 8449820e4..e4c4534b8 100644 --- a/packages/client.api/package.json +++ b/packages/client.api/package.json @@ -17,8 +17,8 @@ } }, "scripts": { - "api-checker": "api-extractor run --verbose --local", "api-docs": "api-documenter markdown -i build/api-extractor --output-folder api-docs", + "check-api": "api-extractor run --verbose --local", "check-attw": "../../scripts/build_common/check-attw.sh esm", "check-spelling": "cspell --quiet .", "clean": "rm -rf lib dist types build tsconfig.tsbuildinfo", diff --git a/packages/client/api-extractor.json b/packages/client/api-extractor.json new file mode 100644 index 000000000..e95b323e5 --- /dev/null +++ b/packages/client/api-extractor.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "@osdk/monorepo.api-extractor/base.json", + "mainEntryPointFilePath": "/build/esm/index.d.ts" +} diff --git a/packages/client/package.json b/packages/client/package.json index 238b1dcc3..b2b9bfc51 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -19,6 +19,7 @@ } }, "scripts": { + "check-api": "api-extractor run --verbose --local", "check-attw": "../../scripts/build_common/check-attw.sh esm", "check-spelling": "cspell --quiet .", "clean": "rm -rf lib dist types build tsconfig.tsbuildinfo", @@ -57,6 +58,8 @@ } }, "devDependencies": { + "@microsoft/api-documenter": "^7.25.3", + "@microsoft/api-extractor": "^7.47.0", "@osdk/client.test.ontology": "workspace:~", "@osdk/internal.foundry": "workspace:~", "@osdk/monorepo.api-extractor": "workspace:~", diff --git a/packages/monorepo.api-extractor/base.json b/packages/monorepo.api-extractor/base.json index 4dad27016..2b2285c5d 100644 --- a/packages/monorepo.api-extractor/base.json +++ b/packages/monorepo.api-extractor/base.json @@ -11,7 +11,7 @@ "apiReport": { "enabled": true, "reportFileName": ".report.api.md", - "reportFolder": "/etc/", + "reportFolder": "/../../etc/", "reportTempFolder": "/build/api-extractor/" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 531d0ab82..b475f6829 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -646,6 +646,12 @@ importers: specifier: ^8.18.0 version: 8.18.0 devDependencies: + '@microsoft/api-documenter': + specifier: ^7.25.3 + version: 7.25.3 + '@microsoft/api-extractor': + specifier: ^7.47.0 + version: 7.47.0 '@osdk/client.test.ontology': specifier: workspace:~ version: link:../client.test.ontology diff --git a/turbo.json b/turbo.json index 6437fa1e5..eef1261c7 100644 --- a/turbo.json +++ b/turbo.json @@ -90,15 +90,15 @@ "inputs": ["tsup.mjs"] }, - "api-checker": { + "check-api": { "outputLogs": "new-only", "inputs": ["api-extractor.json", "build/esm/**/*", "api-extractor.json"], "outputs": ["etc/*.report.api.md", "build/api-extractor/**/*"], - "dependsOn": ["typecheck", "@osdk/monorepo.api-extractor#api-checker"] + "dependsOn": ["typecheck", "@osdk/monorepo.api-extractor#check-api"] }, // Doesn't do anything, just a virtual task to depend on the base.json file - "@osdk/monorepo.api-extractor#api-checker": { + "@osdk/monorepo.api-extractor#check-api": { "inputs": ["base.json"] }, @@ -106,7 +106,7 @@ "outputLogs": "new-only", "inputs": ["temp/**/*"], "outputs": ["api-docs/**/*"], - "dependsOn": ["api-checker"] + "dependsOn": ["check-api"] }, "postVersioning": { @@ -176,7 +176,7 @@ "typecheck", "test", "check-attw", - "api-checker", + "check-api", "check-spelling" ] }