@go-avro/avro-js 1.6.5 → 1.6.6-rc2

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.
Files changed (72) hide show
  1. package/dist/client/QueryClient.d.ts +122 -63
  2. package/dist/client/QueryClient.js +151 -26
  3. package/dist/client/core/xhr.js +2 -1
  4. package/dist/client/hooks/audit.js +4 -2
  5. package/dist/client/hooks/avro.js +6 -2
  6. package/dist/client/hooks/bills.d.ts +1 -1
  7. package/dist/client/hooks/bills.js +26 -13
  8. package/dist/client/hooks/catalog_items.js +4 -1
  9. package/dist/client/hooks/chats.js +33 -1
  10. package/dist/client/hooks/companies.js +38 -4
  11. package/dist/client/hooks/events.js +13 -9
  12. package/dist/client/hooks/jobs.js +29 -3
  13. package/dist/client/hooks/messages.js +6 -2
  14. package/dist/client/hooks/plans.js +1 -1
  15. package/dist/client/hooks/routes.js +55 -5
  16. package/dist/client/hooks/sessions.js +39 -11
  17. package/dist/client/hooks/skills.js +1 -1
  18. package/dist/client/hooks/teams.js +1 -1
  19. package/dist/client/hooks/timecards.js +2 -1
  20. package/dist/client/hooks/users.js +8 -3
  21. package/dist/client/realtime.d.ts +13 -0
  22. package/dist/client/realtime.js +30 -5
  23. package/dist/client/requests.d.ts +470 -0
  24. package/dist/client/requests.js +5 -0
  25. package/dist/client/wire.d.ts +7 -0
  26. package/dist/client/wire.js +14 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/types/api/AdditionalCharge.d.ts +2 -1
  29. package/dist/types/api/Avro.d.ts +33 -28
  30. package/dist/types/api/Bill.d.ts +7 -5
  31. package/dist/types/api/BillPayment.d.ts +8 -4
  32. package/dist/types/api/BillUser.d.ts +3 -2
  33. package/dist/types/api/CatalogItem.d.ts +9 -6
  34. package/dist/types/api/Chat.d.ts +3 -5
  35. package/dist/types/api/Company.d.ts +39 -13
  36. package/dist/types/api/DelayEvent.d.ts +5 -2
  37. package/dist/types/api/Device.d.ts +5 -4
  38. package/dist/types/api/Email.d.ts +14 -3
  39. package/dist/types/api/Friendship.d.ts +8 -0
  40. package/dist/types/api/Group.d.ts +3 -2
  41. package/dist/types/api/Job.d.ts +55 -5
  42. package/dist/types/api/LineItem.d.ts +3 -2
  43. package/dist/types/api/MemberState.d.ts +2 -1
  44. package/dist/types/api/Message.d.ts +4 -3
  45. package/dist/types/api/Notification.d.ts +26 -0
  46. package/dist/types/api/PaymentMethod.d.ts +7 -2
  47. package/dist/types/api/PaymentOption.d.ts +6 -4
  48. package/dist/types/api/Payout.d.ts +1 -1
  49. package/dist/types/api/Plan.d.ts +5 -4
  50. package/dist/types/api/PlanPayment.d.ts +5 -3
  51. package/dist/types/api/Prepayment.d.ts +2 -1
  52. package/dist/types/api/Reaction.d.ts +3 -3
  53. package/dist/types/api/Refund.d.ts +1 -1
  54. package/dist/types/api/Route.d.ts +11 -10
  55. package/dist/types/api/Route.js +5 -0
  56. package/dist/types/api/RouteJob.d.ts +1 -1
  57. package/dist/types/api/ServiceMonth.d.ts +2 -2
  58. package/dist/types/api/Session.d.ts +5 -2
  59. package/dist/types/api/Skill.d.ts +2 -2
  60. package/dist/types/api/Subscription.d.ts +5 -3
  61. package/dist/types/api/Task.d.ts +10 -9
  62. package/dist/types/api/Task.js +3 -1
  63. package/dist/types/api/TimecardAction.d.ts +2 -2
  64. package/dist/types/api/User.d.ts +11 -9
  65. package/dist/types/api/UserCompanyAssociation.d.ts +7 -1
  66. package/dist/types/api/UserMerge.d.ts +3 -3
  67. package/dist/types/api/_Event.d.ts +20 -4
  68. package/dist/types/api/_Event.js +1 -0
  69. package/dist/types/api.d.ts +156 -39
  70. package/dist/version.d.ts +1 -1
  71. package/dist/version.js +1 -1
  72. package/package.json +1 -1
@@ -0,0 +1,470 @@
1
+ /**
2
+ * Request bodies and endpoint-specific responses of the REST API, matching
3
+ * the backend's pydantic schemas (`avro/views/<domain>/schemas.py`).
4
+ */
5
+ import type { CatalogIndustry, CatalogPriceFormat, EventUpdatePayload, LineItemStatus, NotificationLevel, PaymentType, Permission, TaskStatus } from '../types/api.js';
6
+ /** Body of `POST /company/<id>/skill` (backend `CreateSkill`). */
7
+ export interface SkillCreatePayload {
8
+ /** 1–255 characters. */
9
+ name: string;
10
+ /** At most 1023 characters; defaults to `''`. */
11
+ description?: string;
12
+ }
13
+ /**
14
+ * Body of `PUT /skill/<id>` (backend `UpdateSkill`); omitted fields are
15
+ * unchanged and `description: ''` clears the description.
16
+ */
17
+ export type SkillUpdatePayload = Partial<SkillCreatePayload>;
18
+ /** `status` filter of `POST /company/<id>/payouts` (backend `PayoutsListBody`). */
19
+ export type PayoutStatusFilter = 'paid' | 'pending' | 'in_transit' | 'canceled' | 'failed';
20
+ /**
21
+ * Body of `POST /company/<id>/event` (backend `CreateCompanyEvent`): the
22
+ * `UpdateEvent` fields plus the job. `team_id: ''` is omitted by the SDK.
23
+ */
24
+ export type EventCreatePayload = EventUpdatePayload & {
25
+ job_id: string;
26
+ };
27
+ /**
28
+ * Body of `POST /company` (backend `CreateCompany`). `logo` is not read by
29
+ * this endpoint (upload it with `POST /company/<id>/logo`); it is accepted
30
+ * here only so existing callers type-check.
31
+ */
32
+ export interface CompanyCreatePayload {
33
+ /** 1–256 characters. */
34
+ name: string;
35
+ /** Referral code; unknown codes are ignored. */
36
+ code?: string | null;
37
+ /** IANA zone name; omit for the server's default zone. */
38
+ timezone?: string;
39
+ overdue_threshold?: number;
40
+ /** Rounded to a whole number. */
41
+ delay_scalar?: number;
42
+ /** Plan GUID to subscribe to. */
43
+ plan?: string | null;
44
+ logo?: File | null;
45
+ }
46
+ /** A Stripe payment method kept on a company (backend `PaymentMethodRef`). */
47
+ export interface CompanyPaymentMethodInput {
48
+ /** Stripe payment method id (`pm_...`). */
49
+ id: string;
50
+ autopay: boolean;
51
+ }
52
+ /**
53
+ * Body of `PUT /company/<id>` (backend `UpdateCompany`); omitted fields are
54
+ * unchanged. `null` unlinks the mailboxes / clears the plan; it is a 400 on
55
+ * every other field (and `''` is a 400 on the id fields).
56
+ */
57
+ export interface CompanyUpdatePayload {
58
+ /** 1–256 characters. */
59
+ name?: string;
60
+ email?: string;
61
+ address?: string;
62
+ /** IANA zone name. */
63
+ timezone?: string;
64
+ delay_scalar?: number;
65
+ overdue_threshold?: number;
66
+ completed_onboarding?: boolean;
67
+ /** Unix seconds the first pay period starts. */
68
+ timecard_base?: number;
69
+ /** Pay period length in seconds; at least one day. */
70
+ timecard_length?: number;
71
+ use_client_side_customer_start_billing?: boolean;
72
+ use_client_side_customer_stop_billing?: boolean;
73
+ use_client_side_employee_start_billing?: boolean;
74
+ use_client_side_employee_stop_billing?: boolean;
75
+ indicator_lifetime?: number;
76
+ /** One of the company's mailboxes; null unsets it. */
77
+ service_email_id?: string | null;
78
+ /** One of the company's mailboxes; null unsets it. */
79
+ billing_email_id?: string | null;
80
+ /** In cents; only applied for root. */
81
+ balance?: number;
82
+ /** Null clears the plan. Ignored while the balance is negative. */
83
+ plan_id?: string | null;
84
+ enabled_payment_methods?: PaymentType[];
85
+ require_team_for_clock_in?: boolean;
86
+ accepts_cash_payments?: boolean;
87
+ default_pass_on_fees?: boolean;
88
+ /** Replaces the company's payment methods (detaching the rest). */
89
+ payment_methods?: CompanyPaymentMethodInput[];
90
+ /** `false` force-releases the scheduling lock; `true` is ignored. */
91
+ schedule_locked?: boolean;
92
+ /** Not read by this endpoint (upload with `POST /company/<id>/logo`). */
93
+ logo?: File | null;
94
+ }
95
+ /** Body of `POST /company/<id>/user/<user_id>` (backend `AddMember`). */
96
+ export interface MemberAddPayload {
97
+ /** `is_root` is dropped. */
98
+ permissions?: Permission[];
99
+ notification_setting?: NotificationLevel[];
100
+ /** A group of the company for the new member to join; null for none. */
101
+ group?: string | null;
102
+ }
103
+ /**
104
+ * Body of `PUT /company/<id>/user/<user_id>` (backend `UpdateMember`);
105
+ * omitted fields are unchanged and nothing is nullable.
106
+ */
107
+ export interface MemberUpdatePayload {
108
+ /** `is_root` is dropped. */
109
+ permissions?: Permission[];
110
+ hourly_rate?: number;
111
+ salary_rate?: number;
112
+ bill_rate?: number;
113
+ pto_rate?: number;
114
+ sick_rate?: number;
115
+ accrued_pto?: number;
116
+ accrued_sick?: number;
117
+ pto_accrual_rate?: number;
118
+ sick_accrual_rate?: number;
119
+ notification_setting?: NotificationLevel[];
120
+ }
121
+ /**
122
+ * Body of `POST /user` (backend `CreateUser`). `password` and `last_name`
123
+ * may be empty; `email` must look like an address; `phone_number` must be a
124
+ * real number with country code (e.g. `+1 616-555-0100`).
125
+ */
126
+ export interface UserCreatePayload {
127
+ /** 1–150 characters. */
128
+ username: string;
129
+ /** At most 100 characters. */
130
+ first_name: string;
131
+ /** At most 100 characters. */
132
+ last_name: string;
133
+ password: string;
134
+ email: string;
135
+ phone_number?: string | null;
136
+ /** Referral code. */
137
+ code?: string | null;
138
+ /** Company GUID to join as a customer. */
139
+ company_id?: string | null;
140
+ invite_token?: string | null;
141
+ share_location?: boolean;
142
+ share_email?: boolean;
143
+ share_phone?: boolean;
144
+ share_with_public?: boolean;
145
+ }
146
+ /** A saved Stripe payment method on a user write (backend `PaymentMethodIn`). */
147
+ export interface UserPaymentMethodInput {
148
+ /** Stripe payment method id (`pm_...`). */
149
+ id: string;
150
+ /** Omitted keeps the current setting (off for a newly saved method). */
151
+ autopay?: boolean;
152
+ }
153
+ /**
154
+ * Body of `PUT /user/<id>` (backend `UpdateUser`): profile fields plus the
155
+ * credentials a password/email change needs. Omitted fields are unchanged;
156
+ * only `phone_number` is nullable (null removes the number, `''` is a 400).
157
+ * A new `password` must be non-empty.
158
+ */
159
+ export interface UserUpdatePayload {
160
+ /** 1–150 characters; stored lowercased. */
161
+ username?: string;
162
+ /** At most 100 characters. */
163
+ first_name?: string;
164
+ /** At most 100 characters. */
165
+ last_name?: string;
166
+ /** Changing your own password needs `current_password` (or an Apple re-sign-in). */
167
+ password?: string;
168
+ /** Changing your own email needs `current_password` (or an Apple re-sign-in). */
169
+ email?: string;
170
+ current_password?: string;
171
+ /** A fresh Apple identity token, instead of `current_password`. */
172
+ apple_token?: string;
173
+ /** The raw nonce `apple_token` was requested with. */
174
+ apple_nonce?: string;
175
+ /** A real number with country code; null removes it. */
176
+ phone_number?: string | null;
177
+ notification_setting?: NotificationLevel[];
178
+ /** Replaces the saved payment methods (`[]` detaches all). */
179
+ payment_methods?: UserPaymentMethodInput[];
180
+ share_location?: boolean;
181
+ share_email?: boolean;
182
+ share_phone?: boolean;
183
+ share_with_public?: boolean;
184
+ }
185
+ /** A custom line item on a bill write (backend `BillLineItemIn`). */
186
+ export interface BillLineItemInput {
187
+ name?: string;
188
+ description?: string;
189
+ /** Quantity (default 1); may be fractional (e.g. hours). */
190
+ amount?: number;
191
+ /** Unit price in integer cents (default 0). */
192
+ cost?: number;
193
+ }
194
+ /** A member recipient on a bill write (backend `BillUserIn`). */
195
+ export interface BillUserInput {
196
+ /** The member's user GUID. */
197
+ id: string;
198
+ /**
199
+ * Create only: charge up to this many integer cents (>= 0) to the
200
+ * user's autopay method. Fractional values are rejected.
201
+ */
202
+ amt?: number | null;
203
+ }
204
+ /**
205
+ * Body of `POST /company/<id>/bill` and `PUT /bill/<id>` (backend
206
+ * `CreateBill` / `UpdateBill`); omitted fields are unchanged. Only `name`
207
+ * and `due_date` are nullable (null clears them); null elsewhere is a 400.
208
+ */
209
+ export interface BillWritePayload {
210
+ /** Event GUIDs; replaces the bill's events. */
211
+ events?: string[];
212
+ /** Service month GUIDs; replaces the bill's months. */
213
+ months?: string[];
214
+ /** Prepayment GUIDs; replaces the bill's prepayments. */
215
+ prepayments?: string[];
216
+ /** Replaces the bill's custom line items. */
217
+ line_items?: BillLineItemInput[];
218
+ /** Extra recipients as `[name, email]` pairs; replaces them. */
219
+ manual_emails?: [string, string][];
220
+ /** Replaces the member recipients. */
221
+ users?: BillUserInput[];
222
+ /** At most 256 characters; null clears it. */
223
+ name?: string | null;
224
+ /** Marks every item paid outside Avro. */
225
+ status?: 'MANUALLY_PAID';
226
+ /** Unix seconds; null clears it. */
227
+ due_date?: number | null;
228
+ /** Empty means the company's defaults. */
229
+ enabled_payment_methods?: PaymentType[];
230
+ pass_on_fees?: boolean;
231
+ }
232
+ /** Response of `POST /company/<id>/intuit/import` (backend `IntuitImportResult`). */
233
+ export interface IntuitImportResult {
234
+ msg: string;
235
+ imported: number;
236
+ skipped: number;
237
+ payments_imported: number;
238
+ payments_skipped: number;
239
+ }
240
+ /**
241
+ * A payment option on a catalog item write (backend `CreatePaymentOption`).
242
+ * Prices are integer cents.
243
+ */
244
+ export interface PaymentOptionInput {
245
+ /** 1–64 characters. */
246
+ name: string;
247
+ is_prepay?: boolean;
248
+ price_under_prepay?: number | null;
249
+ price?: number;
250
+ recommended_prepay_count?: number | null;
251
+ /** Case-insensitive; defaults to `NONE`. */
252
+ mode?: 'NONE' | 'MONTH' | 'SERVICE' | Lowercase<'NONE' | 'MONTH' | 'SERVICE'>;
253
+ }
254
+ /**
255
+ * Body of `PUT /catalog_item/<id>` (backend `UpdateCatalogItem`); omitted
256
+ * fields are unchanged and `null` clears the `recommended_*` fields.
257
+ */
258
+ export interface CatalogItemUpdatePayload {
259
+ /** 1–256 characters. */
260
+ name?: string;
261
+ description?: string;
262
+ /**
263
+ * A `CatalogIndustry` name, matched case-insensitively with spaces for
264
+ * underscores (`'Snow Removal'`).
265
+ */
266
+ industry?: CatalogIndustry | (string & {});
267
+ /** A `CatalogPriceFormat` name, matched like `industry`. */
268
+ price_format?: CatalogPriceFormat | (string & {});
269
+ /** Integer seconds between services; null clears it. */
270
+ recommended_frequency?: number | null;
271
+ /** Unix seconds (>= 0); null clears it. */
272
+ recommended_activate_on?: number | null;
273
+ /** Unix seconds (>= 0); null clears it. */
274
+ recommended_expire_on?: number | null;
275
+ /** Skill GUIDs; replaces the item's skills. */
276
+ skills?: string[];
277
+ /** Replaces the item's payment options. */
278
+ payment_options?: PaymentOptionInput[];
279
+ }
280
+ /** Body of `POST /company/<id>/catalog_item` (backend `CreateCatalogItem`). */
281
+ export type CatalogItemCreatePayload = CatalogItemUpdatePayload & {
282
+ name: string;
283
+ };
284
+ /**
285
+ * Body of `POST /job/<id>/proposal` and `PUT /proposal/<id>` (backend
286
+ * `CreateProposal` / `UpdateProposal`); omitted fields are unchanged, and
287
+ * null clears `expire_on` / `terms_version_id` / `prepay_due_date`.
288
+ */
289
+ export interface ProposalWritePayload {
290
+ /**
291
+ * Unix seconds (>= 0) after which the customer can no longer review;
292
+ * null means never.
293
+ */
294
+ expire_on?: number | null;
295
+ /** Terms version GUID; null detaches. */
296
+ terms_version_id?: string | null;
297
+ /** Unix seconds (>= 0); null clears. */
298
+ prepay_due_date?: number | null;
299
+ /** Replaces the proposal's tasks (only `id` is read). */
300
+ tasks?: {
301
+ id: string;
302
+ }[];
303
+ }
304
+ /** A prepayment a customer commits to when accepting a task (backend `AcceptPrepayment`). */
305
+ export interface ProposalReviewPrepayment {
306
+ /** Unit price in integer cents (>= 0). */
307
+ cost?: number;
308
+ /** Integer count (>= 1). */
309
+ amount?: number;
310
+ type?: 'SERVICE' | 'MONTH';
311
+ description?: string;
312
+ name?: string;
313
+ }
314
+ /**
315
+ * The customer's decision on one proposal task (backend `ReviewTask`).
316
+ * Omit a choice to not make it; null is a 400.
317
+ */
318
+ export interface ProposalReviewTask {
319
+ id: string;
320
+ /** `ARCHIVED` rejects the task; anything else (or omitting it) accepts it. */
321
+ status?: TaskStatus;
322
+ prepayments?: ProposalReviewPrepayment[];
323
+ bill_mode?: 'NONE' | 'MONTH' | 'SERVICE';
324
+ /** Chosen price in integer cents. */
325
+ price?: number;
326
+ /** @deprecated Not read by the backend. */
327
+ payment_option_id?: string;
328
+ }
329
+ /** Body of `POST /proposal/<id>/review` (backend `ReviewProposal`). */
330
+ export interface ProposalReviewPayload {
331
+ tasks?: ProposalReviewTask[];
332
+ /** Required when the proposal has terms and any task is accepted. */
333
+ terms_version_id?: string | null;
334
+ pay_in_cash?: boolean;
335
+ }
336
+ /**
337
+ * A prepayment on a task write (backend `TaskPrepaymentIn`), matched to an
338
+ * existing one by `id`; omitted fields keep an existing prepayment's values.
339
+ */
340
+ export interface TaskPrepaymentInput {
341
+ /** An existing prepayment of the task; omit to create one. */
342
+ id?: string;
343
+ /** Unit price in integer cents; defaults to 0. */
344
+ cost?: number;
345
+ /** Defaults to 1. */
346
+ amount?: number;
347
+ /** Defaults to `SERVICE`. */
348
+ type?: 'SERVICE' | 'MONTH';
349
+ /** Defaults to `EXTERNALLY_PAID`. */
350
+ status?: LineItemStatus;
351
+ description?: string;
352
+ name?: string;
353
+ }
354
+ /**
355
+ * A task inside a job write (backend `JobTaskIn` / `UpdateTask`), matched
356
+ * to the job's tasks by `id`. Omitted fields are unchanged; null clears
357
+ * `expire_on`, `activate_on`, `bill_day`, `enforce_image_amount` and
358
+ * `catalog_item_id` and is a 400 on every other field.
359
+ */
360
+ export interface TaskWritePayload {
361
+ /** An existing task of the job; omit (or `''`) to create one. */
362
+ id?: string;
363
+ /** Required unless the task already has a name. */
364
+ name?: string;
365
+ /** Replaces the task's prepayments. */
366
+ prepayments?: TaskPrepaymentInput[];
367
+ /** Unix seconds, truncated to UTC midnight; null means never. */
368
+ expire_on?: number | null;
369
+ /** Unix seconds, truncated to UTC midnight; null means right away. */
370
+ activate_on?: number | null;
371
+ /** Day of month to bill; null means the month's last day. */
372
+ bill_day?: number | null;
373
+ services_remaining?: number;
374
+ /** Seconds between services; <= 0 means not recurring. */
375
+ frequency?: number;
376
+ internal_notes?: string;
377
+ external_notes?: string;
378
+ /** Proof images expected per service. */
379
+ image_amt?: number;
380
+ enforce_image_amount?: boolean | null;
381
+ status?: TaskStatus;
382
+ /** Email the other party when `status` moves to a pending state. */
383
+ send_email?: boolean;
384
+ /** With an accepting `status`, settle a cash proposal's unbilled prepayments. */
385
+ cash_received?: boolean;
386
+ /** Service duration in seconds. */
387
+ service?: number;
388
+ autobill?: boolean;
389
+ bill_mode?: 'NONE' | 'MONTH' | 'SERVICE';
390
+ /** Replaces the task's payment options. */
391
+ payment_options?: PaymentOptionInput[];
392
+ /** Price in integer cents; -1 means unset. */
393
+ price?: number;
394
+ priority?: boolean;
395
+ /** Null unlinks the catalog item. */
396
+ catalog_item_id?: string | null;
397
+ /** Skill GUIDs; replaces the task's skills. */
398
+ skills?: string[];
399
+ }
400
+ /**
401
+ * Body of `POST /company/<id>/team` and `PUT /team/<id>` (backend
402
+ * `CreateTeam` / `UpdateTeam`); omitted fields are unchanged. A start or
403
+ * end point is sent whole: both halves as numbers, or both null to clear
404
+ * it (one half alone is a 400). Null is a 400 on every other field.
405
+ */
406
+ export interface TeamWritePayload {
407
+ name?: string;
408
+ description?: string;
409
+ start_latitude?: number | null;
410
+ start_longitude?: number | null;
411
+ start_address?: string;
412
+ end_latitude?: number | null;
413
+ end_longitude?: number | null;
414
+ end_address?: string;
415
+ /** -1 for no limit. */
416
+ max_jobs?: number;
417
+ speed_factor?: number;
418
+ /** Seconds; -1 for no limit. */
419
+ max_travel_time?: number;
420
+ /** Meters; -1 for no limit. */
421
+ max_distance?: number;
422
+ /** Seconds after midnight the shift starts; -1 for none. */
423
+ start_time?: number;
424
+ /** Seconds after midnight the shift ends; -1 for none. */
425
+ end_time?: number;
426
+ fixed_cost?: number;
427
+ hourly_cost?: number;
428
+ km_cost?: number;
429
+ autoconfigure?: boolean;
430
+ /** `#RRGGBB`. */
431
+ color?: string;
432
+ /** Route GUIDs; replaces the team's routes (`[]` clears them). */
433
+ routes?: string[];
434
+ /** User GUIDs; replaces the team's members. */
435
+ users?: string[];
436
+ /** Skill GUIDs; replaces the team's skills. */
437
+ skills?: string[];
438
+ }
439
+ /**
440
+ * Body of `PUT /session/<id>` (backend `UpdateSession`); omitted fields are
441
+ * unchanged. Null clears the team / route, and `time_ended: null` re-opens
442
+ * the session; `time_started` is not nullable.
443
+ */
444
+ export interface SessionUpdatePayload {
445
+ team_id?: string | null;
446
+ route_id?: string | null;
447
+ /** Alias of `route_id`. */
448
+ current_route_id?: string | null;
449
+ /** Unix seconds; restarts the clock. */
450
+ time_started?: number;
451
+ /** Unix seconds, or `true` for now; null re-opens the session. */
452
+ time_ended?: number | true | null;
453
+ }
454
+ /** Body of `POST /company/<id>/session` (backend `StartSession`). */
455
+ export interface SessionCreatePayload extends SessionUpdatePayload {
456
+ /** Member to clock in; defaults to the caller. */
457
+ user_id?: string | null;
458
+ }
459
+ /**
460
+ * Body of `POST /session/<id>/break` and `PUT /break/<id>` (backend
461
+ * `CreateSessionBreak` / `UpdateBreak`); nothing is nullable.
462
+ */
463
+ export interface BreakWritePayload {
464
+ /** Unix seconds. */
465
+ time_started?: number;
466
+ /** Unix seconds. */
467
+ time_ended?: number;
468
+ company_billable?: boolean;
469
+ client_billable?: boolean;
470
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Request bodies and endpoint-specific responses of the REST API, matching
3
+ * the backend's pydantic schemas (`avro/views/<domain>/schemas.py`).
4
+ */
5
+ export {};
@@ -0,0 +1,7 @@
1
+ /** Helpers that shape request bodies to what the backend schemas accept. */
2
+ /**
3
+ * Drop optional keys holding `''`. The backend schemas type these as UUIDs
4
+ * or enums, so an empty string is a 400, while an omitted key means "no
5
+ * filter" (lists) or "unchanged" (updates).
6
+ */
7
+ export declare function withoutEmpty<T extends object>(body: T, ...keys: string[]): T;
@@ -0,0 +1,14 @@
1
+ /** Helpers that shape request bodies to what the backend schemas accept. */
2
+ /**
3
+ * Drop optional keys holding `''`. The backend schemas type these as UUIDs
4
+ * or enums, so an empty string is a 400, while an omitted key means "no
5
+ * filter" (lists) or "unchanged" (updates).
6
+ */
7
+ export function withoutEmpty(body, ...keys) {
8
+ const out = { ...body };
9
+ for (const key of keys) {
10
+ if (out[key] === '')
11
+ delete out[key];
12
+ }
13
+ return out;
14
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { AvroQueryClientProvider, useAvroQueryClient, useSocketEvent, } from './
3
3
  export { useEmailStatus } from './client/hooks/email.js';
4
4
  export type { EmailResult, EmailResultStatus, UseEmailStatusOptions } from './client/hooks/email.js';
5
5
  export type { BulkBillError, BulkDeleteBillsResponse, BulkEmailBillsResponse, } from './client/hooks/bills.js';
6
+ export type * from './client/requests.js';
6
7
  export { AuthManager } from './auth/AuthManager.js';
7
8
  export { MemoryStorage, LocalStorage } from './auth/storage.js';
8
9
  export { QueryPersister, IndexedDBStore, MemoryKeyValueStore, defaultKeyValueStore, PERSISTED_NAMESPACES, } from './client/persist.js';
@@ -1,6 +1,7 @@
1
1
  import { LineItem } from './LineItem.js';
2
2
  export interface AdditionalCharge extends LineItem {
3
3
  line_item_type: 'ADDITIONAL_CHARGE';
4
- time_updated: number | null;
4
+ /** GUID of the event the charge belongs to. */
5
+ parent_id: string;
5
6
  earned_revenue: number;
6
7
  }
@@ -2,15 +2,15 @@ import { Email } from './Email.js';
2
2
  export interface Avro {
3
3
  id: string;
4
4
  name: string;
5
- time_created: number;
6
- time_updated: number;
5
+ time_created: number | null;
6
+ time_updated: number | null;
7
7
  emails: Email[];
8
- totp_email_id: string;
9
- billing_email_id: string;
10
- join_email_id: string;
8
+ totp_email_id: string | null;
9
+ billing_email_id: string | null;
10
+ join_email_id: string | null;
11
11
  }
12
12
  export interface StorageByType {
13
- type: string;
13
+ type: 'TASK' | 'EVENT' | 'NOTIFICATION' | 'COMPANY_LOGO' | 'USER_PROFILE';
14
14
  count: number;
15
15
  bytes: number;
16
16
  }
@@ -112,28 +112,33 @@ export interface ClientErrorReport {
112
112
  export interface ErrorLogEntry {
113
113
  id: string;
114
114
  time: number;
115
- source: 'backend' | 'app' | 'web' | string;
116
- status?: number;
117
- message?: string | null;
118
- traceback?: string;
119
- stack?: string;
120
- fatal?: boolean;
121
- platform?: string;
122
- app_version?: string;
123
- update_id?: string;
124
- route?: string;
125
- method?: string;
126
- path?: string;
127
- endpoint?: string | null;
128
- client_id?: string | null;
129
- client_version?: string | null;
130
- js_version?: string | null;
131
- user_agent?: string | null;
132
- remote_addr?: string | null;
133
- forwarded_for?: string | null;
134
- user?: {
115
+ source: 'backend' | 'app' | 'web';
116
+ /** HTTP status; absent from client reports. */
117
+ status?: number | null;
118
+ message: string | null;
119
+ traceback?: string | null;
120
+ stack?: string | null;
121
+ fatal?: boolean | null;
122
+ platform?: string | null;
123
+ app_version?: string | null;
124
+ update_id?: string | null;
125
+ route?: string | null;
126
+ method: string;
127
+ path: string;
128
+ endpoint: string | null;
129
+ client_id: string | null;
130
+ client_version: string | null;
131
+ js_version: string | null;
132
+ user_agent: string | null;
133
+ remote_addr: string | null;
134
+ forwarded_for: string | null;
135
+ source_ip: string | null;
136
+ /** A string when the stored value was too long and was truncated to its JSON text. */
137
+ user: {
135
138
  id: string;
136
139
  username: string;
137
- } | null;
138
- extra?: Record<string, unknown>;
140
+ is_paying?: boolean | null;
141
+ } | string | null;
142
+ /** A string when the stored value was too long and was truncated to its JSON text. */
143
+ extra?: Record<string, unknown> | string | null;
139
144
  }
@@ -18,24 +18,26 @@ declare module './Bill.js' {
18
18
  id: string;
19
19
  invoice_id: number;
20
20
  intuit_id: string | null;
21
- name: string;
21
+ name: string | null;
22
+ /** Creator's user GUID; the string "None" for automatically created bills. */
22
23
  billed_by: string;
23
- customer_email: string | null;
24
24
  manual_emails: string[][];
25
25
  users: BillUser[];
26
26
  status: BillStatus;
27
27
  enabled_payment_methods: PaymentType[];
28
- time_created: number;
29
- time_updated: number;
28
+ time_created: number | null;
29
+ time_updated: number | null;
30
30
  events: string[];
31
+ /** Unix time of the first PaymentIntent; -1 when none. */
31
32
  intent_created_at: number;
33
+ /** Unix time of the latest PaymentIntent; -1 when none. */
32
34
  intent_last_created_at: number;
33
35
  payments: BillPayment[];
34
36
  refunds: Refund[];
35
37
  line_items: LineItem[];
36
38
  prepayments: string[];
37
39
  months: string[];
38
- due_date: number;
40
+ due_date: number | null;
39
41
  pass_on_fees: boolean;
40
42
  }
41
43
  }
@@ -1,16 +1,20 @@
1
1
  export interface BillPayment {
2
2
  id: string;
3
3
  amount: number;
4
- avro_fees: number;
5
- stripe_fees: number;
6
- stripe_pi_id: string;
4
+ /** Set once the charge settles. */
5
+ avro_fees: number | null;
6
+ /** Set once the charge settles. */
7
+ stripe_fees: number | null;
8
+ /** Null for payments recorded outside Stripe. */
9
+ stripe_pi_id: string | null;
7
10
  payout_id: string | null;
11
+ /** Payer's bill-user GUID; the string "None" when there is none. */
8
12
  bill_user_id: string;
9
13
  status: 'created' | 'processing' | 'succeeded' | 'failed' | 'canceled' | 'requires_action' | 'in_transit' | 'deposited';
10
14
  type: 'us_bank_account' | 'card';
11
15
  email_paid_by: string;
12
16
  name_paid_by: string;
13
17
  action_required_at: number | null;
14
- time_created: number;
18
+ time_created: number | null;
15
19
  time_updated: number | null;
16
20
  }
@@ -3,9 +3,10 @@ export interface BillUser {
3
3
  id: string;
4
4
  user_id: string;
5
5
  bill_id: string;
6
- invoice_id: string;
6
+ /** The bill's public invoice number. */
7
+ invoice_id: number;
7
8
  payment_attempts: BillPayment[];
8
- time_created: number;
9
+ time_created: number | null;
9
10
  time_updated: number | null;
10
11
  amount: number;
11
12
  }