@i.un/libs 1.0.2 → 1.0.4

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.
@@ -1,3 +1,5 @@
1
1
  export * from "./api";
2
2
  export * from "./dom";
3
3
  export * from "./utils";
4
+ export * from "./types";
5
+ export * from "./transform";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * LinkedIn 数据转换
3
+ * 将 rawProfile 数据转换为我们的存储格式
4
+ * 支持多语言:主数据存 primaryLocale,其他语言存 translations
5
+ */
6
+ import type { LinkedinContact, LinkedinCompany } from "./types";
7
+ /**
8
+ * 转换 rawProfile 为 LinkedinContact
9
+ */
10
+ export declare function transformRawProfile(raw: any): LinkedinContact;
11
+ /**
12
+ * 从 rawProfile 中提取公司信息
13
+ * 返回所有出现的公司 (去重)
14
+ */
15
+ export declare function extractCompaniesFromRawProfile(raw: any): LinkedinCompany[];
16
+ /**
17
+ * 转换完整的公司数据 (从 getLinkedinCompany API 返回)
18
+ */
19
+ export declare function transformRawCompany(raw: any): LinkedinCompany;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * LinkedIn 联系人和公司的类型定义
3
+ */
4
+ export interface DateRange {
5
+ year: number;
6
+ month?: number;
7
+ }
8
+ /** 联系人翻译 */
9
+ export interface ContactTranslation {
10
+ firstName?: string;
11
+ lastName?: string;
12
+ headline?: string;
13
+ summary?: string;
14
+ }
15
+ /** 职位翻译 */
16
+ export interface PositionTranslation {
17
+ title?: string;
18
+ description?: string;
19
+ companyName?: string;
20
+ }
21
+ /** 公司翻译 */
22
+ export interface CompanyTranslation {
23
+ name?: string;
24
+ description?: string;
25
+ }
26
+ export interface LinkedinContactEducation {
27
+ school: string;
28
+ degree?: string;
29
+ fieldOfStudy?: string;
30
+ startDate?: DateRange;
31
+ endDate?: DateRange;
32
+ }
33
+ export interface LinkedinContactCertification {
34
+ name: string;
35
+ authority?: string;
36
+ startDate?: DateRange;
37
+ endDate?: DateRange;
38
+ licenseNumber?: string;
39
+ url?: string;
40
+ }
41
+ export interface LinkedinContactLanguage {
42
+ name: string;
43
+ proficiency?: string;
44
+ }
45
+ export interface LinkedinContactHonor {
46
+ title: string;
47
+ issuer?: string;
48
+ issuedOn?: DateRange;
49
+ }
50
+ export interface LinkedinContactPosition {
51
+ linkedinPositionId?: string;
52
+ companyName: string;
53
+ companyLinkedinId?: string;
54
+ companyUniversalName?: string;
55
+ title: string;
56
+ description?: string;
57
+ startDate?: DateRange;
58
+ endDate?: DateRange;
59
+ isCurrent: boolean;
60
+ companyLogoUrl?: string;
61
+ companyIndustry?: string;
62
+ companyEmployeeCountRange?: {
63
+ start: number;
64
+ end?: number;
65
+ };
66
+ translations?: Record<string, PositionTranslation>;
67
+ }
68
+ export interface LinkedinContact {
69
+ id?: string;
70
+ memberId: string;
71
+ publicIdentifier?: string;
72
+ firstName: string;
73
+ lastName: string;
74
+ headline?: string;
75
+ summary?: string;
76
+ location?: string;
77
+ pictureUrl?: string;
78
+ backgroundPictureUrl?: string;
79
+ isPremium?: boolean;
80
+ industry?: string;
81
+ primaryLocale?: string;
82
+ supportedLocales?: string[];
83
+ skills?: string[];
84
+ languages?: LinkedinContactLanguage[];
85
+ honors?: LinkedinContactHonor[];
86
+ educations?: LinkedinContactEducation[];
87
+ certifications?: LinkedinContactCertification[];
88
+ positions?: LinkedinContactPosition[];
89
+ translations?: Record<string, ContactTranslation>;
90
+ fetchedAt?: string;
91
+ }
92
+ export interface LinkedinCompany {
93
+ id?: string;
94
+ linkedinId: string;
95
+ universalName?: string;
96
+ slug?: string;
97
+ name: string;
98
+ description?: string;
99
+ industry?: string;
100
+ employeeCountRange?: {
101
+ start: number;
102
+ end?: number;
103
+ };
104
+ headquarters?: {
105
+ country: string;
106
+ city: string;
107
+ geographicArea?: string;
108
+ postalCode?: string;
109
+ line1?: string;
110
+ };
111
+ logoUrl?: string;
112
+ backgroundCoverUrl?: string;
113
+ specialities?: string[];
114
+ companyType?: string;
115
+ foundedYear?: number;
116
+ websiteUrl?: string;
117
+ jobSearchPageUrl?: string;
118
+ primaryLocale?: string;
119
+ supportedLocales?: string[];
120
+ translations?: Record<string, CompanyTranslation>;
121
+ fetchedAt?: string;
122
+ }
123
+ export interface GetContactResponse {
124
+ data: LinkedinContact | null;
125
+ isExpired: boolean;
126
+ }
127
+ export interface GetCompanyResponse {
128
+ data: LinkedinCompany | null;
129
+ isExpired: boolean;
130
+ }
131
+ /** 联系人信息来源 */
132
+ export declare enum ContactInfoSource {
133
+ PUBLIC = "public",
134
+ MANUAL = "manual",
135
+ APOLLO = "apollo",
136
+ LUSHA = "lusha",
137
+ HUNTER = "hunter",
138
+ ROCKETREACH = "rocketreach",
139
+ SNOV = "snov",
140
+ CLEARBIT = "clearbit"
141
+ }
142
+ /** 查询类型 */
143
+ export declare enum QueryType {
144
+ EMAIL = "email",
145
+ PHONE = "phone",
146
+ BOTH = "both"
147
+ }
148
+ /** 查询联系人信息请求 */
149
+ export interface QueryContactInfoRequest {
150
+ providers: ContactInfoSource[];
151
+ contactId: string;
152
+ }
153
+ /** 邮箱查询结果项 */
154
+ export interface EmailResult {
155
+ email: string;
156
+ source: ContactInfoSource;
157
+ confidenceScore: number | null;
158
+ isVerified: boolean;
159
+ }
160
+ /** 手机号查询结果项 */
161
+ export interface PhoneResult {
162
+ phone: string;
163
+ phoneType: string;
164
+ source: ContactInfoSource;
165
+ confidenceScore: number | null;
166
+ isVerified: boolean;
167
+ }
168
+ /** 查询联系人信息响应 */
169
+ export interface QueryContactInfoResponse {
170
+ queryType: QueryType;
171
+ found: boolean;
172
+ emails?: EmailResult[];
173
+ phones?: PhoneResult[];
174
+ creditsUsed: number;
175
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i.un/libs",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "一个实用的ts函数库",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
@@ -49,4 +49,4 @@
49
49
  "type": "git",
50
50
  "url": "git+https://github.com/zhyswan/libs.git"
51
51
  }
52
- }
52
+ }