@anuragpal02/zcl-contracts 0.14.0 → 0.16.0
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/dist/admin.d.ts +173 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +81 -0
- package/dist/client.d.ts +28 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +68 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/projects.d.ts +3 -3
- package/dist/workspaces.d.ts +141 -0
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +40 -1
- package/package.json +1 -1
package/dist/admin.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const creditLedgerTypeSchema: z.ZodEnum<{
|
|
3
|
+
grant: "grant";
|
|
4
|
+
reserve: "reserve";
|
|
5
|
+
capture: "capture";
|
|
6
|
+
release: "release";
|
|
7
|
+
refund: "refund";
|
|
8
|
+
adjustment: "adjustment";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const adminMeResponseSchema: z.ZodObject<{
|
|
11
|
+
data: z.ZodObject<{
|
|
12
|
+
userId: z.ZodString;
|
|
13
|
+
email: z.ZodString;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
isPlatformAdmin: z.ZodLiteral<true>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const adminUserSummarySchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
email: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
disabledAt: z.ZodNullable<z.ZodString>;
|
|
23
|
+
createdAt: z.ZodString;
|
|
24
|
+
workspaceCount: z.ZodNumber;
|
|
25
|
+
isPlatformAdmin: z.ZodBoolean;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const listAdminUsersResponseSchema: z.ZodObject<{
|
|
28
|
+
data: z.ZodObject<{
|
|
29
|
+
users: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
email: z.ZodString;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
disabledAt: z.ZodNullable<z.ZodString>;
|
|
34
|
+
createdAt: z.ZodString;
|
|
35
|
+
workspaceCount: z.ZodNumber;
|
|
36
|
+
isPlatformAdmin: z.ZodBoolean;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const adminWorkspaceCreditSchema: z.ZodObject<{
|
|
41
|
+
workspaceId: z.ZodString;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
role: z.ZodEnum<{
|
|
44
|
+
owner: "owner";
|
|
45
|
+
admin: "admin";
|
|
46
|
+
artist: "artist";
|
|
47
|
+
viewer: "viewer";
|
|
48
|
+
}>;
|
|
49
|
+
balance: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const adminUserDetailResponseSchema: z.ZodObject<{
|
|
52
|
+
data: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
email: z.ZodString;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
disabledAt: z.ZodNullable<z.ZodString>;
|
|
57
|
+
createdAt: z.ZodString;
|
|
58
|
+
isPlatformAdmin: z.ZodBoolean;
|
|
59
|
+
workspaces: z.ZodArray<z.ZodObject<{
|
|
60
|
+
workspaceId: z.ZodString;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
role: z.ZodEnum<{
|
|
63
|
+
owner: "owner";
|
|
64
|
+
admin: "admin";
|
|
65
|
+
artist: "artist";
|
|
66
|
+
viewer: "viewer";
|
|
67
|
+
}>;
|
|
68
|
+
balance: z.ZodNumber;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const adminLedgerEntrySchema: z.ZodObject<{
|
|
73
|
+
type: z.ZodEnum<{
|
|
74
|
+
grant: "grant";
|
|
75
|
+
reserve: "reserve";
|
|
76
|
+
capture: "capture";
|
|
77
|
+
release: "release";
|
|
78
|
+
refund: "refund";
|
|
79
|
+
adjustment: "adjustment";
|
|
80
|
+
}>;
|
|
81
|
+
amount: z.ZodNumber;
|
|
82
|
+
balanceAfter: z.ZodNumber;
|
|
83
|
+
createdAt: z.ZodString;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export declare const adminWorkspaceDetailResponseSchema: z.ZodObject<{
|
|
86
|
+
data: z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
name: z.ZodString;
|
|
89
|
+
type: z.ZodEnum<{
|
|
90
|
+
personal: "personal";
|
|
91
|
+
organization: "organization";
|
|
92
|
+
}>;
|
|
93
|
+
balance: z.ZodNumber;
|
|
94
|
+
members: z.ZodArray<z.ZodObject<{
|
|
95
|
+
userId: z.ZodString;
|
|
96
|
+
email: z.ZodString;
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
role: z.ZodEnum<{
|
|
99
|
+
owner: "owner";
|
|
100
|
+
admin: "admin";
|
|
101
|
+
artist: "artist";
|
|
102
|
+
viewer: "viewer";
|
|
103
|
+
}>;
|
|
104
|
+
status: z.ZodEnum<{
|
|
105
|
+
active: "active";
|
|
106
|
+
invited: "invited";
|
|
107
|
+
disabled: "disabled";
|
|
108
|
+
}>;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
recentLedger: z.ZodArray<z.ZodObject<{
|
|
111
|
+
type: z.ZodEnum<{
|
|
112
|
+
grant: "grant";
|
|
113
|
+
reserve: "reserve";
|
|
114
|
+
capture: "capture";
|
|
115
|
+
release: "release";
|
|
116
|
+
refund: "refund";
|
|
117
|
+
adjustment: "adjustment";
|
|
118
|
+
}>;
|
|
119
|
+
amount: z.ZodNumber;
|
|
120
|
+
balanceAfter: z.ZodNumber;
|
|
121
|
+
createdAt: z.ZodString;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
export declare const adminAdjustCreditsRequestSchema: z.ZodObject<{
|
|
126
|
+
amount: z.ZodNumber;
|
|
127
|
+
reason: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
export declare const adminAdjustCreditsResponseSchema: z.ZodObject<{
|
|
130
|
+
data: z.ZodObject<{
|
|
131
|
+
balance: z.ZodNumber;
|
|
132
|
+
ledgerEntry: z.ZodObject<{
|
|
133
|
+
type: z.ZodEnum<{
|
|
134
|
+
grant: "grant";
|
|
135
|
+
reserve: "reserve";
|
|
136
|
+
capture: "capture";
|
|
137
|
+
release: "release";
|
|
138
|
+
refund: "refund";
|
|
139
|
+
adjustment: "adjustment";
|
|
140
|
+
}>;
|
|
141
|
+
amount: z.ZodNumber;
|
|
142
|
+
balanceAfter: z.ZodNumber;
|
|
143
|
+
createdAt: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export declare const setPlatformAdminRequestSchema: z.ZodObject<{
|
|
148
|
+
isPlatformAdmin: z.ZodBoolean;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
export declare const setPlatformAdminResponseSchema: z.ZodObject<{
|
|
151
|
+
data: z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
email: z.ZodString;
|
|
154
|
+
name: z.ZodString;
|
|
155
|
+
disabledAt: z.ZodNullable<z.ZodString>;
|
|
156
|
+
createdAt: z.ZodString;
|
|
157
|
+
workspaceCount: z.ZodNumber;
|
|
158
|
+
isPlatformAdmin: z.ZodBoolean;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type CreditLedgerType = z.infer<typeof creditLedgerTypeSchema>;
|
|
162
|
+
export type AdminMeResponse = z.infer<typeof adminMeResponseSchema>;
|
|
163
|
+
export type AdminUserSummary = z.infer<typeof adminUserSummarySchema>;
|
|
164
|
+
export type ListAdminUsersResponse = z.infer<typeof listAdminUsersResponseSchema>;
|
|
165
|
+
export type AdminWorkspaceCredit = z.infer<typeof adminWorkspaceCreditSchema>;
|
|
166
|
+
export type AdminUserDetailResponse = z.infer<typeof adminUserDetailResponseSchema>;
|
|
167
|
+
export type AdminLedgerEntry = z.infer<typeof adminLedgerEntrySchema>;
|
|
168
|
+
export type AdminWorkspaceDetailResponse = z.infer<typeof adminWorkspaceDetailResponseSchema>;
|
|
169
|
+
export type AdminAdjustCreditsRequest = z.input<typeof adminAdjustCreditsRequestSchema>;
|
|
170
|
+
export type AdminAdjustCreditsResponse = z.infer<typeof adminAdjustCreditsResponseSchema>;
|
|
171
|
+
export type SetPlatformAdminRequest = z.input<typeof setPlatformAdminRequestSchema>;
|
|
172
|
+
export type SetPlatformAdminResponse = z.infer<typeof setPlatformAdminResponseSchema>;
|
|
173
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,sBAAsB;;;;;;;EAOjC,CAAA;AAGF,eAAO,MAAM,qBAAqB;;;;;;;iBAOjC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;iBAQjC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;iBAIxC,CAAA;AAGD,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAKrC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;iBAUzC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;iBAKjC,CAAA;AAEF,eAAO,MAAM,kC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,OAAO,8BAA8B,CAAC,CAAA"}
|
package/dist/admin.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiSuccessSchema, idSchema, isoDateSchema } from './common.js';
|
|
3
|
+
import { workspaceMembershipStatusSchema, workspaceRoleSchema, workspaceTypeSchema } from './workspaces.js';
|
|
4
|
+
// The credit-ledger entry kinds: lifecycle of a workspace's credits.
|
|
5
|
+
// `adjustment` is the type recorded by an admin manual grant/deduct.
|
|
6
|
+
export const creditLedgerTypeSchema = z.enum([
|
|
7
|
+
'grant',
|
|
8
|
+
'reserve',
|
|
9
|
+
'capture',
|
|
10
|
+
'release',
|
|
11
|
+
'refund',
|
|
12
|
+
'adjustment'
|
|
13
|
+
]);
|
|
14
|
+
// `/admin/me` — confirms the caller is a platform admin (literal `true`, never `false`).
|
|
15
|
+
export const adminMeResponseSchema = apiSuccessSchema(z.object({
|
|
16
|
+
userId: idSchema,
|
|
17
|
+
email: z.string().email(),
|
|
18
|
+
name: z.string(),
|
|
19
|
+
isPlatformAdmin: z.literal(true)
|
|
20
|
+
}));
|
|
21
|
+
export const adminUserSummarySchema = z.object({
|
|
22
|
+
id: idSchema,
|
|
23
|
+
email: z.string().email(),
|
|
24
|
+
name: z.string(),
|
|
25
|
+
disabledAt: isoDateSchema.nullable(),
|
|
26
|
+
createdAt: isoDateSchema,
|
|
27
|
+
workspaceCount: z.number().int(),
|
|
28
|
+
isPlatformAdmin: z.boolean()
|
|
29
|
+
});
|
|
30
|
+
export const listAdminUsersResponseSchema = apiSuccessSchema(z.object({
|
|
31
|
+
users: z.array(adminUserSummarySchema)
|
|
32
|
+
}));
|
|
33
|
+
// A workspace the user belongs to, enriched with their role + the workspace's balance.
|
|
34
|
+
export const adminWorkspaceCreditSchema = z.object({
|
|
35
|
+
workspaceId: idSchema,
|
|
36
|
+
name: z.string(),
|
|
37
|
+
role: workspaceRoleSchema,
|
|
38
|
+
balance: z.number().int()
|
|
39
|
+
});
|
|
40
|
+
export const adminUserDetailResponseSchema = apiSuccessSchema(z.object({
|
|
41
|
+
id: idSchema,
|
|
42
|
+
email: z.string().email(),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
disabledAt: isoDateSchema.nullable(),
|
|
45
|
+
createdAt: isoDateSchema,
|
|
46
|
+
isPlatformAdmin: z.boolean(),
|
|
47
|
+
workspaces: z.array(adminWorkspaceCreditSchema)
|
|
48
|
+
}));
|
|
49
|
+
export const adminLedgerEntrySchema = z.object({
|
|
50
|
+
type: creditLedgerTypeSchema,
|
|
51
|
+
amount: z.number().int(),
|
|
52
|
+
balanceAfter: z.number().int(),
|
|
53
|
+
createdAt: isoDateSchema
|
|
54
|
+
});
|
|
55
|
+
export const adminWorkspaceDetailResponseSchema = apiSuccessSchema(z.object({
|
|
56
|
+
id: idSchema,
|
|
57
|
+
name: z.string(),
|
|
58
|
+
type: workspaceTypeSchema,
|
|
59
|
+
balance: z.number().int(),
|
|
60
|
+
members: z.array(z.object({
|
|
61
|
+
userId: idSchema,
|
|
62
|
+
email: z.string().email(),
|
|
63
|
+
name: z.string(),
|
|
64
|
+
role: workspaceRoleSchema,
|
|
65
|
+
status: workspaceMembershipStatusSchema
|
|
66
|
+
})),
|
|
67
|
+
recentLedger: z.array(adminLedgerEntrySchema)
|
|
68
|
+
}));
|
|
69
|
+
// Manual credit adjustment: positive = grant, negative = deduct; never zero.
|
|
70
|
+
export const adminAdjustCreditsRequestSchema = z.object({
|
|
71
|
+
amount: z.number().int().refine((n) => n !== 0, 'amount must be non-zero'),
|
|
72
|
+
reason: z.string().min(1).max(500)
|
|
73
|
+
});
|
|
74
|
+
export const adminAdjustCreditsResponseSchema = apiSuccessSchema(z.object({
|
|
75
|
+
balance: z.number().int(),
|
|
76
|
+
ledgerEntry: adminLedgerEntrySchema
|
|
77
|
+
}));
|
|
78
|
+
export const setPlatformAdminRequestSchema = z.object({
|
|
79
|
+
isPlatformAdmin: z.boolean()
|
|
80
|
+
});
|
|
81
|
+
export const setPlatformAdminResponseSchema = apiSuccessSchema(adminUserSummarySchema);
|
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { type AuthSessionResponse, type ConfirmPasswordResetRequest, type LoginRequest, type LogoutResponse, type PasswordResetResponse, type RequestPasswordResetRequest, type SessionResponse, type SignupRequest } from './auth.js';
|
|
2
3
|
import { type ApiErrorCode } from './common.js';
|
|
3
4
|
import { type CreditBalanceResponse } from './credits.js';
|
|
4
|
-
import { type CreateWorkspaceRequest, type Workspace, type WorkspaceMembership } from './workspaces.js';
|
|
5
|
+
import { workspaceMemberSchema, type CreateWorkspaceRequest, type InviteMemberRequest, type InviteMemberResponse, type ListMembersResponse, type UpdateMemberRoleRequest, type UpdateWorkspaceRequest, type Workspace, type WorkspaceMembership } from './workspaces.js';
|
|
5
6
|
import { type Asset, type AssetUpload, type CreateAssetUploadRequest, type CreateAssetUploadResponse, type FinalizeAssetUploadRequest, type ListAssetsResponse } from './assets.js';
|
|
6
7
|
import { type CreateProjectRequest, type LedMapResponse, type Project, type UpdateLedMapRequest, type UpdateProjectRequest } from './projects.js';
|
|
7
8
|
import { type CreateGenerationJobRequest, type CreatePanelSetRequest, type CreatePanelSetResponse, type CreateVideoLoopRequest, type CreateVideoUpscaleRequest, type EditGenerationJobRequest, type GenerationJobResponse, type GenerationJobStatus, type ListGenerationJobsResponse } from './generation.js';
|
|
8
9
|
import { type DescribeImageRequest, type DescribeImageResponse } from './assistant.js';
|
|
10
|
+
import { type AdminAdjustCreditsRequest, type AdminAdjustCreditsResponse, type AdminMeResponse, type AdminUserDetailResponse, type AdminWorkspaceDetailResponse, type ListAdminUsersResponse, type SetPlatformAdminRequest, type SetPlatformAdminResponse } from './admin.js';
|
|
9
11
|
type FetchLike = (request: Request) => Promise<Response>;
|
|
10
12
|
export type ZclApiClientOptions = {
|
|
11
13
|
baseUrl: string;
|
|
@@ -42,6 +44,20 @@ export declare function createZclApiClient(options: ZclApiClientOptions): {
|
|
|
42
44
|
create(input: CreateWorkspaceRequest): Promise<{
|
|
43
45
|
data: Workspace;
|
|
44
46
|
}>;
|
|
47
|
+
update(workspaceId: string, input: UpdateWorkspaceRequest): Promise<{
|
|
48
|
+
data: Workspace;
|
|
49
|
+
}>;
|
|
50
|
+
listMembers(workspaceId: string): Promise<ListMembersResponse>;
|
|
51
|
+
inviteMember(workspaceId: string, input: InviteMemberRequest): Promise<InviteMemberResponse>;
|
|
52
|
+
updateMemberRole(workspaceId: string, userId: string, input: UpdateMemberRoleRequest): Promise<{
|
|
53
|
+
data: z.infer<typeof workspaceMemberSchema>;
|
|
54
|
+
}>;
|
|
55
|
+
removeMember(workspaceId: string, userId: string): Promise<{
|
|
56
|
+
data: Record<string, never>;
|
|
57
|
+
}>;
|
|
58
|
+
revokeInvite(workspaceId: string, inviteId: string): Promise<{
|
|
59
|
+
data: Record<string, never>;
|
|
60
|
+
}>;
|
|
45
61
|
};
|
|
46
62
|
projects: {
|
|
47
63
|
list(workspaceId: string, options?: {
|
|
@@ -91,6 +107,17 @@ export declare function createZclApiClient(options: ZclApiClientOptions): {
|
|
|
91
107
|
assistant: {
|
|
92
108
|
describeImage(workspaceId: string, projectId: string, input: DescribeImageRequest): Promise<DescribeImageResponse>;
|
|
93
109
|
};
|
|
110
|
+
admin: {
|
|
111
|
+
me(): Promise<AdminMeResponse>;
|
|
112
|
+
listUsers(options?: {
|
|
113
|
+
q?: string;
|
|
114
|
+
limit?: number;
|
|
115
|
+
}): Promise<ListAdminUsersResponse>;
|
|
116
|
+
getUser(userId: string): Promise<AdminUserDetailResponse>;
|
|
117
|
+
getWorkspace(workspaceId: string): Promise<AdminWorkspaceDetailResponse>;
|
|
118
|
+
adjustCredits(workspaceId: string, input: AdminAdjustCreditsRequest): Promise<AdminAdjustCreditsResponse>;
|
|
119
|
+
setPlatformAdmin(userId: string, input: SetPlatformAdminRequest): Promise<SetPlatformAdminResponse>;
|
|
120
|
+
};
|
|
94
121
|
};
|
|
95
122
|
export type ZclApiClient = ReturnType<typeof createZclApiClient>;
|
|
96
123
|
export {};
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EASL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAA;AAClB,OAAO,EAA2C,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACxF,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACtF,OAAO,EAOL,qBAAqB,EAIrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAML,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EASL,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAA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AqB,CAAC;;;cAY3B,OAAO,CAAC,eAAe,CAAC;4BAGX;YAAE,CAAC,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,GAAQ,OAAO,CAAC,sBAAsB,CAAC;wBAWxE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;kCAG/B,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;mCAIzD,MAAM,SACZ,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC;iCAO5B,MAAM,SACP,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;;EAQzC;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
package/dist/client.js
CHANGED
|
@@ -2,11 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import { authSessionResponseSchema, confirmPasswordResetSchema, loginRequestSchema, logoutResponseSchema, passwordResetResponseSchema, requestPasswordResetSchema, sessionResponseSchema, signupRequestSchema } from './auth.js';
|
|
3
3
|
import { errorResponseSchema, listResponseSchema } from './common.js';
|
|
4
4
|
import { creditBalanceResponseSchema } from './credits.js';
|
|
5
|
-
import { createWorkspaceRequestSchema, workspaceMembershipSchema, workspaceSchema } from './workspaces.js';
|
|
5
|
+
import { createWorkspaceRequestSchema, inviteMemberRequestSchema, inviteMemberResponseSchema, listMembersResponseSchema, updateMemberRoleRequestSchema, updateWorkspaceRequestSchema, workspaceMemberSchema, workspaceMembershipSchema, workspaceResponseSchema, workspaceSchema } from './workspaces.js';
|
|
6
6
|
import { assetSchema, createAssetUploadRequestSchema, createAssetUploadResponseSchema, finalizeAssetUploadRequestSchema, listAssetsResponseSchema } from './assets.js';
|
|
7
7
|
import { createProjectRequestSchema, ledMapResponseSchema, projectSchema, updateLedMapRequestSchema, updateProjectRequestSchema } from './projects.js';
|
|
8
8
|
import { createGenerationJobRequestSchema, createPanelSetRequestSchema, createPanelSetResponseSchema, createVideoLoopRequestSchema, createVideoUpscaleRequestSchema, editGenerationJobRequestSchema, generationJobResponseSchema, listGenerationJobsResponseSchema } from './generation.js';
|
|
9
9
|
import { describeImageRequestSchema, describeImageResponseSchema } from './assistant.js';
|
|
10
|
+
import { adminAdjustCreditsRequestSchema, adminAdjustCreditsResponseSchema, adminMeResponseSchema, adminUserDetailResponseSchema, adminWorkspaceDetailResponseSchema, listAdminUsersResponseSchema, setPlatformAdminRequestSchema, setPlatformAdminResponseSchema } from './admin.js';
|
|
10
11
|
const workspaceListResponseSchema = listResponseSchema(workspaceSchema.extend({
|
|
11
12
|
membership: workspaceMembershipSchema
|
|
12
13
|
}));
|
|
@@ -117,10 +118,41 @@ export function createZclApiClient(options) {
|
|
|
117
118
|
return request('/workspaces', workspaceListResponseSchema);
|
|
118
119
|
},
|
|
119
120
|
create(input) {
|
|
120
|
-
return request('/workspaces',
|
|
121
|
+
return request('/workspaces', workspaceResponseSchema, {
|
|
121
122
|
method: 'POST',
|
|
122
123
|
body: createWorkspaceRequestSchema.parse(input)
|
|
123
124
|
});
|
|
125
|
+
},
|
|
126
|
+
update(workspaceId, input) {
|
|
127
|
+
return request(`/workspaces/${workspaceId}`, workspaceResponseSchema, {
|
|
128
|
+
method: 'PATCH',
|
|
129
|
+
body: updateWorkspaceRequestSchema.parse(input)
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
listMembers(workspaceId) {
|
|
133
|
+
return request(`/workspaces/${workspaceId}/members`, listMembersResponseSchema);
|
|
134
|
+
},
|
|
135
|
+
inviteMember(workspaceId, input) {
|
|
136
|
+
return request(`/workspaces/${workspaceId}/members`, inviteMemberResponseSchema, {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
body: inviteMemberRequestSchema.parse(input)
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
updateMemberRole(workspaceId, userId, input) {
|
|
142
|
+
return request(`/workspaces/${workspaceId}/members/${userId}`, z.object({ data: workspaceMemberSchema }), {
|
|
143
|
+
method: 'PATCH',
|
|
144
|
+
body: updateMemberRoleRequestSchema.parse(input)
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
removeMember(workspaceId, userId) {
|
|
148
|
+
return request(`/workspaces/${workspaceId}/members/${userId}`, z.object({ data: z.object({}) }), {
|
|
149
|
+
method: 'DELETE'
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
revokeInvite(workspaceId, inviteId) {
|
|
153
|
+
return request(`/workspaces/${workspaceId}/invites/${inviteId}`, z.object({ data: z.object({}) }), {
|
|
154
|
+
method: 'DELETE'
|
|
155
|
+
});
|
|
124
156
|
}
|
|
125
157
|
},
|
|
126
158
|
projects: {
|
|
@@ -241,6 +273,40 @@ export function createZclApiClient(options) {
|
|
|
241
273
|
body: describeImageRequestSchema.parse(input)
|
|
242
274
|
});
|
|
243
275
|
}
|
|
276
|
+
},
|
|
277
|
+
admin: {
|
|
278
|
+
me() {
|
|
279
|
+
return request('/admin/me', adminMeResponseSchema);
|
|
280
|
+
},
|
|
281
|
+
listUsers(options = {}) {
|
|
282
|
+
const params = new URLSearchParams();
|
|
283
|
+
if (options.q !== undefined) {
|
|
284
|
+
params.set('q', options.q);
|
|
285
|
+
}
|
|
286
|
+
if (options.limit !== undefined) {
|
|
287
|
+
params.set('limit', String(options.limit));
|
|
288
|
+
}
|
|
289
|
+
const query = params.toString() ? `?${params.toString()}` : '';
|
|
290
|
+
return request(`/admin/users${query}`, listAdminUsersResponseSchema);
|
|
291
|
+
},
|
|
292
|
+
getUser(userId) {
|
|
293
|
+
return request(`/admin/users/${userId}`, adminUserDetailResponseSchema);
|
|
294
|
+
},
|
|
295
|
+
getWorkspace(workspaceId) {
|
|
296
|
+
return request(`/admin/workspaces/${workspaceId}`, adminWorkspaceDetailResponseSchema);
|
|
297
|
+
},
|
|
298
|
+
adjustCredits(workspaceId, input) {
|
|
299
|
+
return request(`/admin/workspaces/${workspaceId}/credits`, adminAdjustCreditsResponseSchema, {
|
|
300
|
+
method: 'POST',
|
|
301
|
+
body: adminAdjustCreditsRequestSchema.parse(input)
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
setPlatformAdmin(userId, input) {
|
|
305
|
+
return request(`/admin/users/${userId}/platform-admin`, setPlatformAdminResponseSchema, {
|
|
306
|
+
method: 'POST',
|
|
307
|
+
body: setPlatformAdminRequestSchema.parse(input)
|
|
308
|
+
});
|
|
309
|
+
}
|
|
244
310
|
}
|
|
245
311
|
};
|
|
246
312
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/projects.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export declare const projectVisibilitySchema: z.ZodEnum<{
|
|
|
4
4
|
workspace: "workspace";
|
|
5
5
|
}>;
|
|
6
6
|
export declare const projectStatusSchema: z.ZodEnum<{
|
|
7
|
-
deleted: "deleted";
|
|
8
7
|
active: "active";
|
|
8
|
+
deleted: "deleted";
|
|
9
9
|
archived: "archived";
|
|
10
10
|
}>;
|
|
11
11
|
export declare const ledPanelIdSchema: z.ZodString;
|
|
@@ -113,8 +113,8 @@ export declare const projectSchema: z.ZodObject<{
|
|
|
113
113
|
workspace: "workspace";
|
|
114
114
|
}>;
|
|
115
115
|
status: z.ZodEnum<{
|
|
116
|
-
deleted: "deleted";
|
|
117
116
|
active: "active";
|
|
117
|
+
deleted: "deleted";
|
|
118
118
|
archived: "archived";
|
|
119
119
|
}>;
|
|
120
120
|
createdAt: z.ZodString;
|
|
@@ -134,8 +134,8 @@ export declare const updateProjectRequestSchema: z.ZodObject<{
|
|
|
134
134
|
workspace: "workspace";
|
|
135
135
|
}>>;
|
|
136
136
|
status: z.ZodOptional<z.ZodEnum<{
|
|
137
|
-
deleted: "deleted";
|
|
138
137
|
active: "active";
|
|
138
|
+
deleted: "deleted";
|
|
139
139
|
archived: "archived";
|
|
140
140
|
}>>;
|
|
141
141
|
}, z.core.$strip>;
|
package/dist/workspaces.d.ts
CHANGED
|
@@ -44,10 +44,151 @@ export declare const workspaceMembershipSchema: z.ZodObject<{
|
|
|
44
44
|
disabled: "disabled";
|
|
45
45
|
}>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
|
+
export declare const updateWorkspaceRequestSchema: z.ZodObject<{
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const workspaceResponseSchema: z.ZodObject<{
|
|
51
|
+
data: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
type: z.ZodEnum<{
|
|
54
|
+
personal: "personal";
|
|
55
|
+
organization: "organization";
|
|
56
|
+
}>;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
slug: z.ZodString;
|
|
59
|
+
createdAt: z.ZodString;
|
|
60
|
+
updatedAt: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export declare const workspaceMemberSchema: z.ZodObject<{
|
|
64
|
+
userId: z.ZodString;
|
|
65
|
+
email: z.ZodString;
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
68
|
+
role: z.ZodEnum<{
|
|
69
|
+
owner: "owner";
|
|
70
|
+
admin: "admin";
|
|
71
|
+
artist: "artist";
|
|
72
|
+
viewer: "viewer";
|
|
73
|
+
}>;
|
|
74
|
+
status: z.ZodEnum<{
|
|
75
|
+
active: "active";
|
|
76
|
+
invited: "invited";
|
|
77
|
+
disabled: "disabled";
|
|
78
|
+
}>;
|
|
79
|
+
createdAt: z.ZodString;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const workspaceInviteSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
email: z.ZodString;
|
|
84
|
+
role: z.ZodEnum<{
|
|
85
|
+
owner: "owner";
|
|
86
|
+
admin: "admin";
|
|
87
|
+
artist: "artist";
|
|
88
|
+
viewer: "viewer";
|
|
89
|
+
}>;
|
|
90
|
+
invitedByUserId: z.ZodString;
|
|
91
|
+
createdAt: z.ZodString;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export declare const listMembersResponseSchema: z.ZodObject<{
|
|
94
|
+
data: z.ZodObject<{
|
|
95
|
+
members: z.ZodArray<z.ZodObject<{
|
|
96
|
+
userId: z.ZodString;
|
|
97
|
+
email: z.ZodString;
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
100
|
+
role: z.ZodEnum<{
|
|
101
|
+
owner: "owner";
|
|
102
|
+
admin: "admin";
|
|
103
|
+
artist: "artist";
|
|
104
|
+
viewer: "viewer";
|
|
105
|
+
}>;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
active: "active";
|
|
108
|
+
invited: "invited";
|
|
109
|
+
disabled: "disabled";
|
|
110
|
+
}>;
|
|
111
|
+
createdAt: z.ZodString;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
invites: z.ZodArray<z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
email: z.ZodString;
|
|
116
|
+
role: z.ZodEnum<{
|
|
117
|
+
owner: "owner";
|
|
118
|
+
admin: "admin";
|
|
119
|
+
artist: "artist";
|
|
120
|
+
viewer: "viewer";
|
|
121
|
+
}>;
|
|
122
|
+
invitedByUserId: z.ZodString;
|
|
123
|
+
createdAt: z.ZodString;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export declare const inviteMemberRequestSchema: z.ZodObject<{
|
|
128
|
+
email: z.ZodString;
|
|
129
|
+
role: z.ZodEnum<{
|
|
130
|
+
owner: "owner";
|
|
131
|
+
admin: "admin";
|
|
132
|
+
artist: "artist";
|
|
133
|
+
viewer: "viewer";
|
|
134
|
+
}>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export declare const inviteMemberResponseSchema: z.ZodObject<{
|
|
137
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
+
kind: z.ZodLiteral<"member">;
|
|
139
|
+
member: z.ZodObject<{
|
|
140
|
+
userId: z.ZodString;
|
|
141
|
+
email: z.ZodString;
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
144
|
+
role: z.ZodEnum<{
|
|
145
|
+
owner: "owner";
|
|
146
|
+
admin: "admin";
|
|
147
|
+
artist: "artist";
|
|
148
|
+
viewer: "viewer";
|
|
149
|
+
}>;
|
|
150
|
+
status: z.ZodEnum<{
|
|
151
|
+
active: "active";
|
|
152
|
+
invited: "invited";
|
|
153
|
+
disabled: "disabled";
|
|
154
|
+
}>;
|
|
155
|
+
createdAt: z.ZodString;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"invite">;
|
|
159
|
+
invite: z.ZodObject<{
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
email: z.ZodString;
|
|
162
|
+
role: z.ZodEnum<{
|
|
163
|
+
owner: "owner";
|
|
164
|
+
admin: "admin";
|
|
165
|
+
artist: "artist";
|
|
166
|
+
viewer: "viewer";
|
|
167
|
+
}>;
|
|
168
|
+
invitedByUserId: z.ZodString;
|
|
169
|
+
createdAt: z.ZodString;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
}, z.core.$strip>], "kind">;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
export declare const updateMemberRoleRequestSchema: z.ZodObject<{
|
|
174
|
+
role: z.ZodEnum<{
|
|
175
|
+
owner: "owner";
|
|
176
|
+
admin: "admin";
|
|
177
|
+
artist: "artist";
|
|
178
|
+
viewer: "viewer";
|
|
179
|
+
}>;
|
|
180
|
+
}, z.core.$strip>;
|
|
47
181
|
export type CreateWorkspaceRequest = z.input<typeof createWorkspaceRequestSchema>;
|
|
182
|
+
export type UpdateWorkspaceRequest = z.input<typeof updateWorkspaceRequestSchema>;
|
|
48
183
|
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
49
184
|
export type WorkspaceMembership = z.infer<typeof workspaceMembershipSchema>;
|
|
50
185
|
export type WorkspaceMembershipStatus = z.infer<typeof workspaceMembershipStatusSchema>;
|
|
186
|
+
export type WorkspaceMember = z.infer<typeof workspaceMemberSchema>;
|
|
187
|
+
export type WorkspaceInvite = z.infer<typeof workspaceInviteSchema>;
|
|
188
|
+
export type ListMembersResponse = z.infer<typeof listMembersResponseSchema>;
|
|
189
|
+
export type InviteMemberRequest = z.input<typeof inviteMemberRequestSchema>;
|
|
190
|
+
export type InviteMemberResponse = z.infer<typeof inviteMemberResponseSchema>;
|
|
191
|
+
export type UpdateMemberRoleRequest = z.input<typeof updateMemberRoleRequestSchema>;
|
|
51
192
|
export type WorkspaceRole = z.infer<typeof workspaceRoleSchema>;
|
|
52
193
|
export type WorkspaceType = z.infer<typeof workspaceTypeSchema>;
|
|
53
194
|
//# sourceMappingURL=workspaces.d.ts.map
|
package/dist/workspaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../src/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,mBAAmB;;;EAAuC,CAAA;AACvE,eAAO,MAAM,mBAAmB;;;;;EAAiD,CAAA;AACjF,eAAO,MAAM,+BAA+B;;;;EAA4C,CAAA;AAExF,eAAO,MAAM,eAAe;;;;;;;;;;iBAO1B,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;iBAKpC,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACjF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../src/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,mBAAmB;;;EAAuC,CAAA;AACvE,eAAO,MAAM,mBAAmB;;;;;EAAi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C,CAAA;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC7E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACnF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
package/dist/workspaces.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { idSchema, isoDateSchema } from './common.js';
|
|
2
|
+
import { apiSuccessSchema, idSchema, isoDateSchema } from './common.js';
|
|
3
3
|
export const workspaceTypeSchema = z.enum(['personal', 'organization']);
|
|
4
4
|
export const workspaceRoleSchema = z.enum(['owner', 'admin', 'artist', 'viewer']);
|
|
5
5
|
export const workspaceMembershipStatusSchema = z.enum(['active', 'invited', 'disabled']);
|
|
@@ -21,3 +21,42 @@ export const workspaceMembershipSchema = z.object({
|
|
|
21
21
|
role: workspaceRoleSchema,
|
|
22
22
|
status: workspaceMembershipStatusSchema
|
|
23
23
|
});
|
|
24
|
+
export const updateWorkspaceRequestSchema = z.object({
|
|
25
|
+
name: z.string().trim().min(1).max(120)
|
|
26
|
+
});
|
|
27
|
+
// Single-workspace response wrapper, reused by `create` and `update`.
|
|
28
|
+
export const workspaceResponseSchema = apiSuccessSchema(workspaceSchema);
|
|
29
|
+
// A member row enriched with the user's identity for display in Settings.
|
|
30
|
+
export const workspaceMemberSchema = z.object({
|
|
31
|
+
userId: idSchema,
|
|
32
|
+
email: z.string().email(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
avatarUrl: z.string().nullable(),
|
|
35
|
+
role: workspaceRoleSchema,
|
|
36
|
+
status: workspaceMembershipStatusSchema,
|
|
37
|
+
createdAt: isoDateSchema
|
|
38
|
+
});
|
|
39
|
+
// A pending invite (no user row yet) — materialized into a membership on first SSO login.
|
|
40
|
+
export const workspaceInviteSchema = z.object({
|
|
41
|
+
id: idSchema,
|
|
42
|
+
email: z.string().email(),
|
|
43
|
+
role: workspaceRoleSchema,
|
|
44
|
+
invitedByUserId: idSchema,
|
|
45
|
+
createdAt: isoDateSchema
|
|
46
|
+
});
|
|
47
|
+
export const listMembersResponseSchema = apiSuccessSchema(z.object({
|
|
48
|
+
members: z.array(workspaceMemberSchema),
|
|
49
|
+
invites: z.array(workspaceInviteSchema)
|
|
50
|
+
}));
|
|
51
|
+
export const inviteMemberRequestSchema = z.object({
|
|
52
|
+
email: z.string().email(),
|
|
53
|
+
role: workspaceRoleSchema
|
|
54
|
+
});
|
|
55
|
+
// Inviting an existing+known user adds them immediately; a new email becomes a pending invite.
|
|
56
|
+
export const inviteMemberResponseSchema = apiSuccessSchema(z.discriminatedUnion('kind', [
|
|
57
|
+
z.object({ kind: z.literal('member'), member: workspaceMemberSchema }),
|
|
58
|
+
z.object({ kind: z.literal('invite'), invite: workspaceInviteSchema })
|
|
59
|
+
]));
|
|
60
|
+
export const updateMemberRoleRequestSchema = z.object({
|
|
61
|
+
role: workspaceRoleSchema
|
|
62
|
+
});
|