Skip to content

Commit

Permalink
build: Build API docs for additional packages (#16824)
Browse files Browse the repository at this point in the history
While reviewing the packages in use by partners, I noticed some that do
not have API docs generated for them. Since we use the API report files
to trigger some policy-related stuff in CI (e.g. labeling PRs with
"public api change") we should generate docs for these packages.
Arguably we should do a review of all packages but I just focused on the
ones that are known to be used.

Packages:

agent-scheduler
odsp-doclib-utils
tinylicious-driver
  • Loading branch information
tylerbutler authored Sep 1, 2023
1 parent 5c4bf0d commit 74f413a
Show file tree
Hide file tree
Showing 11 changed files with 366 additions and 2 deletions.
71 changes: 71 additions & 0 deletions api-report/agent-scheduler.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## API Report File for "@fluidframework/agent-scheduler"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { FluidDataStoreRuntime } from '@fluidframework/datastore';
import { IEvent } from '@fluidframework/core-interfaces';
import { IEventProvider } from '@fluidframework/core-interfaces';
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
import { IFluidLoadable } from '@fluidframework/core-interfaces';
import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
import { TypedEventEmitter } from '@fluidframework/common-utils';

// @public (undocumented)
export class AgentSchedulerFactory implements IFluidDataStoreFactory {
// (undocumented)
static createChildInstance(parentContext: IFluidDataStoreContext): Promise<IAgentScheduler>;
// (undocumented)
get IFluidDataStoreFactory(): this;
// (undocumented)
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
// (undocumented)
static get registryEntry(): NamedFluidDataStoreRegistryEntry;
// (undocumented)
static readonly type = "_scheduler";
// (undocumented)
readonly type = "_scheduler";
}

// @public (undocumented)
export const IAgentScheduler: keyof IProvideAgentScheduler;

// @public
export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable {
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
pickedTasks(): string[];
register(...taskUrls: string[]): Promise<void>;
release(...taskUrls: string[]): Promise<void>;
}

// @public (undocumented)
export interface IAgentSchedulerEvents extends IEvent {
(event: "picked" | "released" | "lost", listener: (taskId: string) => void): any;
}

// @public (undocumented)
export interface IProvideAgentScheduler {
// (undocumented)
readonly IAgentScheduler: IAgentScheduler;
}

// @public (undocumented)
export interface ITaskSubscriptionEvents extends IEvent {
// (undocumented)
(event: "gotTask" | "lostTask", listener: () => void): any;
}

// @public
export class TaskSubscription extends TypedEventEmitter<ITaskSubscriptionEvents> {
constructor(agentScheduler: IAgentScheduler, taskId: string);
haveTask(): boolean;
// (undocumented)
readonly taskId: string;
volunteer(): void;
}

// (No @packageDocumentation comment for this package)

```
204 changes: 204 additions & 0 deletions api-report/odsp-doclib-utils.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
## API Report File for "@fluidframework/odsp-doclib-utils"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { DriverErrorTelemetryProps } from '@fluidframework/driver-utils';
import { IFluidErrorBase } from '@fluidframework/telemetry-utils';
import { IOdspErrorAugmentations } from '@fluidframework/odsp-driver-definitions';
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
import { LoggingError } from '@fluidframework/telemetry-utils';
import { OdspError } from '@fluidframework/odsp-driver-definitions';

// @public
export function authRequestWithRetry(authRequestInfo: IOdspAuthRequestInfo, requestCallback: (config: RequestInit) => Promise<Response>): Promise<Response>;

// @public (undocumented)
export function createOdspNetworkError(errorMessage: string, statusCode: number, retryAfterSeconds?: number, response?: Response, responseText?: string, props?: ITelemetryProperties): IFluidErrorBase & OdspError;

// @public (undocumented)
export function enrichOdspError(error: IFluidErrorBase & OdspError, response?: Response, facetCodes?: string[], props?: ITelemetryProperties): IFluidErrorBase & OdspError;

// @public (undocumented)
export const fetchIncorrectResponse = 712;

// @public
export function fetchTokens(server: string, scope: string, clientConfig: IClientConfig, credentials: TokenRequestCredentials): Promise<IOdspTokens>;

// @public (undocumented)
export function getAadTenant(server: string): string;

// @public (undocumented)
export function getAadUrl(server: string): string;

// @public (undocumented)
export function getAsync(url: string, authRequestInfo: IOdspAuthRequestInfo): Promise<Response>;

// @public (undocumented)
export function getChildrenByDriveItem(driveItem: IOdspDriveItem, server: string, authRequestInfo: IOdspAuthRequestInfo): Promise<IOdspDriveItem[]>;

// @public (undocumented)
export function getDriveId(server: string, account: string, library: string | undefined, authRequestInfo: IOdspAuthRequestInfo): Promise<string>;

// @public (undocumented)
export function getDriveItemByRootFileName(server: string, account: string | undefined, path: string, authRequestInfo: IOdspAuthRequestInfo, create: boolean, driveId?: string): Promise<IOdspDriveItem>;

// @public (undocumented)
export function getDriveItemByServerRelativePath(server: string, serverRelativePath: string, authRequestInfo: IOdspAuthRequestInfo, create: boolean): Promise<IOdspDriveItem>;

// @public (undocumented)
export function getDriveItemFromDriveAndItem(server: string, drive: string, item: string, authRequestInfo: IOdspAuthRequestInfo): Promise<IOdspDriveItem>;

// @public (undocumented)
export function getFetchTokenUrl(server: string): string;

// @public (undocumented)
export function getLoginPageUrl(server: string, clientConfig: IClientConfig, scope: string, odspAuthRedirectUri: string): string;

// @public (undocumented)
export const getOdspRefreshTokenFn: (server: string, clientConfig: IClientConfig, tokens: IOdspTokens) => () => Promise<string>;

// @public (undocumented)
export const getOdspScope: (server: string) => string;

// @public (undocumented)
export const getPushRefreshTokenFn: (server: string, clientConfig: IClientConfig, tokens: IOdspTokens) => () => Promise<string>;

// @public (undocumented)
export const getRefreshTokenFn: (scope: string, server: string, clientConfig: IClientConfig, tokens: IOdspTokens) => () => Promise<string>;

// @public (undocumented)
export function getServer(tenantId: string): string;

// @public (undocumented)
export function getSiteUrl(server: string): string;

// @public (undocumented)
export function getSPOAndGraphRequestIdsFromResponse(headers: {
get: (id: string) => string | undefined | null;
}): ITelemetryProperties;

// @public (undocumented)
export function hasFacetCodes(x: any): x is Pick<IOdspErrorAugmentations, "facetCodes">;

// @public (undocumented)
export interface IClientConfig {
// (undocumented)
clientId: string;
// (undocumented)
clientSecret: string;
}

// @public (undocumented)
export interface IOdspAuthRequestInfo {
// (undocumented)
accessToken: string;
// (undocumented)
refreshTokenFn?: () => Promise<string>;
}

// @public (undocumented)
export interface IOdspDriveItem {
// (undocumented)
driveId: string;
// (undocumented)
isFolder: boolean;
// (undocumented)
itemId: string;
// (undocumented)
name: string;
// (undocumented)
path: string;
}

// @public (undocumented)
export interface IOdspTokens {
// (undocumented)
readonly accessToken: string;
// (undocumented)
readonly refreshToken: string;
}

// @public (undocumented)
export function isOdspHostname(server: string): boolean;

// @public (undocumented)
export function isPushChannelHostname(server: string): boolean;

// @public
export interface OdspErrorResponse {
// (undocumented)
error: OdspErrorResponseInnerError & {
message: string;
};
}

// @public
export interface OdspErrorResponseInnerError {
// (undocumented)
code?: string;
// (undocumented)
innerError?: OdspErrorResponseInnerError;
}

// @public
export class OdspRedirectError extends LoggingError implements IFluidErrorBase {
constructor(message: string, redirectLocation: string | undefined, props: DriverErrorTelemetryProps);
// (undocumented)
readonly canRetry = false;
// (undocumented)
readonly errorType = DriverErrorType.fileNotFoundOrAccessDeniedError;
// (undocumented)
readonly redirectLocation: string | undefined;
}

// @public (undocumented)
export const OdspServiceReadOnlyErrorCode = "serviceReadOnly";

// @public (undocumented)
export function parseFacetCodes(errorResponse: OdspErrorResponse): string[];

// @public (undocumented)
export function postAsync(url: string, body: any, authRequestInfo: IOdspAuthRequestInfo): Promise<Response>;

// @public (undocumented)
export const pushScope = "offline_access https://pushchannel.1drv.ms/PushChannel.ReadWrite.All";

// @public (undocumented)
export function putAsync(url: string, authRequestInfo: IOdspAuthRequestInfo): Promise<Response>;

// @public
export function refreshTokens(server: string, scope: string, clientConfig: IClientConfig, tokens: IOdspTokens): Promise<IOdspTokens>;

// @public
export function throwOdspNetworkError(errorMessage: string, statusCode: number, response: Response, responseText?: string, props?: ITelemetryProperties): never;

// @public (undocumented)
export type TokenRequestCredentials = {
grant_type: "authorization_code";
code: string;
redirect_uri: string;
} | {
grant_type: "refresh_token";
refresh_token: string;
} | {
grant_type: "password";
username: string;
password: string;
};

// @public (undocumented)
export function tryParseErrorResponse(response: string | undefined): {
success: true;
errorResponse: OdspErrorResponse;
} | {
success: false;
};

// @public (undocumented)
export function unauthPostAsync(url: string, body: any): Promise<Response>;

// (No @packageDocumentation comment for this package)

```
44 changes: 44 additions & 0 deletions api-report/tinylicious-driver.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## API Report File for "@fluidframework/tinylicious-driver"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { IRequest } from '@fluidframework/core-interfaces';
import { IResolvedUrl } from '@fluidframework/driver-definitions';
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
import { IUrlResolver } from '@fluidframework/driver-definitions';
import { ScopeType } from '@fluidframework/protocol-definitions';

// @public (undocumented)
export const createTinyliciousCreateNewRequest: (documentId?: string | undefined) => IRequest;

// @public
export const defaultTinyliciousEndpoint = "http://localhost";

// @public
export const defaultTinyliciousPort = 7070;

// @public
export class InsecureTinyliciousTokenProvider implements ITokenProvider {
constructor(
scopes?: ScopeType[] | undefined);
// (undocumented)
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
// (undocumented)
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
}

// @public
export class InsecureTinyliciousUrlResolver implements IUrlResolver {
constructor(port?: number, endpoint?: string);
// (undocumented)
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
// (undocumented)
resolve(request: IRequest): Promise<IResolvedUrl>;
}

// (No @packageDocumentation comment for this package)

```
4 changes: 4 additions & 0 deletions packages/drivers/tinylicious-driver/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-common-report.json"
}
4 changes: 4 additions & 0 deletions packages/drivers/tinylicious-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"build": "fluid-build . --task build",
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
"clean": "rimraf --glob \"dist\" \"lib\" \"*.tsbuildinfo\" \"*.build.log\"",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
Expand Down Expand Up @@ -52,11 +54,13 @@
"@fluidframework/mocha-test-setup": "workspace:~",
"@fluidframework/test-tools": "^0.2.158186",
"@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/[email protected]",
"@microsoft/api-extractor": "^7.34.4",
"@types/jsrsasign": "^8.0.8",
"@types/mocha": "^9.1.1",
"@types/node": "^16.18.38",
"@types/uuid": "^9.0.2",
"concurrently": "^7.6.0",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "~8.6.0",
"mocha": "^10.2.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/framework/agent-scheduler/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluidframework/build-common/api-extractor-common-report.json"
}
6 changes: 6 additions & 0 deletions packages/framework/agent-scheduler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"scripts": {
"build": "fluid-build . --task build",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
"build:esnext": "tsc --project ./tsconfig.esnext.json",
"build:test": "tsc --project ./src/test/tsconfig.json",
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
"clean": "rimraf --glob \"dist\" \"lib\" \"*.tsbuildinfo\" \"*.build.log\"",
"dev": "npm run build:dev -- --watch",
"eslint": "eslint --format stylish src",
Expand Down Expand Up @@ -51,7 +53,11 @@
"@fluidframework/build-common": "^2.0.0",
"@fluidframework/build-tools": "^0.22.0",
"@fluidframework/eslint-config-fluid": "^2.1.0",
"@microsoft/api-extractor": "^7.34.4",
"@types/mocha": "^9.1.1",
"@types/node": "^16.18.38",
"concurrently": "^7.6.0",
"copyfiles": "^2.4.1",
"eslint": "~8.6.0",
"prettier": "~2.6.2",
"rimraf": "^4.4.0",
Expand Down
Loading

0 comments on commit 74f413a

Please sign in to comment.