From 17c8081a6bdec6a495a3e816e5416d72c1b3416a Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 17 Mar 2024 14:32:05 -0300 Subject: [PATCH] Configure API Extractor --- .gitignore | 1 + api-extractor.json | 41 +++++ api/.gitignore | 5 + api/tough-cookie.api.md | 332 ++++++++++++++++++++++++++++++++++++++++ package.json | 5 + 5 files changed, 384 insertions(+) create mode 100644 api-extractor.json create mode 100644 api/.gitignore create mode 100644 api/tough-cookie.api.md diff --git a/.gitignore b/.gitignore index a0fc24a8..881cc62e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ coverage .config .bash_history dist/ +tmp/ diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 00000000..0716ab9f --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "/dist/cookie/index.d.ts", + "newlineKind": "os", + "apiReport": { + "enabled": true, + "reportFolder": "api", + "reportTempFolder": "tmp" + }, + "docModel": { + "enabled": true, + "apiJsonFilePath": "/tmp/.api.json" + }, + "dtsRollup": { + "enabled": false + }, + "tsdocMetadata": { + "enabled": true + }, + "messages": { + "compilerMessageReporting": { + "default": { + "logLevel": "warning" + } + }, + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + }, + "ae-internal-missing-underscore": { + "logLevel": "none", + "addToApiReportFile": false + } + }, + "tsdocMessageReporting": { + "default": { + "logLevel": "warning" + } + } + } +} diff --git a/api/.gitignore b/api/.gitignore new file mode 100644 index 00000000..bed7e484 --- /dev/null +++ b/api/.gitignore @@ -0,0 +1,5 @@ +# ignoring all the generated docs initially +docs/*.md + +# subsequent PRs will un-ignore areas that are under review until +# all docs are complete and we can drop this ignore file entirely diff --git a/api/tough-cookie.api.md b/api/tough-cookie.api.md new file mode 100644 index 00000000..eca22a33 --- /dev/null +++ b/api/tough-cookie.api.md @@ -0,0 +1,332 @@ +## API Report File for "tough-cookie" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +// @public (undocumented) +export function canonicalDomain(str: string | null): string | null; + +// @public (undocumented) +export class Cookie { + // Warning: (ae-forgotten-export) The symbol "CreateCookieOptions" needs to be exported by the entry point index.d.ts + constructor(options?: CreateCookieOptions); + // (undocumented) + canonicalizedDomain(): string | null; + // (undocumented) + cdomain(): string | null; + // (undocumented) + clone(): Cookie | null; + // (undocumented) + static cookiesCreated: number; + // (undocumented) + cookieString(): string; + // (undocumented) + creation: Date | 'Infinity' | null; + // (undocumented) + creationIndex: number; + // (undocumented) + domain: string | null; + // (undocumented) + expires: Date | 'Infinity' | null; + // (undocumented) + expiryTime(now?: Date): number | undefined; + // (undocumented) + extensions: string[] | null; + // Warning: (ae-forgotten-export) The symbol "fromJSON_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static fromJSON: typeof fromJSON_2; + // (undocumented) + hostOnly: boolean | null; + // (undocumented) + httpOnly: boolean; + // (undocumented) + isPersistent(): boolean; + // (undocumented) + key: string; + // (undocumented) + lastAccessed: Date | 'Infinity' | null; + // (undocumented) + maxAge: number | 'Infinity' | '-Infinity' | null; + // Warning: (ae-forgotten-export) The symbol "parse_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static parse: typeof parse_2; + // (undocumented) + path: string | null; + // (undocumented) + pathIsDefault: boolean | null; + // (undocumented) + sameSite: string | undefined; + // (undocumented) + static sameSiteCanonical: { + readonly strict: "Strict"; + readonly lax: "Lax"; + }; + // (undocumented) + static sameSiteLevel: { + readonly strict: 3; + readonly lax: 2; + readonly none: 1; + }; + // (undocumented) + secure: boolean; + // (undocumented) + static serializableProperties: readonly ["key", "value", "expires", "maxAge", "domain", "path", "secure", "httpOnly", "extensions", "hostOnly", "pathIsDefault", "creation", "lastAccessed", "sameSite"]; + // (undocumented) + setExpires(exp: string | Date): void; + // (undocumented) + setMaxAge(age: number): void; + // Warning: (ae-forgotten-export) The symbol "SerializedCookie" needs to be exported by the entry point index.d.ts + // + // (undocumented) + toJSON(): SerializedCookie; + // (undocumented) + toString(): string; + // (undocumented) + TTL(now?: number): number; + // (undocumented) + validate(): boolean; + // (undocumented) + value: string; +} + +// @public +export function cookieCompare(a: Cookie, b: Cookie): number; + +// @public (undocumented) +export class CookieJar { + // Warning: (ae-forgotten-export) The symbol "CreateCookieJarOptions" needs to be exported by the entry point index.d.ts + constructor(store?: Store | null | undefined, options?: CreateCookieJarOptions | boolean); + // (undocumented) + clone(callback: Callback): void; + // (undocumented) + clone(newStore: Store, callback: Callback): void; + // (undocumented) + clone(newStore?: Store): Promise; + // (undocumented) + cloneSync(newStore?: Store): CookieJar | undefined; + // (undocumented) + _cloneSync(newStore?: Store): CookieJar | undefined; + // (undocumented) + static deserialize(strOrObj: string | object, callback: Callback): void; + // (undocumented) + static deserialize(strOrObj: string | object, store: Store, callback: Callback): void; + // (undocumented) + static deserialize(strOrObj: string | object, store?: Store): Promise; + // (undocumented) + static deserialize(strOrObj: string | object, store?: Store | Callback, callback?: Callback): unknown; + // (undocumented) + static deserializeSync(strOrObj: string | SerializedCookieJar, store?: Store): CookieJar; + // (undocumented) + static fromJSON(jsonString: SerializedCookieJar, store?: Store): CookieJar; + // (undocumented) + getCookies(url: string, callback: Callback): void; + // Warning: (ae-forgotten-export) The symbol "GetCookiesOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getCookies(url: string | URL, options: GetCookiesOptions | undefined, callback: Callback): void; + // (undocumented) + getCookies(url: string | URL, options?: GetCookiesOptions | undefined): Promise; + // (undocumented) + getCookies(url: string | URL, options: GetCookiesOptions | undefined | Callback, callback?: Callback): unknown; + // (undocumented) + getCookiesSync(url: string, options?: GetCookiesOptions): Cookie[]; + // (undocumented) + getCookieString(url: string, options: GetCookiesOptions, callback: Callback): void; + // (undocumented) + getCookieString(url: string, callback: Callback): void; + // (undocumented) + getCookieString(url: string, options?: GetCookiesOptions): Promise; + // (undocumented) + getCookieString(url: string, options: GetCookiesOptions | Callback, callback?: Callback): unknown; + // (undocumented) + getCookieStringSync(url: string, options?: GetCookiesOptions): string; + // (undocumented) + getSetCookieStrings(url: string, callback: Callback): void; + // (undocumented) + getSetCookieStrings(url: string, options: GetCookiesOptions, callback: Callback): void; + // (undocumented) + getSetCookieStrings(url: string, options?: GetCookiesOptions): Promise; + // (undocumented) + getSetCookieStrings(url: string, options: GetCookiesOptions, callback?: Callback): unknown; + // (undocumented) + getSetCookieStringsSync(url: string, options?: GetCookiesOptions): string[]; + // (undocumented) + _importCookies(serialized: unknown, callback: Callback): void; + // (undocumented) + _importCookiesSync(serialized: unknown): void; + // (undocumented) + readonly prefixSecurity: string; + // Warning: (ae-forgotten-export) The symbol "ErrorCallback" needs to be exported by the entry point index.d.ts + // + // (undocumented) + removeAllCookies(callback: ErrorCallback): void; + // (undocumented) + removeAllCookies(): Promise; + // (undocumented) + removeAllCookiesSync(): void; + // Warning: (ae-forgotten-export) The symbol "SerializedCookieJar" needs to be exported by the entry point index.d.ts + // + // (undocumented) + serialize(callback: Callback): void; + // (undocumented) + serialize(): Promise; + // (undocumented) + serializeSync(): SerializedCookieJar | undefined; + // Warning: (ae-forgotten-export) The symbol "Callback" needs to be exported by the entry point index.d.ts + // + // (undocumented) + setCookie(cookie: string | Cookie, url: string | URL, callback: Callback): void; + // Warning: (ae-forgotten-export) The symbol "SetCookieOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + setCookie(cookie: string | Cookie, url: string | URL, options: SetCookieOptions, callback: Callback): void; + // (undocumented) + setCookie(cookie: string | Cookie, url: string | URL, options?: SetCookieOptions): Promise; + // (undocumented) + setCookie(cookie: string | Cookie, url: string | URL, options: SetCookieOptions | Callback, callback?: Callback): unknown; + // (undocumented) + setCookieSync(cookie: string | Cookie, url: string, options?: SetCookieOptions): Cookie | undefined; + // (undocumented) + readonly store: Store; + // (undocumented) + toJSON(): SerializedCookieJar | undefined; +} + +// @public (undocumented) +export function defaultPath(path?: string | null): string; + +// @public (undocumented) +export function domainMatch(str?: string | null, domStr?: string | null, canonicalize?: boolean): boolean | null; + +// @public +export function formatDate(date: Date): string; + +// @public (undocumented) +export const fromJSON: (str: unknown) => Cookie | null; + +// Warning: (ae-forgotten-export) The symbol "GetPublicSuffixOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export function getPublicSuffix(domain: string, options?: GetPublicSuffixOptions): string | null; + +// @public (undocumented) +export class MemoryCookieStore extends Store { + constructor(); + // (undocumented) + findCookie(domain: string | null, path: string | null, key: string | undefined): Promise; + // (undocumented) + findCookie(domain: string | null, path: string | null, key: string | undefined, callback: Callback): void; + // (undocumented) + findCookies(domain: string, path: string, allowSpecialUseDomain?: boolean): Promise; + // (undocumented) + findCookies(domain: string, path: string, allowSpecialUseDomain?: boolean, callback?: Callback): void; + // (undocumented) + getAllCookies(): Promise; + // (undocumented) + getAllCookies(callback: Callback): void; + // Warning: (ae-forgotten-export) The symbol "MemoryCookieStoreIndex" needs to be exported by the entry point index.d.ts + // + // (undocumented) + idx: MemoryCookieStoreIndex; + // (undocumented) + putCookie(cookie: Cookie): Promise; + // (undocumented) + putCookie(cookie: Cookie, callback: ErrorCallback): void; + // (undocumented) + removeAllCookies(): Promise; + // (undocumented) + removeAllCookies(callback: ErrorCallback): void; + // (undocumented) + removeCookie(domain: string, path: string, key: string): Promise; + // (undocumented) + removeCookie(domain: string, path: string, key: string, callback: ErrorCallback): void; + // (undocumented) + removeCookies(domain: string, path: string): Promise; + // (undocumented) + removeCookies(domain: string, path: string, callback: ErrorCallback): void; + // (undocumented) + synchronous: boolean; + // (undocumented) + updateCookie(oldCookie: Cookie, newCookie: Cookie): Promise; + // (undocumented) + updateCookie(oldCookie: Cookie, newCookie: Cookie, callback: ErrorCallback): void; +} + +// @public (undocumented) +export class ParameterError extends Error { +} + +// @public (undocumented) +export const parse: (str: string, options?: { + loose?: boolean | undefined; +} | undefined) => Cookie | null | undefined; + +// @public (undocumented) +export function parseDate(str: string | undefined | null): Date | undefined; + +// @public (undocumented) +export function pathMatch(reqPath: string, cookiePath: string): boolean; + +// @public (undocumented) +export function permuteDomain(domain: string, allowSpecialUseDomain?: boolean): string[] | null; + +// @public +export function permutePath(path: string): string[]; + +// @public (undocumented) +export const PrefixSecurityEnum: Readonly<{ + SILENT: "silent"; + STRICT: "strict"; + DISABLED: "unsafe-disabled"; +}>; + +// @public (undocumented) +export class Store { + constructor(); + // (undocumented) + findCookie(domain: string | null, path: string | null, key: string | undefined): Promise; + // (undocumented) + findCookie(domain: string | null, path: string | null, key: string | undefined, callback: Callback): void; + // (undocumented) + findCookies(domain: string | null, path: string | null, allowSpecialUseDomain?: boolean): Promise; + // (undocumented) + findCookies(domain: string | null, path: string | null, allowSpecialUseDomain?: boolean, callback?: Callback): void; + // (undocumented) + getAllCookies(): Promise; + // (undocumented) + getAllCookies(callback: Callback): void; + // (undocumented) + putCookie(cookie: Cookie): Promise; + // (undocumented) + putCookie(cookie: Cookie, callback: ErrorCallback): void; + // (undocumented) + removeAllCookies(): Promise; + // (undocumented) + removeAllCookies(callback: ErrorCallback): void; + // (undocumented) + removeCookie(domain: string | null | undefined, path: string | null | undefined, key: string | null | undefined): Promise; + // (undocumented) + removeCookie(domain: string | null | undefined, path: string | null | undefined, key: string | null | undefined, callback: ErrorCallback): void; + // (undocumented) + removeCookies(domain: string, path: string | null): Promise; + // (undocumented) + removeCookies(domain: string, path: string | null, callback: ErrorCallback): void; + // (undocumented) + synchronous: boolean; + // (undocumented) + updateCookie(oldCookie: Cookie, newCookie: Cookie): Promise; + // (undocumented) + updateCookie(oldCookie: Cookie, newCookie: Cookie, callback: ErrorCallback): void; +} + +// @public (undocumented) +export const version = "5.0.0-rc.1"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/package.json b/package.json index c7824e0a..4f143fc0 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,9 @@ "!__tests__" ], "scripts": { + "api:dev": "npm run build && npm run api:extract -- --local && npm run api:docs", + "api:docs": "api-documenter markdown --input-folder ./tmp --output-folder ./api/docs", + "api:extract": "api-extractor run --verbose", "build": "npm run clean && tsc", "clean": "rm -rf dist", "version": "genversion --es6 lib/version.ts && git add lib/version.ts", @@ -100,6 +103,8 @@ "node": ">=16" }, "devDependencies": { + "@microsoft/api-documenter": "^7.23.37", + "@microsoft/api-extractor": "^7.42.3", "@types/jest": "^29.5.10", "@types/node": "^14.18.63", "@types/punycode": "^2.1.4",