@epsilon-asi/actors 0.0.40 → 0.0.41
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/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import {parseUpworkSearchResults, UpworkJobListing} from "./util/scrapeJobListin
|
|
|
8
8
|
import {Page} from "puppeteer-core";
|
|
9
9
|
import {
|
|
10
10
|
fillUpworkProposalQuestions,
|
|
11
|
-
parseUpworkProposalQuestions,
|
|
11
|
+
parseUpworkProposalQuestions, UpworkProposalAnswers, UpworkProposalQuestionKind,
|
|
12
12
|
UpworkProposalQuestions
|
|
13
13
|
} from "./util/parseJobApplicationDetails.js";
|
|
14
14
|
|
|
@@ -77,15 +77,19 @@ export const upworkComActor = defineActor({
|
|
|
77
77
|
scrapeJobs: async (context, input: ScrapeDashboardInput = {}): Promise<any> => {
|
|
78
78
|
await parseUpworkSearchResults(context.session.page as Page)
|
|
79
79
|
},
|
|
80
|
-
|
|
80
|
+
getJobQuestions: async (_context, input: UpworkApplyToJobInput): Promise<UpworkProposalQuestions> => {
|
|
81
|
+
await _context.nav.goto(`/nx/proposals/job/~${input.jobId}/apply/`);
|
|
81
82
|
|
|
83
|
+
return await parseUpworkProposalQuestions(_context.session.page as Page);
|
|
84
|
+
},
|
|
85
|
+
applyToJob: async (_context, input: UpworkApplyToJobInput & UpworkProposalAnswers): Promise<UpworkApplyToJobResult> => {
|
|
82
86
|
await _context.cursor.scrollIntoView(`[data-ev-job-uid="${input.jobId}"]`);
|
|
83
87
|
|
|
84
88
|
await _context.cursor.move(`[data-ev-job-uid="${input.jobId}"]`);
|
|
85
89
|
await _context.cursor.click(`[data-ev-job-uid="${input.jobId}"]`);
|
|
86
90
|
|
|
87
91
|
await _context.cursor.move(`[data-test="Apply"]>button`);
|
|
88
|
-
|
|
92
|
+
/*await _context.cursor.click(`[data-test="Apply"]>button`);*/
|
|
89
93
|
|
|
90
94
|
await _context.nav.goto(`/nx/proposals/job/~${input.jobId}/apply/`);
|
|
91
95
|
|
|
@@ -108,10 +112,6 @@ export const upworkComActor = defineActor({
|
|
|
108
112
|
await _context.cursor.move('li[role="option"][tabindex="0"]')
|
|
109
113
|
await _context.cursor.click('li[role="option"][tabindex="0"]')
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
return await parseUpworkProposalQuestions(_context.session.page as Page);
|
|
113
|
-
},
|
|
114
|
-
applyToJobPart2: async (_context, input: UpworkApplyToJobInput): Promise<UpworkApplyToJobResult> => {
|
|
115
115
|
await fillUpworkProposalQuestions(_context.session.page as Page, input.answers)
|
|
116
116
|
|
|
117
117
|
return {
|
|
@@ -86,7 +86,36 @@ export interface UpworkProposalQuestions {
|
|
|
86
86
|
hasCoverLetter: boolean;
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
+
import { z } from "zod";
|
|
90
|
+
|
|
91
|
+
export const UpworkProposalAnswerSchema = z.object({
|
|
92
|
+
questionId: z.string(),
|
|
93
|
+
kind: z.enum(["cover_letter", "custom_question"]),
|
|
94
|
+
prompt: z.string(),
|
|
95
|
+
answer: z.string(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const UpworkProposalAnswersSchema = z.object({
|
|
99
|
+
sourceUrl: z.string().nullable().optional(),
|
|
100
|
+
|
|
101
|
+
coverLetter: UpworkProposalAnswerSchema.extend({
|
|
102
|
+
kind: z.literal("cover_letter"),
|
|
103
|
+
})
|
|
104
|
+
.nullable()
|
|
105
|
+
.optional(),
|
|
106
|
+
|
|
107
|
+
customQuestions: z.array(
|
|
108
|
+
UpworkProposalAnswerSchema.extend({
|
|
109
|
+
kind: z.literal("custom_question"),
|
|
110
|
+
})
|
|
111
|
+
),
|
|
112
|
+
|
|
113
|
+
allAnswers: z.array(UpworkProposalAnswerSchema),
|
|
114
|
+
});
|
|
89
115
|
|
|
116
|
+
export type UpworkProposalAnswers = z.infer<
|
|
117
|
+
typeof UpworkProposalAnswersSchema
|
|
118
|
+
>;
|
|
90
119
|
/* -------------------------------------------------------------------------------------------------
|
|
91
120
|
* Browser-context parser
|
|
92
121
|
*
|