@ttctl/core 0.0.0 → 0.1.0-rc.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/README.md +49 -9
- package/dist/__generated__/gateway.d.ts +4546 -0
- package/dist/__generated__/gateway.d.ts.map +1 -0
- package/dist/__generated__/gateway.js +9 -0
- package/dist/__generated__/gateway.js.map +1 -0
- package/dist/__generated__/talent-profile-zod-schemas.d.ts +1187 -0
- package/dist/__generated__/talent-profile-zod-schemas.d.ts.map +1 -0
- package/dist/__generated__/talent-profile-zod-schemas.js +1136 -0
- package/dist/__generated__/talent-profile-zod-schemas.js.map +1 -0
- package/dist/__generated__/talent-profile.d.ts +1397 -0
- package/dist/__generated__/talent-profile.d.ts.map +1 -0
- package/dist/__generated__/talent-profile.js +9 -0
- package/dist/__generated__/talent-profile.js.map +1 -0
- package/dist/__generated__/zod-schemas.d.ts +2895 -0
- package/dist/__generated__/zod-schemas.d.ts.map +1 -0
- package/dist/__generated__/zod-schemas.js +3121 -0
- package/dist/__generated__/zod-schemas.js.map +1 -0
- package/dist/__tests__/fixtures/profile/builders.d.ts +74 -0
- package/dist/__tests__/fixtures/profile/builders.d.ts.map +1 -0
- package/dist/__tests__/fixtures/profile/builders.js +196 -0
- package/dist/__tests__/fixtures/profile/builders.js.map +1 -0
- package/dist/__tests__/fixtures/profile/data.d.ts +39 -0
- package/dist/__tests__/fixtures/profile/data.d.ts.map +1 -0
- package/dist/__tests__/fixtures/profile/data.js +230 -0
- package/dist/__tests__/fixtures/profile/data.js.map +1 -0
- package/dist/__tests__/fixtures/profile/index.d.ts +9 -0
- package/dist/__tests__/fixtures/profile/index.d.ts.map +1 -0
- package/dist/__tests__/fixtures/profile/index.js +10 -0
- package/dist/__tests__/fixtures/profile/index.js.map +1 -0
- package/dist/__tests__/fixtures/profile/types.d.ts +53 -0
- package/dist/__tests__/fixtures/profile/types.d.ts.map +1 -0
- package/dist/__tests__/fixtures/profile/types.js +4 -0
- package/dist/__tests__/fixtures/profile/types.js.map +1 -0
- package/dist/auth/errors.d.ts +82 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/errors.js +68 -0
- package/dist/auth/errors.js.map +1 -0
- package/dist/auth.d.ts +192 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +294 -0
- package/dist/auth.js.map +1 -0
- package/dist/config.d.ts +212 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +349 -0
- package/dist/config.js.map +1 -0
- package/dist/configLock.d.ts +50 -0
- package/dist/configLock.d.ts.map +1 -0
- package/dist/configLock.js +88 -0
- package/dist/configLock.js.map +1 -0
- package/dist/configWriter.d.ts +97 -0
- package/dist/configWriter.d.ts.map +1 -0
- package/dist/configWriter.js +687 -0
- package/dist/configWriter.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/kill-switch.d.ts +161 -0
- package/dist/kill-switch.d.ts.map +1 -0
- package/dist/kill-switch.js +235 -0
- package/dist/kill-switch.js.map +1 -0
- package/dist/lib/date.d.ts +58 -0
- package/dist/lib/date.d.ts.map +1 -0
- package/dist/lib/date.js +104 -0
- package/dist/lib/date.js.map +1 -0
- package/dist/lib/diagnostic-log.d.ts +159 -0
- package/dist/lib/diagnostic-log.d.ts.map +1 -0
- package/dist/lib/diagnostic-log.js +186 -0
- package/dist/lib/diagnostic-log.js.map +1 -0
- package/dist/lib/package-version.d.ts +19 -0
- package/dist/lib/package-version.d.ts.map +1 -0
- package/dist/lib/package-version.js +38 -0
- package/dist/lib/package-version.js.map +1 -0
- package/dist/lib/redact.d.ts +153 -0
- package/dist/lib/redact.d.ts.map +1 -0
- package/dist/lib/redact.js +207 -0
- package/dist/lib/redact.js.map +1 -0
- package/dist/lib/text.d.ts +14 -0
- package/dist/lib/text.d.ts.map +1 -0
- package/dist/lib/text.js +21 -0
- package/dist/lib/text.js.map +1 -0
- package/dist/lib/wire-shape.d.ts +131 -0
- package/dist/lib/wire-shape.d.ts.map +1 -0
- package/dist/lib/wire-shape.js +376 -0
- package/dist/lib/wire-shape.js.map +1 -0
- package/dist/onepassword.d.ts +29 -0
- package/dist/onepassword.d.ts.map +1 -0
- package/dist/onepassword.js +112 -0
- package/dist/onepassword.js.map +1 -0
- package/dist/services/_shared/transport.d.ts +148 -0
- package/dist/services/_shared/transport.d.ts.map +1 -0
- package/dist/services/_shared/transport.js +102 -0
- package/dist/services/_shared/transport.js.map +1 -0
- package/dist/services/applications/index.d.ts +210 -0
- package/dist/services/applications/index.d.ts.map +1 -0
- package/dist/services/applications/index.js +240 -0
- package/dist/services/applications/index.js.map +1 -0
- package/dist/services/availability/index.d.ts +254 -0
- package/dist/services/availability/index.d.ts.map +1 -0
- package/dist/services/availability/index.js +310 -0
- package/dist/services/availability/index.js.map +1 -0
- package/dist/services/contracts/index.d.ts +132 -0
- package/dist/services/contracts/index.d.ts.map +1 -0
- package/dist/services/contracts/index.js +211 -0
- package/dist/services/contracts/index.js.map +1 -0
- package/dist/services/engagements/index.d.ts +504 -0
- package/dist/services/engagements/index.d.ts.map +1 -0
- package/dist/services/engagements/index.js +613 -0
- package/dist/services/engagements/index.js.map +1 -0
- package/dist/services/jobs/index.d.ts +490 -0
- package/dist/services/jobs/index.d.ts.map +1 -0
- package/dist/services/jobs/index.js +753 -0
- package/dist/services/jobs/index.js.map +1 -0
- package/dist/services/payments/index.d.ts +415 -0
- package/dist/services/payments/index.d.ts.map +1 -0
- package/dist/services/payments/index.js +636 -0
- package/dist/services/payments/index.js.map +1 -0
- package/dist/services/profile/__tests__/fixtures.d.ts +214 -0
- package/dist/services/profile/__tests__/fixtures.d.ts.map +1 -0
- package/dist/services/profile/__tests__/fixtures.js +176 -0
- package/dist/services/profile/__tests__/fixtures.js.map +1 -0
- package/dist/services/profile/basic/index.d.ts +390 -0
- package/dist/services/profile/basic/index.d.ts.map +1 -0
- package/dist/services/profile/basic/index.js +1007 -0
- package/dist/services/profile/basic/index.js.map +1 -0
- package/dist/services/profile/certifications/index.d.ts +74 -0
- package/dist/services/profile/certifications/index.d.ts.map +1 -0
- package/dist/services/profile/certifications/index.js +169 -0
- package/dist/services/profile/certifications/index.js.map +1 -0
- package/dist/services/profile/education/index.d.ts +73 -0
- package/dist/services/profile/education/index.d.ts.map +1 -0
- package/dist/services/profile/education/index.js +168 -0
- package/dist/services/profile/education/index.js.map +1 -0
- package/dist/services/profile/employment/index.d.ts +111 -0
- package/dist/services/profile/employment/index.d.ts.map +1 -0
- package/dist/services/profile/employment/index.js +202 -0
- package/dist/services/profile/employment/index.js.map +1 -0
- package/dist/services/profile/external/index.d.ts +219 -0
- package/dist/services/profile/external/index.d.ts.map +1 -0
- package/dist/services/profile/external/index.js +560 -0
- package/dist/services/profile/external/index.js.map +1 -0
- package/dist/services/profile/index.d.ts +24 -0
- package/dist/services/profile/index.d.ts.map +1 -0
- package/dist/services/profile/index.js +26 -0
- package/dist/services/profile/index.js.map +1 -0
- package/dist/services/profile/industries/index.d.ts +130 -0
- package/dist/services/profile/industries/index.d.ts.map +1 -0
- package/dist/services/profile/industries/index.js +292 -0
- package/dist/services/profile/industries/index.js.map +1 -0
- package/dist/services/profile/portfolio/index.d.ts +352 -0
- package/dist/services/profile/portfolio/index.d.ts.map +1 -0
- package/dist/services/profile/portfolio/index.js +833 -0
- package/dist/services/profile/portfolio/index.js.map +1 -0
- package/dist/services/profile/resume/index.d.ts +60 -0
- package/dist/services/profile/resume/index.d.ts.map +1 -0
- package/dist/services/profile/resume/index.js +212 -0
- package/dist/services/profile/resume/index.js.map +1 -0
- package/dist/services/profile/reviews/index.d.ts +137 -0
- package/dist/services/profile/reviews/index.d.ts.map +1 -0
- package/dist/services/profile/reviews/index.js +431 -0
- package/dist/services/profile/reviews/index.js.map +1 -0
- package/dist/services/profile/shared.d.ts +127 -0
- package/dist/services/profile/shared.d.ts.map +1 -0
- package/dist/services/profile/shared.js +155 -0
- package/dist/services/profile/shared.js.map +1 -0
- package/dist/services/profile/skills/index.d.ts +212 -0
- package/dist/services/profile/skills/index.d.ts.map +1 -0
- package/dist/services/profile/skills/index.js +461 -0
- package/dist/services/profile/skills/index.js.map +1 -0
- package/dist/services/profile/visas/index.d.ts +74 -0
- package/dist/services/profile/visas/index.d.ts.map +1 -0
- package/dist/services/profile/visas/index.js +306 -0
- package/dist/services/profile/visas/index.js.map +1 -0
- package/dist/services/timesheet/index.d.ts +326 -0
- package/dist/services/timesheet/index.d.ts.map +1 -0
- package/dist/services/timesheet/index.js +324 -0
- package/dist/services/timesheet/index.js.map +1 -0
- package/dist/services/translations.d.ts +79 -0
- package/dist/services/translations.d.ts.map +1 -0
- package/dist/services/translations.js +136 -0
- package/dist/services/translations.js.map +1 -0
- package/dist/transport-resilience.d.ts +136 -0
- package/dist/transport-resilience.d.ts.map +1 -0
- package/dist/transport-resilience.js +247 -0
- package/dist/transport-resilience.js.map +1 -0
- package/dist/transport.d.ts +408 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +691 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -12
- package/index.js +0 -7
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Employment` row as ttctl exposes it. Trimmed read-side projection of
|
|
3
|
+
* the `Employment` GraphQL fragment (see
|
|
4
|
+
* `research/graphql/talent_profile/fragments/Employment.graphql`). Years
|
|
5
|
+
* are integers (`startDate`, `endDate`) per the empirical capture
|
|
6
|
+
* `research/captures/web/inputs/UpdateEmploymentInput.json`. `endDate` is
|
|
7
|
+
* `null` for current positions.
|
|
8
|
+
*/
|
|
9
|
+
export interface Employment {
|
|
10
|
+
id: string;
|
|
11
|
+
company: string;
|
|
12
|
+
position: string;
|
|
13
|
+
companyWebsite: string | null;
|
|
14
|
+
noWebsite: boolean;
|
|
15
|
+
startDate: number | null;
|
|
16
|
+
endDate: number | null;
|
|
17
|
+
experienceItems: string[] | null;
|
|
18
|
+
highlight: boolean;
|
|
19
|
+
showViaToptal: boolean;
|
|
20
|
+
toptalRelated: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fields editable on an Employment row. Mirrors `EmploymentInput` per the
|
|
24
|
+
* inferred shape in `research/notes/10-mutation-input-patterns.md`
|
|
25
|
+
* (Pattern 1) and the live capture in
|
|
26
|
+
* `research/captures/web/inputs/UpdateEmploymentInput.json`.
|
|
27
|
+
*
|
|
28
|
+
* The CLI exposes a curated subset: `--company`, `--role` (→ position),
|
|
29
|
+
* `--from`, `--to`, `--current`, `--description` (→ experienceItems —
|
|
30
|
+
* single-paragraph today; multi-paragraph splits on blank lines). Other
|
|
31
|
+
* fields (employerId, engagementId, industryIds, managementExperience,
|
|
32
|
+
* primaryGeographyId, reportingTo, skills, …) are exposed at the type
|
|
33
|
+
* level so future leaves can grow without churning callers.
|
|
34
|
+
*/
|
|
35
|
+
export interface EmploymentFields {
|
|
36
|
+
company?: string;
|
|
37
|
+
position?: string;
|
|
38
|
+
companyWebsite?: string | null;
|
|
39
|
+
noWebsite?: boolean;
|
|
40
|
+
startDate?: number;
|
|
41
|
+
endDate?: number | null;
|
|
42
|
+
experienceItems?: string[];
|
|
43
|
+
highlight?: boolean;
|
|
44
|
+
publicationPermit?: boolean;
|
|
45
|
+
showViaToptal?: boolean;
|
|
46
|
+
toptalRelated?: boolean;
|
|
47
|
+
industryIds?: string[];
|
|
48
|
+
primaryGeographyId?: string | null;
|
|
49
|
+
reportingTo?: string | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Lightweight `Employer` reference returned by
|
|
53
|
+
* `employer-autocomplete`. Mirrors the read-side `Employer` fragment
|
|
54
|
+
* trimmed to the fields that matter at the catalog layer.
|
|
55
|
+
*/
|
|
56
|
+
export interface EmployerSuggestion {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
city: string | null;
|
|
60
|
+
country: string | null;
|
|
61
|
+
logoUrl: string | null;
|
|
62
|
+
website: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* List the signed-in user's employment rows.
|
|
66
|
+
*
|
|
67
|
+
* Issues `GET_WORK_EXPERIENCE` against the talent-profile surface; keyed
|
|
68
|
+
* by the user's `profileId`. The read-side query also returns `countries`
|
|
69
|
+
* — ttctl ignores it for now.
|
|
70
|
+
*/
|
|
71
|
+
export declare function list(token: string): Promise<Employment[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Look up a single employment row by id. Throws `VALIDATION_ERROR` when
|
|
74
|
+
* no matching row exists.
|
|
75
|
+
*/
|
|
76
|
+
export declare function show(token: string, id: string): Promise<Employment>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new employment row. Wire format per Pattern 2: `{ profileId,
|
|
79
|
+
* employment: EmploymentInput }`. `company` and `position` are required.
|
|
80
|
+
*/
|
|
81
|
+
export declare function add(token: string, fields: EmploymentFields): Promise<Employment>;
|
|
82
|
+
/**
|
|
83
|
+
* Update an existing employment row. Wire format per Pattern 1:
|
|
84
|
+
* `{ employmentId, employment: EmploymentInput }`.
|
|
85
|
+
*/
|
|
86
|
+
export declare function update(token: string, id: string, fields: EmploymentFields): Promise<Employment>;
|
|
87
|
+
/**
|
|
88
|
+
* Remove an employment row. Wire format per Pattern 3: `{ employmentId }`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function remove(token: string, id: string): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Toggle the `highlight` flag on an employment row. Wire format per
|
|
93
|
+
* Pattern 4: `{ employmentId, highlight: Boolean }`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function highlight(token: string, id: string, value?: boolean): Promise<{
|
|
96
|
+
id: string;
|
|
97
|
+
highlight: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Search the employer catalog for a known employer name (e.g. "Google").
|
|
101
|
+
*
|
|
102
|
+
* Issues `GET_EMPLOYERS_AUTOCOMPLETE($search, $limit)` against the
|
|
103
|
+
* talent-profile surface. The schema types the return as a single
|
|
104
|
+
* `Employer` but real responses are a list — accepting either shape
|
|
105
|
+
* keeps callers from crashing if Toptal swings the cardinality.
|
|
106
|
+
*
|
|
107
|
+
* The `limit` argument bounds the suggestion count; default `10` mirrors
|
|
108
|
+
* the React app.
|
|
109
|
+
*/
|
|
110
|
+
export declare function employerAutocomplete(token: string, search: string, limit?: number): Promise<EmployerSuggestion[]>;
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/profile/employment/index.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,CAAC,E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S,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,UAAO,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAiBpH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAgBnH"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { ProfileError } from "../basic/index.js";
|
|
4
|
+
import { applyUserErrorsAndSuccess, callTalentProfile, ensureNoTopLevelErrors, extractProfileId } from "../shared.js";
|
|
5
|
+
const EMPLOYMENT_FRAGMENT = `fragment Employment on Employment {
|
|
6
|
+
id
|
|
7
|
+
company
|
|
8
|
+
position
|
|
9
|
+
companyWebsite
|
|
10
|
+
noWebsite
|
|
11
|
+
startDate
|
|
12
|
+
endDate
|
|
13
|
+
experienceItems
|
|
14
|
+
highlight
|
|
15
|
+
showViaToptal
|
|
16
|
+
toptalRelated
|
|
17
|
+
}`;
|
|
18
|
+
const GET_WORK_EXPERIENCE_QUERY = `query GET_WORK_EXPERIENCE($profileId: ID!) {
|
|
19
|
+
profile(id: $profileId) {
|
|
20
|
+
id
|
|
21
|
+
employments { nodes { ...Employment } }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
${EMPLOYMENT_FRAGMENT}`;
|
|
25
|
+
const CREATE_EMPLOYMENT_MUTATION = `mutation CreateEmployment($input: CreateEmploymentInput!) {
|
|
26
|
+
createEmployment(input: $input) {
|
|
27
|
+
success
|
|
28
|
+
notice
|
|
29
|
+
errors { code key message }
|
|
30
|
+
profile { id employments { nodes { ...Employment } } }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
${EMPLOYMENT_FRAGMENT}`;
|
|
34
|
+
const UPDATE_EMPLOYMENT_MUTATION = `mutation UpdateEmployment($input: UpdateEmploymentInput!) {
|
|
35
|
+
updateEmployment(input: $input) {
|
|
36
|
+
success
|
|
37
|
+
notice
|
|
38
|
+
errors { code key message }
|
|
39
|
+
profile { id employments { nodes { ...Employment } } }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
${EMPLOYMENT_FRAGMENT}`;
|
|
43
|
+
const REMOVE_EMPLOYMENT_MUTATION = `mutation RemoveEmployment($input: RemoveEmploymentInput!) {
|
|
44
|
+
removeEmployment(input: $input) {
|
|
45
|
+
success
|
|
46
|
+
notice
|
|
47
|
+
errors { code key message }
|
|
48
|
+
profile { id employments { nodes { ...Employment } } }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
${EMPLOYMENT_FRAGMENT}`;
|
|
52
|
+
const HIGHLIGHT_EMPLOYMENT_MUTATION = `mutation highlightEmployment($id: ID!, $highlight: Boolean!) {
|
|
53
|
+
highlightEmployment(input: { employmentId: $id, highlight: $highlight }) {
|
|
54
|
+
success
|
|
55
|
+
notice
|
|
56
|
+
errors { code key message }
|
|
57
|
+
employment { id highlight }
|
|
58
|
+
}
|
|
59
|
+
}`;
|
|
60
|
+
const EMPLOYERS_AUTOCOMPLETE_QUERY = `query GET_EMPLOYERS_AUTOCOMPLETE($search: String!, $limit: Int!) {
|
|
61
|
+
employersAutocomplete(search: $search, limit: $limit) {
|
|
62
|
+
id
|
|
63
|
+
name
|
|
64
|
+
city
|
|
65
|
+
country
|
|
66
|
+
logoUrl
|
|
67
|
+
website
|
|
68
|
+
}
|
|
69
|
+
}`;
|
|
70
|
+
/**
|
|
71
|
+
* List the signed-in user's employment rows.
|
|
72
|
+
*
|
|
73
|
+
* Issues `GET_WORK_EXPERIENCE` against the talent-profile surface; keyed
|
|
74
|
+
* by the user's `profileId`. The read-side query also returns `countries`
|
|
75
|
+
* — ttctl ignores it for now.
|
|
76
|
+
*/
|
|
77
|
+
export async function list(token) {
|
|
78
|
+
const profileId = await extractProfileId(token);
|
|
79
|
+
return listByProfileId(token, profileId);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Internal helper: list employment rows when the caller has already
|
|
83
|
+
* resolved `profileId` (used by `add()` to avoid double-round-tripping).
|
|
84
|
+
*/
|
|
85
|
+
async function listByProfileId(token, profileId) {
|
|
86
|
+
const res = await callTalentProfile(token, "GET_WORK_EXPERIENCE", GET_WORK_EXPERIENCE_QUERY, { profileId }, "employment list");
|
|
87
|
+
const body = res.body;
|
|
88
|
+
ensureNoTopLevelErrors(body, "employment list");
|
|
89
|
+
const profile = body?.data?.profile;
|
|
90
|
+
if (!profile)
|
|
91
|
+
throw new ProfileError("UNKNOWN", "employment list response had no `data.profile` field");
|
|
92
|
+
return profile.employments.nodes.filter((n) => n !== null);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Look up a single employment row by id. Throws `VALIDATION_ERROR` when
|
|
96
|
+
* no matching row exists.
|
|
97
|
+
*/
|
|
98
|
+
export async function show(token, id) {
|
|
99
|
+
const all = await list(token);
|
|
100
|
+
const found = all.find((e) => e.id === id);
|
|
101
|
+
if (!found) {
|
|
102
|
+
throw new ProfileError("VALIDATION_ERROR", `Employment with id "${id}" not found on this profile.`);
|
|
103
|
+
}
|
|
104
|
+
return found;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a new employment row. Wire format per Pattern 2: `{ profileId,
|
|
108
|
+
* employment: EmploymentInput }`. `company` and `position` are required.
|
|
109
|
+
*/
|
|
110
|
+
export async function add(token, fields) {
|
|
111
|
+
if (!fields.company || !fields.position) {
|
|
112
|
+
throw new ProfileError("VALIDATION_ERROR", "employment add requires --company and --role.");
|
|
113
|
+
}
|
|
114
|
+
const profileId = await extractProfileId(token);
|
|
115
|
+
const before = await listByProfileId(token, profileId);
|
|
116
|
+
const beforeIds = new Set(before.map((e) => e.id));
|
|
117
|
+
const res = await callTalentProfile(token, "CreateEmployment", CREATE_EMPLOYMENT_MUTATION, { input: { profileId, employment: fields } }, "employment add");
|
|
118
|
+
const payload = unwrapMutation(res, "createEmployment", "employment add");
|
|
119
|
+
const after = payload.profile?.employments.nodes.filter((n) => n !== null) ?? [];
|
|
120
|
+
const created = after.find((e) => !beforeIds.has(e.id));
|
|
121
|
+
if (!created) {
|
|
122
|
+
throw new ProfileError("UNKNOWN", "employment add returned success but no new row was found in the response.");
|
|
123
|
+
}
|
|
124
|
+
return created;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Update an existing employment row. Wire format per Pattern 1:
|
|
128
|
+
* `{ employmentId, employment: EmploymentInput }`.
|
|
129
|
+
*/
|
|
130
|
+
export async function update(token, id, fields) {
|
|
131
|
+
if (Object.keys(fields).length === 0) {
|
|
132
|
+
throw new ProfileError("VALIDATION_ERROR", "employment update requires at least one field flag.");
|
|
133
|
+
}
|
|
134
|
+
const res = await callTalentProfile(token, "UpdateEmployment", UPDATE_EMPLOYMENT_MUTATION, { input: { employmentId: id, employment: fields } }, "employment update");
|
|
135
|
+
const payload = unwrapMutation(res, "updateEmployment", "employment update");
|
|
136
|
+
const updated = payload.profile?.employments.nodes
|
|
137
|
+
.filter((n) => n !== null)
|
|
138
|
+
.find((e) => e.id === id);
|
|
139
|
+
if (!updated) {
|
|
140
|
+
throw new ProfileError("UNKNOWN", `employment update returned success but row "${id}" was not in the response.`);
|
|
141
|
+
}
|
|
142
|
+
return updated;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Remove an employment row. Wire format per Pattern 3: `{ employmentId }`.
|
|
146
|
+
*/
|
|
147
|
+
export async function remove(token, id) {
|
|
148
|
+
const res = await callTalentProfile(token, "RemoveEmployment", REMOVE_EMPLOYMENT_MUTATION, { input: { employmentId: id } }, "employment remove");
|
|
149
|
+
unwrapMutation(res, "removeEmployment", "employment remove");
|
|
150
|
+
return id;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Toggle the `highlight` flag on an employment row. Wire format per
|
|
154
|
+
* Pattern 4: `{ employmentId, highlight: Boolean }`.
|
|
155
|
+
*/
|
|
156
|
+
export async function highlight(token, id, value = true) {
|
|
157
|
+
const res = await callTalentProfile(token, "highlightEmployment", HIGHLIGHT_EMPLOYMENT_MUTATION, { id, highlight: value }, "employment highlight");
|
|
158
|
+
const body = res.body;
|
|
159
|
+
ensureNoTopLevelErrors(body, "employment highlight");
|
|
160
|
+
const payload = body?.data?.highlightEmployment;
|
|
161
|
+
if (!payload)
|
|
162
|
+
throw new ProfileError("UNKNOWN", "employment highlight response had no payload.");
|
|
163
|
+
applyUserErrorsAndSuccess(payload, "employment highlight");
|
|
164
|
+
if (!payload.employment) {
|
|
165
|
+
throw new ProfileError("UNKNOWN", "employment highlight response had no `employment` field.");
|
|
166
|
+
}
|
|
167
|
+
return payload.employment;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Search the employer catalog for a known employer name (e.g. "Google").
|
|
171
|
+
*
|
|
172
|
+
* Issues `GET_EMPLOYERS_AUTOCOMPLETE($search, $limit)` against the
|
|
173
|
+
* talent-profile surface. The schema types the return as a single
|
|
174
|
+
* `Employer` but real responses are a list — accepting either shape
|
|
175
|
+
* keeps callers from crashing if Toptal swings the cardinality.
|
|
176
|
+
*
|
|
177
|
+
* The `limit` argument bounds the suggestion count; default `10` mirrors
|
|
178
|
+
* the React app.
|
|
179
|
+
*/
|
|
180
|
+
export async function employerAutocomplete(token, search, limit = 10) {
|
|
181
|
+
if (!search) {
|
|
182
|
+
throw new ProfileError("VALIDATION_ERROR", "employer-autocomplete requires a non-empty search query.");
|
|
183
|
+
}
|
|
184
|
+
const res = await callTalentProfile(token, "GET_EMPLOYERS_AUTOCOMPLETE", EMPLOYERS_AUTOCOMPLETE_QUERY, { search, limit }, "employer-autocomplete");
|
|
185
|
+
const body = res.body;
|
|
186
|
+
ensureNoTopLevelErrors(body, "employer-autocomplete");
|
|
187
|
+
const raw = body?.data?.employersAutocomplete;
|
|
188
|
+
if (raw === null || raw === undefined)
|
|
189
|
+
return [];
|
|
190
|
+
return Array.isArray(raw) ? raw : [raw];
|
|
191
|
+
}
|
|
192
|
+
function unwrapMutation(res, payloadKey, verb) {
|
|
193
|
+
const body = res.body;
|
|
194
|
+
ensureNoTopLevelErrors(body, verb);
|
|
195
|
+
const payload = body?.data?.[payloadKey];
|
|
196
|
+
if (!payload) {
|
|
197
|
+
throw new ProfileError("UNKNOWN", `${verb} response had no \`data.${payloadKey}\` field`);
|
|
198
|
+
}
|
|
199
|
+
applyUserErrorsAndSuccess(payload, verb);
|
|
200
|
+
return payload;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/profile/employment/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAqEtH,MAAM,mBAAmB,GAAG;;;;;;;;;;;;EAY1B,CAAC;AAEH,MAAM,yBAAyB,GAAG;;;;;;EAMhC,mBAAmB,EAAE,CAAC;AAExB,MAAM,0BAA0B,GAAG;;;;;;;;EAQjC,mBAAmB,EAAE,CAAC;AAExB,MAAM,0BAA0B,GAAG;;;;;;;;EAQjC,mBAAmB,EAAE,CAAC;AAExB,MAAM,0BAA0B,GAAG;;;;;;;;EAQjC,mBAAmB,EAAE,CAAC;AAExB,MAAM,6BAA6B,GAAG;;;;;;;EAOpC,CAAC;AAEH,MAAM,4BAA4B,GAAG;;;;;;;;;EASnC,CAAC;AA+BH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,KAAa;IACtC,MAAM,SAAS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AAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,cAAc,CACrB,GAAsB,EACtB,UAAwE,EACxE,IAAY;IAEZ,MAAM,IAAI,GAAG,GAAG,CAAC,IAA+B,CAAC;IACjD,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,UAAU,CAAgC,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,YAAY,CAAC,SAAS,EAAE,GAAG,IAAI,2BAA2B,UAAU,UAAU,CAAC,CAAC;IAC5F,CAAC;IACD,yBAAyB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ProfileError } from "../basic/index.js";
|
|
2
|
+
import type { ProfileErrorCode } from "../basic/index.js";
|
|
3
|
+
export { ProfileError };
|
|
4
|
+
export type { ProfileErrorCode };
|
|
5
|
+
/**
|
|
6
|
+
* Subset of `UpdateExternalProfilesInput` actually exposed at v0. All fields
|
|
7
|
+
* are optional; the caller is responsible for passing at least one or the
|
|
8
|
+
* service will reject with `VALIDATION_ERROR`.
|
|
9
|
+
*
|
|
10
|
+
* `twitter / behance / dribbble` are exposed because they are present in the
|
|
11
|
+
* `UpdateExternalProfilesPayload` response selection of the captured
|
|
12
|
+
* `UpdateExternalProfiles` mutation document
|
|
13
|
+
* (`research/graphql/talent_profile/operations/UpdateExternalProfiles.graphql`).
|
|
14
|
+
* `skype` is also present on the underlying `Profile` type but the captured
|
|
15
|
+
* mutation document does not request it back; we omit it from the v0 surface
|
|
16
|
+
* (the user can still update it via the web portal).
|
|
17
|
+
*/
|
|
18
|
+
export interface ExternalProfilesUpdate {
|
|
19
|
+
linkedin?: string;
|
|
20
|
+
github?: string;
|
|
21
|
+
website?: string;
|
|
22
|
+
twitter?: string;
|
|
23
|
+
behance?: string;
|
|
24
|
+
dribbble?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Server-confirmed result of {@link update}. Mirrors the response selection
|
|
28
|
+
* of the captured `UpdateExternalProfiles` mutation. Fields are nullable
|
|
29
|
+
* because the server returns `null` for any external link the talent has
|
|
30
|
+
* not set.
|
|
31
|
+
*/
|
|
32
|
+
export interface UpdateExternalProfilesResult {
|
|
33
|
+
profile: {
|
|
34
|
+
id: string;
|
|
35
|
+
updatedByTalentAt: string | null;
|
|
36
|
+
linkedin: string | null;
|
|
37
|
+
github: string | null;
|
|
38
|
+
website: string | null;
|
|
39
|
+
behance: string | null;
|
|
40
|
+
dribbble: string | null;
|
|
41
|
+
};
|
|
42
|
+
notice: string | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Update external profile URLs (linkedin / github / website / twitter /
|
|
46
|
+
* behance / dribbble). Each field is optional; the caller must pass at
|
|
47
|
+
* least one. Unknown / extraneous fields are rejected at compile time by
|
|
48
|
+
* the {@link ExternalProfilesUpdate} type.
|
|
49
|
+
*
|
|
50
|
+
* Wire shape follows Pattern 1 of `research/notes/10-mutation-input-patterns.md`
|
|
51
|
+
* with the wrapper key `externalProfiles`. **INFERRED — UNVERIFIED**: no
|
|
52
|
+
* live curl capture exists in `research/captures/web/inputs/` for this
|
|
53
|
+
* mutation; deviations would surface as `USER_ERROR` at runtime.
|
|
54
|
+
*
|
|
55
|
+
* Errors:
|
|
56
|
+
* - `ProfileError("VALIDATION_ERROR")` when no fields are supplied
|
|
57
|
+
* - `ProfileError("USER_ERROR")` when the server rejects an individual
|
|
58
|
+
* field (e.g. malformed URL)
|
|
59
|
+
* - `AuthRevokedError`, `Cf403Error`, other `TtctlError` subclasses
|
|
60
|
+
* propagate verbatim
|
|
61
|
+
*/
|
|
62
|
+
export declare function update(token: string, changes: ExternalProfilesUpdate): Promise<UpdateExternalProfilesResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Boolean trio comprising the talent's onboarding-readiness self-attestation.
|
|
65
|
+
* All three are exposed unchanged (no display-name remapping) because each
|
|
66
|
+
* field name is already self-documenting.
|
|
67
|
+
*
|
|
68
|
+
* Returned by {@link customRequirementsShow}. Callers willing to accept the
|
|
69
|
+
* "missing fields default to current state" semantic of
|
|
70
|
+
* {@link customRequirementsSet} pass a {@link CustomRequirementsUpdate} (a
|
|
71
|
+
* partial of this trio).
|
|
72
|
+
*/
|
|
73
|
+
export interface CustomRequirements {
|
|
74
|
+
backgroundCheck: boolean | null;
|
|
75
|
+
drugTest: boolean | null;
|
|
76
|
+
timeTrackingTools: boolean | null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Read the three onboarding-readiness toggles for the signed-in user.
|
|
80
|
+
*
|
|
81
|
+
* Errors: `AuthRevokedError`, `ProfileError(GRAPHQL_ERROR)`,
|
|
82
|
+
* `ProfileError(NETWORK_ERROR)`, `Cf403Error` (and other `TtctlError`
|
|
83
|
+
* subclasses) propagate verbatim.
|
|
84
|
+
*/
|
|
85
|
+
export declare function customRequirementsShow(token: string): Promise<CustomRequirements>;
|
|
86
|
+
/**
|
|
87
|
+
* Partial-update shape for {@link customRequirementsSet}. Each missing
|
|
88
|
+
* field is filled from the current server state before the mutation is
|
|
89
|
+
* dispatched (the underlying `updateCustomRequirements` mutation sends ALL
|
|
90
|
+
* three booleans per call, no PATCH semantics — see the capture notes
|
|
91
|
+
* referenced in the module comment).
|
|
92
|
+
*/
|
|
93
|
+
export interface CustomRequirementsUpdate {
|
|
94
|
+
backgroundCheck?: boolean;
|
|
95
|
+
drugTest?: boolean;
|
|
96
|
+
timeTrackingTools?: boolean;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Server-confirmed result of {@link customRequirementsSet}. Mirrors the
|
|
100
|
+
* response selection of the captured mutation document.
|
|
101
|
+
*/
|
|
102
|
+
export interface CustomRequirementsSetResult {
|
|
103
|
+
profile: {
|
|
104
|
+
id: string;
|
|
105
|
+
updatedByTalentAt: string | null;
|
|
106
|
+
customRequirements: CustomRequirements;
|
|
107
|
+
};
|
|
108
|
+
notice: string | null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Toggle one or more of the three onboarding-readiness booleans
|
|
112
|
+
* (`backgroundCheck`, `drugTest`, `timeTrackingTools`). Caller-omitted
|
|
113
|
+
* fields are pre-filled from the current server state via
|
|
114
|
+
* {@link customRequirementsShow} before the mutation is sent (the underlying
|
|
115
|
+
* `updateCustomRequirements` mutation has no diff/PATCH semantics — every
|
|
116
|
+
* call resubmits all three booleans).
|
|
117
|
+
*
|
|
118
|
+
* Pre-fill of missing fields treats `null` (server has no value yet) as
|
|
119
|
+
* `false` for the post-merge wire shape, since the mutation input is
|
|
120
|
+
* `Boolean!` and rejects `null`.
|
|
121
|
+
*
|
|
122
|
+
* Errors: same taxonomy as {@link update}.
|
|
123
|
+
*/
|
|
124
|
+
export declare function customRequirementsSet(token: string, changes: CustomRequirementsUpdate): Promise<CustomRequirementsSetResult>;
|
|
125
|
+
/**
|
|
126
|
+
* The flat boolean set returned by `getProfileReadiness`. Each field
|
|
127
|
+
* corresponds to a section completion check the platform runs before a
|
|
128
|
+
* talent can submit-for-review. Schema types each as `Unknown` (the
|
|
129
|
+
* SDL reflects what we've inferred, not strongly typed) so we coerce
|
|
130
|
+
* defensively at the boundary.
|
|
131
|
+
*/
|
|
132
|
+
export interface ProfileReadiness {
|
|
133
|
+
isPhotoResolutionSatisfied: boolean | null;
|
|
134
|
+
isBasicInfoSatisfied: boolean | null;
|
|
135
|
+
isCertificationsSatisfied: boolean | null;
|
|
136
|
+
isEmploymentsCountSatisfied: boolean | null;
|
|
137
|
+
isEmploymentConnectionsSatisfied: boolean | null;
|
|
138
|
+
isSkillValidationsSatisfied: boolean | null;
|
|
139
|
+
isPortfolioItemsCountSatisfied: boolean | null;
|
|
140
|
+
isPortfolioItemConnectionsSatisfied: boolean | null;
|
|
141
|
+
isWorkingHoursSatisfied: boolean | null;
|
|
142
|
+
/**
|
|
143
|
+
* `submitAvailable` rolls up the per-section signals into a single
|
|
144
|
+
* "ready to submit?" boolean. Hoisted alongside the per-section
|
|
145
|
+
* booleans because it's the value the user usually wants at a glance.
|
|
146
|
+
*/
|
|
147
|
+
submitAvailable: boolean | null;
|
|
148
|
+
/** ISO timestamp of last talent-side edit, returned by the same query. */
|
|
149
|
+
updatedByTalentAt: string | null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Read the per-section profile-readiness booleans plus the rolled-up
|
|
153
|
+
* `submitAvailable` flag and the last-edit timestamp.
|
|
154
|
+
*
|
|
155
|
+
* Errors: same taxonomy as {@link customRequirementsShow}.
|
|
156
|
+
*/
|
|
157
|
+
export declare function readiness(token: string): Promise<ProfileReadiness>;
|
|
158
|
+
/**
|
|
159
|
+
* A single recommendation item. The platform returns recommendations as a
|
|
160
|
+
* union over multiple concrete types
|
|
161
|
+
* (`EmploymentsCountRecommendation`, `PortfolioItemsCountRecommendation`,
|
|
162
|
+
* `EmploymentsMissingDataRecommendation`, etc.). We surface the discriminator
|
|
163
|
+
* `type` plus the entire payload as a generic `payload` map rather than
|
|
164
|
+
* typing each variant — the per-variant fields are descriptive UX hints, not
|
|
165
|
+
* enforced data, and the schema types most fields as `Unknown` anyway.
|
|
166
|
+
* CLI/MCP formatters render `type` and a stringified payload preview;
|
|
167
|
+
* consumers who need richer typing can extend later.
|
|
168
|
+
*/
|
|
169
|
+
export interface ProfileRecommendation {
|
|
170
|
+
type: string;
|
|
171
|
+
payload: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Read the list of profile recommendations. Each recommendation has a
|
|
175
|
+
* discriminator `type` and a small payload of variant-specific fields.
|
|
176
|
+
*
|
|
177
|
+
* Recommendations that involve nested entity lists (e.g.
|
|
178
|
+
* `EmploymentsMissingDataRecommendation` with a `nodes` array of employments)
|
|
179
|
+
* are intentionally trimmed at the GraphQL level — at v0 the CLI/MCP only
|
|
180
|
+
* surfaces the recommendation `type` and any scalar variant fields. Drilling
|
|
181
|
+
* into nested entity lists requires fetching the underlying domain
|
|
182
|
+
* (employments, portfolio items, skills) directly, which is outside the
|
|
183
|
+
* recommendations leaf's scope.
|
|
184
|
+
*/
|
|
185
|
+
export declare function recommendations(token: string): Promise<ProfileRecommendation[]>;
|
|
186
|
+
/**
|
|
187
|
+
* Combined view of the advanced-profile-wizard state. Issue #76 spec collapses
|
|
188
|
+
* `getAdvancedProfileData` and `GetAdvancedProfileWizardStatus` into a single
|
|
189
|
+
* read leaf — but `getAdvancedProfileData` already includes
|
|
190
|
+
* `advancedProfileWizardStatus` in its selection, so a single query suffices.
|
|
191
|
+
*
|
|
192
|
+
* `travelVisas` is a list of the talent's submitted travel visas; we surface
|
|
193
|
+
* a count + the IDs at v0 to keep the payload bounded. Full visa CRUD lives
|
|
194
|
+
* in the `visas` sub-domain (separate wave).
|
|
195
|
+
*/
|
|
196
|
+
export interface AdvancedProfileSnapshot {
|
|
197
|
+
/**
|
|
198
|
+
* Wizard-status discriminator. Schema types as `Unknown`; we surface
|
|
199
|
+
* whatever the server returns without introspection.
|
|
200
|
+
*/
|
|
201
|
+
wizardStatus: string | null;
|
|
202
|
+
travelVisaCount: number;
|
|
203
|
+
travelVisaIds: string[];
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Read the advanced-profile-wizard status plus a summary of the talent's
|
|
207
|
+
* travel-visa list. This is the read-side combined view of
|
|
208
|
+
* `getAdvancedProfileData` — the spec also references
|
|
209
|
+
* `GetAdvancedProfileWizardStatus` as a separate operation, but
|
|
210
|
+
* `getAdvancedProfileData` already returns `advancedProfileWizardStatus`, so
|
|
211
|
+
* one query is sufficient.
|
|
212
|
+
*
|
|
213
|
+
* The full TravelVisa fragment is intentionally trimmed to `id` only. Visa
|
|
214
|
+
* CRUD operations live in the `visas` sub-domain — surfacing the rich shape
|
|
215
|
+
* here would create a partial duplication that drifts as the visas
|
|
216
|
+
* sub-domain evolves.
|
|
217
|
+
*/
|
|
218
|
+
export declare function advancedWizardShow(token: string): Promise<AdvancedProfileSnapshot>;
|
|
219
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/profile/external/index.ts"],"names":[],"mappings":"AAmFA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,CAAC;AA6FjC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AA6DD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAA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