@thejob/util 1.0.25 → 1.0.26
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/dist/cjs/user/utils.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
|
+
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
4
|
+
*
|
|
5
|
+
* Strategy:
|
|
6
|
+
* 1. Core identity (headline + location)
|
|
7
|
+
* 2. About me (intent/personality signal)
|
|
8
|
+
* 3. Flattened structured data (skills, experience, education)
|
|
9
|
+
*/
|
|
10
|
+
export declare function prepareUserForEmbedding(user: {
|
|
11
|
+
headline?: string;
|
|
12
|
+
aboutMe?: string;
|
|
13
|
+
location?: {
|
|
14
|
+
city?: string;
|
|
15
|
+
stateCode?: string;
|
|
16
|
+
state?: string;
|
|
17
|
+
country?: string;
|
|
18
|
+
};
|
|
19
|
+
skills?: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
experienceLevel?: string;
|
|
23
|
+
workExperiences?: Array<{
|
|
24
|
+
title?: string;
|
|
25
|
+
company?: string;
|
|
26
|
+
}>;
|
|
27
|
+
educations?: Array<{
|
|
28
|
+
degree?: string;
|
|
29
|
+
fieldOfStudy?: string;
|
|
30
|
+
institution?: string;
|
|
31
|
+
}>;
|
|
32
|
+
languages?: Array<{
|
|
33
|
+
name: string;
|
|
34
|
+
}>;
|
|
35
|
+
}): string;
|
|
1
36
|
export declare const parseName: (name: string | {
|
|
2
37
|
first: string;
|
|
3
38
|
last?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CA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defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseName = void 0;
|
|
4
|
+
exports.prepareUserForEmbedding = prepareUserForEmbedding;
|
|
5
|
+
/**
|
|
6
|
+
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
7
|
+
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
8
|
+
*
|
|
9
|
+
* Strategy:
|
|
10
|
+
* 1. Core identity (headline + location)
|
|
11
|
+
* 2. About me (intent/personality signal)
|
|
12
|
+
* 3. Flattened structured data (skills, experience, education)
|
|
13
|
+
*/
|
|
14
|
+
function prepareUserForEmbedding(user) {
|
|
15
|
+
const headline = user.headline?.trim() || '';
|
|
16
|
+
const about = user.aboutMe?.replace(/\n/g, ' ').trim() || '';
|
|
17
|
+
const locationParts = [
|
|
18
|
+
user.location?.city,
|
|
19
|
+
user.location?.stateCode || user.location?.state,
|
|
20
|
+
user.location?.country,
|
|
21
|
+
].filter(Boolean);
|
|
22
|
+
const location = locationParts.join(', ');
|
|
23
|
+
const skillsList = user.skills
|
|
24
|
+
?.map((s) => s.name.toLowerCase())
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join(', ') || '';
|
|
27
|
+
const experienceList = user.workExperiences
|
|
28
|
+
?.map((w) => [w.title, w.company].filter(Boolean).join(' at '))
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join('; ') || '';
|
|
31
|
+
const educationList = user.educations
|
|
32
|
+
?.map((e) => [e.degree, e.fieldOfStudy, e.institution ? `at ${e.institution}` : '']
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join(' '))
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join('; ') || '';
|
|
37
|
+
const languagesList = user.languages
|
|
38
|
+
?.map((l) => l.name)
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.join(', ') || '';
|
|
41
|
+
const parts = [];
|
|
42
|
+
if (headline)
|
|
43
|
+
parts.push(`Headline: ${headline}`);
|
|
44
|
+
if (about)
|
|
45
|
+
parts.push(`About: ${about}`);
|
|
46
|
+
if (skillsList)
|
|
47
|
+
parts.push(`Skills: ${skillsList}`);
|
|
48
|
+
if (location)
|
|
49
|
+
parts.push(`Location: ${location}`);
|
|
50
|
+
if (user.experienceLevel)
|
|
51
|
+
parts.push(`Level: ${user.experienceLevel}`);
|
|
52
|
+
if (experienceList)
|
|
53
|
+
parts.push(`Experience: ${experienceList}`);
|
|
54
|
+
if (educationList)
|
|
55
|
+
parts.push(`Education: ${educationList}`);
|
|
56
|
+
if (languagesList)
|
|
57
|
+
parts.push(`Languages: ${languagesList}`);
|
|
58
|
+
return parts.join('. ').replace(/\s\s+/g, ' ').trim();
|
|
59
|
+
}
|
|
4
60
|
const parseName = (name) => {
|
|
5
61
|
if (typeof name === "string") {
|
|
6
62
|
const nameParts = name.trim().split(/\s+/); // Split by spaces, ensuring no extra whitespace
|
package/dist/esm/user/utils.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
|
+
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
4
|
+
*
|
|
5
|
+
* Strategy:
|
|
6
|
+
* 1. Core identity (headline + location)
|
|
7
|
+
* 2. About me (intent/personality signal)
|
|
8
|
+
* 3. Flattened structured data (skills, experience, education)
|
|
9
|
+
*/
|
|
10
|
+
export declare function prepareUserForEmbedding(user: {
|
|
11
|
+
headline?: string;
|
|
12
|
+
aboutMe?: string;
|
|
13
|
+
location?: {
|
|
14
|
+
city?: string;
|
|
15
|
+
stateCode?: string;
|
|
16
|
+
state?: string;
|
|
17
|
+
country?: string;
|
|
18
|
+
};
|
|
19
|
+
skills?: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
experienceLevel?: string;
|
|
23
|
+
workExperiences?: Array<{
|
|
24
|
+
title?: string;
|
|
25
|
+
company?: string;
|
|
26
|
+
}>;
|
|
27
|
+
educations?: Array<{
|
|
28
|
+
degree?: string;
|
|
29
|
+
fieldOfStudy?: string;
|
|
30
|
+
institution?: string;
|
|
31
|
+
}>;
|
|
32
|
+
languages?: Array<{
|
|
33
|
+
name: string;
|
|
34
|
+
}>;
|
|
35
|
+
}): string;
|
|
1
36
|
export declare const parseName: (name: string | {
|
|
2
37
|
first: string;
|
|
3
38
|
last?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;WAAvB,MAAM;WAAS,MAAM;CAWtE,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrF,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,GAAG,MAAM,CA8CT;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;WAAvB,MAAM;WAAS,MAAM;CAWtE,CAAC"}
|
package/dist/esm/user/utils.js
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
|
+
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
4
|
+
*
|
|
5
|
+
* Strategy:
|
|
6
|
+
* 1. Core identity (headline + location)
|
|
7
|
+
* 2. About me (intent/personality signal)
|
|
8
|
+
* 3. Flattened structured data (skills, experience, education)
|
|
9
|
+
*/
|
|
10
|
+
export function prepareUserForEmbedding(user) {
|
|
11
|
+
const headline = user.headline?.trim() || '';
|
|
12
|
+
const about = user.aboutMe?.replace(/\n/g, ' ').trim() || '';
|
|
13
|
+
const locationParts = [
|
|
14
|
+
user.location?.city,
|
|
15
|
+
user.location?.stateCode || user.location?.state,
|
|
16
|
+
user.location?.country,
|
|
17
|
+
].filter(Boolean);
|
|
18
|
+
const location = locationParts.join(', ');
|
|
19
|
+
const skillsList = user.skills
|
|
20
|
+
?.map((s) => s.name.toLowerCase())
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(', ') || '';
|
|
23
|
+
const experienceList = user.workExperiences
|
|
24
|
+
?.map((w) => [w.title, w.company].filter(Boolean).join(' at '))
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join('; ') || '';
|
|
27
|
+
const educationList = user.educations
|
|
28
|
+
?.map((e) => [e.degree, e.fieldOfStudy, e.institution ? `at ${e.institution}` : '']
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(' '))
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.join('; ') || '';
|
|
33
|
+
const languagesList = user.languages
|
|
34
|
+
?.map((l) => l.name)
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join(', ') || '';
|
|
37
|
+
const parts = [];
|
|
38
|
+
if (headline)
|
|
39
|
+
parts.push(`Headline: ${headline}`);
|
|
40
|
+
if (about)
|
|
41
|
+
parts.push(`About: ${about}`);
|
|
42
|
+
if (skillsList)
|
|
43
|
+
parts.push(`Skills: ${skillsList}`);
|
|
44
|
+
if (location)
|
|
45
|
+
parts.push(`Location: ${location}`);
|
|
46
|
+
if (user.experienceLevel)
|
|
47
|
+
parts.push(`Level: ${user.experienceLevel}`);
|
|
48
|
+
if (experienceList)
|
|
49
|
+
parts.push(`Experience: ${experienceList}`);
|
|
50
|
+
if (educationList)
|
|
51
|
+
parts.push(`Education: ${educationList}`);
|
|
52
|
+
if (languagesList)
|
|
53
|
+
parts.push(`Languages: ${languagesList}`);
|
|
54
|
+
return parts.join('. ').replace(/\s\s+/g, ' ').trim();
|
|
55
|
+
}
|
|
1
56
|
export const parseName = (name) => {
|
|
2
57
|
if (typeof name === "string") {
|
|
3
58
|
const nameParts = name.trim().split(/\s+/); // Split by spaces, ensuring no extra whitespace
|