@automate.ax/api-contract 0.1.3
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/api-key.d.ts +58 -0
- package/dist/api-key.js +73 -0
- package/dist/auth.d.ts +24 -0
- package/dist/auth.js +35 -0
- package/dist/authorization.d.ts +144 -0
- package/dist/authorization.js +121 -0
- package/dist/deployment.d.ts +38 -0
- package/dist/deployment.js +46 -0
- package/dist/index.d.ts +451 -0
- package/dist/index.js +22 -0
- package/dist/org.d.ts +288 -0
- package/dist/org.js +180 -0
- package/dist/project.d.ts +68 -0
- package/dist/project.js +91 -0
- package/dist/runtime.d.ts +66 -0
- package/dist/runtime.js +89 -0
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +2 -0
- package/package.json +60 -0
package/dist/org.d.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const organizationRoleSchema: z.ZodEnum<{
|
|
3
|
+
member: "member";
|
|
4
|
+
admin: "admin";
|
|
5
|
+
owner: "owner";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const publicOrganizationOutputSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const activeSubscriptionOutputSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
plan: z.ZodString;
|
|
14
|
+
status: z.ZodString;
|
|
15
|
+
periodEnd: z.ZodNullable<z.ZodDate>;
|
|
16
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const organizationSummaryOutputSchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
22
|
+
metadata: z.ZodNullable<z.ZodString>;
|
|
23
|
+
createdAt: z.ZodDate;
|
|
24
|
+
role: z.ZodEnum<{
|
|
25
|
+
member: "member";
|
|
26
|
+
admin: "admin";
|
|
27
|
+
owner: "owner";
|
|
28
|
+
}>;
|
|
29
|
+
memberCount: z.ZodNumber;
|
|
30
|
+
pendingInvitationCount: z.ZodNumber;
|
|
31
|
+
projectCount: z.ZodNumber;
|
|
32
|
+
activeSubscription: z.ZodNullable<z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
plan: z.ZodString;
|
|
35
|
+
status: z.ZodString;
|
|
36
|
+
periodEnd: z.ZodNullable<z.ZodDate>;
|
|
37
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
plan: z.ZodEnum<{
|
|
40
|
+
free: "free";
|
|
41
|
+
pro: "pro";
|
|
42
|
+
enterprise: "enterprise";
|
|
43
|
+
}>;
|
|
44
|
+
limits: z.ZodObject<{
|
|
45
|
+
projects: z.ZodNumber;
|
|
46
|
+
seats: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export declare const organizationMemberOutputSchema: z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
userId: z.ZodString;
|
|
52
|
+
role: z.ZodEnum<{
|
|
53
|
+
member: "member";
|
|
54
|
+
admin: "admin";
|
|
55
|
+
owner: "owner";
|
|
56
|
+
}>;
|
|
57
|
+
createdAt: z.ZodDate;
|
|
58
|
+
email: z.ZodEmail;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
image: z.ZodNullable<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export declare const organizationInvitationOutputSchema: z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
email: z.ZodEmail;
|
|
65
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
66
|
+
member: "member";
|
|
67
|
+
admin: "admin";
|
|
68
|
+
owner: "owner";
|
|
69
|
+
}>>;
|
|
70
|
+
status: z.ZodString;
|
|
71
|
+
createdAt: z.ZodDate;
|
|
72
|
+
expiresAt: z.ZodDate;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const organizationProjectOutputSchema: z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
createdAt: z.ZodDate;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export declare const organizationDetailsOutputSchema: z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
83
|
+
metadata: z.ZodNullable<z.ZodString>;
|
|
84
|
+
createdAt: z.ZodDate;
|
|
85
|
+
role: z.ZodEnum<{
|
|
86
|
+
member: "member";
|
|
87
|
+
admin: "admin";
|
|
88
|
+
owner: "owner";
|
|
89
|
+
}>;
|
|
90
|
+
memberCount: z.ZodNumber;
|
|
91
|
+
pendingInvitationCount: z.ZodNumber;
|
|
92
|
+
projectCount: z.ZodNumber;
|
|
93
|
+
activeSubscription: z.ZodNullable<z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
plan: z.ZodString;
|
|
96
|
+
status: z.ZodString;
|
|
97
|
+
periodEnd: z.ZodNullable<z.ZodDate>;
|
|
98
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
plan: z.ZodEnum<{
|
|
101
|
+
free: "free";
|
|
102
|
+
pro: "pro";
|
|
103
|
+
enterprise: "enterprise";
|
|
104
|
+
}>;
|
|
105
|
+
limits: z.ZodObject<{
|
|
106
|
+
projects: z.ZodNumber;
|
|
107
|
+
seats: z.ZodNumber;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
members: z.ZodArray<z.ZodObject<{
|
|
110
|
+
id: z.ZodString;
|
|
111
|
+
userId: z.ZodString;
|
|
112
|
+
role: z.ZodEnum<{
|
|
113
|
+
member: "member";
|
|
114
|
+
admin: "admin";
|
|
115
|
+
owner: "owner";
|
|
116
|
+
}>;
|
|
117
|
+
createdAt: z.ZodDate;
|
|
118
|
+
email: z.ZodEmail;
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
image: z.ZodNullable<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
invitations: z.ZodArray<z.ZodObject<{
|
|
123
|
+
id: z.ZodString;
|
|
124
|
+
email: z.ZodEmail;
|
|
125
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
126
|
+
member: "member";
|
|
127
|
+
admin: "admin";
|
|
128
|
+
owner: "owner";
|
|
129
|
+
}>>;
|
|
130
|
+
status: z.ZodString;
|
|
131
|
+
createdAt: z.ZodDate;
|
|
132
|
+
expiresAt: z.ZodDate;
|
|
133
|
+
}, z.core.$strip>>;
|
|
134
|
+
projects: z.ZodArray<z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
name: z.ZodString;
|
|
137
|
+
createdAt: z.ZodDate;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export declare const createdInvitationOutputSchema: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
email: z.ZodEmail;
|
|
143
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
144
|
+
member: "member";
|
|
145
|
+
admin: "admin";
|
|
146
|
+
owner: "owner";
|
|
147
|
+
}>>;
|
|
148
|
+
status: z.ZodString;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
export declare const orgContract: {
|
|
151
|
+
canInvite: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
152
|
+
organizationId: z.ZodString;
|
|
153
|
+
}, z.core.$strip>, z.ZodBoolean, Record<never, never>, Record<never, never>>;
|
|
154
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
160
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
161
|
+
organizationId: z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
163
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
164
|
+
organizationId: z.ZodString;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
169
|
+
metadata: z.ZodNullable<z.ZodString>;
|
|
170
|
+
createdAt: z.ZodDate;
|
|
171
|
+
role: z.ZodEnum<{
|
|
172
|
+
member: "member";
|
|
173
|
+
admin: "admin";
|
|
174
|
+
owner: "owner";
|
|
175
|
+
}>;
|
|
176
|
+
memberCount: z.ZodNumber;
|
|
177
|
+
pendingInvitationCount: z.ZodNumber;
|
|
178
|
+
projectCount: z.ZodNumber;
|
|
179
|
+
activeSubscription: z.ZodNullable<z.ZodObject<{
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
plan: z.ZodString;
|
|
182
|
+
status: z.ZodString;
|
|
183
|
+
periodEnd: z.ZodNullable<z.ZodDate>;
|
|
184
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
plan: z.ZodEnum<{
|
|
187
|
+
free: "free";
|
|
188
|
+
pro: "pro";
|
|
189
|
+
enterprise: "enterprise";
|
|
190
|
+
}>;
|
|
191
|
+
limits: z.ZodObject<{
|
|
192
|
+
projects: z.ZodNumber;
|
|
193
|
+
seats: z.ZodNumber;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
members: z.ZodArray<z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
userId: z.ZodString;
|
|
198
|
+
role: z.ZodEnum<{
|
|
199
|
+
member: "member";
|
|
200
|
+
admin: "admin";
|
|
201
|
+
owner: "owner";
|
|
202
|
+
}>;
|
|
203
|
+
createdAt: z.ZodDate;
|
|
204
|
+
email: z.ZodEmail;
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
image: z.ZodNullable<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
invitations: z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
email: z.ZodEmail;
|
|
211
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
212
|
+
member: "member";
|
|
213
|
+
admin: "admin";
|
|
214
|
+
owner: "owner";
|
|
215
|
+
}>>;
|
|
216
|
+
status: z.ZodString;
|
|
217
|
+
createdAt: z.ZodDate;
|
|
218
|
+
expiresAt: z.ZodDate;
|
|
219
|
+
}, z.core.$strip>>;
|
|
220
|
+
projects: z.ZodArray<z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
name: z.ZodString;
|
|
223
|
+
createdAt: z.ZodDate;
|
|
224
|
+
}, z.core.$strip>>;
|
|
225
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
226
|
+
invite: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
227
|
+
organizationId: z.ZodString;
|
|
228
|
+
email: z.ZodEmail;
|
|
229
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
230
|
+
member: "member";
|
|
231
|
+
admin: "admin";
|
|
232
|
+
owner: "owner";
|
|
233
|
+
}>>;
|
|
234
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
235
|
+
id: z.ZodString;
|
|
236
|
+
email: z.ZodEmail;
|
|
237
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
238
|
+
member: "member";
|
|
239
|
+
admin: "admin";
|
|
240
|
+
owner: "owner";
|
|
241
|
+
}>>;
|
|
242
|
+
status: z.ZodString;
|
|
243
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
244
|
+
leave: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
245
|
+
organizationId: z.ZodString;
|
|
246
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
247
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodDefault<z.ZodObject<{
|
|
248
|
+
query: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
250
|
+
id: z.ZodString;
|
|
251
|
+
name: z.ZodString;
|
|
252
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
253
|
+
metadata: z.ZodNullable<z.ZodString>;
|
|
254
|
+
createdAt: z.ZodDate;
|
|
255
|
+
role: z.ZodEnum<{
|
|
256
|
+
member: "member";
|
|
257
|
+
admin: "admin";
|
|
258
|
+
owner: "owner";
|
|
259
|
+
}>;
|
|
260
|
+
memberCount: z.ZodNumber;
|
|
261
|
+
pendingInvitationCount: z.ZodNumber;
|
|
262
|
+
projectCount: z.ZodNumber;
|
|
263
|
+
activeSubscription: z.ZodNullable<z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
plan: z.ZodString;
|
|
266
|
+
status: z.ZodString;
|
|
267
|
+
periodEnd: z.ZodNullable<z.ZodDate>;
|
|
268
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
plan: z.ZodEnum<{
|
|
271
|
+
free: "free";
|
|
272
|
+
pro: "pro";
|
|
273
|
+
enterprise: "enterprise";
|
|
274
|
+
}>;
|
|
275
|
+
limits: z.ZodObject<{
|
|
276
|
+
projects: z.ZodNumber;
|
|
277
|
+
seats: z.ZodNumber;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
280
|
+
remove: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
281
|
+
organizationId: z.ZodString;
|
|
282
|
+
memberIdOrEmail: z.ZodString;
|
|
283
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
284
|
+
update: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
285
|
+
organizationId: z.ZodString;
|
|
286
|
+
name: z.ZodString;
|
|
287
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
288
|
+
};
|
package/dist/org.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { reasonableNameSchema } from "./schemas.js";
|
|
4
|
+
export const organizationRoleSchema = z.enum(["member", "admin", "owner"]);
|
|
5
|
+
export const publicOrganizationOutputSchema = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
});
|
|
9
|
+
export const activeSubscriptionOutputSchema = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
plan: z.string(),
|
|
12
|
+
status: z.string(),
|
|
13
|
+
periodEnd: z.date().nullable(),
|
|
14
|
+
cancelAtPeriodEnd: z.boolean(),
|
|
15
|
+
});
|
|
16
|
+
export const organizationSummaryOutputSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
name: z.string(),
|
|
19
|
+
logo: z.string().nullable(),
|
|
20
|
+
metadata: z.string().nullable(),
|
|
21
|
+
createdAt: z.date(),
|
|
22
|
+
role: organizationRoleSchema,
|
|
23
|
+
memberCount: z.number(),
|
|
24
|
+
pendingInvitationCount: z.number(),
|
|
25
|
+
projectCount: z.number(),
|
|
26
|
+
activeSubscription: activeSubscriptionOutputSchema.nullable(),
|
|
27
|
+
plan: z.enum(["free", "pro", "enterprise"]),
|
|
28
|
+
limits: z.object({
|
|
29
|
+
projects: z.number(),
|
|
30
|
+
seats: z.number(),
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
export const organizationMemberOutputSchema = z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
userId: z.string(),
|
|
36
|
+
role: organizationRoleSchema,
|
|
37
|
+
createdAt: z.date(),
|
|
38
|
+
email: z.email(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
image: z.string().nullable(),
|
|
41
|
+
});
|
|
42
|
+
export const organizationInvitationOutputSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
email: z.email(),
|
|
45
|
+
role: organizationRoleSchema.nullable(),
|
|
46
|
+
status: z.string(),
|
|
47
|
+
createdAt: z.date(),
|
|
48
|
+
expiresAt: z.date(),
|
|
49
|
+
});
|
|
50
|
+
export const organizationProjectOutputSchema = z.object({
|
|
51
|
+
id: z.string(),
|
|
52
|
+
name: z.string(),
|
|
53
|
+
createdAt: z.date(),
|
|
54
|
+
});
|
|
55
|
+
export const organizationDetailsOutputSchema = organizationSummaryOutputSchema.extend({
|
|
56
|
+
members: organizationMemberOutputSchema.array(),
|
|
57
|
+
invitations: organizationInvitationOutputSchema.array(),
|
|
58
|
+
projects: organizationProjectOutputSchema.array(),
|
|
59
|
+
});
|
|
60
|
+
export const createdInvitationOutputSchema = z.object({
|
|
61
|
+
id: z.string(),
|
|
62
|
+
email: z.email(),
|
|
63
|
+
role: organizationRoleSchema.nullable(),
|
|
64
|
+
status: z.string(),
|
|
65
|
+
});
|
|
66
|
+
export const orgContract = {
|
|
67
|
+
canInvite: oc
|
|
68
|
+
.input(z.object({ organizationId: z.string() }))
|
|
69
|
+
.output(z.boolean()),
|
|
70
|
+
create: oc
|
|
71
|
+
.route({
|
|
72
|
+
method: "POST",
|
|
73
|
+
path: "/organizations",
|
|
74
|
+
operationId: "createOrganization",
|
|
75
|
+
summary: "Create organization",
|
|
76
|
+
description: "Creates an organization owned by the authenticated user.",
|
|
77
|
+
successStatus: 201,
|
|
78
|
+
successDescription: "Organization created.",
|
|
79
|
+
tags: ["Organizations"],
|
|
80
|
+
})
|
|
81
|
+
.input(z.object({ name: reasonableNameSchema }))
|
|
82
|
+
.output(publicOrganizationOutputSchema),
|
|
83
|
+
delete: oc
|
|
84
|
+
.route({
|
|
85
|
+
method: "DELETE",
|
|
86
|
+
path: "/organizations/{organizationId}",
|
|
87
|
+
operationId: "deleteOrganization",
|
|
88
|
+
summary: "Delete organization",
|
|
89
|
+
description: "Deletes an organization. Caller must be the organization owner.",
|
|
90
|
+
tags: ["Organizations"],
|
|
91
|
+
successStatus: 204,
|
|
92
|
+
})
|
|
93
|
+
.input(z.object({ organizationId: z.string() }))
|
|
94
|
+
.output(z.void()),
|
|
95
|
+
get: oc
|
|
96
|
+
.route({
|
|
97
|
+
method: "GET",
|
|
98
|
+
path: "/organizations/{organizationId}",
|
|
99
|
+
operationId: "getOrganization",
|
|
100
|
+
summary: "Get organization",
|
|
101
|
+
description: "Returns organization details, members, invitations, projects, plan, and usage.",
|
|
102
|
+
tags: ["Organizations"],
|
|
103
|
+
})
|
|
104
|
+
.input(z.object({ organizationId: z.string().min(1) }))
|
|
105
|
+
.output(organizationDetailsOutputSchema),
|
|
106
|
+
invite: oc
|
|
107
|
+
.route({
|
|
108
|
+
method: "POST",
|
|
109
|
+
path: "/organizations/{organizationId}/invitations",
|
|
110
|
+
operationId: "createOrganizationInvitation",
|
|
111
|
+
summary: "Invite organization member",
|
|
112
|
+
description: "Creates a pending invitation for an email address. Caller must be an organization admin or owner.",
|
|
113
|
+
successStatus: 201,
|
|
114
|
+
successDescription: "Invitation created.",
|
|
115
|
+
tags: ["Organizations"],
|
|
116
|
+
})
|
|
117
|
+
.input(z.object({
|
|
118
|
+
organizationId: z.string(),
|
|
119
|
+
email: z.email(),
|
|
120
|
+
role: organizationRoleSchema.default("member"),
|
|
121
|
+
}))
|
|
122
|
+
.output(createdInvitationOutputSchema),
|
|
123
|
+
leave: oc
|
|
124
|
+
.route({
|
|
125
|
+
method: "DELETE",
|
|
126
|
+
path: "/organizations/{organizationId}/membership",
|
|
127
|
+
operationId: "leaveOrganization",
|
|
128
|
+
summary: "Leave organization",
|
|
129
|
+
description: "Removes the current user from an organization. Owners must transfer ownership or delete the organization instead.",
|
|
130
|
+
tags: ["Organizations"],
|
|
131
|
+
successStatus: 204,
|
|
132
|
+
})
|
|
133
|
+
.input(z.object({ organizationId: z.string() }))
|
|
134
|
+
.output(z.void()),
|
|
135
|
+
list: oc
|
|
136
|
+
.route({
|
|
137
|
+
method: "GET",
|
|
138
|
+
path: "/organizations",
|
|
139
|
+
operationId: "listOrganizations",
|
|
140
|
+
summary: "List organizations",
|
|
141
|
+
description: "Lists organizations the authenticated user belongs to, optionally filtered by name or ID.",
|
|
142
|
+
tags: ["Organizations"],
|
|
143
|
+
})
|
|
144
|
+
.input(z
|
|
145
|
+
.object({
|
|
146
|
+
query: z.string().min(1).optional(),
|
|
147
|
+
})
|
|
148
|
+
.default({}))
|
|
149
|
+
.output(organizationSummaryOutputSchema.array()),
|
|
150
|
+
remove: oc
|
|
151
|
+
.route({
|
|
152
|
+
method: "DELETE",
|
|
153
|
+
path: "/organizations/{organizationId}/members/{memberIdOrEmail}",
|
|
154
|
+
operationId: "removeOrganizationMember",
|
|
155
|
+
summary: "Remove organization member",
|
|
156
|
+
description: "Removes a member from an organization by member ID or email.",
|
|
157
|
+
tags: ["Organizations"],
|
|
158
|
+
successStatus: 204,
|
|
159
|
+
})
|
|
160
|
+
.input(z.object({
|
|
161
|
+
organizationId: z.string(),
|
|
162
|
+
memberIdOrEmail: z.string().min(1),
|
|
163
|
+
}))
|
|
164
|
+
.output(z.void()),
|
|
165
|
+
update: oc
|
|
166
|
+
.route({
|
|
167
|
+
method: "PATCH",
|
|
168
|
+
path: "/organizations/{organizationId}",
|
|
169
|
+
operationId: "updateOrganization",
|
|
170
|
+
summary: "Update organization",
|
|
171
|
+
description: "Updates organization fields the caller can manage.",
|
|
172
|
+
successStatus: 204,
|
|
173
|
+
tags: ["Organizations"],
|
|
174
|
+
})
|
|
175
|
+
.input(z.object({
|
|
176
|
+
organizationId: z.string(),
|
|
177
|
+
name: reasonableNameSchema,
|
|
178
|
+
}))
|
|
179
|
+
.output(z.void()),
|
|
180
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const projectOutputSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
organizationId: z.ZodString;
|
|
6
|
+
createdAt: z.ZodDate;
|
|
7
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const projectWithOrganizationOutputSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
organizationId: z.ZodString;
|
|
13
|
+
createdAt: z.ZodDate;
|
|
14
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
15
|
+
org: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const projectContract: {
|
|
21
|
+
canCreate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
22
|
+
organizationId: z.ZodString;
|
|
23
|
+
}, z.core.$strip>, z.ZodBoolean, Record<never, never>, Record<never, never>>;
|
|
24
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
25
|
+
organizationId: z.ZodString;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
organizationId: z.ZodString;
|
|
31
|
+
createdAt: z.ZodDate;
|
|
32
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
34
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{
|
|
35
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
query: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
organizationId: z.ZodString;
|
|
41
|
+
createdAt: z.ZodDate;
|
|
42
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
43
|
+
org: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>>, Record<never, never>, Record<never, never>>;
|
|
48
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
49
|
+
projectId: z.ZodString;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
organizationId: z.ZodString;
|
|
54
|
+
createdAt: z.ZodDate;
|
|
55
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
56
|
+
org: z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
61
|
+
update: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
62
|
+
projectId: z.ZodString;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
65
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
66
|
+
projectId: z.ZodString;
|
|
67
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
68
|
+
};
|
package/dist/project.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { reasonableNameSchema } from "./schemas.js";
|
|
4
|
+
export const projectOutputSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
organizationId: z.string(),
|
|
8
|
+
createdAt: z.date(),
|
|
9
|
+
createdBy: z.string().nullable(),
|
|
10
|
+
});
|
|
11
|
+
export const projectWithOrganizationOutputSchema = projectOutputSchema.extend({
|
|
12
|
+
org: z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
export const projectContract = {
|
|
18
|
+
canCreate: oc
|
|
19
|
+
.input(z.object({ organizationId: z.string() }))
|
|
20
|
+
.output(z.boolean()),
|
|
21
|
+
create: oc
|
|
22
|
+
.route({
|
|
23
|
+
method: "POST",
|
|
24
|
+
path: "/organizations/{organizationId}/projects",
|
|
25
|
+
operationId: "createProject",
|
|
26
|
+
summary: "Create project",
|
|
27
|
+
description: "Creates a project inside an organization the user belongs to.",
|
|
28
|
+
successStatus: 201,
|
|
29
|
+
successDescription: "Project created.",
|
|
30
|
+
tags: ["Projects"],
|
|
31
|
+
})
|
|
32
|
+
.input(z.object({
|
|
33
|
+
organizationId: z.string(),
|
|
34
|
+
name: reasonableNameSchema,
|
|
35
|
+
}))
|
|
36
|
+
.output(projectOutputSchema),
|
|
37
|
+
list: oc
|
|
38
|
+
.route({
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: "/projects",
|
|
41
|
+
operationId: "listProjects",
|
|
42
|
+
summary: "List projects",
|
|
43
|
+
description: "Lists projects visible to the authenticated user, optionally filtered by organization or query.",
|
|
44
|
+
tags: ["Projects"],
|
|
45
|
+
})
|
|
46
|
+
.input(z
|
|
47
|
+
.object({
|
|
48
|
+
organizationId: z.string().optional(),
|
|
49
|
+
query: z.string().min(1).optional(),
|
|
50
|
+
})
|
|
51
|
+
.optional())
|
|
52
|
+
.output(projectWithOrganizationOutputSchema.array()),
|
|
53
|
+
get: oc
|
|
54
|
+
.route({
|
|
55
|
+
method: "GET",
|
|
56
|
+
path: "/projects/{projectId}",
|
|
57
|
+
operationId: "getProject",
|
|
58
|
+
summary: "Get project",
|
|
59
|
+
description: "Returns project details and its organization.",
|
|
60
|
+
tags: ["Projects"],
|
|
61
|
+
})
|
|
62
|
+
.input(z.object({ projectId: z.string() }))
|
|
63
|
+
.output(projectWithOrganizationOutputSchema),
|
|
64
|
+
update: oc
|
|
65
|
+
.route({
|
|
66
|
+
method: "PATCH",
|
|
67
|
+
path: "/projects/{projectId}",
|
|
68
|
+
operationId: "updateProject",
|
|
69
|
+
summary: "Update project",
|
|
70
|
+
description: "Updates project fields. Caller must be an organization admin or owner.",
|
|
71
|
+
successStatus: 204,
|
|
72
|
+
tags: ["Projects"],
|
|
73
|
+
})
|
|
74
|
+
.input(z.object({
|
|
75
|
+
projectId: z.string(),
|
|
76
|
+
name: reasonableNameSchema,
|
|
77
|
+
}))
|
|
78
|
+
.output(z.void()),
|
|
79
|
+
delete: oc
|
|
80
|
+
.route({
|
|
81
|
+
method: "DELETE",
|
|
82
|
+
path: "/projects/{projectId}",
|
|
83
|
+
operationId: "deleteProject",
|
|
84
|
+
summary: "Delete project",
|
|
85
|
+
description: "Deletes a project. Caller must be an organization admin or owner.",
|
|
86
|
+
tags: ["Projects"],
|
|
87
|
+
successStatus: 204,
|
|
88
|
+
})
|
|
89
|
+
.input(z.object({ projectId: z.string() }))
|
|
90
|
+
.output(z.void()),
|
|
91
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runtimeContract: {
|
|
3
|
+
commit: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
4
|
+
actionInvocations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
5
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
6
|
+
description: z.ZodNullable<z.ZodString>;
|
|
7
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
slot: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>>>;
|
|
11
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
12
|
+
completeInvocation: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
13
|
+
output: z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>;
|
|
14
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
15
|
+
loadInvocation: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
16
|
+
context: z.ZodObject<{
|
|
17
|
+
actionOutputs: z.ZodArray<z.ZodObject<{
|
|
18
|
+
actionInvocationId: z.ZodString;
|
|
19
|
+
output: z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>;
|
|
20
|
+
slot: z.ZodNumber;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
contextId: z.ZodString;
|
|
23
|
+
events: z.ZodArray<z.ZodObject<{
|
|
24
|
+
automationEventId: z.ZodString;
|
|
25
|
+
payload: z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>;
|
|
26
|
+
slot: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
slot: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
32
|
+
nextBatch: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
33
|
+
context: z.ZodObject<{
|
|
34
|
+
actionOutputs: z.ZodArray<z.ZodObject<{
|
|
35
|
+
actionInvocationId: z.ZodString;
|
|
36
|
+
slot: z.ZodNumber;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
contextId: z.ZodString;
|
|
39
|
+
events: z.ZodArray<z.ZodObject<{
|
|
40
|
+
automationEventId: z.ZodString;
|
|
41
|
+
slot: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
45
|
+
resolveAccountInput: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
46
|
+
binding: z.ZodString;
|
|
47
|
+
serviceId: z.ZodString;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
secret: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
50
|
+
serviceId: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
52
|
+
sendOutput: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
53
|
+
output: z.ZodObject<{
|
|
54
|
+
data: z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>;
|
|
55
|
+
type: z.ZodString;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
outputIndex: z.ZodNumber;
|
|
58
|
+
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
59
|
+
sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
60
|
+
subject: z.ZodString;
|
|
61
|
+
text: z.ZodString;
|
|
62
|
+
to: z.ZodEmail;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
id: z.ZodNullable<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
66
|
+
};
|