@octokit/app
Advanced tools
Comparing version 11.0.0 to 11.1.0
@@ -190,3 +190,3 @@ 'use strict'; | ||
const VERSION = "11.0.0"; | ||
const VERSION = "11.1.0"; | ||
@@ -467,2 +467,12 @@ function webhooks(appOctokit, options // Explict return type for better debugability and performance, | ||
static defaults(defaults) { | ||
const AppWithDefaults = class extends this { | ||
constructor(...args) { | ||
super(_objectSpread2(_objectSpread2({}, defaults), args[0])); | ||
} | ||
}; | ||
return AppWithDefaults; | ||
} | ||
} | ||
@@ -469,0 +479,0 @@ App.VERSION = VERSION; |
@@ -61,2 +61,13 @@ import { Octokit as OctokitCore } from "@octokit/core"; | ||
} | ||
static defaults(defaults) { | ||
const AppWithDefaults = class extends this { | ||
constructor(...args) { | ||
super({ | ||
...defaults, | ||
...args[0], | ||
}); | ||
} | ||
}; | ||
return AppWithDefaults; | ||
} | ||
} | ||
@@ -63,0 +74,0 @@ App.VERSION = VERSION; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "11.0.0"; | ||
export const VERSION = "11.1.0"; |
@@ -6,4 +6,10 @@ /// <reference types="node" /> | ||
import { webhooks } from "./webhooks"; | ||
declare type Constructor<T> = new (...args: any[]) => T; | ||
export declare class App<O extends Options = Options> { | ||
static VERSION: string; | ||
static defaults<S extends Constructor<any>>(this: S, defaults: Partial<Options>): { | ||
new (...args: any[]): { | ||
[x: string]: any; | ||
}; | ||
} & S; | ||
octokit: OctokitCore; | ||
@@ -25,1 +31,2 @@ webhooks: ReturnType<typeof webhooks>; | ||
export declare function createNodeMiddleware(app: App): (request: import("http").IncomingMessage, response: import("http").ServerResponse) => Promise<void>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "11.0.0"; | ||
export declare const VERSION = "11.1.0"; |
{ | ||
"name": "@octokit/app", | ||
"description": "GitHub Apps toolset for Node.js", | ||
"version": "11.0.0", | ||
"version": "11.1.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
@@ -11,2 +11,3 @@ # app.js | ||
- [Usage](#usage) | ||
- [`App.defaults(options)`](#appdefaultsoptions) | ||
- [Constructor](#constructor) | ||
@@ -102,2 +103,14 @@ - [API](#api) | ||
## `App.defaults(options)` | ||
Create a new `App` with custom defaults for the [constructor options](#constructor-options) | ||
```js | ||
const MyApp = App.defaults({ | ||
Octokit: MyOctokit, | ||
}); | ||
const app = new MyApp({ clientId, clientSecret }); | ||
// app.octokit is now an instance of MyOctokit | ||
``` | ||
## Constructor | ||
@@ -104,0 +117,0 @@ |
Sorry, the diff of this file is not supported yet
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
67403
1049
416