@go-avro/avro-js 1.6.6-rc9 → 1.7.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/dist/chat.d.ts +25 -0
- package/dist/chat.js +47 -0
- package/dist/client/QueryClient.d.ts +108 -26
- package/dist/client/QueryClient.js +103 -59
- package/dist/client/cache.d.ts +4 -0
- package/dist/client/cache.js +19 -0
- package/dist/client/core/uploads.js +226 -0
- package/dist/client/hooks/bills.js +15 -13
- package/dist/client/hooks/catalog_items.js +16 -4
- package/dist/client/hooks/chats.js +26 -0
- package/dist/client/hooks/devices.js +17 -3
- package/dist/client/hooks/messages.js +54 -1
- package/dist/client/hooks/routes.js +4 -1
- package/dist/client/hooks/teams.js +4 -1
- package/dist/client/hooks/{proposal_terms.js → terms.js} +14 -14
- package/dist/client/realtime.d.ts +26 -3
- package/dist/client/realtime.js +93 -16
- package/dist/client/requests.d.ts +7 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/types/api/AuditLog.d.ts +1 -1
- package/dist/types/api/Avro.d.ts +5 -0
- package/dist/types/api/CatalogItem.d.ts +3 -1
- package/dist/types/api/Company.d.ts +0 -2
- package/dist/types/api/Job.js +11 -2
- package/dist/types/api/MemberState.d.ts +3 -0
- package/dist/types/api/Notification.d.ts +39 -0
- package/dist/types/api/Proposal.d.ts +2 -2
- package/dist/types/api/Task.d.ts +16 -0
- package/dist/types/api/Task.js +30 -3
- package/dist/types/api/{ProposalTerms.d.ts → Terms.d.ts} +3 -3
- package/dist/types/api/Terms.js +1 -0
- package/dist/types/api.d.ts +1 -1
- package/dist/types/api.js +1 -1
- package/dist/types/client.d.ts +125 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- /package/dist/client/{hooks/proposal_terms.d.ts → core/uploads.d.ts} +0 -0
- /package/dist/{types/api/ProposalTerms.js → client/hooks/terms.d.ts} +0 -0
package/dist/types/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CreateNotificationPayload, SendEmailPayload } from './api.js';
|
|
1
2
|
export type RetryStrategy = 'fixed' | 'exponential' | ((attempt: number) => number);
|
|
2
3
|
export interface CancelToken {
|
|
3
4
|
isCancelled(): boolean;
|
|
@@ -11,3 +12,127 @@ export declare const ClientId: {
|
|
|
11
12
|
readonly DEV_APP: "dev-app";
|
|
12
13
|
};
|
|
13
14
|
export type ClientId = (typeof ClientId)[keyof typeof ClientId];
|
|
15
|
+
/**
|
|
16
|
+
* A photo file to upload: a browser `Blob`/`File`, or React Native's
|
|
17
|
+
* `{ uri, name, type }` file reference.
|
|
18
|
+
*/
|
|
19
|
+
export type UploadFile = Blob | {
|
|
20
|
+
uri: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
/** One photo for `uploadImages` / `useUploadImages`. */
|
|
25
|
+
export interface UploadImage {
|
|
26
|
+
file: UploadFile;
|
|
27
|
+
/** MIME type (`image/jpeg`, `image/png`, …); S3 enforces it. */
|
|
28
|
+
type: string;
|
|
29
|
+
/** Size in bytes; the upload may not exceed it. */
|
|
30
|
+
size: number;
|
|
31
|
+
/** File name sent with the upload (defaults to a `File`'s own name). */
|
|
32
|
+
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The name the server gave this photo on an earlier try (from
|
|
35
|
+
* `UploadImageFailure.upload`). Sending it back resends the same photo,
|
|
36
|
+
* so one resent after a lost response, or from an offline queue, is
|
|
37
|
+
* never stored twice.
|
|
38
|
+
*/
|
|
39
|
+
upload?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface UploadImagesOptions {
|
|
42
|
+
/** Progress in photos: `sent` of `total`, fractional mid-upload. */
|
|
43
|
+
onProgress?: (sent: number, total: number) => void;
|
|
44
|
+
/** Tries per photo upload to S3 before it counts as failed. */
|
|
45
|
+
attempts?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Each S3 upload try as it starts, with when the whole upload will give
|
|
48
|
+
* up (and report the rest retryable) if the connection stays stalled,
|
|
49
|
+
* e.g. to show a countdown on a slow connection.
|
|
50
|
+
*/
|
|
51
|
+
onAttempt?: (attempt: {
|
|
52
|
+
startedAt: number;
|
|
53
|
+
giveUpAt: number;
|
|
54
|
+
}) => void;
|
|
55
|
+
/** Cancelling aborts the upload in flight too (e.g. "Try later"). */
|
|
56
|
+
cancelToken?: CancelToken;
|
|
57
|
+
}
|
|
58
|
+
/** The event or task photos are uploaded to. */
|
|
59
|
+
export type ImageTarget = {
|
|
60
|
+
eventId: string;
|
|
61
|
+
} | {
|
|
62
|
+
taskId: string;
|
|
63
|
+
};
|
|
64
|
+
/** Variables of `useUploadImages`. */
|
|
65
|
+
export interface UploadImagesVars {
|
|
66
|
+
target: ImageTarget;
|
|
67
|
+
images: UploadImage[];
|
|
68
|
+
options?: UploadImagesOptions;
|
|
69
|
+
}
|
|
70
|
+
/** Variables of `useSendNotification`. */
|
|
71
|
+
export interface SendNotificationVars {
|
|
72
|
+
body: CreateNotificationPayload;
|
|
73
|
+
/** Defaults to the current company. */
|
|
74
|
+
companyId?: string;
|
|
75
|
+
/** Resending with the same key never sends twice (see `useSendEmailMessage`). */
|
|
76
|
+
idempotencyKey?: string;
|
|
77
|
+
}
|
|
78
|
+
/** Variables of `useSendEmailMessage`. */
|
|
79
|
+
export interface SendEmailMessageVars {
|
|
80
|
+
emailId: string;
|
|
81
|
+
body: SendEmailPayload;
|
|
82
|
+
/** Echoed in the `email_succeeded`/`email_failed` events. */
|
|
83
|
+
requestId?: string;
|
|
84
|
+
/** Attach this proposal's PDF (rendered server-side). */
|
|
85
|
+
proposalId?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Any unique string (e.g. a UUID) kept with the message: resending with
|
|
88
|
+
* the same key replays the first send's result instead of emailing
|
|
89
|
+
* again, so a send can be retried after a lost response.
|
|
90
|
+
*/
|
|
91
|
+
idempotencyKey?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Variables of `useSendBillEmail`. */
|
|
94
|
+
export interface SendBillEmailVars {
|
|
95
|
+
billId: string;
|
|
96
|
+
/** Defaults to `Invoice (<number>): <company>`. */
|
|
97
|
+
subject?: string;
|
|
98
|
+
/** `[name, email]` pairs; omitted: the bill's own recipients. */
|
|
99
|
+
recipients?: [string, string][];
|
|
100
|
+
request_id?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Permanent, signed links to an event's photos (`useEventPhotoLinks`). */
|
|
103
|
+
export interface EventPhotoLinks {
|
|
104
|
+
/**
|
|
105
|
+
* One URL per photo position, for `<img>` tags in an email. Each
|
|
106
|
+
* redirects to the photo, including photos still uploading when the
|
|
107
|
+
* email is sent (they appear once stored).
|
|
108
|
+
*/
|
|
109
|
+
images: string[];
|
|
110
|
+
/** A page showing every photo the event has ("View photos"). */
|
|
111
|
+
page: string;
|
|
112
|
+
}
|
|
113
|
+
/** Variables of `useEventPhotoLinks`. */
|
|
114
|
+
export interface EventPhotoLinksVars {
|
|
115
|
+
eventId: string;
|
|
116
|
+
/** How many photo positions to link (photos taken, stored or queued). */
|
|
117
|
+
count: number;
|
|
118
|
+
}
|
|
119
|
+
/** What `generatePDFFromBackend` renders. */
|
|
120
|
+
export type PdfSource = {
|
|
121
|
+
billId: string;
|
|
122
|
+
} | {
|
|
123
|
+
timecardsPeriodStart: number;
|
|
124
|
+
};
|
|
125
|
+
/** A photo that wasn't stored. */
|
|
126
|
+
export interface UploadImageFailure {
|
|
127
|
+
image: UploadImage;
|
|
128
|
+
msg: string;
|
|
129
|
+
/** Worth sending again later (e.g. it never reached S3). */
|
|
130
|
+
retryable: boolean;
|
|
131
|
+
/** The name the server gave it: keep it as `UploadImage.upload`. */
|
|
132
|
+
upload?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface UploadImagesResult {
|
|
135
|
+
/** Stored name per photo, in order; `null` where it failed. */
|
|
136
|
+
names: (string | null)[];
|
|
137
|
+
failed: UploadImageFailure[];
|
|
138
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AVRO_JS_VERSION = "1.
|
|
1
|
+
export declare const AVRO_JS_VERSION = "1.7.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|