@go-avro/avro-js 0.0.2-beta.1 → 0.0.2-beta.2
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/dist/auth/AuthManager.d.ts +3 -1
- package/dist/auth/AuthManager.js +13 -1
- package/dist/client/QueryClient.d.ts +5 -0
- package/dist/client/QueryClient.js +74 -0
- package/dist/types/api.d.ts +497 -10
- package/package.json +1 -1
|
@@ -6,8 +6,10 @@ export declare class AuthManager {
|
|
|
6
6
|
baseUrl: string;
|
|
7
7
|
storage: TokenStorage | TokenStorage[];
|
|
8
8
|
});
|
|
9
|
+
hasTokens(): Promise<boolean>;
|
|
9
10
|
fetchNewTokens(): Promise<Tokens>;
|
|
10
11
|
accessToken(): Promise<string | undefined>;
|
|
11
12
|
refreshTokens(): Promise<Tokens | null>;
|
|
12
|
-
|
|
13
|
+
setTokens(tokens: Tokens): Promise<void>;
|
|
14
|
+
clearTokens(): Promise<void>;
|
|
13
15
|
}
|
package/dist/auth/AuthManager.js
CHANGED
|
@@ -11,6 +11,15 @@ export class AuthManager {
|
|
|
11
11
|
});
|
|
12
12
|
this.baseUrl = baseUrl;
|
|
13
13
|
}
|
|
14
|
+
async hasTokens() {
|
|
15
|
+
for (const storage of this.storages) {
|
|
16
|
+
const tokens = await storage.get();
|
|
17
|
+
if (tokens && tokens.access_token) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
14
23
|
async fetchNewTokens() {
|
|
15
24
|
const refreshToken = await new Promise((resolve, reject) => {
|
|
16
25
|
this.storages.map(async (storage) => {
|
|
@@ -61,7 +70,10 @@ export class AuthManager {
|
|
|
61
70
|
return null;
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
|
-
async
|
|
73
|
+
async setTokens(tokens) {
|
|
74
|
+
await Promise.all(this.storages.map(s => s.set(tokens)));
|
|
75
|
+
}
|
|
76
|
+
async clearTokens() {
|
|
65
77
|
await Promise.all(this.storages.map(s => s.clear()));
|
|
66
78
|
}
|
|
67
79
|
}
|
|
@@ -12,8 +12,13 @@ export declare class AvroQueryClient {
|
|
|
12
12
|
constructor(config: AvroQueryClientConfig);
|
|
13
13
|
getDelay(strategy: RetryStrategy, attempt: number): number;
|
|
14
14
|
private _xhr;
|
|
15
|
+
private _fetch;
|
|
15
16
|
get<T>(path: string, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<T>;
|
|
16
17
|
post<T>(path: string, data: any, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<T>;
|
|
17
18
|
put<T>(path: string, data: any, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<T>;
|
|
18
19
|
delete<T>(path: string, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<T>;
|
|
20
|
+
login(data: {
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
}, cancelToken?: CancelToken): Promise<Boolean>;
|
|
19
24
|
}
|
|
@@ -104,6 +104,66 @@ export class AvroQueryClient {
|
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
+
_fetch(method, path, body, cancelToken, headers = {}, isIdempotent = false, retryCount = 0) {
|
|
108
|
+
const checkCancelled = () => {
|
|
109
|
+
if (cancelToken?.isCancelled()) {
|
|
110
|
+
return new StandardError(0, 'Request cancelled');
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
};
|
|
114
|
+
return this.config.authManager.accessToken().then(token => {
|
|
115
|
+
const cancelErr = checkCancelled();
|
|
116
|
+
if (cancelErr)
|
|
117
|
+
return Promise.reject(cancelErr);
|
|
118
|
+
const url = this.config.baseUrl + path;
|
|
119
|
+
const requestHeaders = {
|
|
120
|
+
'Content-Type': 'application/json',
|
|
121
|
+
...headers,
|
|
122
|
+
};
|
|
123
|
+
if (token) {
|
|
124
|
+
requestHeaders['Authorization'] = `Bearer ${token}`;
|
|
125
|
+
}
|
|
126
|
+
const options = {
|
|
127
|
+
method,
|
|
128
|
+
headers: requestHeaders,
|
|
129
|
+
body: body ? JSON.stringify(body) : null,
|
|
130
|
+
};
|
|
131
|
+
return fetch(url, options).then(response => {
|
|
132
|
+
if (response.status === 401 && this.config.authManager.refreshTokens && retryCount === 0) {
|
|
133
|
+
return this.config.authManager
|
|
134
|
+
.refreshTokens()
|
|
135
|
+
.then(() => this._fetch(method, path, body, cancelToken, headers, isIdempotent, retryCount + 1))
|
|
136
|
+
.catch(() => Promise.reject(new StandardError(401, 'Unauthorized (refresh failed)')));
|
|
137
|
+
}
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
if (retryCount < this.config.maxRetries) {
|
|
140
|
+
const delay = this.getDelay(this.config.retryStrategy, retryCount);
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
this._fetch(method, path, body, cancelToken, headers, isIdempotent, retryCount + 1)
|
|
144
|
+
.then(resolve)
|
|
145
|
+
.catch(reject);
|
|
146
|
+
}, delay);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return response.text().then(text => {
|
|
151
|
+
let msg = response.statusText;
|
|
152
|
+
try {
|
|
153
|
+
const parsed = JSON.parse(text);
|
|
154
|
+
msg = parsed.message || msg;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
console.warn('Failed to parse error response:', text);
|
|
158
|
+
}
|
|
159
|
+
throw new StandardError(response.status, msg);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return response.json();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
107
167
|
get(path, cancelToken, headers = {}) {
|
|
108
168
|
return this._xhr('GET', path, null, cancelToken, headers, true);
|
|
109
169
|
}
|
|
@@ -116,4 +176,18 @@ export class AvroQueryClient {
|
|
|
116
176
|
delete(path, cancelToken, headers = {}) {
|
|
117
177
|
return this._xhr('DELETE', path, null, cancelToken, headers, false);
|
|
118
178
|
}
|
|
179
|
+
// add login that uses fetch and sets the tokens in the auth manager
|
|
180
|
+
login(data, cancelToken) {
|
|
181
|
+
return this._fetch('POST', '/login', data, cancelToken)
|
|
182
|
+
.then(tokens => {
|
|
183
|
+
if (!tokens || !tokens.access_token || !tokens.refresh_token) {
|
|
184
|
+
throw new StandardError(401, 'Invalid login response');
|
|
185
|
+
}
|
|
186
|
+
return this.config.authManager.setTokens(tokens).then(() => true);
|
|
187
|
+
})
|
|
188
|
+
.catch(err => {
|
|
189
|
+
console.error('Login failed:', err);
|
|
190
|
+
throw new StandardError(401, 'Login failed');
|
|
191
|
+
});
|
|
192
|
+
}
|
|
119
193
|
}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,19 +1,506 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface PaymentMethod {
|
|
2
|
+
allow_redisplay: string;
|
|
3
|
+
autopay: boolean;
|
|
4
|
+
billing_details: {
|
|
5
|
+
email: string;
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
created: number;
|
|
9
|
+
customer: string;
|
|
10
|
+
id: string;
|
|
11
|
+
type: "us_bank_account" | "card";
|
|
12
|
+
us_bank_account: {
|
|
13
|
+
account_holder_type: string;
|
|
14
|
+
account_type: string;
|
|
15
|
+
bank_name: string;
|
|
16
|
+
financial_connections_account: string;
|
|
17
|
+
fingerprint: string;
|
|
18
|
+
last4: string;
|
|
19
|
+
networks: {
|
|
20
|
+
preferred: string;
|
|
21
|
+
supported: string[];
|
|
22
|
+
};
|
|
23
|
+
routing_number: string;
|
|
24
|
+
status_details: object;
|
|
25
|
+
} | null;
|
|
26
|
+
card: {
|
|
27
|
+
brand: string;
|
|
28
|
+
checks: {
|
|
29
|
+
address_line1_check: string;
|
|
30
|
+
address_postal_code_check: string;
|
|
31
|
+
cvc_check: string;
|
|
32
|
+
};
|
|
33
|
+
country: string;
|
|
34
|
+
exp_month: number;
|
|
35
|
+
exp_year: number;
|
|
36
|
+
fingerprint: string;
|
|
37
|
+
funding: string;
|
|
38
|
+
last4: string;
|
|
39
|
+
networks: {
|
|
40
|
+
preferred: string;
|
|
41
|
+
supported: string[];
|
|
42
|
+
};
|
|
43
|
+
three_d_secure_usage: {
|
|
44
|
+
supported: boolean;
|
|
45
|
+
};
|
|
46
|
+
wallet: {
|
|
47
|
+
type: string;
|
|
48
|
+
} | null;
|
|
49
|
+
} | null;
|
|
50
|
+
}
|
|
51
|
+
export interface Avro {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
time_created: number;
|
|
55
|
+
time_updated: number;
|
|
56
|
+
emails: Email[];
|
|
57
|
+
totp_email_id: string;
|
|
58
|
+
billing_email_id: string;
|
|
59
|
+
join_email_id: string;
|
|
60
|
+
}
|
|
61
|
+
export interface Friendship {
|
|
62
|
+
}
|
|
63
|
+
export interface MemberState {
|
|
64
|
+
id: string;
|
|
65
|
+
state: string;
|
|
66
|
+
friendship: Friendship | null;
|
|
67
|
+
last_message_read_at: number | null;
|
|
68
|
+
}
|
|
69
|
+
export interface LineItem {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
cost: number | null;
|
|
74
|
+
amount: number | null;
|
|
75
|
+
time_created: number;
|
|
76
|
+
}
|
|
77
|
+
export interface Reaction {
|
|
78
|
+
id: string;
|
|
79
|
+
message_id: string;
|
|
80
|
+
sender_id: string;
|
|
81
|
+
reaction: string;
|
|
82
|
+
time_created: number;
|
|
83
|
+
time_updated: number;
|
|
84
|
+
}
|
|
85
|
+
export interface Message {
|
|
86
|
+
id: string;
|
|
87
|
+
chat_id: string;
|
|
88
|
+
sender_id: string;
|
|
89
|
+
reply_to_id: string;
|
|
90
|
+
content: string;
|
|
91
|
+
reactions: Reaction[];
|
|
92
|
+
time_created: number;
|
|
93
|
+
time_updated: number;
|
|
94
|
+
time_sent: number;
|
|
95
|
+
message: string;
|
|
96
|
+
}
|
|
97
|
+
export interface Chat {
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
company_id: string;
|
|
101
|
+
time_created: number;
|
|
102
|
+
time_updated: number;
|
|
103
|
+
last_message: Message;
|
|
104
|
+
user_state: MemberState[];
|
|
105
|
+
messages: Message[];
|
|
106
|
+
}
|
|
107
|
+
export interface TeamLocation {
|
|
108
|
+
accuracy: number;
|
|
109
|
+
heading: number;
|
|
110
|
+
id: string;
|
|
111
|
+
latitude: number;
|
|
112
|
+
longitude: number;
|
|
113
|
+
time_collected: number;
|
|
114
|
+
time_created: number;
|
|
115
|
+
time_updated: number | null;
|
|
116
|
+
}
|
|
117
|
+
export interface Team {
|
|
118
|
+
autoconfigure: boolean;
|
|
119
|
+
company_id: string;
|
|
120
|
+
description: string;
|
|
121
|
+
end: number[];
|
|
122
|
+
end_time: number;
|
|
123
|
+
fixed_cost: number;
|
|
124
|
+
hourly_cost: number;
|
|
125
|
+
id: string;
|
|
126
|
+
items: string[];
|
|
127
|
+
km_cost: number;
|
|
128
|
+
max_distance: number;
|
|
129
|
+
max_jobs: number;
|
|
130
|
+
max_travel_time: number;
|
|
131
|
+
color: string;
|
|
132
|
+
name: string;
|
|
133
|
+
profile: string;
|
|
134
|
+
routes: string[];
|
|
135
|
+
skills: string[];
|
|
136
|
+
speed_factor: number;
|
|
137
|
+
start_latitude: number;
|
|
138
|
+
start_longitude: number;
|
|
139
|
+
end_latitude: number;
|
|
140
|
+
end_longitude: number;
|
|
141
|
+
start_time: number;
|
|
142
|
+
users: string[];
|
|
143
|
+
current_location: TeamLocation;
|
|
144
|
+
start_address: string;
|
|
145
|
+
end_address: string;
|
|
146
|
+
}
|
|
147
|
+
export interface Subscription {
|
|
148
|
+
time_created: number;
|
|
149
|
+
time_updated: string;
|
|
150
|
+
user: User;
|
|
151
|
+
user_company_id: string;
|
|
152
|
+
job_id: string;
|
|
153
|
+
id: string;
|
|
154
|
+
notifications: number;
|
|
155
|
+
}
|
|
156
|
+
export interface Plan {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
base_rate: number;
|
|
160
|
+
price_per_job: number;
|
|
161
|
+
description: string;
|
|
162
|
+
referral_codes: string[];
|
|
163
|
+
trial_period_days: number;
|
|
164
|
+
time_created: number;
|
|
165
|
+
time_updated: number;
|
|
166
|
+
}
|
|
167
|
+
export interface BillPayment {
|
|
168
|
+
id: string;
|
|
169
|
+
amount: number;
|
|
170
|
+
stripe_pi_id: string;
|
|
171
|
+
bill_user_id: string;
|
|
172
|
+
status: "created" | "processing" | "succeeded" | "failed" | "canceled" | "requires_action";
|
|
173
|
+
type: "us_bank_account" | "card";
|
|
174
|
+
action_required_at: number;
|
|
175
|
+
time_created: number;
|
|
176
|
+
time_updated: number | null;
|
|
177
|
+
}
|
|
178
|
+
export interface BillUser {
|
|
179
|
+
id: string;
|
|
180
|
+
user_id: string;
|
|
181
|
+
bill_id: string;
|
|
182
|
+
invoice_id: string;
|
|
183
|
+
payment_attempts: BillPayment[];
|
|
184
|
+
time_created: number;
|
|
185
|
+
time_updated: number | null;
|
|
186
|
+
amount: number;
|
|
187
|
+
}
|
|
188
|
+
export interface User {
|
|
189
|
+
id: string;
|
|
190
|
+
username: string;
|
|
191
|
+
name: string;
|
|
192
|
+
verified: boolean;
|
|
193
|
+
companies: UserCompanyAssociation[] | null;
|
|
194
|
+
email: string | null;
|
|
195
|
+
phone_number: string | null;
|
|
196
|
+
time_created: string | null;
|
|
197
|
+
time_updated: string | null;
|
|
198
|
+
can_send_emails: boolean | null;
|
|
199
|
+
payment_methods: PaymentMethod[];
|
|
200
|
+
autopay_payment_types: string[];
|
|
201
|
+
autopay: boolean | null;
|
|
202
|
+
chats: Chat[];
|
|
203
|
+
bills: BillUser[];
|
|
204
|
+
}
|
|
205
|
+
export interface Break {
|
|
206
|
+
id: string;
|
|
207
|
+
time_started: number;
|
|
208
|
+
time_ended: number;
|
|
209
|
+
company_billable: boolean;
|
|
210
|
+
client_billable: boolean;
|
|
211
|
+
}
|
|
212
|
+
export interface ServiceMonth {
|
|
213
|
+
id: string;
|
|
214
|
+
job_name: string;
|
|
215
|
+
job_id: string | null;
|
|
216
|
+
bill_id: string | null;
|
|
217
|
+
cost: number;
|
|
218
|
+
billed: boolean;
|
|
219
|
+
paid: boolean;
|
|
220
|
+
amount: number;
|
|
221
|
+
time_created: number;
|
|
222
|
+
time_updated: number | null;
|
|
223
|
+
}
|
|
224
|
+
export interface Session {
|
|
225
|
+
session_id: string;
|
|
226
|
+
user_id: string;
|
|
227
|
+
company_id: string;
|
|
228
|
+
time_started: number;
|
|
229
|
+
time_ended: number;
|
|
230
|
+
break_id: string;
|
|
231
|
+
is_paused: boolean;
|
|
232
|
+
team_id: string;
|
|
233
|
+
current_route_id: string;
|
|
234
|
+
breaks: Break[];
|
|
235
|
+
}
|
|
236
|
+
export interface Group {
|
|
237
|
+
id: string;
|
|
238
|
+
name: string;
|
|
239
|
+
is_active: boolean;
|
|
240
|
+
is_user_type: boolean;
|
|
241
|
+
users: string[];
|
|
242
|
+
permissions: string[];
|
|
243
|
+
company_id: string;
|
|
244
|
+
time_created: number;
|
|
245
|
+
time_updated: number;
|
|
246
|
+
}
|
|
247
|
+
export interface UserCompanyAssociation {
|
|
248
|
+
id: string;
|
|
249
|
+
user: User;
|
|
250
|
+
company: string;
|
|
251
|
+
permissions: string[];
|
|
252
|
+
effective_permissions: string[];
|
|
253
|
+
time_created: number | null;
|
|
254
|
+
time_updated: number | null;
|
|
255
|
+
notification_setting: number[];
|
|
256
|
+
share_email_company_wide: boolean;
|
|
257
|
+
notifications: number[];
|
|
258
|
+
groups: string[];
|
|
259
|
+
}
|
|
260
|
+
export interface Email {
|
|
261
|
+
id: string;
|
|
262
|
+
company_id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
mail_server: string;
|
|
265
|
+
mail_port: number;
|
|
266
|
+
mail_username: string;
|
|
267
|
+
mail_password: string | null;
|
|
268
|
+
mail_default_sender: string;
|
|
269
|
+
mail_use_tls: boolean;
|
|
270
|
+
mail_use_ssl: boolean;
|
|
271
|
+
mail_api_key: string;
|
|
272
|
+
is_company_wide: boolean;
|
|
273
|
+
users: User[];
|
|
274
|
+
type: "OUTLOOK" | "SMTP" | "GMAIL";
|
|
275
|
+
access_token?: string;
|
|
276
|
+
access_token_expiry?: number;
|
|
277
|
+
refresh_token?: string;
|
|
278
|
+
refresh_token_expiry?: number;
|
|
279
|
+
}
|
|
280
|
+
export interface Label {
|
|
281
|
+
name: string;
|
|
282
|
+
id: string;
|
|
283
|
+
company_id: string;
|
|
284
|
+
color: string;
|
|
285
|
+
jobs: string[];
|
|
286
|
+
}
|
|
287
|
+
export interface Bill {
|
|
288
|
+
id: string;
|
|
289
|
+
invoice_id: number;
|
|
290
|
+
intuit_id: string | null;
|
|
291
|
+
name: string;
|
|
292
|
+
amount: number;
|
|
293
|
+
billed_by: string;
|
|
294
|
+
customer_email: string | null;
|
|
295
|
+
manual_emails: string[][];
|
|
296
|
+
users: BillUser[];
|
|
297
|
+
paid_at: number;
|
|
298
|
+
time_created: number;
|
|
299
|
+
time_updated: number;
|
|
300
|
+
events: string[];
|
|
301
|
+
intent_created_at: number;
|
|
302
|
+
intent_last_created_at: number;
|
|
303
|
+
payment: BillPayment | null;
|
|
304
|
+
line_items: LineItem[];
|
|
305
|
+
months: string[];
|
|
306
|
+
due_date: number;
|
|
307
|
+
}
|
|
308
|
+
export interface Skill {
|
|
2
309
|
id: string;
|
|
3
310
|
name: string;
|
|
311
|
+
company_id: string;
|
|
312
|
+
time_created: number;
|
|
313
|
+
time_updated: number;
|
|
314
|
+
}
|
|
315
|
+
export interface PlanPayment {
|
|
316
|
+
id: string;
|
|
317
|
+
amount: number;
|
|
318
|
+
stripe_pi_id: string;
|
|
319
|
+
company_id: string;
|
|
320
|
+
plan_id: string;
|
|
321
|
+
status: "created" | "processing" | "succeeded" | "failed" | "canceled";
|
|
322
|
+
time_created: number;
|
|
323
|
+
time_updated: number;
|
|
324
|
+
}
|
|
325
|
+
export interface Company {
|
|
326
|
+
events: _Event[];
|
|
327
|
+
months: ServiceMonth[];
|
|
328
|
+
id: string;
|
|
329
|
+
jobs: Job[];
|
|
330
|
+
name: string;
|
|
4
331
|
email: string;
|
|
5
|
-
|
|
332
|
+
routes: Route[];
|
|
333
|
+
teams: Team[];
|
|
334
|
+
emails: Email[];
|
|
335
|
+
skills: Skill[];
|
|
336
|
+
time_created: string;
|
|
337
|
+
time_updated: string | null;
|
|
338
|
+
users: UserCompanyAssociation[];
|
|
339
|
+
use_client_side_customer_start_billing: boolean;
|
|
340
|
+
use_client_side_customer_stop_billing: boolean;
|
|
341
|
+
use_client_side_employee_start_billing: boolean;
|
|
342
|
+
use_client_side_employee_stop_billing: boolean;
|
|
343
|
+
logo_url: string;
|
|
344
|
+
delay_scalar: number;
|
|
345
|
+
incomplete_payments: PlanPayment[];
|
|
346
|
+
overdue_threshold: number;
|
|
347
|
+
stripe_account_id: string;
|
|
348
|
+
is_restricted: false;
|
|
349
|
+
disabled_reason: string;
|
|
350
|
+
completed_onboarding: boolean;
|
|
351
|
+
restricted_soon: boolean;
|
|
352
|
+
service_email_id: string;
|
|
353
|
+
billing_email_id: string;
|
|
354
|
+
num_events: number;
|
|
355
|
+
num_jobs: number;
|
|
356
|
+
bills: Bill[];
|
|
357
|
+
enabled_payment_methods: string[];
|
|
358
|
+
sessions: Session[];
|
|
359
|
+
num_sessions: number;
|
|
360
|
+
labels: Label[];
|
|
361
|
+
groups: Group[];
|
|
362
|
+
indicator_lifetime: number;
|
|
363
|
+
available_plans: Plan[];
|
|
364
|
+
last_payment: number;
|
|
365
|
+
last_charged: number;
|
|
366
|
+
balance: number;
|
|
367
|
+
plan_id: string;
|
|
368
|
+
payment_methods: PaymentMethod[];
|
|
369
|
+
autopay_payment_id: string;
|
|
370
|
+
intuit_connected: boolean;
|
|
371
|
+
}
|
|
372
|
+
export interface RouteJob {
|
|
373
|
+
time_created: number;
|
|
374
|
+
route_id: string;
|
|
375
|
+
job_id: string;
|
|
376
|
+
id: string;
|
|
377
|
+
order: number;
|
|
378
|
+
estimated_arrival_time: number;
|
|
379
|
+
scheduled_arrival_time: number;
|
|
380
|
+
tasks: string[];
|
|
6
381
|
}
|
|
7
|
-
export interface
|
|
382
|
+
export interface Route {
|
|
383
|
+
company: string;
|
|
8
384
|
id: string;
|
|
385
|
+
is_internal: boolean;
|
|
386
|
+
jobs: RouteJob[];
|
|
9
387
|
name: string;
|
|
10
|
-
|
|
388
|
+
time_created: number;
|
|
389
|
+
time_updated: number | null;
|
|
390
|
+
teams: string[];
|
|
391
|
+
polyline: string;
|
|
392
|
+
is_optimized: boolean;
|
|
393
|
+
start_time: number;
|
|
394
|
+
end_time: number;
|
|
395
|
+
start_latitude: number;
|
|
396
|
+
start_longitude: number;
|
|
397
|
+
end_latitude: number;
|
|
398
|
+
end_longitude: number;
|
|
11
399
|
}
|
|
12
|
-
export interface
|
|
400
|
+
export interface Job {
|
|
401
|
+
address: string;
|
|
402
|
+
company: string;
|
|
403
|
+
description: string;
|
|
13
404
|
id: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
405
|
+
is_one_time: boolean;
|
|
406
|
+
autostart_radius: number;
|
|
407
|
+
latitude: number;
|
|
408
|
+
longitude: number;
|
|
409
|
+
name: string;
|
|
410
|
+
internal_notes: string;
|
|
411
|
+
external_notes: string;
|
|
412
|
+
priority: number;
|
|
413
|
+
tasks: Task[];
|
|
414
|
+
time_created: number;
|
|
415
|
+
time_updated: number | null;
|
|
416
|
+
routes: RouteJob[];
|
|
417
|
+
subscribers: Subscription[];
|
|
418
|
+
manual_emails: string[][];
|
|
419
|
+
last_completed_event: _Event | null;
|
|
420
|
+
last_event: _Event | null;
|
|
421
|
+
labels: string[];
|
|
422
|
+
owner: string;
|
|
423
|
+
}
|
|
424
|
+
export interface Task {
|
|
425
|
+
enforce_proof_amount: boolean;
|
|
426
|
+
events: _Event[];
|
|
427
|
+
frequency: number;
|
|
428
|
+
id: string;
|
|
429
|
+
job_id: string;
|
|
430
|
+
name: string;
|
|
431
|
+
internal_notes: string;
|
|
432
|
+
external_notes: string;
|
|
433
|
+
proof_amt: number;
|
|
434
|
+
images: string[];
|
|
435
|
+
time_created: number;
|
|
436
|
+
time_updated: number | null;
|
|
437
|
+
status: "PENDING_CUSTOMER" | "PENDING_COMPANY" | "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
438
|
+
created_by: UserCompanyAssociation | null;
|
|
439
|
+
overdueness: number | null;
|
|
440
|
+
overdue_time: number;
|
|
441
|
+
last_event: _Event | null;
|
|
442
|
+
delay: number;
|
|
443
|
+
skills: string[];
|
|
444
|
+
service: number;
|
|
445
|
+
bill_mode: "MONTH" | "SERVICE" | "NONE";
|
|
446
|
+
price: number;
|
|
447
|
+
services_remaining: number;
|
|
448
|
+
expire_on: number | null;
|
|
449
|
+
bill_day: number | null;
|
|
450
|
+
services_prepaid: number;
|
|
451
|
+
months_prepaid: number;
|
|
452
|
+
priority: boolean;
|
|
453
|
+
}
|
|
454
|
+
export interface TaskWrapper {
|
|
455
|
+
latestEvent: number;
|
|
456
|
+
task: Task;
|
|
457
|
+
}
|
|
458
|
+
export interface JobWrapper {
|
|
459
|
+
latestEvent: number;
|
|
460
|
+
routeIndex: number;
|
|
461
|
+
job: Job;
|
|
462
|
+
frequency: number;
|
|
463
|
+
isOverdue: boolean;
|
|
464
|
+
}
|
|
465
|
+
export interface taskStartInfo {
|
|
466
|
+
name: string;
|
|
467
|
+
start: number;
|
|
468
|
+
}
|
|
469
|
+
export interface taskEndInfo {
|
|
470
|
+
end: number;
|
|
471
|
+
internal_notes: string;
|
|
472
|
+
external_notes: string;
|
|
473
|
+
}
|
|
474
|
+
export interface AdditionalCharge {
|
|
475
|
+
id: string;
|
|
476
|
+
time_created: number;
|
|
477
|
+
time_updated: number | null;
|
|
478
|
+
name: string;
|
|
479
|
+
amount: number;
|
|
480
|
+
}
|
|
481
|
+
export interface _Event {
|
|
482
|
+
breaks: string[];
|
|
483
|
+
id: string;
|
|
484
|
+
name: string;
|
|
485
|
+
internal_notes: string;
|
|
486
|
+
external_notes: string;
|
|
487
|
+
proofs: string[];
|
|
488
|
+
tasks: string[];
|
|
489
|
+
time_created: number;
|
|
490
|
+
time_ended: number;
|
|
491
|
+
time_started: number;
|
|
492
|
+
time_updated: number | null;
|
|
493
|
+
job_id: string;
|
|
494
|
+
job_name: string;
|
|
495
|
+
job_address: string;
|
|
496
|
+
bill_id: string;
|
|
497
|
+
billed_amount: number;
|
|
498
|
+
additional_charges: AdditionalCharge[];
|
|
499
|
+
user_id: string;
|
|
500
|
+
team_id: string;
|
|
501
|
+
cost: number;
|
|
502
|
+
billed: boolean;
|
|
503
|
+
paid: boolean;
|
|
504
|
+
autostart: boolean;
|
|
505
|
+
job_labels: string[];
|
|
19
506
|
}
|