@workwae/sdk 0.1.0-alpha.1 → 0.1.0-alpha.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.
Files changed (61) hide show
  1. package/README.md +7 -7
  2. package/client.d.ts +1 -1
  3. package/contract/accounts/models.d.ts +85 -45
  4. package/contract/accounts/routes.d.ts +191 -29
  5. package/contract/ai/models.d.ts +0 -1
  6. package/contract/ai/routes.d.ts +9 -0
  7. package/contract/audit-log/models.d.ts +19 -5
  8. package/contract/audit-log/routes.d.ts +10 -1
  9. package/contract/calendar/models.d.ts +249 -74
  10. package/contract/calendar/routes.d.ts +574 -30
  11. package/contract/connect/models.d.ts +28 -16
  12. package/contract/connect/routes.d.ts +46 -7
  13. package/contract/contacts/models.d.ts +0 -10
  14. package/contract/contacts/routes.d.ts +14 -0
  15. package/contract/email-validation/models.d.ts +119 -0
  16. package/contract/email-validation/routes.d.ts +106 -0
  17. package/contract/errors.d.ts +28 -20
  18. package/contract/events/models.d.ts +139 -79
  19. package/contract/events/routes.d.ts +54 -44
  20. package/contract/exports/routes.d.ts +10 -0
  21. package/contract/identities/models.d.ts +7 -9
  22. package/contract/identities/routes.d.ts +79 -10
  23. package/contract/limits.d.ts +21 -73
  24. package/contract/mail/models.d.ts +91 -48
  25. package/contract/mail/routes.d.ts +458 -18
  26. package/contract/mcp-keys/models.d.ts +125 -0
  27. package/contract/mcp-keys/routes.d.ts +151 -0
  28. package/contract/meetings/models.d.ts +28 -33
  29. package/contract/meetings/routes.d.ts +44 -25
  30. package/contract/oauth-apps/models.d.ts +0 -6
  31. package/contract/oauth-apps/routes.d.ts +8 -0
  32. package/contract/org-connections/models.d.ts +83 -39
  33. package/contract/org-connections/routes.d.ts +320 -43
  34. package/contract/plans/credit-packs.d.ts +30 -0
  35. package/contract/plans/models.d.ts +208 -0
  36. package/contract/primitives.d.ts +7 -62
  37. package/contract/public.d.ts +6 -0
  38. package/contract/reasons.d.ts +532 -21
  39. package/contract/router.d.ts +6425 -3212
  40. package/contract/scheduling/models.d.ts +405 -0
  41. package/contract/scheduling/routes.d.ts +756 -0
  42. package/contract/send/models.d.ts +82 -45
  43. package/contract/send/routes.d.ts +281 -32
  44. package/contract/settings/models.d.ts +73 -13
  45. package/contract/settings/routes.d.ts +56 -4
  46. package/contract/suppressions/models.d.ts +21 -28
  47. package/contract/suppressions/routes.d.ts +62 -14
  48. package/contract/templates/models.d.ts +0 -14
  49. package/contract/templates/routes.d.ts +30 -6
  50. package/contract/threads/models.d.ts +0 -5
  51. package/contract/threads/routes.d.ts +40 -0
  52. package/contract/tracking-domain/models.d.ts +41 -0
  53. package/contract/tracking-domain/routes.d.ts +193 -0
  54. package/contract/usage/models.d.ts +98 -126
  55. package/contract/usage/routes.d.ts +48 -20
  56. package/contract/webhooks/models.d.ts +45 -30
  57. package/contract/webhooks/routes.d.ts +52 -9
  58. package/contract/webhooks/signing.d.ts +0 -16
  59. package/index.js +1 -4334
  60. package/package.json +6 -7
  61. package/index.js.map +0 -59
@@ -0,0 +1,106 @@
1
+ export declare const emailValidations: {
2
+ create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
3
+ addresses: import("zod").ZodArray<import("zod").ZodEmail>;
4
+ suppressInvalid: import("zod").ZodDefault<import("zod").ZodBoolean>;
5
+ refresh: import("zod").ZodDefault<import("zod").ZodBoolean>;
6
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
7
+ results: import("zod").ZodArray<import("zod").ZodObject<{
8
+ address: import("zod").ZodString;
9
+ reachability: import("zod").ZodEnum<{
10
+ unknown: "unknown";
11
+ safe: "safe";
12
+ risky: "risky";
13
+ invalid: "invalid";
14
+ }>;
15
+ validSyntax: import("zod").ZodBoolean;
16
+ domainAcceptsMail: import("zod").ZodNullable<import("zod").ZodBoolean>;
17
+ deliverable: import("zod").ZodNullable<import("zod").ZodBoolean>;
18
+ disabled: import("zod").ZodNullable<import("zod").ZodBoolean>;
19
+ fullInbox: import("zod").ZodNullable<import("zod").ZodBoolean>;
20
+ catchAll: import("zod").ZodNullable<import("zod").ZodBoolean>;
21
+ disposable: import("zod").ZodNullable<import("zod").ZodBoolean>;
22
+ roleAccount: import("zod").ZodNullable<import("zod").ZodBoolean>;
23
+ suppressed: import("zod").ZodBoolean;
24
+ cached: import("zod").ZodBoolean;
25
+ checkedAt: import("zod").ZodPreprocess<import("zod").ZodDate, Date>;
26
+ }, import("zod/v4/core").$strip>>;
27
+ }, import("zod/v4/core").$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, import("../errors.js").DeclaredErrors<{
28
+ readonly invalid_input: "The request does not match the operation's input schema (a malformed body included); data.issues names each problem.";
29
+ readonly unauthenticated: "No usable credential: none was sent, or it is malformed, unknown, revoked or an expired account token.";
30
+ readonly api_key_expired: "The API key is past its expiry (or the grace of the rotation that replaced it).";
31
+ readonly missing_scope: "The API key lacks the scope the operation needs.";
32
+ readonly role_forbidden: "The member's role does not allow the operation.";
33
+ readonly account_token_forbidden: "An account token called an operation account tokens cannot call.";
34
+ readonly account_scope_forbidden: "A credential limited to specific accounts called an operation that reaches beyond them.";
35
+ readonly mcp_only_key: "An MCP-only key (minted for an end user's MCP client) was used outside the MCP server.";
36
+ readonly rate_limited: "The tenant used up its plan's request rate; Retry-After says when the window ends.";
37
+ readonly too_many_requests: "The credential has too many requests in flight at once; retry after Retry-After.";
38
+ readonly overloaded: "The API is shedding load; retry after Retry-After.";
39
+ readonly payload_too_large: "The request body is larger than the API accepts.";
40
+ readonly internal_error: "An unexpected failure on our side.";
41
+ readonly invalid_idempotency_key: "POST only: the Idempotency-Key header is not 1 to 255 printable ASCII characters.";
42
+ readonly idempotency_key_reused: "POST only: the Idempotency-Key was used in the last 24 hours with another method, path or body.";
43
+ readonly idempotency_key_in_progress: "POST only: the request first sent with this Idempotency-Key has not been answered yet.";
44
+ }>>, import("../errors.js").DeclaredErrors<{
45
+ readonly email_validation_disabled: "Email validation is unavailable.";
46
+ readonly email_validation_unavailable: "The validation service fails or does not answer in time; no address is suppressed.";
47
+ readonly email_validation_suspended: "The validation service refuses Workwae's requests for now; try again later.";
48
+ readonly plan_limit_validations: "The addresses to check again exceed what the plan allows today (UTC); nothing was checked.";
49
+ readonly plan_required: "The workspace has no plan and is not its owner's Free workspace (the Free plan covers one workspace per owner): choose a plan under Billing.";
50
+ readonly validation_credits_exhausted: "The tenant has fewer email validation credits than the addresses to check again; data.balance and data.needed say how many; nothing was checked.";
51
+ }>>, Record<never, never>>;
52
+ list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
53
+ limit: import("zod").ZodDefault<import("zod").ZodCoercedNumber<unknown>>;
54
+ cursor: import("zod").ZodOptional<import("zod").ZodString>;
55
+ address: import("zod").ZodOptional<import("zod").ZodString>;
56
+ reachability: import("zod").ZodOptional<import("zod").ZodEnum<{
57
+ unknown: "unknown";
58
+ safe: "safe";
59
+ risky: "risky";
60
+ invalid: "invalid";
61
+ }>>;
62
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
63
+ items: import("zod").ZodArray<import("zod").ZodObject<{
64
+ address: import("zod").ZodString;
65
+ reachability: import("zod").ZodEnum<{
66
+ unknown: "unknown";
67
+ safe: "safe";
68
+ risky: "risky";
69
+ invalid: "invalid";
70
+ }>;
71
+ validSyntax: import("zod").ZodBoolean;
72
+ domainAcceptsMail: import("zod").ZodNullable<import("zod").ZodBoolean>;
73
+ deliverable: import("zod").ZodNullable<import("zod").ZodBoolean>;
74
+ disabled: import("zod").ZodNullable<import("zod").ZodBoolean>;
75
+ fullInbox: import("zod").ZodNullable<import("zod").ZodBoolean>;
76
+ catchAll: import("zod").ZodNullable<import("zod").ZodBoolean>;
77
+ disposable: import("zod").ZodNullable<import("zod").ZodBoolean>;
78
+ roleAccount: import("zod").ZodNullable<import("zod").ZodBoolean>;
79
+ suppressed: import("zod").ZodBoolean;
80
+ cached: import("zod").ZodBoolean;
81
+ checkedAt: import("zod").ZodPreprocess<import("zod").ZodDate, Date>;
82
+ id: import("zod").ZodUUID;
83
+ createdAt: import("zod").ZodPreprocess<import("zod").ZodDate, Date>;
84
+ }, import("zod/v4/core").$strip>>;
85
+ nextCursor: import("zod").ZodNullable<import("zod").ZodString>;
86
+ }, import("zod/v4/core").$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, import("../errors.js").DeclaredErrors<{
87
+ readonly invalid_input: "The request does not match the operation's input schema (a malformed body included); data.issues names each problem.";
88
+ readonly unauthenticated: "No usable credential: none was sent, or it is malformed, unknown, revoked or an expired account token.";
89
+ readonly api_key_expired: "The API key is past its expiry (or the grace of the rotation that replaced it).";
90
+ readonly missing_scope: "The API key lacks the scope the operation needs.";
91
+ readonly role_forbidden: "The member's role does not allow the operation.";
92
+ readonly account_token_forbidden: "An account token called an operation account tokens cannot call.";
93
+ readonly account_scope_forbidden: "A credential limited to specific accounts called an operation that reaches beyond them.";
94
+ readonly mcp_only_key: "An MCP-only key (minted for an end user's MCP client) was used outside the MCP server.";
95
+ readonly rate_limited: "The tenant used up its plan's request rate; Retry-After says when the window ends.";
96
+ readonly too_many_requests: "The credential has too many requests in flight at once; retry after Retry-After.";
97
+ readonly overloaded: "The API is shedding load; retry after Retry-After.";
98
+ readonly payload_too_large: "The request body is larger than the API accepts.";
99
+ readonly internal_error: "An unexpected failure on our side.";
100
+ readonly invalid_idempotency_key: "POST only: the Idempotency-Key header is not 1 to 255 printable ASCII characters.";
101
+ readonly idempotency_key_reused: "POST only: the Idempotency-Key was used in the last 24 hours with another method, path or body.";
102
+ readonly idempotency_key_in_progress: "POST only: the request first sent with this Idempotency-Key has not been answered yet.";
103
+ }>>, import("../errors.js").DeclaredErrors<{
104
+ readonly invalid_cursor: "The cursor is not one this list issued.";
105
+ }>>, Record<never, never>>;
106
+ };
@@ -1,5 +1,4 @@
1
1
  import { type ErrorReason, type ReasonDataSchema, type ReasonStatus, type ReasonTable } from "./reasons.js";
2
- /** A declared error: its reason's status and data schema, with the condition as its message. */
3
2
  export type DeclaredError<R extends ErrorReason> = {
4
3
  status: ReasonStatus<R>;
5
4
  message: string;
@@ -9,22 +8,14 @@ export type DeclaredError<R extends ErrorReason> = {
9
8
  export type DeclaredErrors<C> = {
10
9
  [R in keyof C & ErrorReason]: DeclaredError<R>;
11
10
  };
12
- /**
13
- * The oRPC error map for `conditions` (reason -> when it is answered, one sentence), each with its
14
- * reason's status and data schema from `table`. errors() below and the console's wrap it; they
15
- * are declared functions with named return types so declarations reference the table by name
16
- * instead of inlining it into every route.
17
- */
18
11
  export declare function errorMap(table: ReasonTable, conditions: Record<string, string | undefined>): Record<string, {
19
12
  status: number;
20
13
  message: string;
21
14
  data?: unknown;
22
15
  }>;
23
- /** The error map of a /v1 route; console routes use console/reasons.ts's, which knows theirs. */
24
16
  export declare function errors<const C extends {
25
17
  [R in ErrorReason]?: string;
26
18
  }>(conditions: C): DeclaredErrors<C>;
27
- /** What any route can answer with, whoever calls it and whatever it does. */
28
19
  export declare const GLOBAL_ERRORS: DeclaredErrors<{
29
20
  readonly invalid_input: "The request does not match the operation's input schema (a malformed body included); data.issues names each problem.";
30
21
  readonly unauthenticated: "No usable credential: none was sent, or it is malformed, unknown, revoked or an expired account token.";
@@ -32,6 +23,8 @@ export declare const GLOBAL_ERRORS: DeclaredErrors<{
32
23
  readonly missing_scope: "The API key lacks the scope the operation needs.";
33
24
  readonly role_forbidden: "The member's role does not allow the operation.";
34
25
  readonly account_token_forbidden: "An account token called an operation account tokens cannot call.";
26
+ readonly account_scope_forbidden: "A credential limited to specific accounts called an operation that reaches beyond them.";
27
+ readonly mcp_only_key: "An MCP-only key (minted for an end user's MCP client) was used outside the MCP server.";
35
28
  readonly rate_limited: "The tenant used up its plan's request rate; Retry-After says when the window ends.";
36
29
  readonly too_many_requests: "The credential has too many requests in flight at once; retry after Retry-After.";
37
30
  readonly overloaded: "The API is shedding load; retry after Retry-After.";
@@ -41,7 +34,6 @@ export declare const GLOBAL_ERRORS: DeclaredErrors<{
41
34
  readonly idempotency_key_reused: "POST only: the Idempotency-Key was used in the last 24 hours with another method, path or body.";
42
35
  readonly idempotency_key_in_progress: "POST only: the request first sent with this Idempotency-Key has not been answered yet.";
43
36
  }>;
44
- /** The builder every route starts from: oc with GLOBAL_ERRORS declared. */
45
37
  export declare const base: import("@orpc/contract").ContractBuilder<import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").MergedErrorMap<Record<never, never>, DeclaredErrors<{
46
38
  readonly invalid_input: "The request does not match the operation's input schema (a malformed body included); data.issues names each problem.";
47
39
  readonly unauthenticated: "No usable credential: none was sent, or it is malformed, unknown, revoked or an expired account token.";
@@ -49,6 +41,8 @@ export declare const base: import("@orpc/contract").ContractBuilder<import("@orp
49
41
  readonly missing_scope: "The API key lacks the scope the operation needs.";
50
42
  readonly role_forbidden: "The member's role does not allow the operation.";
51
43
  readonly account_token_forbidden: "An account token called an operation account tokens cannot call.";
44
+ readonly account_scope_forbidden: "A credential limited to specific accounts called an operation that reaches beyond them.";
45
+ readonly mcp_only_key: "An MCP-only key (minted for an end user's MCP client) was used outside the MCP server.";
52
46
  readonly rate_limited: "The tenant used up its plan's request rate; Retry-After says when the window ends.";
53
47
  readonly too_many_requests: "The credential has too many requests in flight at once; retry after Retry-After.";
54
48
  readonly overloaded: "The API is shedding load; retry after Retry-After.";
@@ -59,46 +53,60 @@ export declare const base: import("@orpc/contract").ContractBuilder<import("@orp
59
53
  readonly idempotency_key_in_progress: "POST only: the request first sent with this Idempotency-Key has not been answered yet.";
60
54
  }>>, Record<never, never>>;
61
55
  export declare const SESSION_ONLY: DeclaredErrors<{
62
- readonly session_required: "The caller is not a board session (only board sessions may call this).";
56
+ readonly session_required: "The caller is not a console session (only console sessions may call this).";
63
57
  }>;
64
58
  export declare const OWNER_ONLY: DeclaredErrors<{
65
- readonly session_required: "The caller is not a board session (only board sessions may call this).";
59
+ readonly session_required: "The caller is not a console session (only console sessions may call this).";
66
60
  readonly owner_required: "The caller does not own the organization.";
67
61
  }>;
68
62
  export declare const PLATFORM_ONLY: DeclaredErrors<{
69
- readonly session_required: "The caller is not a board session (only board sessions may call this).";
63
+ readonly session_required: "The caller is not a console session (only console sessions may call this).";
70
64
  readonly platform_admin_required: "The caller is not a platform administrator.";
71
65
  readonly email_verification_required: "The platform administrator has not verified their email address yet.";
72
66
  }>;
73
- /** The account a path names: missing, deleted, or another account than an account token's. */
74
67
  export declare const ACCOUNT_NOT_FOUND: DeclaredErrors<{
75
68
  readonly account_not_found: "The account does not exist, or the caller is an account token for another account.";
76
69
  }>;
77
- /** The account states that keep a route from reaching the provider; `account` names the account
78
- * and may narrow when, e.g. "With source=provider, the account". */
70
+ export declare const MAIL_ACCOUNT: {
71
+ mail_disabled: {
72
+ status: 409;
73
+ message: string;
74
+ };
75
+ account_not_found: {
76
+ status: 404;
77
+ message: string;
78
+ };
79
+ plan_module_unavailable: {
80
+ status: 403;
81
+ message: string;
82
+ };
83
+ };
79
84
  export declare function accountState(account?: string): DeclaredErrors<{
80
85
  readonly account_paused: `${string} is paused.`;
81
86
  readonly account_disabled: `${string} is disabled.`;
82
87
  readonly account_reauth_required: `${string} must be reconnected: its stored grant or login no longer works.`;
83
88
  readonly account_misconfigured: `${string}'s stored grant cannot be used until an administrator fixes what it relies on (the tenant's OAuth app or organization connection is refused, missing or unreadable).`;
84
89
  }>;
85
- /** What any provider call answers when it fails. A route the provider can refuse adds
86
- * `provider_forbidden` with its own condition, and one reading an item `provider_not_found`. */
87
90
  export declare const PROVIDER_FAILURES: DeclaredErrors<{
88
91
  readonly provider_throttled: "The provider asked us to slow down (with Retry-After when it named a wait).";
89
92
  readonly provider_unavailable: "The provider could not be reached (with Retry-After when it named a wait).";
90
93
  }>;
91
- /** What asking for stored bodies through `field` refuses. */
92
94
  export declare function bodyStorage(field: string): DeclaredErrors<{
93
95
  readonly storage_unavailable: `${string} is cache or full and no object store is configured.`;
94
96
  readonly plan_limit_storage: `${string} is cache or full and the tenant's plan does not include body storage.`;
95
97
  }>;
96
- /** A route of a module the tenant's plan may lack, e.g. planModule("calendar"). */
97
98
  export declare function planModule(module: string): DeclaredErrors<{
98
99
  readonly plan_module_unavailable: `The tenant's plan does not include ${string}.`;
99
100
  }>;
101
+ export declare const PLAN_REQUIRED_CONDITION = "The workspace has no plan and is not its owner's Free workspace (the Free plan covers one workspace per owner): choose a plan under Billing.";
102
+ export declare const PLAN_REQUIRED: DeclaredErrors<{
103
+ readonly plan_required: "The workspace has no plan and is not its owner's Free workspace (the Free plan covers one workspace per owner): choose a plan under Billing.";
104
+ }>;
105
+ export declare function spendCapCondition(what: string): string;
100
106
  export declare const PLAN_LIMIT_ACCOUNTS: DeclaredErrors<{
101
107
  readonly plan_limit_accounts: "The tenant already has as many accounts as its plan allows.";
108
+ readonly plan_required: "The workspace has no plan and is not its owner's Free workspace (the Free plan covers one workspace per owner): choose a plan under Billing.";
109
+ readonly spend_cap_reached: string;
102
110
  }>;
103
111
  export declare const BILLING_PAST_DUE: DeclaredErrors<{
104
112
  readonly billing_past_due: "The tenant's payment is past due beyond the grace period (sends already queued or scheduled still go out).";