@logto/connector-feishu-web 1.0.0-beta.14

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.
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@silverhand/jest-config';
2
+ declare const config: Config.InitialOptions;
3
+ export default config;
@@ -0,0 +1,5 @@
1
+ import type { ConnectorMetadata } from '@logto/connector-kit';
2
+ export declare const codeEndpoint = "https://passport.feishu.cn/suite/passport/oauth/authorize";
3
+ export declare const accessTokenEndpoint = "https://passport.feishu.cn/suite/passport/oauth/token";
4
+ export declare const userInfoEndpoint = "https://passport.feishu.cn/suite/passport/oauth/userinfo";
5
+ export declare const defaultMetadata: ConnectorMetadata;
@@ -0,0 +1,13 @@
1
+ import type { CreateConnector, GetAuthorizationUri, GetConnectorConfig, GetUserInfo, SocialConnector } from '@logto/connector-kit';
2
+ export declare function buildAuthorizationUri(clientId: string, redirectUri: string, state: string): string;
3
+ export declare function getAuthorizationUri(getConfig: GetConnectorConfig): GetAuthorizationUri;
4
+ export declare function authorizationCallbackHandler(data: unknown): Promise<{
5
+ code: string;
6
+ redirectUri: string;
7
+ }>;
8
+ export declare function getAccessToken(code: string, appId: string, appSecret: string, redirectUri: string): Promise<{
9
+ accessToken: string;
10
+ }>;
11
+ export declare function getUserInfo(getConfig: GetConnectorConfig): GetUserInfo;
12
+ declare const createFeishuConnector: CreateConnector<SocialConnector>;
13
+ export default createFeishuConnector;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { FeishuConfig } from './types';
2
+ export declare const mockedTimestamp = "2022-02-22 22:22:22";
3
+ export declare const mockedFeishuConfig: FeishuConfig;
4
+ export declare const mockedFeishuPublicParameters: {
5
+ format: string;
6
+ grantType: string;
7
+ timestamp: string;
8
+ version: string;
9
+ method: string;
10
+ };
@@ -0,0 +1,100 @@
1
+ import { z } from 'zod';
2
+ export declare const feishuConfigGuard: z.ZodObject<{
3
+ appId: z.ZodString;
4
+ appSecret: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ appId: string;
7
+ appSecret: string;
8
+ }, {
9
+ appId: string;
10
+ appSecret: string;
11
+ }>;
12
+ export type FeishuConfig = z.infer<typeof feishuConfigGuard>;
13
+ export declare const feishuAuthCodeGuard: z.ZodObject<{
14
+ code: z.ZodString;
15
+ redirectUri: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ code: string;
18
+ redirectUri: string;
19
+ }, {
20
+ code: string;
21
+ redirectUri: string;
22
+ }>;
23
+ export declare const feishuErrorResponse: z.ZodObject<{
24
+ error: z.ZodString;
25
+ error_description: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ error_description?: string | undefined;
28
+ error: string;
29
+ }, {
30
+ error_description?: string | undefined;
31
+ error: string;
32
+ }>;
33
+ export declare const feishuAccessTokenResponse: z.ZodObject<{
34
+ access_token: z.ZodString;
35
+ token_type: z.ZodString;
36
+ expires_in: z.ZodNumber;
37
+ refresh_token: z.ZodOptional<z.ZodString>;
38
+ refresh_expires_in: z.ZodOptional<z.ZodNumber>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ refresh_token?: string | undefined;
41
+ refresh_expires_in?: number | undefined;
42
+ access_token: string;
43
+ token_type: string;
44
+ expires_in: number;
45
+ }, {
46
+ refresh_token?: string | undefined;
47
+ refresh_expires_in?: number | undefined;
48
+ access_token: string;
49
+ token_type: string;
50
+ expires_in: number;
51
+ }>;
52
+ export declare const feishuUserInfoResponse: z.ZodObject<{
53
+ sub: z.ZodString;
54
+ name: z.ZodString;
55
+ picture: z.ZodString;
56
+ open_id: z.ZodString;
57
+ union_id: z.ZodString;
58
+ en_name: z.ZodString;
59
+ tenant_key: z.ZodString;
60
+ avatar_url: z.ZodString;
61
+ avatar_thumb: z.ZodString;
62
+ avatar_middle: z.ZodString;
63
+ avatar_big: z.ZodString;
64
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
65
+ user_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
66
+ employee_no: z.ZodNullable<z.ZodOptional<z.ZodString>>;
67
+ mobile: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ email?: string | null | undefined;
70
+ user_id?: string | null | undefined;
71
+ employee_no?: string | null | undefined;
72
+ mobile?: string | null | undefined;
73
+ sub: string;
74
+ name: string;
75
+ picture: string;
76
+ open_id: string;
77
+ union_id: string;
78
+ en_name: string;
79
+ tenant_key: string;
80
+ avatar_url: string;
81
+ avatar_thumb: string;
82
+ avatar_middle: string;
83
+ avatar_big: string;
84
+ }, {
85
+ email?: string | null | undefined;
86
+ user_id?: string | null | undefined;
87
+ employee_no?: string | null | undefined;
88
+ mobile?: string | null | undefined;
89
+ sub: string;
90
+ name: string;
91
+ picture: string;
92
+ open_id: string;
93
+ union_id: string;
94
+ en_name: string;
95
+ tenant_key: string;
96
+ avatar_url: string;
97
+ avatar_thumb: string;
98
+ avatar_middle: string;
99
+ avatar_big: string;
100
+ }>;
package/logo.svg ADDED
@@ -0,0 +1,7 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.6547 12.4032C12.6715 12.3871 12.6883 12.3711 12.7051 12.3549C12.7386 12.3225 12.7719 12.2901 12.805 12.2574L12.8727 12.1905L13.078 11.9876L13.3567 11.7123L13.5961 11.4757L13.821 11.2535L14.0556 11.0217L14.2708 10.809L14.5705 10.5129C14.6275 10.457 14.6855 10.4021 14.7444 10.3482C14.8531 10.2489 14.9649 10.153 15.08 10.0608C15.1854 9.97624 15.2933 9.89487 15.4038 9.81658C15.5585 9.70696 15.7179 9.6038 15.882 9.50704C16.0423 9.41251 16.2068 9.3245 16.3755 9.24301C16.5338 9.16653 16.6953 9.09615 16.8603 9.0318C16.9521 8.996 17.045 8.9622 17.1387 8.93027C17.1857 8.91433 17.2329 8.89888 17.2803 8.88391C16.8644 7.24735 16.1026 5.71897 15.0462 4.40167C14.9452 4.27611 14.8174 4.17484 14.672 4.10533C14.5267 4.03583 14.3676 3.99986 14.2065 4.0001L5.57655 4C5.54247 3.99997 5.50927 4.01073 5.48169 4.03073C5.4541 4.05073 5.43356 4.07895 5.42299 4.11134C5.41243 4.14373 5.41239 4.17863 5.42287 4.21105C5.43337 4.24347 5.45384 4.27174 5.48138 4.2918C8.42731 6.45092 10.8683 9.22508 12.635 12.4218L12.6547 12.4032Z" fill="#00D6B9"/>
3
+ <path d="M19.5961 13.9055L19.5903 13.9157L19.5969 13.906L19.6367 13.8311C19.6231 13.8559 19.6098 13.8809 19.5961 13.9055Z" fill="#133C9A"/>
4
+ <path d="M19.782 13.5575L19.7926 13.5376L19.7977 13.5273C19.7925 13.5375 19.7872 13.5474 19.782 13.5575Z" fill="#133C9A"/>
5
+ <path d="M22.3201 9.26579C20.8165 8.52906 19.0941 8.37182 17.4818 8.82394C17.4142 8.84295 17.347 8.86299 17.2802 8.88406C17.2329 8.89903 17.1856 8.91448 17.1387 8.93042C17.0449 8.96229 16.9522 8.99615 16.8602 9.03195C16.6954 9.09617 16.5338 9.16662 16.3755 9.24316C16.2069 9.32453 16.0424 9.41254 15.8819 9.50718C15.718 9.60383 15.5586 9.70699 15.4038 9.81673C15.2933 9.89496 15.1854 9.97639 15.0799 10.061C14.965 10.1531 14.8531 10.249 14.7444 10.3484C14.6855 10.4022 14.6275 10.4571 14.5705 10.5131L14.2708 10.8092L14.0556 11.0218L13.821 11.2537L13.5961 11.4759L13.3566 11.7124L13.0779 11.9878L12.8727 12.1906L12.805 12.2575C12.7718 12.2902 12.7385 12.3227 12.705 12.355C12.6883 12.3712 12.6715 12.3873 12.6546 12.4033C12.6294 12.4274 12.604 12.4514 12.5785 12.4753C12.5504 12.5017 12.5221 12.5279 12.4937 12.5539C11.7517 13.2357 10.9259 13.8205 10.0364 14.294C10.0895 14.319 10.1427 14.3439 10.1961 14.3686C10.2382 14.3881 10.2805 14.4075 10.3228 14.4268C10.3637 14.4455 10.4047 14.464 10.4456 14.4825C10.486 14.5007 10.5264 14.5187 10.5669 14.5366C10.6112 14.5562 10.6555 14.5758 10.6998 14.5952C10.751 14.6175 10.8022 14.6397 10.8535 14.6616C10.9026 14.6827 10.9518 14.7036 11.0011 14.7244C11.0648 14.7513 11.1288 14.7779 11.1929 14.8043C11.2444 14.8255 11.2959 14.8465 11.3475 14.8674C11.4269 14.8995 11.5065 14.9312 11.5863 14.9625C11.6616 14.992 11.737 15.0212 11.8127 15.0501C11.8692 15.0717 11.9259 15.0931 11.9826 15.1142C12.0801 15.1507 12.178 15.1866 12.2762 15.2219C12.3258 15.2397 12.3754 15.2574 12.4251 15.2749C12.4945 15.2994 12.5641 15.3236 12.6338 15.3475C12.6911 15.3672 12.7485 15.3867 12.806 15.406C12.89 15.4342 12.9743 15.4621 13.0589 15.4895C13.1475 15.5182 13.2365 15.5466 13.3258 15.5744C13.4347 15.6084 13.5439 15.6418 13.6536 15.6745C13.7268 15.6964 13.8003 15.7179 13.8738 15.7391C14.0212 15.7817 14.1692 15.8231 14.318 15.8633C14.3714 15.8777 14.4248 15.8913 14.4781 15.904C14.5795 15.9282 14.6807 15.9492 14.7816 15.9672C14.8977 15.9879 15.0134 16.0045 15.1285 16.0171C15.2855 16.0342 15.4414 16.0441 15.596 16.0464C15.7372 16.0487 15.8771 16.0449 16.0158 16.0351C16.1479 16.0257 16.2786 16.0111 16.408 15.991C16.5862 15.9634 16.7626 15.9255 16.9363 15.8774C17.0527 15.8451 17.1674 15.8083 17.2804 15.7671C17.3848 15.729 17.4875 15.6871 17.5887 15.6416C17.7052 15.5891 17.8193 15.5317 17.931 15.4694C17.9859 15.4387 18.0403 15.4069 18.0939 15.374C18.1454 15.3424 18.1964 15.3096 18.2467 15.2759C18.3261 15.2227 18.4039 15.1668 18.4801 15.1083C18.5453 15.0583 18.6091 15.0065 18.6718 14.9528C18.7844 14.8563 18.8928 14.7539 18.9969 14.6455C19.048 14.5923 19.0981 14.5377 19.147 14.4816C19.209 14.4107 19.2691 14.3376 19.3274 14.2622C19.3738 14.2022 19.419 14.1408 19.463 14.0779C19.5872 13.9004 19.6997 13.715 19.8 13.523L19.9154 13.2927L20.9586 11.2129L20.9569 11.2171C21.2891 10.4893 21.7511 9.82813 22.3201 9.26579Z" fill="#133C9A"/>
6
+ <path d="M9.23236 20.0004C11.3464 20.0012 13.4221 19.4365 15.2443 18.3649C17.0666 17.2934 18.5691 15.7539 19.5961 13.9061C19.6672 13.7785 19.736 13.6494 19.8025 13.5189C19.7017 13.7126 19.5883 13.8995 19.4632 14.0783C19.4192 14.1412 19.3739 14.2025 19.3275 14.2626C19.2692 14.3379 19.2092 14.4111 19.1472 14.482C19.0982 14.538 19.0482 14.5927 18.997 14.6459C18.893 14.7542 18.7846 14.8566 18.6719 14.9532C18.6093 15.0069 18.5454 15.0587 18.4803 15.1086C18.4041 15.1671 18.3263 15.223 18.2468 15.2763C18.1965 15.31 18.1456 15.3427 18.094 15.3744C18.0404 15.4073 17.9861 15.4391 17.9311 15.4697C17.8195 15.532 17.7054 15.5894 17.5888 15.642C17.4877 15.6875 17.3849 15.7294 17.2805 15.7675C17.1676 15.8087 17.0529 15.8454 16.9364 15.8777C16.7627 15.9258 16.5863 15.9638 16.4081 15.9913C16.2788 16.0114 16.1481 16.0261 16.0159 16.0355C15.8774 16.0452 15.7374 16.049 15.5962 16.0468C15.4416 16.0444 15.2858 16.0346 15.1286 16.0175C15.0135 16.0049 14.8979 15.9882 14.7818 15.9676C14.6809 15.9496 14.5797 15.9286 14.4783 15.9044C14.425 15.8917 14.3715 15.8781 14.3181 15.8637C14.1693 15.8235 14.0213 15.7821 13.8739 15.7396C13.8003 15.7183 13.727 15.6968 13.6538 15.6749C13.5441 15.6422 13.4348 15.6088 13.3259 15.5748C13.2367 15.5469 13.1477 15.5186 13.059 15.4898C12.9744 15.4624 12.8902 15.4346 12.8061 15.4064C12.7486 15.3871 12.6912 15.3677 12.6339 15.348C12.5642 15.324 12.4946 15.2998 12.4252 15.2753C12.3755 15.2577 12.3259 15.2401 12.2763 15.2223C12.1781 15.1869 12.0803 15.1511 11.9827 15.1146C11.926 15.0934 11.8694 15.0721 11.8129 15.0505C11.7372 15.0216 11.6617 14.9924 11.5865 14.9629C11.5066 14.9315 11.427 14.8999 11.3477 14.8678C11.296 14.8469 11.2445 14.8258 11.1931 14.8047C11.129 14.7783 11.065 14.7517 11.0012 14.7248C10.9519 14.704 10.9027 14.6831 10.8536 14.662C10.8023 14.6401 10.7511 14.6179 10.7 14.5956C10.6556 14.5762 10.6113 14.5567 10.567 14.5371C10.5265 14.5191 10.4862 14.501 10.4458 14.4829C10.4048 14.4644 10.3638 14.4459 10.3229 14.4272C10.2806 14.4079 10.2384 14.3885 10.1962 14.369C10.1429 14.3443 10.0896 14.3194 10.0365 14.2944C9.98074 14.2681 9.92515 14.2416 9.86967 14.215C9.81021 14.1864 9.75088 14.1576 9.69166 14.1285C9.64114 14.1038 9.59079 14.0789 9.54051 14.0537C6.89238 12.7326 4.50114 10.9497 2.47911 8.78882C2.45696 8.76522 2.42822 8.7488 2.39661 8.74168C2.36501 8.73462 2.33201 8.73721 2.3019 8.74917C2.2718 8.76106 2.24598 8.78176 2.22779 8.80856C2.20961 8.83536 2.19991 8.86706 2.19995 8.89941L2.20425 16.5148L2.20423 17.1326C2.20373 17.3094 2.24691 17.4835 2.32994 17.6395C2.41297 17.7956 2.53328 17.9287 2.68016 18.0271C4.62141 19.3175 6.90135 20.0041 9.23236 20.0004Z" fill="#3370FF"/>
7
+ </svg>
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "main": "./lib/index.js",
3
+ "exports": "./lib/index.js",
4
+ "license": "MPL-2.0",
5
+ "files": [
6
+ "lib",
7
+ "docs",
8
+ "logo.svg",
9
+ "logo-dark.svg"
10
+ ],
11
+ "dependencies": {
12
+ "@logto/connector-kit": "1.0.0-beta.32",
13
+ "@silverhand/essentials": "^1.2.0",
14
+ "got": "^11.8.2",
15
+ "snakecase-keys": "^5.1.0",
16
+ "zod": "^3.20.2"
17
+ },
18
+ "devDependencies": {
19
+ "iconv-lite": "0.6.3",
20
+ "@jest/types": "^29.3.1",
21
+ "@silverhand/eslint-config": "1.3.0",
22
+ "@silverhand/ts-config": "1.2.1",
23
+ "@silverhand/jest-config": "1.2.2",
24
+ "@types/jest": "^29.2.4",
25
+ "@types/node": "^16.3.1",
26
+ "@vercel/ncc": "^0.36.0",
27
+ "@types/supertest": "^2.0.11",
28
+ "eslint": "^8.21.0",
29
+ "jest": "^29.3.1",
30
+ "jest-matcher-specific-error": "^1.0.0",
31
+ "lint-staged": "^13.0.0",
32
+ "nock": "^13.2.2",
33
+ "prettier": "^2.7.1",
34
+ "supertest": "^6.2.2",
35
+ "typescript": "^4.9.4"
36
+ },
37
+ "engines": {
38
+ "node": "^16.13.0 || ^18.12.0"
39
+ },
40
+ "eslintConfig": {
41
+ "extends": "@silverhand"
42
+ },
43
+ "prettier": "@silverhand/eslint-config/.prettierrc",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "name": "@logto/connector-feishu-web",
48
+ "version": "1.0.0-beta.14",
49
+ "description": "Feishu web connector.",
50
+ "author": "Silverhand Inc. <contact@silverhand.io>",
51
+ "scripts": {
52
+ "package:sync": "cd ../../ && pnpm package:sync",
53
+ "precommit": "lint-staged",
54
+ "build": "rm -rf lib/ && ncc build src/index.ts -o lib",
55
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
56
+ "lint": "eslint --ext .ts src",
57
+ "lint:report": "pnpm lint --format json --output-file report.json",
58
+ "test": "jest",
59
+ "test:coverage": "pnpm run test --coverage --silent"
60
+ }
61
+ }