@workwae/sdk 0.0.0-stage → 0.1.0-alpha.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.
Files changed (56) hide show
  1. package/README.md +233 -2
  2. package/client.d.ts +36 -0
  3. package/contract/accounts/models.d.ts +726 -0
  4. package/contract/accounts/routes.d.ts +1318 -0
  5. package/contract/ai/models.d.ts +30 -0
  6. package/contract/ai/routes.d.ts +89 -0
  7. package/contract/audit-log/models.d.ts +107 -0
  8. package/contract/audit-log/routes.d.ts +72 -0
  9. package/contract/calendar/models.d.ts +837 -0
  10. package/contract/calendar/routes.d.ts +1299 -0
  11. package/contract/connect/models.d.ts +272 -0
  12. package/contract/connect/routes.d.ts +531 -0
  13. package/contract/contacts/models.d.ts +269 -0
  14. package/contract/contacts/routes.d.ts +634 -0
  15. package/contract/errors.d.ts +108 -0
  16. package/contract/events/models.d.ts +2364 -0
  17. package/contract/events/routes.d.ts +107 -0
  18. package/contract/exports/models.d.ts +67 -0
  19. package/contract/exports/routes.d.ts +196 -0
  20. package/contract/identities/models.d.ts +100 -0
  21. package/contract/identities/routes.d.ts +249 -0
  22. package/contract/limits.d.ts +170 -0
  23. package/contract/mail/models.d.ts +528 -0
  24. package/contract/mail/routes.d.ts +749 -0
  25. package/contract/meetings/models.d.ts +232 -0
  26. package/contract/meetings/routes.d.ts +386 -0
  27. package/contract/oauth-apps/models.d.ts +92 -0
  28. package/contract/oauth-apps/routes.d.ts +187 -0
  29. package/contract/org-connections/models.d.ts +383 -0
  30. package/contract/org-connections/routes.d.ts +830 -0
  31. package/contract/primitives.d.ts +140 -0
  32. package/contract/public.d.ts +26 -0
  33. package/contract/reasons.d.ts +711 -0
  34. package/contract/router.d.ts +9773 -0
  35. package/contract/send/models.d.ts +750 -0
  36. package/contract/send/routes.d.ts +1239 -0
  37. package/contract/settings/models.d.ts +103 -0
  38. package/contract/settings/routes.d.ts +110 -0
  39. package/contract/suppressions/models.d.ts +231 -0
  40. package/contract/suppressions/routes.d.ts +317 -0
  41. package/contract/templates/models.d.ts +169 -0
  42. package/contract/templates/routes.d.ts +281 -0
  43. package/contract/threads/models.d.ts +117 -0
  44. package/contract/threads/routes.d.ts +336 -0
  45. package/contract/usage/models.d.ts +213 -0
  46. package/contract/usage/routes.d.ts +81 -0
  47. package/contract/webhooks/models.d.ts +879 -0
  48. package/contract/webhooks/routes.d.ts +839 -0
  49. package/contract/webhooks/signing.d.ts +35 -0
  50. package/errors.d.ts +15 -0
  51. package/index.d.ts +6 -0
  52. package/index.js +4334 -0
  53. package/index.js.map +59 -0
  54. package/package.json +45 -4
  55. package/pagination.d.ts +40 -0
  56. package/webhooks.d.ts +28 -0
@@ -0,0 +1,140 @@
1
+ import type { OpenAPI } from "@orpc/contract";
2
+ import * as z from "zod";
3
+ /** Every schema registered as an OpenAPI component, by its name. The API's document generator
4
+ * emits each under components/schemas and refers to it with $ref wherever it appears. */
5
+ export declare const openApiComponents: Map<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
6
+ /** Registers `schema` as the OpenAPI component `name`, which is its TypeScript name too. */
7
+ export declare function named<T extends z.ZodType>(name: string, schema: T): T;
8
+ /** A uuid: every id workwae issues. */
9
+ export declare const Id: z.ZodUUID;
10
+ /** An opaque non-uuid id: one a provider issues (thread, attachment, directory user). */
11
+ export declare const ProviderId: z.ZodString;
12
+ /** An event's sequence id, as decimal digits: the webhook-id header and the dedupe key. */
13
+ export declare const EventId: z.ZodString;
14
+ /** Opaque pagination cursor. */
15
+ export declare const Cursor: z.ZodString;
16
+ export declare const Email: z.ZodEmail;
17
+ /** Every date-time a response carries. */
18
+ export declare const Timestamp: z.ZodPreprocess<z.ZodDate, Date>;
19
+ /** A date-time a query string or a request body carries: a Date, or ISO 8601 text. */
20
+ export declare const QueryTimestamp: z.ZodPreprocess<z.ZodDate, string | Date>;
21
+ /** A calendar date without a time, YYYY-MM-DD. */
22
+ export declare const DateOnly: z.ZodISODate;
23
+ /** Non-empty text, trimmed, of at most `max` characters. */
24
+ export declare function trimmed(max: number): z.ZodString;
25
+ /** See MAX_NAME_LENGTH. */
26
+ export declare const Name: z.ZodString;
27
+ export declare const ExternalRef: z.ZodString;
28
+ /** An address with its display name, as a message, an event or a contact carries it. */
29
+ export declare const Address: z.ZodObject<{
30
+ name: z.ZodNullable<z.ZodString>;
31
+ address: z.ZodString;
32
+ }, z.core.$strip>;
33
+ export type Address = z.infer<typeof Address>;
34
+ /** An address a request names; the name is optional. */
35
+ export declare const AddressInput: z.ZodObject<{
36
+ name: z.ZodOptional<z.ZodString>;
37
+ address: z.ZodEmail;
38
+ }, z.core.$strip>;
39
+ export type AddressInput = z.infer<typeof AddressInput>;
40
+ /** A query-string flag: `true` and `false` arrive as text. */
41
+ export declare const QueryBoolean: z.ZodPipe<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
42
+ true: "true";
43
+ false: "false";
44
+ }>]>, z.ZodTransform<boolean, boolean | "true" | "false">>;
45
+ /** A cursor-paged list: the shape every paged /v1 list answers with. */
46
+ export interface Page<T> {
47
+ items: T[];
48
+ /** Pass back as `cursor` for the next page; null on the last one. */
49
+ nextCursor: string | null;
50
+ }
51
+ /** The fields of a page of `item`, for a page that adds envelope fields of its own (SearchPage). */
52
+ export declare const pageFields: <T extends z.ZodType>(item: T) => {
53
+ items: z.ZodArray<T>;
54
+ nextCursor: z.ZodNullable<z.ZodString>;
55
+ };
56
+ /** The page of a named entity `X`, registered as the component `XPage`. */
57
+ export declare const Page: <T extends z.ZodType>(item: T) => z.ZodObject<{
58
+ items: z.ZodArray<T>;
59
+ nextCursor: z.ZodNullable<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ /**
62
+ * The one cursor loop every paged reader runs (the SDK's pages and change feed, the board's
63
+ * listings): pages from `cursor` on, each fetched with the cursor `next` read off the page
64
+ * before, until `next` answers undefined.
65
+ */
66
+ export declare function followCursor<P>(fetch: (cursor: string | undefined) => PromiseLike<P>, cursor: string | undefined, next: (page: P) => string | undefined): AsyncGenerator<P, void, undefined>;
67
+ /** The fields of a list of `item`, for a list that adds envelope fields of its own. */
68
+ export declare const listFields: <T extends z.ZodType>(item: T) => {
69
+ items: z.ZodArray<T>;
70
+ };
71
+ /** A small bounded list of a named entity `X`, registered as the component `XList`. */
72
+ export declare const List: <T extends z.ZodType>(item: T) => z.ZodObject<{
73
+ items: z.ZodArray<T>;
74
+ }, z.core.$strip>;
75
+ /**
76
+ * The API error reason a refinement's issue answers with instead of invalid_input, carried in the
77
+ * zod issue's `params.reason`. The gate answers a validation failure whose issues all carry the
78
+ * same reason with that reason.
79
+ */
80
+ export declare function issueReason(issue: unknown): string | null;
81
+ /** A day in milliseconds: what a range's span in days is checked against (withDateRange). */
82
+ export declare const DAY_MS = 86400000;
83
+ /**
84
+ * `schema` refined so its `to` field comes after its `from` field (on or after it when
85
+ * `inclusive`, as date-only ranges are), spanning at most `maxSpanMs`. Either end left out is not
86
+ * checked. A violation answers invalid_range (issueReason), so services need not check again.
87
+ * Apply it last: zod refuses to extend a refined object.
88
+ */
89
+ export declare function withDateRange<T extends z.ZodObject, K extends keyof z.output<T> & string>(schema: T, range: {
90
+ from: K;
91
+ to: K;
92
+ maxSpanMs?: number;
93
+ inclusive?: boolean;
94
+ }): T;
95
+ /** A page size of at most `max`, `fallback` when omitted. */
96
+ export declare function pageLimit(max: number, fallback: number): z.ZodDefault<z.ZodCoercedNumber<unknown>>;
97
+ /** A page size; listings that allow more or fewer say so with their own pageLimit. */
98
+ export declare const Limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
99
+ /** The paging fields of a listing that takes the default page size. */
100
+ export declare const Paged: {
101
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
102
+ cursor: z.ZodOptional<z.ZodString>;
103
+ };
104
+ /** The account a route is scoped to: /v1/accounts/{accountId}/... */
105
+ export declare const AccountIdInput: z.ZodObject<{
106
+ accountId: z.ZodUUID;
107
+ }, z.core.$strip>;
108
+ export type AccountIdInput = z.infer<typeof AccountIdInput>;
109
+ /**
110
+ * A download the API streams: the handler answers the bytes as a ReadableStream, with their type,
111
+ * name and size in the response headers, and a client receives them as a File (which is what the
112
+ * SDK's response validation then sees, so it passes too). For /v1 only: the RPC protocol carries
113
+ * a file as multipart, so a download the board reads (a contact photo) stays a z.file().
114
+ */
115
+ export declare const StreamedFile: z.ZodPipe<z.ZodCustom<ReadableStream<Uint8Array<ArrayBufferLike>>, ReadableStream<Uint8Array<ArrayBufferLike>>>, z.ZodTransform<File, ReadableStream<Uint8Array<ArrayBufferLike>>>>;
116
+ /** Whether a procedure's output is a file, its bytes the response body, rather than JSON. */
117
+ export declare function isFileOutput(schema: unknown): boolean;
118
+ type Operation = OpenAPI.OperationObject;
119
+ /**
120
+ * A route's `spec` for an operation that takes no bearer: the token in its path is the credential
121
+ * (the hosted connect page's routes).
122
+ */
123
+ export declare const publicOperation: (operation: Operation) => Operation;
124
+ /**
125
+ * A route's `spec` for a file output, which the generator documents as any media type and nothing
126
+ * more: names the media type (a wildcard where the type is the file's own), the
127
+ * Content-Disposition the handler sets, and any further headers.
128
+ */
129
+ export declare function fileResponse(file: {
130
+ mediaType: string;
131
+ description: string;
132
+ disposition: "attachment" | "inline";
133
+ headers?: Record<string, {
134
+ description: string;
135
+ schema: {
136
+ type: "string";
137
+ };
138
+ }>;
139
+ }): (operation: Operation) => Operation;
140
+ export {};
@@ -0,0 +1,26 @@
1
+ export * from "./accounts/models.js";
2
+ export * from "./ai/models.js";
3
+ export * from "./audit-log/models.js";
4
+ export * from "./calendar/models.js";
5
+ export * from "./connect/models.js";
6
+ export * from "./contacts/models.js";
7
+ export * from "./errors.js";
8
+ export * from "./events/models.js";
9
+ export * from "./exports/models.js";
10
+ export * from "./identities/models.js";
11
+ export * from "./limits.js";
12
+ export * from "./mail/models.js";
13
+ export * from "./meetings/models.js";
14
+ export * from "./oauth-apps/models.js";
15
+ export * from "./org-connections/models.js";
16
+ export * from "./primitives.js";
17
+ export * from "./reasons.js";
18
+ export * from "./router.js";
19
+ export * from "./send/models.js";
20
+ export * from "./settings/models.js";
21
+ export * from "./suppressions/models.js";
22
+ export * from "./templates/models.js";
23
+ export * from "./threads/models.js";
24
+ export * from "./usage/models.js";
25
+ export * from "./webhooks/models.js";
26
+ export * from "./webhooks/signing.js";