@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.
- package/README.md +233 -2
- package/client.d.ts +36 -0
- package/contract/accounts/models.d.ts +726 -0
- package/contract/accounts/routes.d.ts +1318 -0
- package/contract/ai/models.d.ts +30 -0
- package/contract/ai/routes.d.ts +89 -0
- package/contract/audit-log/models.d.ts +107 -0
- package/contract/audit-log/routes.d.ts +72 -0
- package/contract/calendar/models.d.ts +837 -0
- package/contract/calendar/routes.d.ts +1299 -0
- package/contract/connect/models.d.ts +272 -0
- package/contract/connect/routes.d.ts +531 -0
- package/contract/contacts/models.d.ts +269 -0
- package/contract/contacts/routes.d.ts +634 -0
- package/contract/errors.d.ts +108 -0
- package/contract/events/models.d.ts +2364 -0
- package/contract/events/routes.d.ts +107 -0
- package/contract/exports/models.d.ts +67 -0
- package/contract/exports/routes.d.ts +196 -0
- package/contract/identities/models.d.ts +100 -0
- package/contract/identities/routes.d.ts +249 -0
- package/contract/limits.d.ts +170 -0
- package/contract/mail/models.d.ts +528 -0
- package/contract/mail/routes.d.ts +749 -0
- package/contract/meetings/models.d.ts +232 -0
- package/contract/meetings/routes.d.ts +386 -0
- package/contract/oauth-apps/models.d.ts +92 -0
- package/contract/oauth-apps/routes.d.ts +187 -0
- package/contract/org-connections/models.d.ts +383 -0
- package/contract/org-connections/routes.d.ts +830 -0
- package/contract/primitives.d.ts +140 -0
- package/contract/public.d.ts +26 -0
- package/contract/reasons.d.ts +711 -0
- package/contract/router.d.ts +9773 -0
- package/contract/send/models.d.ts +750 -0
- package/contract/send/routes.d.ts +1239 -0
- package/contract/settings/models.d.ts +103 -0
- package/contract/settings/routes.d.ts +110 -0
- package/contract/suppressions/models.d.ts +231 -0
- package/contract/suppressions/routes.d.ts +317 -0
- package/contract/templates/models.d.ts +169 -0
- package/contract/templates/routes.d.ts +281 -0
- package/contract/threads/models.d.ts +117 -0
- package/contract/threads/routes.d.ts +336 -0
- package/contract/usage/models.d.ts +213 -0
- package/contract/usage/routes.d.ts +81 -0
- package/contract/webhooks/models.d.ts +879 -0
- package/contract/webhooks/routes.d.ts +839 -0
- package/contract/webhooks/signing.d.ts +35 -0
- package/errors.d.ts +15 -0
- package/index.d.ts +6 -0
- package/index.js +4334 -0
- package/index.js.map +59 -0
- package/package.json +45 -4
- package/pagination.d.ts +40 -0
- package/webhooks.d.ts +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workwae/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Typed client for the workwae email, calendar and contacts API, with pagination, error and webhook signature helpers",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"homepage": "https://workwae.com",
|
|
7
|
+
"bugs": "https://workwae.com/support",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"workwae",
|
|
10
|
+
"email",
|
|
11
|
+
"calendar",
|
|
12
|
+
"contacts",
|
|
13
|
+
"gmail",
|
|
14
|
+
"microsoft-graph",
|
|
15
|
+
"imap",
|
|
16
|
+
"webhooks",
|
|
17
|
+
"sdk"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"files": [
|
|
22
|
+
"**/*.js",
|
|
23
|
+
"**/*.js.map",
|
|
24
|
+
"**/*.d.ts"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./index.d.ts",
|
|
29
|
+
"import": "./index.js",
|
|
30
|
+
"default": "./index.js"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"types": "./index.d.ts",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@orpc/client": "1.15.5",
|
|
40
|
+
"@orpc/contract": "1.15.5",
|
|
41
|
+
"@orpc/openapi-client": "1.15.5",
|
|
42
|
+
"zod": "4.6.5"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/pagination.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Event, type EventFeedPage, type Page } from "./contract/public.js";
|
|
2
|
+
/** Per-request options forwarded to every call a helper makes. */
|
|
3
|
+
export interface CallOptions {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
}
|
|
6
|
+
/** A procedure that takes a cursor in its input. */
|
|
7
|
+
export type CursorCall<TInput, TOutput> = (input: TInput, options?: CallOptions) => PromiseLike<TOutput>;
|
|
8
|
+
/** Every page of a list, from `input.cursor` (or the start) to the last page. */
|
|
9
|
+
export declare function pages<TInput extends {
|
|
10
|
+
cursor?: string;
|
|
11
|
+
}, TItem>(list: CursorCall<TInput, Page<TItem>>, input: NoInfer<TInput>, options?: CallOptions): AsyncGenerator<Page<TItem>, void, undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Every item of a list, following `nextCursor` until the last page:
|
|
14
|
+
* `for await (const account of paginate(workwae.accounts.list, { limit: 100 }))`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function paginate<TInput extends {
|
|
17
|
+
cursor?: string;
|
|
18
|
+
}, TItem>(list: CursorCall<TInput, Page<TItem>>, input: NoInfer<TInput>, options?: CallOptions): AsyncGenerator<TItem, void, undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Reads the change feed from `input.cursor` until it is caught up (an empty page). `cursor` moves
|
|
21
|
+
* past a page only once its last event has been consumed, so persisting it after processing
|
|
22
|
+
* gives at-least-once delivery: stopping mid-page replays that page next time.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ChangeFeed<TInput extends {
|
|
25
|
+
cursor?: string;
|
|
26
|
+
}> implements AsyncIterable<Event> {
|
|
27
|
+
#private;
|
|
28
|
+
private readonly list;
|
|
29
|
+
private readonly input;
|
|
30
|
+
private readonly options?;
|
|
31
|
+
constructor(list: CursorCall<TInput, EventFeedPage>, input: TInput, options?: CallOptions | undefined);
|
|
32
|
+
/** Where to resume: pass it as `cursor` next time. Undefined until the first page is read when
|
|
33
|
+
* no cursor was given. */
|
|
34
|
+
get cursor(): string | undefined;
|
|
35
|
+
[Symbol.asyncIterator](): AsyncGenerator<Event, void, undefined>;
|
|
36
|
+
}
|
|
37
|
+
/** `const feed = changes(workwae.changes.list, { cursor: saved })`; iterate, then save `feed.cursor`. */
|
|
38
|
+
export declare function changes<TInput extends {
|
|
39
|
+
cursor?: string;
|
|
40
|
+
}>(list: CursorCall<TInput, EventFeedPage>, input: NoInfer<TInput>, options?: CallOptions): ChangeFeed<TInput>;
|
package/webhooks.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Event, type VerifyWebhookOptions, type WebhookHeaders } from "./contract/public.js";
|
|
2
|
+
export { checkWebhookSignature, MAX_SIGNATURE_CANDIDATES, type VerifyWebhookOptions, verifyWebhook, WEBHOOK_TOLERANCE_SECONDS, type WebhookHeaders, WebhookVerificationError, type WebhookVerificationFailure, } from "./contract/public.js";
|
|
3
|
+
/** An event of a type this SDK knows, its data checked against that type's schema. Check
|
|
4
|
+
* `event.type` to narrow `event.data`. */
|
|
5
|
+
export type KnownEvent = Event & {
|
|
6
|
+
known: true;
|
|
7
|
+
};
|
|
8
|
+
/** An event of a type added to the platform after this build: its data is passed on unchecked. */
|
|
9
|
+
export interface UnknownEvent {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
accountId: string | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
data: {
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
isTest?: true;
|
|
18
|
+
known: false;
|
|
19
|
+
}
|
|
20
|
+
/** What parseWebhook returns. Check `known` first: a known event then narrows on `type`. */
|
|
21
|
+
export type WebhookEvent = KnownEvent | UnknownEvent;
|
|
22
|
+
/**
|
|
23
|
+
* Verifies the delivery, then returns its event with its dates as Dates; throws
|
|
24
|
+
* WebhookVerificationError otherwise. Pass the raw request body exactly as received. A known type
|
|
25
|
+
* whose body does not match its schema is refused (failure "payload"); a type added after this
|
|
26
|
+
* build is returned with `known: false`. Envelope fields added after this build are kept.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseWebhook(secret: string, headers: WebhookHeaders, body: string | Uint8Array | ArrayBuffer, options?: VerifyWebhookOptions): Promise<WebhookEvent>;
|