@relaycast/types 0.2.4 → 0.2.5

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/dist/agent.d.ts +189 -23
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +73 -1
  4. package/dist/agent.js.map +1 -1
  5. package/dist/api.d.ts +209 -14
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +22 -1
  8. package/dist/api.js.map +1 -1
  9. package/dist/billing.d.ts +97 -17
  10. package/dist/billing.d.ts.map +1 -1
  11. package/dist/billing.js +44 -1
  12. package/dist/billing.js.map +1 -1
  13. package/dist/channel.d.ts +80 -16
  14. package/dist/channel.d.ts.map +1 -1
  15. package/dist/channel.js +35 -1
  16. package/dist/channel.js.map +1 -1
  17. package/dist/command.d.ts +188 -26
  18. package/dist/command.d.ts.map +1 -1
  19. package/dist/command.js +47 -1
  20. package/dist/command.js.map +1 -1
  21. package/dist/dashboard.d.ts +141 -14
  22. package/dist/dashboard.d.ts.map +1 -1
  23. package/dist/dashboard.js +32 -1
  24. package/dist/dashboard.js.map +1 -1
  25. package/dist/dm.d.ts +74 -15
  26. package/dist/dm.d.ts.map +1 -1
  27. package/dist/dm.js +33 -1
  28. package/dist/dm.js.map +1 -1
  29. package/dist/events.d.ts +1479 -75
  30. package/dist/events.d.ts.map +1 -1
  31. package/dist/events.js +186 -1
  32. package/dist/events.js.map +1 -1
  33. package/dist/file.d.ts +83 -14
  34. package/dist/file.d.ts.map +1 -1
  35. package/dist/file.js +38 -1
  36. package/dist/file.js.map +1 -1
  37. package/dist/message.d.ts +875 -52
  38. package/dist/message.d.ts.map +1 -1
  39. package/dist/message.js +75 -1
  40. package/dist/message.js.map +1 -1
  41. package/dist/reaction.d.ts +35 -7
  42. package/dist/reaction.d.ts.map +1 -1
  43. package/dist/reaction.js +16 -1
  44. package/dist/reaction.js.map +1 -1
  45. package/dist/receipt.d.ts +34 -6
  46. package/dist/receipt.d.ts.map +1 -1
  47. package/dist/receipt.js +16 -1
  48. package/dist/receipt.js.map +1 -1
  49. package/dist/subscription.d.ts +119 -20
  50. package/dist/subscription.d.ts.map +1 -1
  51. package/dist/subscription.js +49 -1
  52. package/dist/subscription.js.map +1 -1
  53. package/dist/webhook.d.ts +81 -17
  54. package/dist/webhook.d.ts.map +1 -1
  55. package/dist/webhook.js +35 -1
  56. package/dist/webhook.js.map +1 -1
  57. package/dist/workspace.d.ts +77 -12
  58. package/dist/workspace.d.ts.map +1 -1
  59. package/dist/workspace.js +32 -1
  60. package/dist/workspace.js.map +1 -1
  61. package/package.json +4 -1
package/dist/agent.d.ts CHANGED
@@ -1,36 +1,202 @@
1
- export type AgentType = 'agent' | 'human';
2
- export type AgentStatus = 'online' | 'offline' | 'away';
3
- export interface Agent {
1
+ import { z } from 'zod';
2
+ export declare const AgentTypeSchema: z.ZodEnum<["agent", "human"]>;
3
+ export type AgentType = z.infer<typeof AgentTypeSchema>;
4
+ export declare const AgentStatusSchema: z.ZodEnum<["online", "offline", "away"]>;
5
+ export type AgentStatus = z.infer<typeof AgentStatusSchema>;
6
+ export declare const AgentSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ workspace_id: z.ZodString;
9
+ name: z.ZodString;
10
+ type: z.ZodEnum<["agent", "human"]>;
11
+ token_hash: z.ZodString;
12
+ status: z.ZodEnum<["online", "offline", "away"]>;
13
+ persona: z.ZodNullable<z.ZodString>;
14
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ created_at: z.ZodString;
16
+ last_seen: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ type: "agent" | "human";
19
+ status: "online" | "offline" | "away";
4
20
  id: string;
5
21
  workspace_id: string;
6
22
  name: string;
7
- type: AgentType;
8
23
  token_hash: string;
9
- status: AgentStatus;
10
24
  persona: string | null;
11
25
  metadata: Record<string, unknown>;
12
26
  created_at: string;
13
27
  last_seen: string;
14
- }
15
- export interface CreateAgentRequest {
16
- name: string;
17
- type?: AgentType;
18
- persona?: string;
19
- metadata?: Record<string, unknown>;
20
- }
21
- export interface CreateAgentResponse {
28
+ }, {
29
+ type: "agent" | "human";
30
+ status: "online" | "offline" | "away";
31
+ id: string;
32
+ workspace_id: string;
33
+ name: string;
34
+ token_hash: string;
35
+ persona: string | null;
36
+ metadata: Record<string, unknown>;
37
+ created_at: string;
38
+ last_seen: string;
39
+ }>;
40
+ export type Agent = z.infer<typeof AgentSchema>;
41
+ export declare const CreateAgentRequestSchema: z.ZodObject<{
42
+ name: z.ZodString;
43
+ type: z.ZodOptional<z.ZodEnum<["agent", "human"]>>;
44
+ persona: z.ZodOptional<z.ZodString>;
45
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ name: string;
48
+ type?: "agent" | "human" | undefined;
49
+ persona?: string | undefined;
50
+ metadata?: Record<string, unknown> | undefined;
51
+ }, {
52
+ name: string;
53
+ type?: "agent" | "human" | undefined;
54
+ persona?: string | undefined;
55
+ metadata?: Record<string, unknown> | undefined;
56
+ }>;
57
+ export type CreateAgentRequest = z.infer<typeof CreateAgentRequestSchema>;
58
+ export declare const CreateAgentResponseSchema: z.ZodObject<{
59
+ id: z.ZodString;
60
+ name: z.ZodString;
61
+ token: z.ZodString;
62
+ status: z.ZodEnum<["online", "offline", "away"]>;
63
+ created_at: z.ZodString;
64
+ }, "strip", z.ZodTypeAny, {
65
+ status: "online" | "offline" | "away";
66
+ id: string;
67
+ name: string;
68
+ created_at: string;
69
+ token: string;
70
+ }, {
71
+ status: "online" | "offline" | "away";
22
72
  id: string;
23
73
  name: string;
74
+ created_at: string;
75
+ token: string;
76
+ }>;
77
+ export type CreateAgentResponse = z.infer<typeof CreateAgentResponseSchema>;
78
+ export declare const UpdateAgentRequestSchema: z.ZodObject<{
79
+ status: z.ZodOptional<z.ZodEnum<["online", "offline", "away"]>>;
80
+ persona: z.ZodOptional<z.ZodString>;
81
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ status?: "online" | "offline" | "away" | undefined;
84
+ persona?: string | undefined;
85
+ metadata?: Record<string, unknown> | undefined;
86
+ }, {
87
+ status?: "online" | "offline" | "away" | undefined;
88
+ persona?: string | undefined;
89
+ metadata?: Record<string, unknown> | undefined;
90
+ }>;
91
+ export type UpdateAgentRequest = z.infer<typeof UpdateAgentRequestSchema>;
92
+ export declare const AgentListQuerySchema: z.ZodObject<{
93
+ status: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["online", "offline", "away"]>, z.ZodLiteral<"all">]>>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ status?: "online" | "offline" | "away" | "all" | undefined;
96
+ }, {
97
+ status?: "online" | "offline" | "away" | "all" | undefined;
98
+ }>;
99
+ export type AgentListQuery = z.infer<typeof AgentListQuerySchema>;
100
+ export declare const AgentPresenceInfoSchema: z.ZodObject<{
101
+ agent_id: z.ZodString;
102
+ agent_name: z.ZodString;
103
+ status: z.ZodEnum<["online", "offline"]>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ status: "online" | "offline";
106
+ agent_id: string;
107
+ agent_name: string;
108
+ }, {
109
+ status: "online" | "offline";
110
+ agent_id: string;
111
+ agent_name: string;
112
+ }>;
113
+ export type AgentPresenceInfo = z.infer<typeof AgentPresenceInfoSchema>;
114
+ export declare const CliTypeSchema: z.ZodEnum<["claude", "codex", "gemini", "aider", "goose"]>;
115
+ export type CliType = z.infer<typeof CliTypeSchema>;
116
+ export declare const SpawnAgentRequestSchema: z.ZodObject<{
117
+ name: z.ZodString;
118
+ cli: z.ZodEnum<["claude", "codex", "gemini", "aider", "goose"]>;
119
+ task: z.ZodString;
120
+ channel: z.ZodOptional<z.ZodString>;
121
+ persona: z.ZodOptional<z.ZodString>;
122
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ name: string;
125
+ cli: "claude" | "codex" | "gemini" | "aider" | "goose";
126
+ task: string;
127
+ persona?: string | undefined;
128
+ metadata?: Record<string, unknown> | undefined;
129
+ channel?: string | undefined;
130
+ }, {
131
+ name: string;
132
+ cli: "claude" | "codex" | "gemini" | "aider" | "goose";
133
+ task: string;
134
+ persona?: string | undefined;
135
+ metadata?: Record<string, unknown> | undefined;
136
+ channel?: string | undefined;
137
+ }>;
138
+ export type SpawnAgentRequest = z.infer<typeof SpawnAgentRequestSchema>;
139
+ export declare const SpawnAgentResponseSchema: z.ZodObject<{
140
+ id: z.ZodString;
141
+ name: z.ZodString;
142
+ token: z.ZodString;
143
+ cli: z.ZodEnum<["claude", "codex", "gemini", "aider", "goose"]>;
144
+ task: z.ZodString;
145
+ channel: z.ZodNullable<z.ZodString>;
146
+ status: z.ZodEnum<["online", "offline", "away"]>;
147
+ created_at: z.ZodString;
148
+ already_existed: z.ZodBoolean;
149
+ }, "strip", z.ZodTypeAny, {
150
+ status: "online" | "offline" | "away";
151
+ id: string;
152
+ name: string;
153
+ created_at: string;
24
154
  token: string;
25
- status: AgentStatus;
155
+ cli: "claude" | "codex" | "gemini" | "aider" | "goose";
156
+ task: string;
157
+ channel: string | null;
158
+ already_existed: boolean;
159
+ }, {
160
+ status: "online" | "offline" | "away";
161
+ id: string;
162
+ name: string;
26
163
  created_at: string;
27
- }
28
- export interface UpdateAgentRequest {
29
- status?: AgentStatus;
30
- persona?: string;
31
- metadata?: Record<string, unknown>;
32
- }
33
- export interface AgentListQuery {
34
- status?: AgentStatus | 'all';
35
- }
164
+ token: string;
165
+ cli: "claude" | "codex" | "gemini" | "aider" | "goose";
166
+ task: string;
167
+ channel: string | null;
168
+ already_existed: boolean;
169
+ }>;
170
+ export type SpawnAgentResponse = z.infer<typeof SpawnAgentResponseSchema>;
171
+ export declare const ReleaseAgentRequestSchema: z.ZodObject<{
172
+ name: z.ZodString;
173
+ reason: z.ZodOptional<z.ZodString>;
174
+ delete_agent: z.ZodOptional<z.ZodBoolean>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ name: string;
177
+ reason?: string | undefined;
178
+ delete_agent?: boolean | undefined;
179
+ }, {
180
+ name: string;
181
+ reason?: string | undefined;
182
+ delete_agent?: boolean | undefined;
183
+ }>;
184
+ export type ReleaseAgentRequest = z.infer<typeof ReleaseAgentRequestSchema>;
185
+ export declare const ReleaseAgentResponseSchema: z.ZodObject<{
186
+ name: z.ZodString;
187
+ released: z.ZodBoolean;
188
+ deleted: z.ZodBoolean;
189
+ reason: z.ZodNullable<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ name: string;
192
+ reason: string | null;
193
+ released: boolean;
194
+ deleted: boolean;
195
+ }, {
196
+ name: string;
197
+ reason: string | null;
198
+ released: boolean;
199
+ deleted: boolean;
200
+ }>;
201
+ export type ReleaseAgentResponse = z.infer<typeof ReleaseAgentResponseSchema>;
36
202
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAA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package/dist/agent.js CHANGED
@@ -1,2 +1,74 @@
1
- export {};
1
+ import { z } from 'zod';
2
+ export const AgentTypeSchema = z.enum(['agent', 'human']);
3
+ export const AgentStatusSchema = z.enum(['online', 'offline', 'away']);
4
+ export const AgentSchema = z.object({
5
+ id: z.string(),
6
+ workspace_id: z.string(),
7
+ name: z.string(),
8
+ type: AgentTypeSchema,
9
+ token_hash: z.string(),
10
+ status: AgentStatusSchema,
11
+ persona: z.string().nullable(),
12
+ metadata: z.record(z.unknown()),
13
+ created_at: z.string(),
14
+ last_seen: z.string(),
15
+ });
16
+ export const CreateAgentRequestSchema = z.object({
17
+ name: z.string(),
18
+ type: AgentTypeSchema.optional(),
19
+ persona: z.string().optional(),
20
+ metadata: z.record(z.unknown()).optional(),
21
+ });
22
+ export const CreateAgentResponseSchema = z.object({
23
+ id: z.string(),
24
+ name: z.string(),
25
+ token: z.string(),
26
+ status: AgentStatusSchema,
27
+ created_at: z.string(),
28
+ });
29
+ export const UpdateAgentRequestSchema = z.object({
30
+ status: AgentStatusSchema.optional(),
31
+ persona: z.string().optional(),
32
+ metadata: z.record(z.unknown()).optional(),
33
+ });
34
+ export const AgentListQuerySchema = z.object({
35
+ status: z.union([AgentStatusSchema, z.literal('all')]).optional(),
36
+ });
37
+ export const AgentPresenceInfoSchema = z.object({
38
+ agent_id: z.string(),
39
+ agent_name: z.string(),
40
+ status: z.enum(['online', 'offline']),
41
+ });
42
+ // === Spawn/Release (Agent Lifecycle) ===
43
+ export const CliTypeSchema = z.enum(['claude', 'codex', 'gemini', 'aider', 'goose']);
44
+ export const SpawnAgentRequestSchema = z.object({
45
+ name: z.string(),
46
+ cli: CliTypeSchema,
47
+ task: z.string(),
48
+ channel: z.string().optional(),
49
+ persona: z.string().optional(),
50
+ metadata: z.record(z.unknown()).optional(),
51
+ });
52
+ export const SpawnAgentResponseSchema = z.object({
53
+ id: z.string(),
54
+ name: z.string(),
55
+ token: z.string(),
56
+ cli: CliTypeSchema,
57
+ task: z.string(),
58
+ channel: z.string().nullable(),
59
+ status: AgentStatusSchema,
60
+ created_at: z.string(),
61
+ already_existed: z.boolean(),
62
+ });
63
+ export const ReleaseAgentRequestSchema = z.object({
64
+ name: z.string(),
65
+ reason: z.string().optional(),
66
+ delete_agent: z.boolean().optional(),
67
+ });
68
+ export const ReleaseAgentResponseSchema = z.object({
69
+ name: z.string(),
70
+ released: z.boolean(),
71
+ deleted: z.boolean(),
72
+ reason: z.string().nullable(),
73
+ });
2
74
  //# sourceMappingURL=agent.js.map
package/dist/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAG1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAGvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,eAAe;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,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,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC"}
package/dist/api.d.ts CHANGED
@@ -1,36 +1,231 @@
1
- export interface ApiSuccess<T> {
2
- ok: true;
1
+ import { z } from 'zod';
2
+ export declare const ApiSuccessSchema: <T extends z.ZodType>(dataSchema: T) => z.ZodObject<{
3
+ ok: z.ZodLiteral<true>;
3
4
  data: T;
4
- cursor?: {
5
+ cursor: z.ZodOptional<z.ZodObject<{
6
+ next: z.ZodNullable<z.ZodString>;
7
+ has_more: z.ZodBoolean;
8
+ }, "strip", z.ZodTypeAny, {
9
+ next: string | null;
10
+ has_more: boolean;
11
+ }, {
12
+ next: string | null;
13
+ has_more: boolean;
14
+ }>>;
15
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
16
+ ok: z.ZodLiteral<true>;
17
+ data: T;
18
+ cursor: z.ZodOptional<z.ZodObject<{
19
+ next: z.ZodNullable<z.ZodString>;
20
+ has_more: z.ZodBoolean;
21
+ }, "strip", z.ZodTypeAny, {
22
+ next: string | null;
23
+ has_more: boolean;
24
+ }, {
25
+ next: string | null;
26
+ has_more: boolean;
27
+ }>>;
28
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
29
+ ok: z.ZodLiteral<true>;
30
+ data: T;
31
+ cursor: z.ZodOptional<z.ZodObject<{
32
+ next: z.ZodNullable<z.ZodString>;
33
+ has_more: z.ZodBoolean;
34
+ }, "strip", z.ZodTypeAny, {
35
+ next: string | null;
36
+ has_more: boolean;
37
+ }, {
5
38
  next: string | null;
6
39
  has_more: boolean;
40
+ }>>;
41
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
42
+ export declare const ApiErrorSchema: z.ZodObject<{
43
+ ok: z.ZodLiteral<false>;
44
+ error: z.ZodObject<{
45
+ code: z.ZodString;
46
+ message: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ code: string;
49
+ message: string;
50
+ }, {
51
+ code: string;
52
+ message: string;
53
+ }>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ ok: false;
56
+ error: {
57
+ code: string;
58
+ message: string;
7
59
  };
8
- }
9
- export interface ApiError {
60
+ }, {
10
61
  ok: false;
11
62
  error: {
12
63
  code: string;
13
64
  message: string;
14
65
  };
15
- }
16
- export type ApiResponse<T> = ApiSuccess<T> | ApiError;
17
- export interface InboxResponse {
18
- unread_channels: Array<{
66
+ }>;
67
+ export declare const ApiResponseSchema: <T extends z.ZodType>(dataSchema: T) => z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
68
+ ok: z.ZodLiteral<true>;
69
+ data: T;
70
+ cursor: z.ZodOptional<z.ZodObject<{
71
+ next: z.ZodNullable<z.ZodString>;
72
+ has_more: z.ZodBoolean;
73
+ }, "strip", z.ZodTypeAny, {
74
+ next: string | null;
75
+ has_more: boolean;
76
+ }, {
77
+ next: string | null;
78
+ has_more: boolean;
79
+ }>>;
80
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
81
+ ok: z.ZodLiteral<true>;
82
+ data: T;
83
+ cursor: z.ZodOptional<z.ZodObject<{
84
+ next: z.ZodNullable<z.ZodString>;
85
+ has_more: z.ZodBoolean;
86
+ }, "strip", z.ZodTypeAny, {
87
+ next: string | null;
88
+ has_more: boolean;
89
+ }, {
90
+ next: string | null;
91
+ has_more: boolean;
92
+ }>>;
93
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
94
+ ok: z.ZodLiteral<true>;
95
+ data: T;
96
+ cursor: z.ZodOptional<z.ZodObject<{
97
+ next: z.ZodNullable<z.ZodString>;
98
+ has_more: z.ZodBoolean;
99
+ }, "strip", z.ZodTypeAny, {
100
+ next: string | null;
101
+ has_more: boolean;
102
+ }, {
103
+ next: string | null;
104
+ has_more: boolean;
105
+ }>>;
106
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>, z.ZodObject<{
107
+ ok: z.ZodLiteral<false>;
108
+ error: z.ZodObject<{
109
+ code: z.ZodString;
110
+ message: z.ZodString;
111
+ }, "strip", z.ZodTypeAny, {
112
+ code: string;
113
+ message: string;
114
+ }, {
115
+ code: string;
116
+ message: string;
117
+ }>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ ok: false;
120
+ error: {
121
+ code: string;
122
+ message: string;
123
+ };
124
+ }, {
125
+ ok: false;
126
+ error: {
127
+ code: string;
128
+ message: string;
129
+ };
130
+ }>]>;
131
+ export declare const InboxResponseSchema: z.ZodObject<{
132
+ unread_channels: z.ZodArray<z.ZodObject<{
133
+ channel_name: z.ZodString;
134
+ unread_count: z.ZodNumber;
135
+ }, "strip", z.ZodTypeAny, {
19
136
  channel_name: string;
20
137
  unread_count: number;
21
- }>;
22
- mentions: Array<{
138
+ }, {
139
+ channel_name: string;
140
+ unread_count: number;
141
+ }>, "many">;
142
+ mentions: z.ZodArray<z.ZodObject<{
143
+ id: z.ZodString;
144
+ channel_name: z.ZodString;
145
+ agent_name: z.ZodString;
146
+ text: z.ZodString;
147
+ created_at: z.ZodString;
148
+ }, "strip", z.ZodTypeAny, {
23
149
  id: string;
150
+ created_at: string;
151
+ agent_name: string;
24
152
  channel_name: string;
153
+ text: string;
154
+ }, {
155
+ id: string;
156
+ created_at: string;
25
157
  agent_name: string;
158
+ channel_name: string;
26
159
  text: string;
160
+ }>, "many">;
161
+ unread_dms: z.ZodArray<z.ZodObject<{
162
+ conversation_id: z.ZodString;
163
+ from: z.ZodString;
164
+ unread_count: z.ZodNumber;
165
+ last_message: z.ZodNullable<z.ZodString>;
166
+ }, "strip", z.ZodTypeAny, {
167
+ unread_count: number;
168
+ conversation_id: string;
169
+ from: string;
170
+ last_message: string | null;
171
+ }, {
172
+ unread_count: number;
173
+ conversation_id: string;
174
+ from: string;
175
+ last_message: string | null;
176
+ }>, "many">;
177
+ }, "strip", z.ZodTypeAny, {
178
+ unread_channels: {
179
+ channel_name: string;
180
+ unread_count: number;
181
+ }[];
182
+ mentions: {
183
+ id: string;
27
184
  created_at: string;
28
- }>;
29
- unread_dms: Array<{
185
+ agent_name: string;
186
+ channel_name: string;
187
+ text: string;
188
+ }[];
189
+ unread_dms: {
190
+ unread_count: number;
30
191
  conversation_id: string;
31
192
  from: string;
193
+ last_message: string | null;
194
+ }[];
195
+ }, {
196
+ unread_channels: {
197
+ channel_name: string;
198
+ unread_count: number;
199
+ }[];
200
+ mentions: {
201
+ id: string;
202
+ created_at: string;
203
+ agent_name: string;
204
+ channel_name: string;
205
+ text: string;
206
+ }[];
207
+ unread_dms: {
32
208
  unread_count: number;
209
+ conversation_id: string;
210
+ from: string;
33
211
  last_message: string | null;
34
- }>;
212
+ }[];
213
+ }>;
214
+ export interface ApiSuccess<T> {
215
+ ok: true;
216
+ data: T;
217
+ cursor?: {
218
+ next: string | null;
219
+ has_more: boolean;
220
+ };
35
221
  }
222
+ export interface ApiError {
223
+ ok: false;
224
+ error: {
225
+ code: string;
226
+ message: string;
227
+ };
228
+ }
229
+ export type ApiResponse<T> = ApiSuccess<T> | ApiError;
230
+ export type InboxResponse = z.infer<typeof InboxResponseSchema>;
36
231
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.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;;;;;;;;;;;iEAQ/D,CAAC;AAEL,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACQ,CAAC;AAE7E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AAEH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
package/dist/api.js CHANGED
@@ -1,2 +1,23 @@
1
- export {};
1
+ import { z } from 'zod';
2
+ export const ApiSuccessSchema = (dataSchema) => z.object({
3
+ ok: z.literal(true),
4
+ data: dataSchema,
5
+ cursor: z.object({
6
+ next: z.string().nullable(),
7
+ has_more: z.boolean(),
8
+ }).optional(),
9
+ });
10
+ export const ApiErrorSchema = z.object({
11
+ ok: z.literal(false),
12
+ error: z.object({
13
+ code: z.string(),
14
+ message: z.string(),
15
+ }),
16
+ });
17
+ export const ApiResponseSchema = (dataSchema) => z.discriminatedUnion('ok', [ApiSuccessSchema(dataSchema), ApiErrorSchema]);
18
+ export const InboxResponseSchema = z.object({
19
+ unread_channels: z.array(z.object({ channel_name: z.string(), unread_count: z.number() })),
20
+ mentions: z.array(z.object({ id: z.string(), channel_name: z.string(), agent_name: z.string(), text: z.string(), created_at: z.string() })),
21
+ unread_dms: z.array(z.object({ conversation_id: z.string(), from: z.string(), unread_count: z.number(), last_message: z.string().nullable() })),
22
+ });
2
23
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAsB,UAAa,EAAE,EAAE,CACrE,CAAC,CAAC,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACnB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;KACtB,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAsB,UAAa,EAAE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