@thejob/util 1.0.26 → 1.0.28
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 +2 -26
- package/dist/cjs/user/utils.d.ts.map +1 -1
- package/dist/cjs/user/utils.js +30 -16
- package/dist/esm/user/utils.d.ts +2 -26
- package/dist/esm/user/utils.d.ts.map +1 -1
- package/dist/esm/user/utils.js +29 -15
- package/package.json +1 -1
package/dist/cjs/user/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TUserSchema } from "@thejob/schema";
|
|
1
2
|
/**
|
|
2
3
|
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
4
|
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
@@ -7,32 +8,7 @@
|
|
|
7
8
|
* 2. About me (intent/personality signal)
|
|
8
9
|
* 3. Flattened structured data (skills, experience, education)
|
|
9
10
|
*/
|
|
10
|
-
export declare function
|
|
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;
|
|
11
|
+
export declare function prepareUserForEmbedding1(user: TUserSchema): string;
|
|
36
12
|
export declare const parseName: (name: string | {
|
|
37
13
|
first: string;
|
|
38
14
|
last?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAmElE;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/cjs/user/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseName = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.prepareUserForEmbedding1 = prepareUserForEmbedding1;
|
|
5
|
+
const common_1 = require("../common");
|
|
5
6
|
/**
|
|
6
7
|
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
7
8
|
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
@@ -11,33 +12,46 @@ exports.prepareUserForEmbedding = prepareUserForEmbedding;
|
|
|
11
12
|
* 2. About me (intent/personality signal)
|
|
12
13
|
* 3. Flattened structured data (skills, experience, education)
|
|
13
14
|
*/
|
|
14
|
-
function
|
|
15
|
-
const headline = user.headline?.trim() ||
|
|
16
|
-
const about = user.aboutMe?.replace(/\n/g,
|
|
15
|
+
function prepareUserForEmbedding1(user) {
|
|
16
|
+
const headline = user.headline?.trim() || "";
|
|
17
|
+
const about = user.aboutMe?.replace(/\n/g, " ").trim() || "";
|
|
17
18
|
const locationParts = [
|
|
18
19
|
user.location?.city,
|
|
19
20
|
user.location?.stateCode || user.location?.state,
|
|
20
|
-
user.location?.country,
|
|
21
|
+
user.location?.country || user.region?.country,
|
|
21
22
|
].filter(Boolean);
|
|
22
|
-
const location = locationParts.join(
|
|
23
|
+
const location = locationParts.join(", ");
|
|
23
24
|
const skillsList = user.skills
|
|
24
|
-
?.map((s) => s.
|
|
25
|
+
?.map((s) => (0, common_1.fromWithOtherValue)(s.skill ?? s, common_1.displayByName)?.toLowerCase())
|
|
25
26
|
.filter(Boolean)
|
|
26
|
-
.join(
|
|
27
|
+
.join(", ") || "";
|
|
27
28
|
const experienceList = user.workExperiences
|
|
28
|
-
?.map((w) => [
|
|
29
|
+
?.map((w) => [
|
|
30
|
+
w.designation,
|
|
31
|
+
w.company
|
|
32
|
+
? `${(0, common_1.fromWithOtherValue)(w.company, common_1.displayByName)}, Work Location: ${(0, common_1.displayLocation)(w.location, "small")}`
|
|
33
|
+
: undefined,
|
|
34
|
+
]
|
|
29
35
|
.filter(Boolean)
|
|
30
|
-
.join(
|
|
36
|
+
.join(" at "))
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join("; ") || "";
|
|
31
39
|
const educationList = user.educations
|
|
32
|
-
?.map((e) => [
|
|
40
|
+
?.map((e) => [
|
|
41
|
+
e.course,
|
|
42
|
+
e.fieldOfStudy,
|
|
43
|
+
e.institute
|
|
44
|
+
? `at ${(0, common_1.fromWithOtherValue)(e.institute, common_1.displayByName)}, Study Location: ${(0, common_1.displayLocation)(e.location, "small")}`
|
|
45
|
+
: undefined,
|
|
46
|
+
]
|
|
33
47
|
.filter(Boolean)
|
|
34
|
-
.join(
|
|
48
|
+
.join(" "))
|
|
35
49
|
.filter(Boolean)
|
|
36
|
-
.join(
|
|
50
|
+
.join("; ") || "";
|
|
37
51
|
const languagesList = user.languages
|
|
38
|
-
?.map((l) => l.
|
|
52
|
+
?.map((l) => (0, common_1.fromWithOtherValue)(l.language, common_1.displayByName))
|
|
39
53
|
.filter(Boolean)
|
|
40
|
-
.join(
|
|
54
|
+
.join(", ") || "";
|
|
41
55
|
const parts = [];
|
|
42
56
|
if (headline)
|
|
43
57
|
parts.push(`Headline: ${headline}`);
|
|
@@ -55,7 +69,7 @@ function prepareUserForEmbedding(user) {
|
|
|
55
69
|
parts.push(`Education: ${educationList}`);
|
|
56
70
|
if (languagesList)
|
|
57
71
|
parts.push(`Languages: ${languagesList}`);
|
|
58
|
-
return parts.join(
|
|
72
|
+
return parts.join(". ").replace(/\s\s+/g, " ").trim();
|
|
59
73
|
}
|
|
60
74
|
const parseName = (name) => {
|
|
61
75
|
if (typeof name === "string") {
|
package/dist/esm/user/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TUserSchema } from "@thejob/schema";
|
|
1
2
|
/**
|
|
2
3
|
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
4
|
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
@@ -7,32 +8,7 @@
|
|
|
7
8
|
* 2. About me (intent/personality signal)
|
|
8
9
|
* 3. Flattened structured data (skills, experience, education)
|
|
9
10
|
*/
|
|
10
|
-
export declare function
|
|
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;
|
|
11
|
+
export declare function prepareUserForEmbedding1(user: TUserSchema): string;
|
|
36
12
|
export declare const parseName: (name: string | {
|
|
37
13
|
first: string;
|
|
38
14
|
last?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/user/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAmElE;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,4 @@
|
|
|
1
|
+
import { displayByName, displayLocation, fromWithOtherValue } from "../common";
|
|
1
2
|
/**
|
|
2
3
|
* Prepares a user profile for vector embedding by creating a semantic narrative.
|
|
3
4
|
* Mirrors prepareJobForEmbedding() — same "Label: Value" format for Voyage AI.
|
|
@@ -7,33 +8,46 @@
|
|
|
7
8
|
* 2. About me (intent/personality signal)
|
|
8
9
|
* 3. Flattened structured data (skills, experience, education)
|
|
9
10
|
*/
|
|
10
|
-
export function
|
|
11
|
-
const headline = user.headline?.trim() ||
|
|
12
|
-
const about = user.aboutMe?.replace(/\n/g,
|
|
11
|
+
export function prepareUserForEmbedding1(user) {
|
|
12
|
+
const headline = user.headline?.trim() || "";
|
|
13
|
+
const about = user.aboutMe?.replace(/\n/g, " ").trim() || "";
|
|
13
14
|
const locationParts = [
|
|
14
15
|
user.location?.city,
|
|
15
16
|
user.location?.stateCode || user.location?.state,
|
|
16
|
-
user.location?.country,
|
|
17
|
+
user.location?.country || user.region?.country,
|
|
17
18
|
].filter(Boolean);
|
|
18
|
-
const location = locationParts.join(
|
|
19
|
+
const location = locationParts.join(", ");
|
|
19
20
|
const skillsList = user.skills
|
|
20
|
-
?.map((s) => s.
|
|
21
|
+
?.map((s) => fromWithOtherValue(s.skill ?? s, displayByName)?.toLowerCase())
|
|
21
22
|
.filter(Boolean)
|
|
22
|
-
.join(
|
|
23
|
+
.join(", ") || "";
|
|
23
24
|
const experienceList = user.workExperiences
|
|
24
|
-
?.map((w) => [
|
|
25
|
+
?.map((w) => [
|
|
26
|
+
w.designation,
|
|
27
|
+
w.company
|
|
28
|
+
? `${fromWithOtherValue(w.company, displayByName)}, Work Location: ${displayLocation(w.location, "small")}`
|
|
29
|
+
: undefined,
|
|
30
|
+
]
|
|
25
31
|
.filter(Boolean)
|
|
26
|
-
.join(
|
|
32
|
+
.join(" at "))
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join("; ") || "";
|
|
27
35
|
const educationList = user.educations
|
|
28
|
-
?.map((e) => [
|
|
36
|
+
?.map((e) => [
|
|
37
|
+
e.course,
|
|
38
|
+
e.fieldOfStudy,
|
|
39
|
+
e.institute
|
|
40
|
+
? `at ${fromWithOtherValue(e.institute, displayByName)}, Study Location: ${displayLocation(e.location, "small")}`
|
|
41
|
+
: undefined,
|
|
42
|
+
]
|
|
29
43
|
.filter(Boolean)
|
|
30
|
-
.join(
|
|
44
|
+
.join(" "))
|
|
31
45
|
.filter(Boolean)
|
|
32
|
-
.join(
|
|
46
|
+
.join("; ") || "";
|
|
33
47
|
const languagesList = user.languages
|
|
34
|
-
?.map((l) => l.
|
|
48
|
+
?.map((l) => fromWithOtherValue(l.language, displayByName))
|
|
35
49
|
.filter(Boolean)
|
|
36
|
-
.join(
|
|
50
|
+
.join(", ") || "";
|
|
37
51
|
const parts = [];
|
|
38
52
|
if (headline)
|
|
39
53
|
parts.push(`Headline: ${headline}`);
|
|
@@ -51,7 +65,7 @@ export function prepareUserForEmbedding(user) {
|
|
|
51
65
|
parts.push(`Education: ${educationList}`);
|
|
52
66
|
if (languagesList)
|
|
53
67
|
parts.push(`Languages: ${languagesList}`);
|
|
54
|
-
return parts.join(
|
|
68
|
+
return parts.join(". ").replace(/\s\s+/g, " ").trim();
|
|
55
69
|
}
|
|
56
70
|
export const parseName = (name) => {
|
|
57
71
|
if (typeof name === "string") {
|