@octokit-next/types
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -16,3 +16,3 @@ import { Octokit } from "./index.js"; | ||
export type GLOBAL_DEFAULTS = { | ||
export type OCTOKIT_ENDPOINT_DEFAULTS = { | ||
method: "GET"; | ||
@@ -44,3 +44,3 @@ baseUrl: "https://api.github.com"; | ||
TVersion extends keyof Octokit.ApiVersions = "github.com", | ||
TDefaults extends KnownEndpointParameters<TVersion> = GLOBAL_DEFAULTS | ||
TDefaults extends KnownEndpointParameters<TVersion> = OCTOKIT_ENDPOINT_DEFAULTS | ||
> { | ||
@@ -47,0 +47,0 @@ /** |
@@ -0,1 +1,4 @@ | ||
import { HookCollection } from "before-after-hook"; | ||
import { RequestError } from "@octokit-next/request-error"; | ||
import { RequestInterface } from "./request"; | ||
@@ -7,5 +10,7 @@ import { | ||
} from "./auth"; | ||
import { GraphqlInterface } from "./graphql"; | ||
export { EndpointInterface, KnownEndpointParameters } from "./endpoint"; | ||
export { RequestInterface } from "./request"; | ||
export { GraphqlInterface, GraphQlQueryResponseData } from "./graphql"; | ||
export * from "./auth"; | ||
@@ -299,8 +304,8 @@ | ||
Class extends ClassWithPlugins, | ||
Plugins extends [Plugin, ...Plugin[]] | ||
Plugins extends [OctokitPlugin, ...OctokitPlugin[]] | ||
>( | ||
this: Class, | ||
plugins: Plugins | ||
PLUGINS: Plugins | ||
): Class & { | ||
plugins: [...Class["plugins"], ...Plugins]; | ||
PLUGINS: [...Class["PLUGINS"], ...Plugins]; | ||
} & Constructor<UnionToIntersection<ReturnTypeOf<Plugins>>>; | ||
@@ -338,3 +343,3 @@ | ||
this: ClassOne, | ||
defaults: PredefinedOptionsOne & { | ||
DEFAULTS: PredefinedOptionsOne & { | ||
version?: TVersion; | ||
@@ -346,3 +351,3 @@ authStrategy?: TAuthStrategy; | ||
this: ClassTwo, | ||
defaults: PredefinedOptionsTwo & { | ||
DEFAULTS: PredefinedOptionsTwo & { | ||
version?: TVersion; | ||
@@ -357,3 +362,3 @@ authStrategy?: TAuthStrategy; | ||
this: ClassThree, | ||
defaults: PredefinedOptionsThree & { | ||
DEFAULTS: PredefinedOptionsThree & { | ||
version?: TVersion; | ||
@@ -376,3 +381,3 @@ authStrategy?: TAuthStrategy; | ||
*/ | ||
static plugins: Plugin[]; | ||
static PLUGINS: OctokitPlugin[]; | ||
@@ -382,4 +387,5 @@ /** | ||
*/ | ||
static defaults: { | ||
static DEFAULTS: { | ||
baseUrl: string; | ||
userAgent: string; | ||
}; | ||
@@ -418,2 +424,7 @@ | ||
/** | ||
* Send a GraphQL query | ||
*/ | ||
graphql: GraphqlInterface<TVersion>; | ||
/** | ||
* Authenticate based on used strategy. | ||
@@ -424,2 +435,18 @@ */ | ||
: AuthInterface<AuthTokenConfig>; | ||
/** | ||
* Hook API | ||
*/ | ||
hook: HookCollection<{ | ||
request: { | ||
Options: Required<Octokit.EndpointOptions>; | ||
Result: Octokit.Response<unknown, number>; | ||
Error: RequestError | Error; | ||
}; | ||
[key: string]: { | ||
Options: unknown; | ||
Result: unknown; | ||
Error: unknown; | ||
}; | ||
}>; | ||
} | ||
@@ -457,6 +484,6 @@ | ||
ApplyPlugins<OctokitExtensions["plugins"]> & { | ||
defaults: OrObject<OctokitExtensions["defaults"], undefined>; | ||
DEFAULTS: OrObject<OctokitExtensions["defaults"], undefined>; | ||
}; | ||
export declare type Plugin = ( | ||
export declare type OctokitPlugin = ( | ||
instance: Octokit, | ||
@@ -492,3 +519,3 @@ options: Octokit.Options | ||
type ClassWithPlugins = Constructor<any> & { | ||
plugins: Plugin[]; | ||
PLUGINS: OctokitPlugin[]; | ||
}; | ||
@@ -536,3 +563,3 @@ | ||
> = { | ||
defaults: PredefinedOptions; | ||
DEFAULTS: PredefinedOptions; | ||
} & { | ||
@@ -549,3 +576,3 @@ new <NowProvided>( | ||
defaults?: {}; | ||
plugins?: Plugin[]; | ||
plugins?: OctokitPlugin[]; | ||
}; | ||
@@ -555,4 +582,4 @@ | ||
type ApplyPlugins<Plugins extends Plugin[] | undefined> = | ||
Plugins extends Plugin[] | ||
type ApplyPlugins<Plugins extends OctokitPlugin[] | undefined> = | ||
Plugins extends OctokitPlugin[] | ||
? UnionToIntersection<ReturnType<Plugins[number]>> | ||
@@ -559,0 +586,0 @@ : {}; |
@@ -7,3 +7,3 @@ { | ||
"type": "module", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Shared TypeScript definitions for upcoming Octokit SDK", | ||
@@ -18,3 +18,8 @@ "types": "./index.d.ts", | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"dependencies": { | ||
"@octokit-next/request-error": "^2.5.0", | ||
"before-after-hook": "^3.0.2", | ||
"type-fest": "^3.0.0" | ||
} | ||
} |
import { Octokit } from "./index.js"; | ||
import { | ||
KnownEndpointParameters, | ||
GLOBAL_DEFAULTS, | ||
OCTOKIT_ENDPOINT_DEFAULTS, | ||
EndpointInterface, | ||
@@ -49,3 +49,3 @@ } from "./endpoint.js"; | ||
TVersion extends keyof Octokit.ApiVersions = "github.com", | ||
TDefaults extends KnownEndpointParameters<TVersion> = GLOBAL_DEFAULTS | ||
TDefaults extends KnownEndpointParameters<TVersion> = OCTOKIT_ENDPOINT_DEFAULTS | ||
> { | ||
@@ -52,0 +52,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34924
8
1039
3
+ Addedbefore-after-hook@^3.0.2
+ Addedtype-fest@^3.0.0
+ Added@octokit-next/request-error@2.8.0(transitive)
+ Added@octokit-next/types@2.8.0(transitive)
+ Addedbefore-after-hook@3.0.2(transitive)
+ Addedtype-fest@3.13.14.26.1(transitive)