feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
import { z } from "zod";
|
|
|
|
|
import {
|
|
|
|
|
INVITE_JOIN_TYPES,
|
|
|
|
|
JOIN_REQUEST_STATUSES,
|
|
|
|
|
JOIN_REQUEST_TYPES,
|
|
|
|
|
PERMISSION_KEYS,
|
|
|
|
|
} from "../constants.js";
|
2026-03-31 20:21:13 +01:00
|
|
|
import { optionalAgentAdapterTypeSchema } from "../adapter-type.js";
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
|
|
|
|
|
export const createCompanyInviteSchema = z.object({
|
|
|
|
|
allowedJoinTypes: z.enum(INVITE_JOIN_TYPES).default("both"),
|
|
|
|
|
defaultsPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
2026-03-05 12:10:01 -06:00
|
|
|
agentMessage: z.string().max(4000).optional().nullable(),
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateCompanyInvite = z.infer<typeof createCompanyInviteSchema>;
|
|
|
|
|
|
2026-03-07 18:19:06 -06:00
|
|
|
export const createOpenClawInvitePromptSchema = z.object({
|
|
|
|
|
agentMessage: z.string().max(4000).optional().nullable(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateOpenClawInvitePrompt = z.infer<
|
|
|
|
|
typeof createOpenClawInvitePromptSchema
|
|
|
|
|
>;
|
|
|
|
|
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
export const acceptInviteSchema = z.object({
|
|
|
|
|
requestType: z.enum(JOIN_REQUEST_TYPES),
|
|
|
|
|
agentName: z.string().min(1).max(120).optional(),
|
2026-03-31 20:21:13 +01:00
|
|
|
adapterType: optionalAgentAdapterTypeSchema,
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
capabilities: z.string().max(4000).optional().nullable(),
|
|
|
|
|
agentDefaultsPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
2026-03-06 09:36:20 -06:00
|
|
|
// OpenClaw join compatibility fields accepted at top level.
|
|
|
|
|
responsesWebhookUrl: z.string().max(4000).optional().nullable(),
|
|
|
|
|
responsesWebhookMethod: z.string().max(32).optional().nullable(),
|
|
|
|
|
responsesWebhookHeaders: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
|
|
|
paperclipApiUrl: z.string().max(4000).optional().nullable(),
|
|
|
|
|
webhookAuthHeader: z.string().max(4000).optional().nullable(),
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type AcceptInvite = z.infer<typeof acceptInviteSchema>;
|
|
|
|
|
|
|
|
|
|
export const listJoinRequestsQuerySchema = z.object({
|
|
|
|
|
status: z.enum(JOIN_REQUEST_STATUSES).optional(),
|
|
|
|
|
requestType: z.enum(JOIN_REQUEST_TYPES).optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type ListJoinRequestsQuery = z.infer<typeof listJoinRequestsQuerySchema>;
|
|
|
|
|
|
2026-02-26 16:33:20 -06:00
|
|
|
export const claimJoinRequestApiKeySchema = z.object({
|
|
|
|
|
claimSecret: z.string().min(16).max(256),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type ClaimJoinRequestApiKey = z.infer<typeof claimJoinRequestApiKeySchema>;
|
|
|
|
|
|
2026-03-23 07:48:03 -05:00
|
|
|
export const boardCliAuthAccessLevelSchema = z.enum([
|
|
|
|
|
"board",
|
|
|
|
|
"instance_admin_required",
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
export type BoardCliAuthAccessLevel = z.infer<typeof boardCliAuthAccessLevelSchema>;
|
|
|
|
|
|
|
|
|
|
export const createCliAuthChallengeSchema = z.object({
|
|
|
|
|
command: z.string().min(1).max(240),
|
|
|
|
|
clientName: z.string().max(120).optional().nullable(),
|
|
|
|
|
requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
|
|
|
|
|
requestedCompanyId: z.string().uuid().optional().nullable(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateCliAuthChallenge = z.infer<typeof createCliAuthChallengeSchema>;
|
|
|
|
|
|
|
|
|
|
export const resolveCliAuthChallengeSchema = z.object({
|
|
|
|
|
token: z.string().min(16).max(256),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type ResolveCliAuthChallenge = z.infer<typeof resolveCliAuthChallengeSchema>;
|
|
|
|
|
|
feat: add auth/access foundation - deps, DB schema, shared types, and config
Add Better Auth, drizzle-orm, @dnd-kit, and remark-gfm dependencies.
Introduce DB schema for auth tables (user, session, account, verification),
company memberships, instance user roles, permission grants, invites, and
join requests. Add assigneeUserId to issues. Extend shared config schema
with deployment mode/exposure/auth settings, add access types and validators,
and wire up new API path constants.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:40:16 -06:00
|
|
|
export const updateMemberPermissionsSchema = z.object({
|
|
|
|
|
grants: z.array(
|
|
|
|
|
z.object({
|
|
|
|
|
permissionKey: z.enum(PERMISSION_KEYS),
|
|
|
|
|
scope: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type UpdateMemberPermissions = z.infer<typeof updateMemberPermissionsSchema>;
|
|
|
|
|
|
|
|
|
|
export const updateUserCompanyAccessSchema = z.object({
|
|
|
|
|
companyIds: z.array(z.string().uuid()).default([]),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type UpdateUserCompanyAccess = z.infer<typeof updateUserCompanyAccessSchema>;
|