@inploi/plugin-job-search 0.1.0 → 0.1.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.
@@ -3,147 +3,106 @@ import { SWRResponse } from 'swr';
3
3
  import { Input } from 'valibot';
4
4
  import { FilterValue } from './components/filter';
5
5
  declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
6
- data: import("valibot").ObjectSchema<{
7
- results: import("valibot").ArraySchema<import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
8
- id: import("valibot").NumberSchema<number>;
9
- company_name: import("valibot").StringSchema<string>;
10
- company_logo: import("valibot").StringSchema<string>;
11
- employment_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"FULL_TIME", "FULL_TIME">, import("valibot").LiteralSchema<"PART_TIME", "PART_TIME">, import("valibot").LiteralSchema<"TEMPORARY", "TEMPORARY">, import("valibot").LiteralSchema<"CONTRACTOR", "CONTRACTOR">, import("valibot").LiteralSchema<"INTERN", "INTERN">, import("valibot").LiteralSchema<"VOLUNTEER", "VOLUNTEER">, import("valibot").LiteralSchema<"OTHER", "OTHER">], "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER">;
12
- location_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"LOCATION", "LOCATION">, import("valibot").LiteralSchema<"REMOTE", "REMOTE">, import("valibot").LiteralSchema<"HYBRID", "HYBRID">], "LOCATION" | "REMOTE" | "HYBRID">;
13
- pay_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"ANNUALLY", "ANNUALLY">, import("valibot").LiteralSchema<"HOURLY", "HOURLY">, import("valibot").LiteralSchema<"MONTHLY", "MONTHLY">, import("valibot").LiteralSchema<"WEEKLY", "WEEKLY">, import("valibot").LiteralSchema<"DAILY", "DAILY">], "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY">;
14
- pay_currency: import("valibot").StringSchema<string>;
15
- pay_mask: import("valibot").BooleanSchema<boolean>;
16
- pay_display: import("valibot").BooleanSchema<boolean>;
17
- pay: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
18
- pay_min: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
19
- pay_max: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
20
- description: import("valibot").StringSchema<string>;
21
- title: import("valibot").StringSchema<string>;
22
- coordinates: import("valibot").ObjectSchema<{
23
- lat: import("valibot").NumberSchema<number>;
24
- lng: import("valibot").NumberSchema<number>;
25
- }, undefined, {
26
- lat: number;
27
- lng: number;
28
- }>;
29
- contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
30
- created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
31
- custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
32
- [x: string]: any;
33
- }>, undefined, {
34
- [x: string]: any;
35
- } | null>;
36
- href: import("valibot").StringSchema<string>;
6
+ data: import("valibot").ArraySchema<import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
7
+ id: import("valibot").NumberSchema<number>;
8
+ company_name: import("valibot").StringSchema<string>;
9
+ company_logo: import("valibot").StringSchema<string>;
10
+ employment_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"FULL_TIME", "FULL_TIME">, import("valibot").LiteralSchema<"PART_TIME", "PART_TIME">, import("valibot").LiteralSchema<"TEMPORARY", "TEMPORARY">, import("valibot").LiteralSchema<"CONTRACTOR", "CONTRACTOR">, import("valibot").LiteralSchema<"INTERN", "INTERN">, import("valibot").LiteralSchema<"VOLUNTEER", "VOLUNTEER">, import("valibot").LiteralSchema<"OTHER", "OTHER">], "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER">;
11
+ location_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"LOCATION", "LOCATION">, import("valibot").LiteralSchema<"REMOTE", "REMOTE">, import("valibot").LiteralSchema<"HYBRID", "HYBRID">], "LOCATION" | "REMOTE" | "HYBRID">;
12
+ pay_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"ANNUALLY", "ANNUALLY">, import("valibot").LiteralSchema<"HOURLY", "HOURLY">, import("valibot").LiteralSchema<"MONTHLY", "MONTHLY">, import("valibot").LiteralSchema<"WEEKLY", "WEEKLY">, import("valibot").LiteralSchema<"DAILY", "DAILY">], "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY">;
13
+ pay_currency: import("valibot").StringSchema<string>;
14
+ pay_mask: import("valibot").BooleanSchema<boolean>;
15
+ pay_display: import("valibot").BooleanSchema<boolean>;
16
+ pay: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
17
+ pay_min: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
18
+ pay_max: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
19
+ description: import("valibot").StringSchema<string>;
20
+ title: import("valibot").StringSchema<string>;
21
+ coordinates: import("valibot").ObjectSchema<{
22
+ lat: import("valibot").NumberSchema<number>;
23
+ lng: import("valibot").NumberSchema<number>;
37
24
  }, undefined, {
38
- title: string;
39
- href: string;
40
- id: number;
41
- company_name: string;
42
- company_logo: string;
43
- employment_type: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
44
- location_type: "LOCATION" | "REMOTE" | "HYBRID";
45
- pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
46
- pay_currency: string;
47
- pay_mask: boolean;
48
- pay_display: boolean;
49
- pay: string | null;
50
- pay_min: string | null;
51
- pay_max: string | null;
52
- description: string;
53
- coordinates: {
54
- lat: number;
55
- lng: number;
56
- };
57
- contract_type: string | null;
58
- created_at: string | null;
59
- custom_data: {
60
- [x: string]: any;
61
- } | null;
62
- }>, {
63
- id: number;
64
- isNew: boolean;
65
- company: {
66
- name: string;
67
- logo: string;
68
- };
69
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
70
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
71
- pay: string | undefined;
72
- description: string;
73
- title: string;
74
- coordinates: {
75
- lat: number;
76
- lng: number;
77
- };
78
- contractType: string | null;
79
- href: string;
80
- relativePostedDate: string;
81
- customData: {
82
- [x: string]: any;
83
- } | null;
84
- }>, {
85
- id: number;
86
- isNew: boolean;
87
- company: {
88
- name: string;
89
- logo: string;
90
- };
91
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
92
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
93
- pay: string | undefined;
94
- description: string;
95
- title: string;
96
- coordinates: {
97
- lat: number;
98
- lng: number;
99
- };
100
- contractType: string | null;
101
- href: string;
102
- relativePostedDate: string;
103
- customData: {
104
- [x: string]: any;
105
- } | null;
106
- }[]>;
107
- available_properties: import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").SchemaWithTransform<import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, {
108
- value: string;
109
- label: string;
110
- }[]>, {
111
- [x: string]: {
112
- value: string;
113
- label: string;
114
- }[];
25
+ lat: number;
26
+ lng: number;
115
27
  }>;
28
+ contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
29
+ created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
30
+ custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
31
+ [x: string]: any;
32
+ }>, undefined, {
33
+ [x: string]: any;
34
+ } | null>;
35
+ href: import("valibot").StringSchema<string>;
116
36
  }, undefined, {
117
- results: {
118
- id: number;
119
- isNew: boolean;
120
- company: {
121
- name: string;
122
- logo: string;
123
- };
124
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
125
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
126
- pay: string | undefined;
127
- description: string;
128
- title: string;
129
- coordinates: {
130
- lat: number;
131
- lng: number;
132
- };
133
- contractType: string | null;
134
- href: string;
135
- relativePostedDate: string;
136
- customData: {
137
- [x: string]: any;
138
- } | null;
139
- }[];
140
- available_properties: {
141
- [x: string]: {
142
- value: string;
143
- label: string;
144
- }[];
37
+ title: string;
38
+ href: string;
39
+ id: number;
40
+ company_name: string;
41
+ company_logo: string;
42
+ employment_type: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
43
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
44
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
45
+ pay_currency: string;
46
+ pay_mask: boolean;
47
+ pay_display: boolean;
48
+ pay: string | null;
49
+ pay_min: string | null;
50
+ pay_max: string | null;
51
+ description: string;
52
+ coordinates: {
53
+ lat: number;
54
+ lng: number;
145
55
  };
146
- }>;
56
+ contract_type: string | null;
57
+ created_at: string | null;
58
+ custom_data: {
59
+ [x: string]: any;
60
+ } | null;
61
+ }>, {
62
+ id: number;
63
+ isNew: boolean;
64
+ company: {
65
+ name: string;
66
+ logo: string;
67
+ };
68
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
69
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
70
+ pay: string | undefined;
71
+ description: string;
72
+ title: string;
73
+ coordinates: {
74
+ lat: number;
75
+ lng: number;
76
+ };
77
+ contractType: string | null;
78
+ href: string;
79
+ relativePostedDate: string;
80
+ customData: {
81
+ [x: string]: any;
82
+ } | null;
83
+ }>, {
84
+ id: number;
85
+ isNew: boolean;
86
+ company: {
87
+ name: string;
88
+ logo: string;
89
+ };
90
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
91
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
92
+ pay: string | undefined;
93
+ description: string;
94
+ title: string;
95
+ coordinates: {
96
+ lat: number;
97
+ lng: number;
98
+ };
99
+ contractType: string | null;
100
+ href: string;
101
+ relativePostedDate: string;
102
+ customData: {
103
+ [x: string]: any;
104
+ } | null;
105
+ }[]>;
147
106
  pagination: import("valibot").ObjectSchema<{
148
107
  total: import("valibot").NumberSchema<number>;
149
108
  current_page: import("valibot").NumberSchema<number>;
@@ -157,36 +116,28 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
157
116
  }>;
158
117
  }, undefined, {
159
118
  data: {
160
- results: {
161
- id: number;
162
- isNew: boolean;
163
- company: {
164
- name: string;
165
- logo: string;
166
- };
167
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
168
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
169
- pay: string | undefined;
170
- description: string;
171
- title: string;
172
- coordinates: {
173
- lat: number;
174
- lng: number;
175
- };
176
- contractType: string | null;
177
- href: string;
178
- relativePostedDate: string;
179
- customData: {
180
- [x: string]: any;
181
- } | null;
182
- }[];
183
- available_properties: {
184
- [x: string]: {
185
- value: string;
186
- label: string;
187
- }[];
119
+ id: number;
120
+ isNew: boolean;
121
+ company: {
122
+ name: string;
123
+ logo: string;
188
124
  };
189
- };
125
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
126
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
127
+ pay: string | undefined;
128
+ description: string;
129
+ title: string;
130
+ coordinates: {
131
+ lat: number;
132
+ lng: number;
133
+ };
134
+ contractType: string | null;
135
+ href: string;
136
+ relativePostedDate: string;
137
+ customData: {
138
+ [x: string]: any;
139
+ } | null;
140
+ }[];
190
141
  pagination: {
191
142
  total: number;
192
143
  current_page: number;
@@ -223,14 +174,20 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
223
174
  [x: string]: any;
224
175
  } | null;
225
176
  }[];
226
- availableProperties: {
227
- [x: string]: {
228
- value: string;
229
- label: string;
230
- }[];
231
- };
232
177
  }>;
233
178
  export type JobSearchResponsePayload = Input<typeof JobSearchResponseSchema>;
179
+ export declare const getAvailableFilters: ({ apiClient, filters, logger, signal, }: {
180
+ apiClient: ApiClient;
181
+ logger: Logger;
182
+ signal?: AbortSignal | undefined;
183
+ filters: Record<string, FilterValue | undefined>;
184
+ }) => Promise<{
185
+ [x: string]: {
186
+ value: string;
187
+ label: string;
188
+ }[];
189
+ }>;
190
+ export type GetAvailableFiltersResponse = Awaited<ReturnType<typeof getAvailableFilters>>;
234
191
  export declare const getJobSearchResults: ({ apiClient, logger, signal, filters, page, }: {
235
192
  apiClient: ApiClient;
236
193
  logger: Logger;
@@ -267,30 +224,27 @@ export declare const getJobSearchResults: ({ apiClient, logger, signal, filters,
267
224
  [x: string]: any;
268
225
  } | null;
269
226
  }[];
270
- availableProperties: {
271
- [x: string]: {
272
- value: string;
273
- label: string;
274
- }[];
275
- };
276
227
  }>;
277
- export declare const getDataState: <T>(swr: SWRResponse<T, any, any>) => {
278
- state: "error";
228
+ export type GetJobSearchResponse = Awaited<ReturnType<typeof getJobSearchResults>>;
229
+ export type QueryState<T> = {
230
+ state: 'error';
231
+ data?: never;
279
232
  error: unknown;
280
- data: T | undefined;
281
233
  } | {
282
- state: "loading";
283
- data: T | undefined;
284
- error?: undefined;
234
+ state: 'loading';
235
+ data?: never;
236
+ error?: never;
285
237
  } | {
286
- state: "revalidating";
287
- data: NonNullable<T>;
288
- error?: undefined;
238
+ state: 'revalidating';
239
+ data: T;
240
+ error?: never;
289
241
  } | {
290
- state: "loaded";
291
- data: NonNullable<T>;
292
- error?: undefined;
242
+ state: 'loaded';
243
+ data: T;
244
+ error?: never;
293
245
  };
246
+ /** Binds together state to data, fixing useSWR’s type-safety */
247
+ export declare const getQueryState: <T>(swr: SWRResponse<T, any, any>) => QueryState<T>;
294
248
  export declare const SWR_SETTINGS: {
295
249
  readonly keepPreviousData: true;
296
250
  readonly revalidateOnFocus: false;
@@ -1,2 +1,3 @@
1
1
  export declare const JOB_SEARCH_ELEMENT_ID = "inploi-job-search";
2
2
  export declare const JOB_SEARCH_SCOPE_ELEMENT_ID = "ijs";
3
+ export declare const PAGE_SIZE = 10;