@nativesquare/upwork 0.1.0 → 0.2.0
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 +150 -94
- package/dist/client/index.d.ts +7 -18
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +38 -21
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +0 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js +0 -1
- package/dist/client/types.js.map +1 -1
- package/dist/component/_generated/component.d.ts +7 -11
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/private.d.ts +2 -2
- package/dist/component/public.d.ts +28 -12
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +113 -25
- package/dist/component/public.js.map +1 -1
- package/dist/component/schema.d.ts +2 -2
- package/package.json +1 -1
- package/src/client/index.ts +46 -41
- package/src/client/types.ts +0 -2
- package/src/component/_generated/component.ts +17 -15
- package/src/component/public.ts +144 -25
package/README.md
CHANGED
|
@@ -1,141 +1,192 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Upwork Component for Convex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/@nativesquare%2Fupwork)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- START: Include on https://convex.dev/components -->
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
your component
|
|
12
|
-
3. Write example usage in example/convex/example.ts.
|
|
13
|
-
4. Delete the text in this readme until `---` and flesh out the README.
|
|
14
|
-
5. Publish to npm with `pnpm run alpha` or `pnpm run release`.
|
|
7
|
+
A [Convex component](https://convex.dev/components) that integrates the
|
|
8
|
+
[Upwork API](https://developers.upwork.com/) into your Convex app. Search job
|
|
9
|
+
postings, fetch individual listings, and manage OAuth authentication — all with
|
|
10
|
+
built-in caching that complies with Upwork's API terms.
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
```ts
|
|
13
|
+
const upwork = new Upwork(components.upwork);
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pnpm run dev
|
|
21
|
-
```
|
|
15
|
+
// Search jobs
|
|
16
|
+
const results = await upwork.searchJobPostings(ctx, { searchQuery: "react" });
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
// Get a single posting (cache-first, fetches from API if not cached)
|
|
19
|
+
const posting = await upwork.getJobPosting(ctx, { upworkId: "~01abc123" });
|
|
20
|
+
```
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
Found a bug? Feature request?
|
|
23
|
+
[File it here](https://github.com/NativeSquare/upwork/issues).
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
## Prerequisites
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
If you will be adding frontend code, add a peer dependency on React in
|
|
34
|
-
package.json.
|
|
27
|
+
You'll need an Upwork API application. Create one at the
|
|
28
|
+
[Upwork Developer Portal](https://www.upwork.com/developer/keys/apply).
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
## Installation
|
|
37
31
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
├── README.md documentation of your component
|
|
41
|
-
├── package.json component name, version number, other metadata
|
|
42
|
-
├── pnpm-lock.yaml Components are like libraries, pnpm-lock.yaml
|
|
43
|
-
│ is .gitignored and ignored by consumers.
|
|
44
|
-
├── src
|
|
45
|
-
│ ├── component/
|
|
46
|
-
│ │ ├── _generated/ Files here are generated for the component.
|
|
47
|
-
│ │ ├── convex.config.ts Name your component here and use other components
|
|
48
|
-
│ │ ├── lib.ts Define functions here and in new files in this directory
|
|
49
|
-
│ │ └── schema.ts schema specific to this component
|
|
50
|
-
│ ├── client/
|
|
51
|
-
│ │ └── index.ts Code that needs to run in the app that uses the
|
|
52
|
-
│ │ component. Generally the app interacts directly with
|
|
53
|
-
│ │ the component's exposed API (src/component/*).
|
|
54
|
-
│ └── react/ Code intended to be used on the frontend goes here.
|
|
55
|
-
│ │ Your are free to delete this if this component
|
|
56
|
-
│ │ does not provide code.
|
|
57
|
-
│ └── index.ts
|
|
58
|
-
├── example/ example Convex app that uses this component
|
|
59
|
-
│ └── convex/
|
|
60
|
-
│ ├── _generated/ Files here are generated for the example app.
|
|
61
|
-
│ ├── convex.config.ts Imports and uses this component
|
|
62
|
-
│ ├── myFunctions.ts Functions that use the component
|
|
63
|
-
│ └── schema.ts Example app schema
|
|
64
|
-
└── dist/ Publishing artifacts will be created here.
|
|
32
|
+
```sh
|
|
33
|
+
npm install @nativesquare/upwork
|
|
65
34
|
```
|
|
66
35
|
|
|
67
|
-
|
|
36
|
+
Register the component in your `convex/convex.config.ts`:
|
|
68
37
|
|
|
69
|
-
|
|
38
|
+
```ts
|
|
39
|
+
// convex/convex.config.ts
|
|
40
|
+
import { defineApp } from "convex/server";
|
|
41
|
+
import upwork from "@nativesquare/upwork/convex.config.js";
|
|
70
42
|
|
|
71
|
-
|
|
43
|
+
const app = defineApp();
|
|
44
|
+
app.use(upwork);
|
|
72
45
|
|
|
73
|
-
|
|
46
|
+
export default app;
|
|
47
|
+
```
|
|
74
48
|
|
|
75
|
-
|
|
76
|
-
- [ ] Why should you use this component?
|
|
77
|
-
- [ ] Links to docs / other resources?
|
|
49
|
+
## Environment Variables
|
|
78
50
|
|
|
79
|
-
|
|
80
|
-
[File it here](https://github.com/NativeSquare/my-component/issues).
|
|
51
|
+
Set the following environment variables in your Convex deployment:
|
|
81
52
|
|
|
82
|
-
|
|
53
|
+
| Variable | Description |
|
|
54
|
+
| ---------------------- | ----------------------------------------- |
|
|
55
|
+
| `UPWORK_CLIENT_ID` | Your Upwork API application client ID |
|
|
56
|
+
| `UPWORK_CLIENT_SECRET` | Your Upwork API application client secret |
|
|
57
|
+
| `CONVEX_SITE_URL` | Your Convex deployment's HTTP Actions URL |
|
|
58
|
+
|
|
59
|
+
The component reads these automatically — you never need to pass credentials
|
|
60
|
+
in your code.
|
|
61
|
+
|
|
62
|
+
## Setup
|
|
63
|
+
|
|
64
|
+
### 1. Register HTTP routes
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
66
|
+
The component needs an HTTP route to handle the OAuth callback from Upwork.
|
|
67
|
+
Add this to your `convex/http.ts`:
|
|
86
68
|
|
|
87
69
|
```ts
|
|
88
|
-
// convex/
|
|
89
|
-
import {
|
|
90
|
-
import
|
|
70
|
+
// convex/http.ts
|
|
71
|
+
import { httpRouter } from "convex/server";
|
|
72
|
+
import { registerRoutes } from "@nativesquare/upwork";
|
|
73
|
+
import { components } from "./_generated/api";
|
|
91
74
|
|
|
92
|
-
const
|
|
93
|
-
app.use(myComponent);
|
|
75
|
+
const http = httpRouter();
|
|
94
76
|
|
|
95
|
-
|
|
77
|
+
registerRoutes(http, components.upwork, {
|
|
78
|
+
onSuccess: "http://localhost:5173", // redirect after successful auth
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default http;
|
|
96
82
|
```
|
|
97
83
|
|
|
98
|
-
|
|
84
|
+
The `onSuccess` option is where the user is redirected after connecting their
|
|
85
|
+
Upwork account. If omitted, a plain text success message is shown instead.
|
|
86
|
+
|
|
87
|
+
### 2. Create the client
|
|
99
88
|
|
|
100
89
|
```ts
|
|
90
|
+
// convex/example.ts
|
|
91
|
+
import { action, query } from "./_generated/server";
|
|
101
92
|
import { components } from "./_generated/api";
|
|
93
|
+
import { Upwork } from "@nativesquare/upwork";
|
|
94
|
+
|
|
95
|
+
const upwork = new Upwork(components.upwork);
|
|
96
|
+
```
|
|
102
97
|
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
## API Reference
|
|
99
|
+
|
|
100
|
+
### `getAuthorizationUrl()`
|
|
101
|
+
|
|
102
|
+
Returns the Upwork OAuth authorization URL. Redirect users here to connect
|
|
103
|
+
their Upwork account.
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
export const getAuthUrl = query({
|
|
107
|
+
args: {},
|
|
108
|
+
handler: async () => {
|
|
109
|
+
return upwork.getAuthorizationUrl();
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `getAuthStatus(ctx)`
|
|
115
|
+
|
|
116
|
+
Returns the current OAuth connection status: `"connected"`, `"disconnected"`,
|
|
117
|
+
or `"expired"`.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
export const authStatus = query({
|
|
121
|
+
args: {},
|
|
122
|
+
handler: async (ctx) => {
|
|
123
|
+
return await upwork.getAuthStatus(ctx);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `searchJobPostings(ctx, opts?)`
|
|
129
|
+
|
|
130
|
+
Searches the Upwork marketplace and caches the results. Requires an action
|
|
131
|
+
context since it makes a live API call.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
export const search = action({
|
|
135
|
+
args: { searchQuery: v.optional(v.string()) },
|
|
105
136
|
handler: async (ctx, args) => {
|
|
106
|
-
return await
|
|
107
|
-
|
|
137
|
+
return await upwork.searchJobPostings(ctx, {
|
|
138
|
+
searchQuery: args.searchQuery,
|
|
139
|
+
sortField: "RECENCY", // optional, defaults to "RECENCY"
|
|
108
140
|
});
|
|
109
141
|
},
|
|
110
142
|
});
|
|
111
143
|
```
|
|
112
144
|
|
|
113
|
-
|
|
145
|
+
Returns `{ totalCount, postings, hasNextPage }`.
|
|
114
146
|
|
|
115
|
-
###
|
|
147
|
+
### `getJobPosting(ctx, opts)`
|
|
116
148
|
|
|
117
|
-
|
|
149
|
+
Gets a single job posting by its Upwork ID. Uses a hybrid strategy: checks the
|
|
150
|
+
local cache first, and if not found, fetches from the Upwork API and stores the
|
|
151
|
+
result. Requires an action context.
|
|
118
152
|
|
|
119
153
|
```ts
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
154
|
+
export const getJob = action({
|
|
155
|
+
args: { upworkId: v.string() },
|
|
156
|
+
handler: async (ctx, args) => {
|
|
157
|
+
return await upwork.getJobPosting(ctx, { upworkId: args.upworkId });
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
```
|
|
123
161
|
|
|
124
|
-
|
|
162
|
+
Returns a `JobPosting` or `null` if the posting doesn't exist.
|
|
125
163
|
|
|
126
|
-
|
|
127
|
-
pathPrefix: "/my-component",
|
|
128
|
-
});
|
|
164
|
+
### `listJobPostings(ctx, opts?)`
|
|
129
165
|
|
|
130
|
-
|
|
166
|
+
Lists cached job postings from the database. This is a query (no API call),
|
|
167
|
+
so it's reactive and fast.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
export const list = query({
|
|
171
|
+
args: { limit: v.optional(v.number()) },
|
|
172
|
+
handler: async (ctx, args) => {
|
|
173
|
+
return await upwork.listJobPostings(ctx, { limit: args.limit });
|
|
174
|
+
},
|
|
175
|
+
});
|
|
131
176
|
```
|
|
132
177
|
|
|
133
|
-
|
|
178
|
+
Returns up to `limit` postings (default 50) cached within the last 23 hours.
|
|
179
|
+
|
|
180
|
+
### `exchangeAuthCode(ctx, opts)`
|
|
181
|
+
|
|
182
|
+
Exchanges an OAuth authorization code for access tokens. You typically don't
|
|
183
|
+
need to call this directly — `registerRoutes` handles it via the callback
|
|
184
|
+
endpoint.
|
|
134
185
|
|
|
135
186
|
## Upwork API Compliance
|
|
136
187
|
|
|
137
188
|
This component caches job postings from the Upwork API to improve performance
|
|
138
|
-
and reduce API calls.
|
|
189
|
+
and reduce API calls. It is designed to comply with
|
|
139
190
|
[Upwork's API Terms of Use](https://www.upwork.com/legal#api):
|
|
140
191
|
|
|
141
192
|
- **24-hour caching limit**: Upwork does not allow storing API data for more
|
|
@@ -145,16 +196,21 @@ and reduce API calls. Users of this component must comply with
|
|
|
145
196
|
|
|
146
197
|
- **Rate limiting**: The Upwork API enforces a rate limit of **300 requests per
|
|
147
198
|
minute per IP address**. Exceeding this limit will result in HTTP 429
|
|
148
|
-
"Too Many Requests" responses. The caching layer
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
`
|
|
199
|
+
"Too Many Requests" responses. The caching layer helps you stay within these
|
|
200
|
+
limits — cached data is served directly from the database without hitting the
|
|
201
|
+
Upwork API. Be mindful of how frequently you call `searchJobPostings` and
|
|
202
|
+
`getJobPosting`, as they may make live API requests.
|
|
203
|
+
|
|
204
|
+
- **Token refresh**: Access tokens are automatically refreshed when expired.
|
|
152
205
|
|
|
153
206
|
<!-- END: Include on https://convex.dev/components -->
|
|
154
207
|
|
|
155
|
-
|
|
208
|
+
## Development
|
|
156
209
|
|
|
157
210
|
```sh
|
|
158
211
|
pnpm i
|
|
159
212
|
pnpm run dev
|
|
160
213
|
```
|
|
214
|
+
|
|
215
|
+
See the [example app](./example/convex/example.ts) for a complete working
|
|
216
|
+
integration.
|
package/dist/client/index.d.ts
CHANGED
|
@@ -5,36 +5,25 @@ export type UpworkComponent = ComponentApi;
|
|
|
5
5
|
export declare class Upwork {
|
|
6
6
|
component: UpworkComponent;
|
|
7
7
|
constructor(component: UpworkComponent);
|
|
8
|
-
getAuthorizationUrl(
|
|
9
|
-
clientId: string;
|
|
10
|
-
siteUrl: string;
|
|
11
|
-
baseUrl?: string;
|
|
12
|
-
}): string;
|
|
8
|
+
getAuthorizationUrl(): string;
|
|
13
9
|
exchangeAuthCode(ctx: ActionCtx, opts: {
|
|
14
|
-
clientId: string;
|
|
15
|
-
clientSecret: string;
|
|
16
10
|
code: string;
|
|
17
|
-
siteUrl: string;
|
|
18
|
-
baseUrl?: string;
|
|
19
11
|
}): Promise<void>;
|
|
20
|
-
searchJobPostings(ctx: ActionCtx, opts
|
|
21
|
-
clientId: string;
|
|
22
|
-
clientSecret: string;
|
|
12
|
+
searchJobPostings(ctx: ActionCtx, opts?: {
|
|
23
13
|
searchQuery?: string;
|
|
24
14
|
sortField?: string;
|
|
25
|
-
baseUrl?: string;
|
|
26
15
|
}): Promise<SearchResult>;
|
|
16
|
+
getJobPosting(ctx: ActionCtx, opts: {
|
|
17
|
+
upworkId: string;
|
|
18
|
+
}): Promise<JobPosting | null>;
|
|
27
19
|
listJobPostings(ctx: QueryCtx, opts?: {
|
|
28
20
|
limit?: number;
|
|
29
21
|
}): Promise<JobPosting[]>;
|
|
30
22
|
getAuthStatus(ctx: QueryCtx): Promise<AuthStatus>;
|
|
31
23
|
}
|
|
32
|
-
export declare function registerRoutes(http: HttpRouter, component: UpworkComponent, opts
|
|
33
|
-
clientId: string;
|
|
34
|
-
clientSecret: string;
|
|
35
|
-
baseUrl?: string;
|
|
24
|
+
export declare function registerRoutes(http: HttpRouter, component: UpworkComponent, opts?: {
|
|
36
25
|
onSuccess?: string;
|
|
37
26
|
}): void;
|
|
38
|
-
export {
|
|
27
|
+
export { CALLBACK_PATH } from "./types.js";
|
|
39
28
|
export type { JobPosting, SearchResult, AuthStatus } from "./types.js";
|
|
40
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,qBAAa,MAAM;IACE,SAAS,EAAE,eAAe;gBAA1B,SAAS,EAAE,eAAe;IAE7C,mBAAmB,IAAI,MAAM;IAkBvB,gBAAgB,CACpB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GACrB,OAAO,CAAC,IAAI,CAAC;IAYV,iBAAiB,CACrB,GAAG,EAAE,SAAS,EACd,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,YAAY,CAAC;IAOlB,aAAa,CACjB,GAAG,EAAE,SAAS,EACd,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAgBvB,eAAe,CACnB,GAAG,EAAE,QAAQ,EACb,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC;IAMlB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAGxD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,eAAe,EAC1B,IAAI,CAAC,EAAE;IACL,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,QAmCF;AAED,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,37 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CALLBACK_PATH } from "./types.js";
|
|
2
2
|
import { httpActionGeneric } from "convex/server";
|
|
3
|
+
const BASE_URL = "https://upwork-mock-server.onrender.com";
|
|
3
4
|
export class Upwork {
|
|
4
5
|
component;
|
|
5
6
|
constructor(component) {
|
|
6
7
|
this.component = component;
|
|
7
8
|
}
|
|
8
|
-
getAuthorizationUrl(
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
getAuthorizationUrl() {
|
|
10
|
+
const clientId = process.env.UPWORK_CLIENT_ID;
|
|
11
|
+
const siteUrl = process.env.CONVEX_SITE_URL;
|
|
12
|
+
if (!clientId) {
|
|
13
|
+
throw new Error("Missing UPWORK_CLIENT_ID environment variable.");
|
|
14
|
+
}
|
|
15
|
+
if (!siteUrl) {
|
|
16
|
+
throw new Error("Missing CONVEX_SITE_URL environment variable.");
|
|
17
|
+
}
|
|
18
|
+
const redirectUri = `${siteUrl}${CALLBACK_PATH}`;
|
|
11
19
|
const params = new URLSearchParams({
|
|
12
20
|
response_type: "code",
|
|
13
|
-
client_id:
|
|
21
|
+
client_id: clientId,
|
|
14
22
|
redirect_uri: redirectUri,
|
|
15
23
|
});
|
|
16
|
-
return `${
|
|
24
|
+
return `${BASE_URL}/ab/account-security/oauth2/authorize?${params.toString()}`;
|
|
17
25
|
}
|
|
18
26
|
async exchangeAuthCode(ctx, opts) {
|
|
19
|
-
const
|
|
27
|
+
const siteUrl = process.env.CONVEX_SITE_URL;
|
|
28
|
+
if (!siteUrl) {
|
|
29
|
+
throw new Error("Missing CONVEX_SITE_URL environment variable.");
|
|
30
|
+
}
|
|
31
|
+
const redirectUri = `${siteUrl}${CALLBACK_PATH}`;
|
|
20
32
|
await ctx.runAction(this.component.public.exchangeAuthCode, {
|
|
21
|
-
clientId: opts.clientId,
|
|
22
|
-
clientSecret: opts.clientSecret,
|
|
23
33
|
code: opts.code,
|
|
24
34
|
redirectUri,
|
|
25
|
-
baseUrl: opts.baseUrl ?? DEFAULT_BASE_URL,
|
|
26
35
|
});
|
|
27
36
|
}
|
|
28
37
|
async searchJobPostings(ctx, opts) {
|
|
29
38
|
return await ctx.runAction(this.component.public.searchJobPostings, {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
searchQuery: opts?.searchQuery,
|
|
40
|
+
sortField: opts?.sortField,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async getJobPosting(ctx, opts) {
|
|
44
|
+
const cached = await ctx.runQuery(this.component.public.getJobPosting, {
|
|
45
|
+
upworkId: opts.upworkId,
|
|
46
|
+
});
|
|
47
|
+
if (cached)
|
|
48
|
+
return cached;
|
|
49
|
+
const fetched = await ctx.runAction(this.component.public.fetchJobPosting, {
|
|
50
|
+
upworkId: opts.upworkId,
|
|
51
|
+
});
|
|
52
|
+
if (!fetched)
|
|
53
|
+
return null;
|
|
54
|
+
return await ctx.runQuery(this.component.public.getJobPosting, {
|
|
55
|
+
upworkId: opts.upworkId,
|
|
35
56
|
});
|
|
36
57
|
}
|
|
37
58
|
async listJobPostings(ctx, opts) {
|
|
@@ -44,7 +65,6 @@ export class Upwork {
|
|
|
44
65
|
}
|
|
45
66
|
}
|
|
46
67
|
export function registerRoutes(http, component, opts) {
|
|
47
|
-
const baseUrl = opts.baseUrl ?? DEFAULT_BASE_URL;
|
|
48
68
|
http.route({
|
|
49
69
|
path: CALLBACK_PATH,
|
|
50
70
|
method: "GET",
|
|
@@ -57,18 +77,15 @@ export function registerRoutes(http, component, opts) {
|
|
|
57
77
|
const redirectUri = `${url.origin}${url.pathname}`;
|
|
58
78
|
try {
|
|
59
79
|
await ctx.runAction(component.public.exchangeAuthCode, {
|
|
60
|
-
clientId: opts.clientId,
|
|
61
|
-
clientSecret: opts.clientSecret,
|
|
62
80
|
code,
|
|
63
81
|
redirectUri,
|
|
64
|
-
baseUrl,
|
|
65
82
|
});
|
|
66
83
|
}
|
|
67
84
|
catch (error) {
|
|
68
85
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
69
86
|
return new Response(`OAuth callback failed: ${message}`, { status: 500 });
|
|
70
87
|
}
|
|
71
|
-
if (opts
|
|
88
|
+
if (opts?.onSuccess) {
|
|
72
89
|
return new Response(null, {
|
|
73
90
|
status: 302,
|
|
74
91
|
headers: { Location: opts.onSuccess },
|
|
@@ -78,5 +95,5 @@ export function registerRoutes(http, component, opts) {
|
|
|
78
95
|
}),
|
|
79
96
|
});
|
|
80
97
|
}
|
|
81
|
-
export {
|
|
98
|
+
export { CALLBACK_PATH } from "./types.js";
|
|
82
99
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,QAAQ,GAAG,yCAAyC,CAAC;AAI3D,MAAM,OAAO,MAAM;IACE;IAAnB,YAAmB,SAA0B;QAA1B,cAAS,GAAT,SAAS,CAAiB;IAAG,CAAC;IAEjD,mBAAmB;QACjB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,WAAW,GAAG,GAAG,OAAO,GAAG,aAAa,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,aAAa,EAAE,MAAM;YACrB,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,WAAW;SAC1B,CAAC,CAAC;QACH,OAAO,GAAG,QAAQ,yCAAyC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjF,CAAC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AAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBACzE,OAAO,IAAI,QAAQ,CAAC,0BAA0B,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YAC5E,CAAC;YAED,IAAI,IAAI,EAAE,SAAS,EAAE,CAAC;gBACpB,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;oBACxB,MAAM,EAAE,GAAG;oBACX,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE;iBACtC,CAAC,CAAC;YACL,CAAC;YAED,OAAO,IAAI,QAAQ,CAAC,mCAAmC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5E,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -29,6 +29,5 @@ export type SearchResult = {
|
|
|
29
29
|
hasNextPage: boolean;
|
|
30
30
|
};
|
|
31
31
|
export type AuthStatus = "connected" | "disconnected" | "expired";
|
|
32
|
-
export declare const DEFAULT_BASE_URL = "https://upwork-mock-server.onrender.com";
|
|
33
32
|
export declare const CALLBACK_PATH = "/upwork/callback";
|
|
34
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,kBAAkB,CAAC,gBAAgB,CAAC,EACpC,UAAU,GAAG,a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C;AAElE,eAAO,MAAM,aAAa,qBAAqB,CAAC"}
|
package/dist/client/types.js
CHANGED
package/dist/client/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -57,25 +57,21 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
57
57
|
};
|
|
58
58
|
public: {
|
|
59
59
|
exchangeAuthCode: FunctionReference<"action", "internal", {
|
|
60
|
-
baseUrl: string;
|
|
61
|
-
clientId: string;
|
|
62
|
-
clientSecret: string;
|
|
63
60
|
code: string;
|
|
64
61
|
redirectUri: string;
|
|
65
62
|
}, any, Name>;
|
|
63
|
+
fetchJobPosting: FunctionReference<"action", "internal", {
|
|
64
|
+
upworkId: string;
|
|
65
|
+
}, any, Name>;
|
|
66
66
|
getAuthStatus: FunctionReference<"query", "internal", {}, any, Name>;
|
|
67
|
+
getJobPosting: FunctionReference<"query", "internal", {
|
|
68
|
+
upworkId: string;
|
|
69
|
+
}, any, Name>;
|
|
67
70
|
listJobPostings: FunctionReference<"query", "internal", {
|
|
68
71
|
limit?: number;
|
|
69
72
|
}, any, Name>;
|
|
70
|
-
refreshAccessToken: FunctionReference<"action", "internal", {
|
|
71
|
-
baseUrl: string;
|
|
72
|
-
clientId: string;
|
|
73
|
-
clientSecret: string;
|
|
74
|
-
}, any, Name>;
|
|
73
|
+
refreshAccessToken: FunctionReference<"action", "internal", {}, any, Name>;
|
|
75
74
|
searchJobPostings: FunctionReference<"action", "internal", {
|
|
76
|
-
baseUrl: string;
|
|
77
|
-
clientId: string;
|
|
78
|
-
clientSecret: string;
|
|
79
75
|
searchQuery?: string;
|
|
80
76
|
sortField?: string;
|
|
81
77
|
}, any, Name>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,OAAO,EAAE;QACP,SAAS,EAAE,iBAAiB,CAC1B,OAAO,EACP,UAAU,EACV,EAAE,EACF;YACE,aAAa,EAAE,MAAM,CAAC;YACtB,GAAG,EAAE,MAAM,CAAC;YACZ,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,IAAI,EACR,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,UAAU,EACV,UAAU,EACV;YACE,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACnB,EACD,IAAI,EACJ,IAAI,CACL,CAAC;QACF,iBAAiB,EAAE,iBAAiB,CAClC,UAAU,EACV,UAAU,EACV;YACE,QAAQ,EAAE,KAAK,CAAC;gBACd,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;gBAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAC1B,eAAe,EAAE,MAAM,CAAC;gBACxB,WAAW,EAAE,MAAM,CAAC;gBACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,eAAe,EAAE,MAAM,CAAC;gBACxB,iBAAiB,EAAE,MAAM,CAAC;gBAC1B,MAAM,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAC;gBAChC,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,KAAK,EAAE,MAAM,CAAC;gBACd,QAAQ,EAAE,MAAM,CAAC;aAClB,CAAC,CAAC;SACJ,EACD,IAAI,EACJ,IAAI,CACL,CAAC;KACH,CAAC;IACF,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CACjC,QAAQ,EACR,UAAU,EACV;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,OAAO,EAAE;QACP,SAAS,EAAE,iBAAiB,CAC1B,OAAO,EACP,UAAU,EACV,EAAE,EACF;YACE,aAAa,EAAE,MAAM,CAAC;YACtB,GAAG,EAAE,MAAM,CAAC;YACZ,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,IAAI,EACR,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,UAAU,EACV,UAAU,EACV;YACE,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACnB,EACD,IAAI,EACJ,IAAI,CACL,CAAC;QACF,iBAAiB,EAAE,iBAAiB,CAClC,UAAU,EACV,UAAU,EACV;YACE,QAAQ,EAAE,K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;SAAE,EAClB,GAAG,EACH,IAAI,CACL,CAAC;QACF,kBAAkB,EAAE,iBAAiB,CACnC,QAAQ,EACR,UAAU,EACV,EAAE,EACF,GAAG,EACH,IAAI,CACL,CAAC;QACF,iBAAiB,EAAE,iBAAiB,CAClC,QAAQ,EACR,UAAU,EACV;YAAE,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,EAC5C,GAAG,EACH,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export declare const storeTokens: import("convex/server").RegisteredMutation<"public", {
|
|
2
2
|
accessToken: string;
|
|
3
|
-
refreshToken: string;
|
|
4
3
|
expiresAt: number;
|
|
4
|
+
refreshToken: string;
|
|
5
5
|
tokenType: string;
|
|
6
6
|
}, Promise<null>>;
|
|
7
7
|
export declare const getTokens: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
8
8
|
_id: import("convex/values").GenericId<"oauthTokens">;
|
|
9
9
|
_creationTime: number;
|
|
10
10
|
accessToken: string;
|
|
11
|
-
refreshToken: string;
|
|
12
11
|
expiresAt: number;
|
|
12
|
+
refreshToken: string;
|
|
13
13
|
tokenType: string;
|
|
14
14
|
} | null>>;
|
|
15
15
|
export declare const upsertJobPostings: import("convex/server").RegisteredMutation<"public", {
|
|
@@ -21,25 +21,41 @@ type SearchResult = {
|
|
|
21
21
|
postings: JobPostingRow[];
|
|
22
22
|
hasNextPage: boolean;
|
|
23
23
|
};
|
|
24
|
-
export declare const refreshAccessToken: import("convex/server").RegisteredAction<"public", {
|
|
25
|
-
clientId: string;
|
|
26
|
-
clientSecret: string;
|
|
27
|
-
baseUrl: string;
|
|
28
|
-
}, Promise<void>>;
|
|
24
|
+
export declare const refreshAccessToken: import("convex/server").RegisteredAction<"public", {}, Promise<void>>;
|
|
29
25
|
export declare const exchangeAuthCode: import("convex/server").RegisteredAction<"public", {
|
|
30
|
-
clientId: string;
|
|
31
|
-
clientSecret: string;
|
|
32
|
-
baseUrl: string;
|
|
33
26
|
code: string;
|
|
34
27
|
redirectUri: string;
|
|
35
28
|
}, Promise<void>>;
|
|
36
29
|
export declare const searchJobPostings: import("convex/server").RegisteredAction<"public", {
|
|
37
30
|
searchQuery?: string | undefined;
|
|
38
31
|
sortField?: string | undefined;
|
|
39
|
-
clientId: string;
|
|
40
|
-
clientSecret: string;
|
|
41
|
-
baseUrl: string;
|
|
42
32
|
}, Promise<SearchResult>>;
|
|
33
|
+
export declare const getJobPosting: import("convex/server").RegisteredQuery<"public", {
|
|
34
|
+
upworkId: string;
|
|
35
|
+
}, Promise<{
|
|
36
|
+
_id: import("convex/values").GenericId<"jobPostings">;
|
|
37
|
+
_creationTime: number;
|
|
38
|
+
category?: string | undefined;
|
|
39
|
+
subcategory?: string | undefined;
|
|
40
|
+
duration?: string | undefined;
|
|
41
|
+
budgetAmount?: string | undefined;
|
|
42
|
+
budgetCurrency?: string | undefined;
|
|
43
|
+
clientTotalHires?: number | undefined;
|
|
44
|
+
clientCompanyName?: string | undefined;
|
|
45
|
+
upworkId: string;
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
skills: {
|
|
49
|
+
name: string;
|
|
50
|
+
}[];
|
|
51
|
+
experienceLevel: string;
|
|
52
|
+
createdDateTime: string;
|
|
53
|
+
publishedDateTime: string;
|
|
54
|
+
cachedAt: number;
|
|
55
|
+
} | null>>;
|
|
56
|
+
export declare const fetchJobPosting: import("convex/server").RegisteredAction<"public", {
|
|
57
|
+
upworkId: string;
|
|
58
|
+
}, Promise<JobPostingRow | null>>;
|
|
43
59
|
export declare const listJobPostings: import("convex/server").RegisteredQuery<"public", {
|
|
44
60
|
limit?: number | undefined;
|
|
45
61
|
}, Promise<{
|
|
@@ -63,6 +79,6 @@ export declare const listJobPostings: import("convex/server").RegisteredQuery<"p
|
|
|
63
79
|
publishedDateTime: string;
|
|
64
80
|
cachedAt: number;
|
|
65
81
|
}[]>>;
|
|
66
|
-
export declare const getAuthStatus: import("convex/server").RegisteredQuery<"public", {}, Promise<"
|
|
82
|
+
export declare const getAuthStatus: import("convex/server").RegisteredQuery<"public", {}, Promise<"connected" | "disconnected" | "expired">>;
|
|
67
83
|
export {};
|
|
68
84
|
//# sourceMappingURL=public.d.ts.map
|