@logto/connector-github 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +135 -0
- package/docs/config-template.json +4 -0
- package/lib/index.js +15636 -0
- package/lib/jest.config.d.ts +3 -0
- package/lib/src/constant.d.ts +7 -0
- package/lib/src/index.d.ts +9 -0
- package/lib/src/index.test.d.ts +1 -0
- package/lib/src/mock.d.ts +4 -0
- package/lib/src/types.d.ts +63 -0
- package/logo-dark.svg +3 -0
- package/logo.svg +3 -0
- package/package.json +60 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConnectorMetadata } from '@logto/connector-kit';
|
|
2
|
+
export declare const authorizationEndpoint = "https://github.com/login/oauth/authorize";
|
|
3
|
+
export declare const scope = "read:user";
|
|
4
|
+
export declare const accessTokenEndpoint = "https://github.com/login/oauth/access_token";
|
|
5
|
+
export declare const userInfoEndpoint = "https://api.github.com/user";
|
|
6
|
+
export declare const defaultMetadata: ConnectorMetadata;
|
|
7
|
+
export declare const defaultTimeout = 5000;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SocialConnector, CreateConnector } from '@logto/connector-kit';
|
|
2
|
+
import { GithubConfig } from './types';
|
|
3
|
+
export declare const getAccessToken: (config: GithubConfig, codeObject: {
|
|
4
|
+
code: string;
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
accessToken: string;
|
|
7
|
+
}>;
|
|
8
|
+
declare const createGithubConnector: CreateConnector<SocialConnector>;
|
|
9
|
+
export default createGithubConnector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const githubConfigGuard: z.ZodObject<{
|
|
3
|
+
clientId: z.ZodString;
|
|
4
|
+
clientSecret: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
clientId: string;
|
|
7
|
+
clientSecret: string;
|
|
8
|
+
}, {
|
|
9
|
+
clientId: string;
|
|
10
|
+
clientSecret: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare type GithubConfig = z.infer<typeof githubConfigGuard>;
|
|
13
|
+
export declare const accessTokenResponseGuard: z.ZodObject<{
|
|
14
|
+
access_token: z.ZodString;
|
|
15
|
+
scope: z.ZodString;
|
|
16
|
+
token_type: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
scope: string;
|
|
19
|
+
access_token: string;
|
|
20
|
+
token_type: string;
|
|
21
|
+
}, {
|
|
22
|
+
scope: string;
|
|
23
|
+
access_token: string;
|
|
24
|
+
token_type: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare type AccessTokenResponse = z.infer<typeof accessTokenResponseGuard>;
|
|
27
|
+
export declare const userInfoResponseGuard: z.ZodObject<{
|
|
28
|
+
id: z.ZodNumber;
|
|
29
|
+
avatar_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
30
|
+
email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
avatar_url?: string | null | undefined;
|
|
34
|
+
email?: string | null | undefined;
|
|
35
|
+
name?: string | null | undefined;
|
|
36
|
+
id: number;
|
|
37
|
+
}, {
|
|
38
|
+
avatar_url?: string | null | undefined;
|
|
39
|
+
email?: string | null | undefined;
|
|
40
|
+
name?: string | null | undefined;
|
|
41
|
+
id: number;
|
|
42
|
+
}>;
|
|
43
|
+
export declare type UserInfoResponse = z.infer<typeof userInfoResponseGuard>;
|
|
44
|
+
export declare const authorizationCallbackErrorGuard: z.ZodObject<{
|
|
45
|
+
error: z.ZodString;
|
|
46
|
+
error_description: z.ZodString;
|
|
47
|
+
error_uri: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
error: string;
|
|
50
|
+
error_description: string;
|
|
51
|
+
error_uri: string;
|
|
52
|
+
}, {
|
|
53
|
+
error: string;
|
|
54
|
+
error_description: string;
|
|
55
|
+
error_uri: string;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const authResponseGuard: z.ZodObject<{
|
|
58
|
+
code: z.ZodString;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
code: string;
|
|
61
|
+
}, {
|
|
62
|
+
code: string;
|
|
63
|
+
}>;
|
package/logo-dark.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 2.24658C9.62547 2.24668 7.32846 3.0917 5.51996 4.63043C3.71146 6.16916 2.5095 8.3012 2.12913 10.6451C1.74876 12.9889 2.21481 15.3917 3.4439 17.4233C4.67298 19.455 6.58488 20.9831 8.83752 21.7341C9.33752 21.8216 9.52502 21.5216 9.52502 21.2591C9.52502 21.0216 9.51251 20.2341 9.51251 19.3966C7 19.8591 6.35 18.7841 6.15 18.2216C5.92807 17.6745 5.57627 17.1897 5.125 16.8091C4.775 16.6216 4.275 16.1591 5.11249 16.1466C5.43227 16.1813 5.73898 16.2926 6.00663 16.471C6.27427 16.6494 6.49496 16.8897 6.65 17.1716C6.78677 17.4173 6.97068 17.6336 7.19119 17.8081C7.4117 17.9826 7.66447 18.1118 7.93503 18.1885C8.20559 18.2651 8.48861 18.2876 8.76788 18.2547C9.04714 18.2218 9.31717 18.134 9.56248 17.9966C9.60577 17.4882 9.83234 17.0129 10.2 16.6591C7.975 16.4091 5.65 15.5466 5.65 11.7216C5.63594 10.7278 6.00268 9.76619 6.675 9.03411C6.36928 8.17033 6.40505 7.2224 6.775 6.38411C6.775 6.38411 7.61247 6.1216 9.525 7.40911C11.1613 6.95909 12.8887 6.95909 14.525 7.40911C16.4375 6.10911 17.275 6.38411 17.275 6.38411C17.645 7.22238 17.6808 8.17034 17.375 9.03411C18.0493 9.76494 18.4164 10.7273 18.4 11.7216C18.4 15.5591 16.0625 16.4091 13.8375 16.6591C14.0761 16.901 14.2599 17.1914 14.3764 17.5106C14.4929 17.8298 14.5393 18.1704 14.5125 18.5091C14.5125 19.8466 14.5 20.9216 14.5 21.2591C14.5 21.5216 14.6875 21.8341 15.1875 21.7341C17.4362 20.977 19.3426 19.4453 20.5664 17.4126C21.7903 15.3799 22.2519 12.9784 21.8689 10.6368C21.4859 8.29523 20.2832 6.16595 18.4755 4.62909C16.6678 3.09223 14.3727 2.24782 12 2.24658Z" fill="white"/>
|
|
3
|
+
</svg>
|
package/logo.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 2.2467C9.6255 2.2468 7.32849 3.09182 5.51999 4.63055C3.71149 6.16929 2.50953 8.30133 2.12916 10.6452C1.74879 12.989 2.21485 15.3918 3.44393 17.4235C4.67301 19.4551 6.58491 20.9832 8.83755 21.7342C9.33755 21.8217 9.52505 21.5217 9.52505 21.2592C9.52505 21.0217 9.51254 20.2342 9.51254 19.3967C7.00003 19.8592 6.35003 18.7842 6.15003 18.2217C5.9281 17.6747 5.5763 17.1899 5.12503 16.8092C4.77503 16.6217 4.27503 16.1592 5.11252 16.1467C5.4323 16.1814 5.73901 16.2927 6.00666 16.4711C6.2743 16.6495 6.49499 16.8899 6.65003 17.1717C6.7868 17.4174 6.97071 17.6337 7.19122 17.8082C7.41173 17.9827 7.6645 18.112 7.93506 18.1886C8.20562 18.2652 8.48864 18.2877 8.76791 18.2548C9.04717 18.2219 9.3172 18.1342 9.56251 17.9967C9.6058 17.4883 9.83237 17.013 10.2 16.6592C7.97503 16.4092 5.65003 15.5467 5.65003 11.7217C5.63597 10.7279 6.00271 9.76631 6.67503 9.03423C6.36931 8.17045 6.40508 7.22252 6.77503 6.38423C6.77503 6.38423 7.6125 6.12172 9.52503 7.40923C11.1613 6.95921 12.8887 6.95921 14.525 7.40923C16.4375 6.10923 17.275 6.38423 17.275 6.38423C17.645 7.22251 17.6808 8.17046 17.375 9.03423C18.0494 9.76506 18.4164 10.7275 18.4 11.7217C18.4 15.5592 16.0625 16.4092 13.8375 16.6592C14.0762 16.9011 14.26 17.1915 14.3764 17.5107C14.4929 17.83 14.5393 18.1705 14.5125 18.5092C14.5125 19.8468 14.5 20.9217 14.5 21.2592C14.5 21.5217 14.6875 21.8342 15.1875 21.7342C17.4362 20.9771 19.3426 19.4455 20.5664 17.4128C21.7903 15.38 22.2519 12.9785 21.8689 10.6369C21.4859 8.29535 20.2832 6.16608 18.4755 4.62922C16.6678 3.09235 14.3727 2.24794 12 2.2467Z" fill="black"/>
|
|
3
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@logto/connector-github",
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
|
+
"description": "Github web connector implementation.",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"exports": "./lib/index.js",
|
|
7
|
+
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
8
|
+
"license": "MPL-2.0",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"docs",
|
|
12
|
+
"logo.svg",
|
|
13
|
+
"README.md",
|
|
14
|
+
"logo-dark.svg"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"precommit": "lint-staged",
|
|
18
|
+
"build": "rm -rf lib/ && ncc build src/index.ts -o lib",
|
|
19
|
+
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
|
|
20
|
+
"lint": "eslint --ext .ts src",
|
|
21
|
+
"lint:report": "pnpm lint --format json --output-file report.json",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:coverage": "jest --coverage --silent",
|
|
24
|
+
"prepack": "pnpm build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@logto/connector-kit": "^1.0.0-beta.13",
|
|
28
|
+
"@silverhand/essentials": "^1.2.0",
|
|
29
|
+
"@silverhand/jest-config": "1.0.0",
|
|
30
|
+
"got": "^11.8.2",
|
|
31
|
+
"query-string": "^7.0.1",
|
|
32
|
+
"zod": "^3.14.3"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@jest/types": "^28.1.3",
|
|
36
|
+
"@silverhand/eslint-config": "1.0.0",
|
|
37
|
+
"@silverhand/ts-config": "1.0.0",
|
|
38
|
+
"@types/jest": "^28.1.6",
|
|
39
|
+
"@types/node": "^16.3.1",
|
|
40
|
+
"@vercel/ncc": "^0.34.0",
|
|
41
|
+
"eslint": "^8.21.0",
|
|
42
|
+
"jest": "^28.1.3",
|
|
43
|
+
"jest-matcher-specific-error": "^1.0.0",
|
|
44
|
+
"lint-staged": "^13.0.0",
|
|
45
|
+
"nock": "^13.2.2",
|
|
46
|
+
"prettier": "^2.7.1",
|
|
47
|
+
"typescript": "^4.7.4"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "^16.0.0"
|
|
51
|
+
},
|
|
52
|
+
"eslintConfig": {
|
|
53
|
+
"extends": "@silverhand"
|
|
54
|
+
},
|
|
55
|
+
"prettier": "@silverhand/eslint-config/.prettierrc",
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "8995e8586ab2fb00fbb58a1c4d0032d67c30948d"
|
|
60
|
+
}
|