@thejob/util 1.0.27 → 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.
@@ -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,35 +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 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
- skill?: {
21
- name?: string;
22
- };
23
- name?: string;
24
- }>;
25
- experienceLevel?: string;
26
- workExperiences?: Array<{
27
- title?: string;
28
- company?: string;
29
- }>;
30
- educations?: Array<{
31
- degree?: string;
32
- fieldOfStudy?: string;
33
- institution?: string;
34
- }>;
35
- languages?: Array<{
36
- name: string;
37
- }>;
38
- }): string;
11
+ export declare function prepareUserForEmbedding1(user: TUserSchema): string;
39
12
  export declare const parseName: (name: string | {
40
13
  first: string;
41
14
  last?: string;
@@ -1 +1 @@
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;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,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;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,GAAG,MAAM,CAkDT;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"}
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"}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseName = void 0;
4
- exports.prepareUserForEmbedding = prepareUserForEmbedding;
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,31 +12,44 @@ exports.prepareUserForEmbedding = prepareUserForEmbedding;
11
12
  * 2. About me (intent/personality signal)
12
13
  * 3. Flattened structured data (skills, experience, education)
13
14
  */
14
- function prepareUserForEmbedding(user) {
15
+ function prepareUserForEmbedding1(user) {
15
16
  const headline = user.headline?.trim() || "";
16
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
23
  const location = locationParts.join(", ");
23
24
  const skillsList = user.skills
24
- ?.map((s) => (s.skill?.name ?? s.name)?.toLowerCase())
25
+ ?.map((s) => (0, common_1.fromWithOtherValue)(s.skill ?? s, common_1.displayByName)?.toLowerCase())
25
26
  .filter(Boolean)
26
27
  .join(", ") || "";
27
28
  const experienceList = user.workExperiences
28
- ?.map((w) => [w.title, w.company].filter(Boolean).join(" at "))
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
+ ]
35
+ .filter(Boolean)
36
+ .join(" at "))
29
37
  .filter(Boolean)
30
38
  .join("; ") || "";
31
39
  const educationList = user.educations
32
- ?.map((e) => [e.degree, e.fieldOfStudy, e.institution ? `at ${e.institution}` : ""]
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
48
  .join(" "))
35
49
  .filter(Boolean)
36
50
  .join("; ") || "";
37
51
  const languagesList = user.languages
38
- ?.map((l) => l.name)
52
+ ?.map((l) => (0, common_1.fromWithOtherValue)(l.language, common_1.displayByName))
39
53
  .filter(Boolean)
40
54
  .join(", ") || "";
41
55
  const parts = [];
@@ -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,35 +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 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
- skill?: {
21
- name?: string;
22
- };
23
- name?: string;
24
- }>;
25
- experienceLevel?: string;
26
- workExperiences?: Array<{
27
- title?: string;
28
- company?: string;
29
- }>;
30
- educations?: Array<{
31
- degree?: string;
32
- fieldOfStudy?: string;
33
- institution?: string;
34
- }>;
35
- languages?: Array<{
36
- name: string;
37
- }>;
38
- }): string;
11
+ export declare function prepareUserForEmbedding1(user: TUserSchema): string;
39
12
  export declare const parseName: (name: string | {
40
13
  first: string;
41
14
  last?: string;
@@ -1 +1 @@
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;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,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;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,GAAG,MAAM,CAkDT;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"}
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"}
@@ -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,31 +8,44 @@
7
8
  * 2. About me (intent/personality signal)
8
9
  * 3. Flattened structured data (skills, experience, education)
9
10
  */
10
- export function prepareUserForEmbedding(user) {
11
+ export function prepareUserForEmbedding1(user) {
11
12
  const headline = user.headline?.trim() || "";
12
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
19
  const location = locationParts.join(", ");
19
20
  const skillsList = user.skills
20
- ?.map((s) => (s.skill?.name ?? s.name)?.toLowerCase())
21
+ ?.map((s) => fromWithOtherValue(s.skill ?? s, displayByName)?.toLowerCase())
21
22
  .filter(Boolean)
22
23
  .join(", ") || "";
23
24
  const experienceList = user.workExperiences
24
- ?.map((w) => [w.title, w.company].filter(Boolean).join(" at "))
25
+ ?.map((w) => [
26
+ w.designation,
27
+ w.company
28
+ ? `${fromWithOtherValue(w.company, displayByName)}, Work Location: ${displayLocation(w.location, "small")}`
29
+ : undefined,
30
+ ]
31
+ .filter(Boolean)
32
+ .join(" at "))
25
33
  .filter(Boolean)
26
34
  .join("; ") || "";
27
35
  const educationList = user.educations
28
- ?.map((e) => [e.degree, e.fieldOfStudy, e.institution ? `at ${e.institution}` : ""]
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
44
  .join(" "))
31
45
  .filter(Boolean)
32
46
  .join("; ") || "";
33
47
  const languagesList = user.languages
34
- ?.map((l) => l.name)
48
+ ?.map((l) => fromWithOtherValue(l.language, displayByName))
35
49
  .filter(Boolean)
36
50
  .join(", ") || "";
37
51
  const parts = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thejob/util",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",