linkedin-api-voyager 1.1.0 → 1.3.1
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/lib/company.js +4 -1
- package/lib/config.js +3 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/posts.d.ts +11 -1
- package/lib/posts.js +83 -6
- package/lib/search.d.ts +3 -26
- package/lib/search.js +163 -112
- package/lib/teste.d.ts +1 -0
- package/lib/teste.js +10 -0
- package/lib/types.d.ts +794 -0
- package/lib/types.js +2 -0
- package/lib/user.d.ts +38 -0
- package/lib/user.js +172 -0
- package/lib/utils.d.ts +35 -0
- package/lib/utils.js +440 -27
- package/package.json +4 -3
- package/lib/account.d.ts +0 -18
- package/lib/account.js +0 -98
- package/lib/linkedin.d.ts +0 -0
- package/lib/linkedin.js +0 -1
package/lib/account.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getProfissionalExperiences = exports.getProfile = void 0;
|
|
13
|
-
const config_1 = require("./config");
|
|
14
|
-
const utils_1 = require("./utils");
|
|
15
|
-
const getProfile = (identifier) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
const response = yield (0, config_1.fetchData)(`/identity/profiles/${identifier}/profileView`);
|
|
18
|
-
const data = response.data;
|
|
19
|
-
const dataResult = response === null || response === void 0 ? void 0 : response.included;
|
|
20
|
-
const getEntityByUrn = (urn) => dataResult.find((item) => item.entityUrn === urn);
|
|
21
|
-
const keyProfile = getEntityByUrn(data === null || data === void 0 ? void 0 : data["*profile"]);
|
|
22
|
-
if (!keyProfile)
|
|
23
|
-
throw new Error("Key profile not found");
|
|
24
|
-
const miniProfile = getEntityByUrn(keyProfile === null || keyProfile === void 0 ? void 0 : keyProfile["*miniProfile"]);
|
|
25
|
-
if (!miniProfile)
|
|
26
|
-
throw new Error("Mini profile not found");
|
|
27
|
-
const profile = {
|
|
28
|
-
// id_urn: keyProfile.entityUrn?.split("urn:li:fs_profile:")[1] || null,
|
|
29
|
-
publicIdentifier: (miniProfile === null || miniProfile === void 0 ? void 0 : miniProfile.publicIdentifier) || null,
|
|
30
|
-
firstName: keyProfile.firstName || null,
|
|
31
|
-
lastName: keyProfile.lastName || null,
|
|
32
|
-
fullName: `${keyProfile.firstName || ""} ${keyProfile.lastName || ""}`,
|
|
33
|
-
birthDate: keyProfile.birthDate
|
|
34
|
-
? JSON.stringify({
|
|
35
|
-
month: keyProfile.birthDate.month,
|
|
36
|
-
day: keyProfile.birthDate.day,
|
|
37
|
-
})
|
|
38
|
-
: null,
|
|
39
|
-
profilePicture: miniProfile.picture
|
|
40
|
-
? `${miniProfile.picture.rootUrl}${(_a = miniProfile.picture.artifacts[miniProfile.picture.artifacts.length - 1]) === null || _a === void 0 ? void 0 : _a.fileIdentifyingUrlPathSegment}`
|
|
41
|
-
: null,
|
|
42
|
-
backgroundPicture: miniProfile.backgroundImage
|
|
43
|
-
? `${miniProfile.backgroundImage.rootUrl}${(_b = miniProfile.backgroundImage.artifacts[miniProfile.backgroundImage.artifacts.length - 1]) === null || _b === void 0 ? void 0 : _b.fileIdentifyingUrlPathSegment}`
|
|
44
|
-
: null,
|
|
45
|
-
location: {
|
|
46
|
-
country: keyProfile.locationName || null,
|
|
47
|
-
city: keyProfile.geoLocationName || null,
|
|
48
|
-
},
|
|
49
|
-
address: keyProfile.address || null,
|
|
50
|
-
industry: keyProfile.industryName || null,
|
|
51
|
-
headline: keyProfile.headline || null,
|
|
52
|
-
summary: keyProfile.summary || null,
|
|
53
|
-
};
|
|
54
|
-
return profile;
|
|
55
|
-
});
|
|
56
|
-
exports.getProfile = getProfile;
|
|
57
|
-
const getProfissionalExperiences = (identifier) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
const response = yield (0, config_1.fetchData)(`/identity/profiles/${identifier}/positions`);
|
|
59
|
-
let { data, included } = response;
|
|
60
|
-
const elements = data["*elements"];
|
|
61
|
-
// Usar a nova função para resolver referências automaticamente
|
|
62
|
-
const dataExperiences = (0, utils_1.extractDataWithReferences)(elements, included);
|
|
63
|
-
// Extrair campos específicos do included
|
|
64
|
-
const extraFields = (0, utils_1.extractFieldsFromIncluded)(included, ["universalName"]);
|
|
65
|
-
// Mapeamento de campos
|
|
66
|
-
const fieldsMap = {
|
|
67
|
-
id: "entityUrn",
|
|
68
|
-
title: "title",
|
|
69
|
-
companyName: "company.miniCompany.name",
|
|
70
|
-
companyUrn: "companyUrn",
|
|
71
|
-
companyEmployeeCount: "company.employeeCountRange",
|
|
72
|
-
companyIndustries: "company.miniCompany.industries",
|
|
73
|
-
description: "description",
|
|
74
|
-
location: "locationName",
|
|
75
|
-
geoLocation: "geoLocationName",
|
|
76
|
-
timePeriod: "timePeriod",
|
|
77
|
-
startDate: "timePeriod.startDate",
|
|
78
|
-
endDate: "timePeriod.endDate",
|
|
79
|
-
};
|
|
80
|
-
// Aplicar mapeamento aos dados resolvidos
|
|
81
|
-
const mappedExperiences = (0, utils_1.extractFields)(dataExperiences, fieldsMap);
|
|
82
|
-
// Associar campos extras
|
|
83
|
-
const experiencesWithExtras = (0, utils_1.mergeExtraFields)(mappedExperiences, extraFields, "companyUrn");
|
|
84
|
-
// Ordenar: sem endDate (ativo) primeiro, depois do mais recente ao mais antigo
|
|
85
|
-
return experiencesWithExtras.sort((a, b) => {
|
|
86
|
-
if (!a.endDate && b.endDate)
|
|
87
|
-
return -1;
|
|
88
|
-
if (a.endDate && !b.endDate)
|
|
89
|
-
return 1;
|
|
90
|
-
if (!a.endDate && !b.endDate)
|
|
91
|
-
return 0;
|
|
92
|
-
const yearDiff = (b.endDate.year || 0) - (a.endDate.year || 0);
|
|
93
|
-
if (yearDiff !== 0)
|
|
94
|
-
return yearDiff;
|
|
95
|
-
return (b.endDate.month || 0) - (a.endDate.month || 0);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
exports.getProfissionalExperiences = getProfissionalExperiences;
|
package/lib/linkedin.d.ts
DELETED
|
File without changes
|
package/lib/linkedin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|