Initial commit of eigent-main

This commit is contained in:
puzhen 2025-08-12 01:16:39 +02:00
commit 723df5a03e
1144 changed files with 103478 additions and 0 deletions

View file

@ -0,0 +1,94 @@
import { InternalSession, AccessToken, RefreshToken } from '../sessions.mjs';
import { EmailTemplateCrud, EmailTemplateType } from './crud/email-templates.mjs';
import { InternalEmailsCrud } from './crud/emails.mjs';
import { InternalApiKeysCrud } from './crud/internal-api-keys.mjs';
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.mjs';
import { ProjectsCrud } from './crud/projects.mjs';
import { SvixTokenCrud } from './crud/svix-token.mjs';
import { TeamPermissionDefinitionsCrud } from './crud/team-permissions.mjs';
import { ServerAuthApplicationOptions, StackServerInterface } from './serverInterface.mjs';
import './clientInterface.mjs';
import '../known-errors.mjs';
import 'jose';
import '../crud.mjs';
import 'yup';
import '../utils/types.mjs';
import '../utils/results.mjs';
import './crud/contact-channels.mjs';
import './crud/current-user.mjs';
import './crud/oauth.mjs';
import './crud/sessions.mjs';
import './crud/team-invitation.mjs';
import './crud/team-member-profiles.mjs';
import './crud/team-memberships.mjs';
import './crud/teams.mjs';
import './crud/users.mjs';
import '../utils/errors.mjs';
import '../utils/json.mjs';
import '@simplewebauthn/types';
import './crud/project-api-keys.mjs';
type AdminAuthApplicationOptions = ServerAuthApplicationOptions & ({
superSecretAdminKey: string;
} | {
projectOwnerSession: InternalSession;
});
type InternalApiKeyCreateCrudRequest = {
has_publishable_client_key: boolean;
has_secret_server_key: boolean;
has_super_secret_admin_key: boolean;
expires_at_millis: number;
description: string;
};
type InternalApiKeyCreateCrudResponse = InternalApiKeysCrud["Admin"]["Read"] & {
publishable_client_key?: string;
secret_server_key?: string;
super_secret_admin_key?: string;
};
declare class StackAdminInterface extends StackServerInterface {
readonly options: AdminAuthApplicationOptions;
constructor(options: AdminAuthApplicationOptions);
sendAdminRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
getProject(): Promise<ProjectsCrud["Admin"]["Read"]>;
updateProject(update: ProjectsCrud["Admin"]["Update"]): Promise<ProjectsCrud["Admin"]["Read"]>;
createInternalApiKey(options: InternalApiKeyCreateCrudRequest): Promise<InternalApiKeyCreateCrudResponse>;
listInternalApiKeys(): Promise<InternalApiKeysCrud["Admin"]["Read"][]>;
revokeInternalApiKeyById(id: string): Promise<void>;
getInternalApiKey(id: string, session: InternalSession): Promise<InternalApiKeysCrud["Admin"]["Read"]>;
listEmailTemplates(): Promise<EmailTemplateCrud['Admin']['Read'][]>;
updateEmailTemplate(type: EmailTemplateType, data: EmailTemplateCrud['Admin']['Update']): Promise<EmailTemplateCrud['Admin']['Read']>;
resetEmailTemplate(type: EmailTemplateType): Promise<void>;
listTeamPermissionDefinitions(): Promise<TeamPermissionDefinitionsCrud['Admin']['Read'][]>;
createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
deleteTeamPermissionDefinition(permissionId: string): Promise<void>;
listProjectPermissionDefinitions(): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read'][]>;
createProjectPermissionDefinition(data: ProjectPermissionDefinitionsCrud['Admin']['Create']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
updateProjectPermissionDefinition(permissionId: string, data: ProjectPermissionDefinitionsCrud['Admin']['Update']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
deleteProjectPermissionDefinition(permissionId: string): Promise<void>;
getSvixToken(): Promise<SvixTokenCrud["Admin"]["Read"]>;
deleteProject(): Promise<void>;
getMetrics(): Promise<any>;
sendTestEmail(data: {
recipient_email: string;
email_config: {
host: string;
port: number;
username: string;
password: string;
sender_email: string;
sender_name: string;
};
}): Promise<{
success: boolean;
error_message?: string;
}>;
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
}
export { type AdminAuthApplicationOptions, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };

View file

@ -0,0 +1,94 @@
import { InternalSession, AccessToken, RefreshToken } from '../sessions.js';
import { EmailTemplateCrud, EmailTemplateType } from './crud/email-templates.js';
import { InternalEmailsCrud } from './crud/emails.js';
import { InternalApiKeysCrud } from './crud/internal-api-keys.js';
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.js';
import { ProjectsCrud } from './crud/projects.js';
import { SvixTokenCrud } from './crud/svix-token.js';
import { TeamPermissionDefinitionsCrud } from './crud/team-permissions.js';
import { ServerAuthApplicationOptions, StackServerInterface } from './serverInterface.js';
import './clientInterface.js';
import '../known-errors.js';
import 'jose';
import '../crud.js';
import 'yup';
import '../utils/types.js';
import '../utils/results.js';
import './crud/contact-channels.js';
import './crud/current-user.js';
import './crud/oauth.js';
import './crud/sessions.js';
import './crud/team-invitation.js';
import './crud/team-member-profiles.js';
import './crud/team-memberships.js';
import './crud/teams.js';
import './crud/users.js';
import '../utils/errors.js';
import '../utils/json.js';
import '@simplewebauthn/types';
import './crud/project-api-keys.js';
type AdminAuthApplicationOptions = ServerAuthApplicationOptions & ({
superSecretAdminKey: string;
} | {
projectOwnerSession: InternalSession;
});
type InternalApiKeyCreateCrudRequest = {
has_publishable_client_key: boolean;
has_secret_server_key: boolean;
has_super_secret_admin_key: boolean;
expires_at_millis: number;
description: string;
};
type InternalApiKeyCreateCrudResponse = InternalApiKeysCrud["Admin"]["Read"] & {
publishable_client_key?: string;
secret_server_key?: string;
super_secret_admin_key?: string;
};
declare class StackAdminInterface extends StackServerInterface {
readonly options: AdminAuthApplicationOptions;
constructor(options: AdminAuthApplicationOptions);
sendAdminRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
getProject(): Promise<ProjectsCrud["Admin"]["Read"]>;
updateProject(update: ProjectsCrud["Admin"]["Update"]): Promise<ProjectsCrud["Admin"]["Read"]>;
createInternalApiKey(options: InternalApiKeyCreateCrudRequest): Promise<InternalApiKeyCreateCrudResponse>;
listInternalApiKeys(): Promise<InternalApiKeysCrud["Admin"]["Read"][]>;
revokeInternalApiKeyById(id: string): Promise<void>;
getInternalApiKey(id: string, session: InternalSession): Promise<InternalApiKeysCrud["Admin"]["Read"]>;
listEmailTemplates(): Promise<EmailTemplateCrud['Admin']['Read'][]>;
updateEmailTemplate(type: EmailTemplateType, data: EmailTemplateCrud['Admin']['Update']): Promise<EmailTemplateCrud['Admin']['Read']>;
resetEmailTemplate(type: EmailTemplateType): Promise<void>;
listTeamPermissionDefinitions(): Promise<TeamPermissionDefinitionsCrud['Admin']['Read'][]>;
createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
deleteTeamPermissionDefinition(permissionId: string): Promise<void>;
listProjectPermissionDefinitions(): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read'][]>;
createProjectPermissionDefinition(data: ProjectPermissionDefinitionsCrud['Admin']['Create']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
updateProjectPermissionDefinition(permissionId: string, data: ProjectPermissionDefinitionsCrud['Admin']['Update']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
deleteProjectPermissionDefinition(permissionId: string): Promise<void>;
getSvixToken(): Promise<SvixTokenCrud["Admin"]["Read"]>;
deleteProject(): Promise<void>;
getMetrics(): Promise<any>;
sendTestEmail(data: {
recipient_email: string;
email_config: {
host: string;
port: number;
username: string;
password: string;
sender_email: string;
sender_name: string;
};
}): Promise<{
success: boolean;
error_message?: string;
}>;
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
}
export { type AdminAuthApplicationOptions, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };

View file

@ -0,0 +1,269 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/adminInterface.ts
var adminInterface_exports = {};
__export(adminInterface_exports, {
StackAdminInterface: () => StackAdminInterface
});
module.exports = __toCommonJS(adminInterface_exports);
var import_serverInterface = require("./serverInterface");
var StackAdminInterface = class extends import_serverInterface.StackServerInterface {
constructor(options) {
super(options);
this.options = options;
}
async sendAdminRequest(path, options, session, requestType = "admin") {
return await this.sendServerRequest(
path,
{
...options,
headers: {
"x-stack-super-secret-admin-key": "superSecretAdminKey" in this.options ? this.options.superSecretAdminKey : "",
...options.headers
}
},
session,
requestType
);
}
async getProject() {
const response = await this.sendAdminRequest(
"/internal/projects/current",
{
method: "GET"
},
null
);
return await response.json();
}
async updateProject(update) {
const response = await this.sendAdminRequest(
"/internal/projects/current",
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(update)
},
null
);
return await response.json();
}
async createInternalApiKey(options) {
const response = await this.sendAdminRequest(
"/internal/api-keys",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(options)
},
null
);
return await response.json();
}
async listInternalApiKeys() {
const response = await this.sendAdminRequest("/internal/api-keys", {}, null);
const result = await response.json();
return result.items;
}
async revokeInternalApiKeyById(id) {
await this.sendAdminRequest(
`/internal/api-keys/${id}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({
revoked: true
})
},
null
);
}
async getInternalApiKey(id, session) {
const response = await this.sendAdminRequest(`/internal/api-keys/${id}`, {}, session);
return await response.json();
}
async listEmailTemplates() {
const response = await this.sendAdminRequest(`/email-templates`, {}, null);
const result = await response.json();
return result.items;
}
async updateEmailTemplate(type, data) {
const result = await this.sendAdminRequest(
`/email-templates/${type}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await result.json();
}
async resetEmailTemplate(type) {
await this.sendAdminRequest(
`/email-templates/${type}`,
{ method: "DELETE" },
null
);
}
// Team permission definitions methods
async listTeamPermissionDefinitions() {
const response = await this.sendAdminRequest(`/team-permission-definitions`, {}, null);
const result = await response.json();
return result.items;
}
async createTeamPermissionDefinition(data) {
const response = await this.sendAdminRequest(
"/team-permission-definitions",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async updateTeamPermissionDefinition(permissionId, data) {
const response = await this.sendAdminRequest(
`/team-permission-definitions/${permissionId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async deleteTeamPermissionDefinition(permissionId) {
await this.sendAdminRequest(
`/team-permission-definitions/${permissionId}`,
{ method: "DELETE" },
null
);
}
async listProjectPermissionDefinitions() {
const response = await this.sendAdminRequest(`/project-permission-definitions`, {}, null);
const result = await response.json();
return result.items;
}
async createProjectPermissionDefinition(data) {
const response = await this.sendAdminRequest(
"/project-permission-definitions",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async updateProjectPermissionDefinition(permissionId, data) {
const response = await this.sendAdminRequest(
`/project-permission-definitions/${permissionId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async deleteProjectPermissionDefinition(permissionId) {
await this.sendAdminRequest(
`/project-permission-definitions/${permissionId}`,
{ method: "DELETE" },
null
);
}
async getSvixToken() {
const response = await this.sendAdminRequest(
"/webhooks/svix-token",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
return await response.json();
}
async deleteProject() {
await this.sendAdminRequest(
"/internal/projects/current",
{
method: "DELETE"
},
null
);
}
async getMetrics() {
const response = await this.sendAdminRequest(
"/internal/metrics",
{
method: "GET"
},
null
);
return await response.json();
}
async sendTestEmail(data) {
const response = await this.sendAdminRequest(`/internal/send-test-email`, {
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
}, null);
return await response.json();
}
async listSentEmails() {
const response = await this.sendAdminRequest("/internal/emails", {
method: "GET"
}, null);
return await response.json();
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
StackAdminInterface
});
//# sourceMappingURL=adminInterface.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,260 @@
import * as yup from 'yup';
import { KnownErrors } from '../known-errors.mjs';
import { InternalSession, RefreshToken, AccessToken } from '../sessions.mjs';
import { ReadonlyJson } from '../utils/json.mjs';
import { PublicKeyCredentialCreationOptionsJSON, RegistrationResponseJSON, PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/types';
import { Result } from '../utils/results.mjs';
import { ContactChannelsCrud } from './crud/contact-channels.mjs';
import { CurrentUserCrud } from './crud/current-user.mjs';
import { ConnectedAccountAccessTokenCrud } from './crud/oauth.mjs';
import { UserApiKeysCrud, TeamApiKeysCrud, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema } from './crud/project-api-keys.mjs';
import { ProjectPermissionsCrud } from './crud/project-permissions.mjs';
import { ClientProjectsCrud, AdminUserProjectsCrud } from './crud/projects.mjs';
import { SessionsCrud } from './crud/sessions.mjs';
import { TeamInvitationCrud } from './crud/team-invitation.mjs';
import { TeamMemberProfilesCrud } from './crud/team-member-profiles.mjs';
import { TeamPermissionsCrud } from './crud/team-permissions.mjs';
import { TeamsCrud } from './crud/teams.mjs';
import '../utils/errors.mjs';
import 'jose';
import '../crud.mjs';
import '../utils/types.mjs';
type ClientInterfaceOptions = {
clientVersion: string;
getBaseUrl: () => string;
extraRequestHeaders: Record<string, string>;
projectId: string;
prepareRequest?: () => Promise<void>;
} & ({
publishableClientKey: string;
} | {
projectOwnerSession: InternalSession;
});
declare class StackClientInterface {
readonly options: ClientInterfaceOptions;
constructor(options: ClientInterfaceOptions);
get projectId(): string;
getApiUrl(): string;
runNetworkDiagnostics(session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<{
"navigator?.onLine": any;
cfTrace: string;
apiRoot: string;
baseUrlBackend: string;
prodDashboard: string;
prodBackend: string;
}>;
protected _createNetworkError(cause: Error, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<Error>;
protected _networkRetry<T>(cb: () => Promise<Result<T, any>>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
protected _networkRetryException<T>(cb: () => Promise<T>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
fetchNewAccessToken(refreshToken: RefreshToken): Promise<AccessToken | null>;
sendClientRequest(path: string, requestOptions: RequestInit, session: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
createSession(options: Omit<ConstructorParameters<typeof InternalSession>[0], "refreshAccessTokenCallback">): InternalSession;
protected sendClientRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise<Result<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}, InstanceType<E>>>;
private sendClientRequestInner;
private _processResponse;
checkFeatureSupport(options: {
featureName?: string;
} & ReadonlyJson): Promise<never>;
sendForgotPasswordEmail(email: string, callbackUrl: string): Promise<Result<undefined, KnownErrors["UserNotFound"]>>;
sendVerificationEmail(email: string, callbackUrl: string, session: InternalSession): Promise<KnownErrors["EmailAlreadyVerified"] | undefined>;
sendMagicLinkEmail(email: string, callbackUrl: string): Promise<Result<{
nonce: string;
}, KnownErrors["RedirectUrlNotWhitelisted"]>>;
resetPassword(options: {
code: string;
} & ({
password: string;
} | {
onlyVerifyCode: true;
})): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
updatePassword(options: {
oldPassword: string;
newPassword: string;
}, session: InternalSession): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
setPassword(options: {
password: string;
}, session: InternalSession): Promise<KnownErrors["PasswordRequirementsNotMet"] | undefined>;
verifyPasswordResetCode(code: string): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
verifyEmail(code: string): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
initiatePasskeyRegistration(options: {}, session: InternalSession): Promise<Result<{
options_json: PublicKeyCredentialCreationOptionsJSON;
code: string;
}, KnownErrors[]>>;
registerPasskey(options: {
credential: RegistrationResponseJSON;
code: string;
}, session: InternalSession): Promise<Result<undefined, KnownErrors["PasskeyRegistrationFailed"]>>;
initiatePasskeyAuthentication(options: {}, session: InternalSession): Promise<Result<{
options_json: PublicKeyCredentialRequestOptionsJSON;
code: string;
}, KnownErrors[]>>;
sendTeamInvitation(options: {
email: string;
teamId: string;
callbackUrl: string;
session: InternalSession;
}): Promise<void>;
acceptTeamInvitation<T extends 'use' | 'details' | 'check'>(options: {
code: string;
session: InternalSession;
type: T;
}): Promise<Result<T extends 'details' ? {
team_display_name: string;
} : undefined, KnownErrors["VerificationCodeError"]>>;
totpMfa(attemptCode: string, totp: string, session: InternalSession): Promise<{
accessToken: any;
refreshToken: any;
newUser: any;
}>;
signInWithCredential(email: string, password: string, session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["EmailPasswordMismatch"]>>;
signUpWithCredential(email: string, password: string, emailVerificationRedirectUrl: string, session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["UserWithEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"]>>;
signUpAnonymously(session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, never>>;
signInWithMagicLink(code: string): Promise<Result<{
newUser: boolean;
accessToken: string;
refreshToken: string;
}, KnownErrors["VerificationCodeError"]>>;
signInWithPasskey(body: {
authentication_response: AuthenticationResponseJSON;
code: string;
}): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["PasskeyAuthenticationFailed"]>>;
getOAuthUrl(options: {
provider: string;
redirectUrl: string;
errorRedirectUrl: string;
afterCallbackRedirectUrl?: string;
codeChallenge: string;
state: string;
type: "authenticate" | "link";
providerScope?: string;
} & ({
type: "authenticate";
} | {
type: "link";
session: InternalSession;
})): Promise<string>;
callOAuthCallback(options: {
oauthParams: URLSearchParams;
redirectUri: string;
codeVerifier: string;
state: string;
}): Promise<{
newUser: boolean;
afterCallbackRedirectUrl?: string;
accessToken: string;
refreshToken: string;
}>;
signOut(session: InternalSession): Promise<void>;
getClientUserByToken(session: InternalSession): Promise<CurrentUserCrud["Client"]["Read"] | null>;
listTeamInvitations(options: {
teamId: string;
}, session: InternalSession): Promise<TeamInvitationCrud['Client']['Read'][]>;
revokeTeamInvitation(invitationId: string, teamId: string, session: InternalSession): Promise<void>;
listTeamMemberProfiles(options: {
teamId?: string;
userId?: string;
}, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read'][]>;
getTeamMemberProfile(options: {
teamId: string;
userId: string;
}, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read']>;
leaveTeam(teamId: string, session: InternalSession): Promise<void>;
updateTeamMemberProfile(options: {
teamId: string;
userId: string;
profile: TeamMemberProfilesCrud['Client']['Update'];
}, session: InternalSession): Promise<void>;
updateTeam(options: {
teamId: string;
data: TeamsCrud['Client']['Update'];
}, session: InternalSession): Promise<void>;
listCurrentUserTeamPermissions(options: {
teamId: string;
recursive: boolean;
}, session: InternalSession): Promise<TeamPermissionsCrud['Client']['Read'][]>;
listCurrentUserProjectPermissions(options: {
recursive: boolean;
}, session: InternalSession): Promise<ProjectPermissionsCrud['Client']['Read'][]>;
listCurrentUserTeams(session: InternalSession): Promise<TeamsCrud["Client"]["Read"][]>;
getClientProject(): Promise<Result<ClientProjectsCrud['Client']['Read'], KnownErrors["ProjectNotFound"]>>;
updateClientUser(update: CurrentUserCrud["Client"]["Update"], session: InternalSession): Promise<void>;
listProjects(session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read'][]>;
createProject(project: AdminUserProjectsCrud['Client']['Create'], session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read']>;
createProviderAccessToken(provider: string, scope: string, session: InternalSession): Promise<ConnectedAccountAccessTokenCrud['Client']['Read']>;
createClientTeam(data: TeamsCrud['Client']['Create'], session: InternalSession): Promise<TeamsCrud['Client']['Read']>;
deleteTeam(teamId: string, session: InternalSession): Promise<void>;
deleteCurrentUser(session: InternalSession): Promise<void>;
createClientContactChannel(data: ContactChannelsCrud['Client']['Create'], session: InternalSession): Promise<ContactChannelsCrud['Client']['Read']>;
updateClientContactChannel(id: string, data: ContactChannelsCrud['Client']['Update'], session: InternalSession): Promise<ContactChannelsCrud['Client']['Read']>;
deleteClientContactChannel(id: string, session: InternalSession): Promise<void>;
deleteSession(sessionId: string, session: InternalSession): Promise<void>;
listSessions(session: InternalSession): Promise<SessionsCrud['Client']['List']>;
listClientContactChannels(session: InternalSession): Promise<ContactChannelsCrud['Client']['Read'][]>;
sendCurrentUserContactChannelVerificationEmail(contactChannelId: string, callbackUrl: string, session: InternalSession): Promise<Result<undefined, KnownErrors["EmailAlreadyVerified"]>>;
cliLogin(loginCode: string, refreshToken: string, session: InternalSession): Promise<Result<undefined, KnownErrors["SchemaError"]>>;
private _getApiKeyRequestInfo;
listProjectApiKeys(options: {
user_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'][]>;
listProjectApiKeys(options: {
team_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read'][]>;
listProjectApiKeys(options: {
user_id: string;
} | {
team_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<(UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read'])[]>;
createProjectApiKey(data: yup.InferType<typeof userApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof userApiKeysCreateOutputSchema>>;
createProjectApiKey(data: yup.InferType<typeof teamApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof teamApiKeysCreateOutputSchema>>;
createProjectApiKey(data: yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof userApiKeysCreateOutputSchema> | yup.InferType<typeof teamApiKeysCreateOutputSchema>>;
getProjectApiKey(options: {
user_id: string | null;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read']>;
getProjectApiKey(options: {
team_id: string;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read']>;
getProjectApiKey(options: {
user_id: string | null;
} | {
team_id: string;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
user_id: string;
}, keyId: string, data: UserApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
team_id: string;
}, keyId: string, data: TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
user_id: string;
} | {
team_id: string;
}, keyId: string, data: UserApiKeysCrud['Client']['Update'] | TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read']>;
checkProjectApiKey(type: "user", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | null>;
checkProjectApiKey(type: "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read'] | null>;
checkProjectApiKey(type: "user" | "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read'] | null>;
}
export { type ClientInterfaceOptions, StackClientInterface };

View file

@ -0,0 +1,260 @@
import * as yup from 'yup';
import { KnownErrors } from '../known-errors.js';
import { InternalSession, RefreshToken, AccessToken } from '../sessions.js';
import { ReadonlyJson } from '../utils/json.js';
import { PublicKeyCredentialCreationOptionsJSON, RegistrationResponseJSON, PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/types';
import { Result } from '../utils/results.js';
import { ContactChannelsCrud } from './crud/contact-channels.js';
import { CurrentUserCrud } from './crud/current-user.js';
import { ConnectedAccountAccessTokenCrud } from './crud/oauth.js';
import { UserApiKeysCrud, TeamApiKeysCrud, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema } from './crud/project-api-keys.js';
import { ProjectPermissionsCrud } from './crud/project-permissions.js';
import { ClientProjectsCrud, AdminUserProjectsCrud } from './crud/projects.js';
import { SessionsCrud } from './crud/sessions.js';
import { TeamInvitationCrud } from './crud/team-invitation.js';
import { TeamMemberProfilesCrud } from './crud/team-member-profiles.js';
import { TeamPermissionsCrud } from './crud/team-permissions.js';
import { TeamsCrud } from './crud/teams.js';
import '../utils/errors.js';
import 'jose';
import '../crud.js';
import '../utils/types.js';
type ClientInterfaceOptions = {
clientVersion: string;
getBaseUrl: () => string;
extraRequestHeaders: Record<string, string>;
projectId: string;
prepareRequest?: () => Promise<void>;
} & ({
publishableClientKey: string;
} | {
projectOwnerSession: InternalSession;
});
declare class StackClientInterface {
readonly options: ClientInterfaceOptions;
constructor(options: ClientInterfaceOptions);
get projectId(): string;
getApiUrl(): string;
runNetworkDiagnostics(session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<{
"navigator?.onLine": any;
cfTrace: string;
apiRoot: string;
baseUrlBackend: string;
prodDashboard: string;
prodBackend: string;
}>;
protected _createNetworkError(cause: Error, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<Error>;
protected _networkRetry<T>(cb: () => Promise<Result<T, any>>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
protected _networkRetryException<T>(cb: () => Promise<T>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
fetchNewAccessToken(refreshToken: RefreshToken): Promise<AccessToken | null>;
sendClientRequest(path: string, requestOptions: RequestInit, session: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
createSession(options: Omit<ConstructorParameters<typeof InternalSession>[0], "refreshAccessTokenCallback">): InternalSession;
protected sendClientRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise<Result<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}, InstanceType<E>>>;
private sendClientRequestInner;
private _processResponse;
checkFeatureSupport(options: {
featureName?: string;
} & ReadonlyJson): Promise<never>;
sendForgotPasswordEmail(email: string, callbackUrl: string): Promise<Result<undefined, KnownErrors["UserNotFound"]>>;
sendVerificationEmail(email: string, callbackUrl: string, session: InternalSession): Promise<KnownErrors["EmailAlreadyVerified"] | undefined>;
sendMagicLinkEmail(email: string, callbackUrl: string): Promise<Result<{
nonce: string;
}, KnownErrors["RedirectUrlNotWhitelisted"]>>;
resetPassword(options: {
code: string;
} & ({
password: string;
} | {
onlyVerifyCode: true;
})): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
updatePassword(options: {
oldPassword: string;
newPassword: string;
}, session: InternalSession): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
setPassword(options: {
password: string;
}, session: InternalSession): Promise<KnownErrors["PasswordRequirementsNotMet"] | undefined>;
verifyPasswordResetCode(code: string): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
verifyEmail(code: string): Promise<Result<undefined, KnownErrors["VerificationCodeError"]>>;
initiatePasskeyRegistration(options: {}, session: InternalSession): Promise<Result<{
options_json: PublicKeyCredentialCreationOptionsJSON;
code: string;
}, KnownErrors[]>>;
registerPasskey(options: {
credential: RegistrationResponseJSON;
code: string;
}, session: InternalSession): Promise<Result<undefined, KnownErrors["PasskeyRegistrationFailed"]>>;
initiatePasskeyAuthentication(options: {}, session: InternalSession): Promise<Result<{
options_json: PublicKeyCredentialRequestOptionsJSON;
code: string;
}, KnownErrors[]>>;
sendTeamInvitation(options: {
email: string;
teamId: string;
callbackUrl: string;
session: InternalSession;
}): Promise<void>;
acceptTeamInvitation<T extends 'use' | 'details' | 'check'>(options: {
code: string;
session: InternalSession;
type: T;
}): Promise<Result<T extends 'details' ? {
team_display_name: string;
} : undefined, KnownErrors["VerificationCodeError"]>>;
totpMfa(attemptCode: string, totp: string, session: InternalSession): Promise<{
accessToken: any;
refreshToken: any;
newUser: any;
}>;
signInWithCredential(email: string, password: string, session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["EmailPasswordMismatch"]>>;
signUpWithCredential(email: string, password: string, emailVerificationRedirectUrl: string, session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["UserWithEmailAlreadyExists"] | KnownErrors["PasswordRequirementsNotMet"]>>;
signUpAnonymously(session: InternalSession): Promise<Result<{
accessToken: string;
refreshToken: string;
}, never>>;
signInWithMagicLink(code: string): Promise<Result<{
newUser: boolean;
accessToken: string;
refreshToken: string;
}, KnownErrors["VerificationCodeError"]>>;
signInWithPasskey(body: {
authentication_response: AuthenticationResponseJSON;
code: string;
}): Promise<Result<{
accessToken: string;
refreshToken: string;
}, KnownErrors["PasskeyAuthenticationFailed"]>>;
getOAuthUrl(options: {
provider: string;
redirectUrl: string;
errorRedirectUrl: string;
afterCallbackRedirectUrl?: string;
codeChallenge: string;
state: string;
type: "authenticate" | "link";
providerScope?: string;
} & ({
type: "authenticate";
} | {
type: "link";
session: InternalSession;
})): Promise<string>;
callOAuthCallback(options: {
oauthParams: URLSearchParams;
redirectUri: string;
codeVerifier: string;
state: string;
}): Promise<{
newUser: boolean;
afterCallbackRedirectUrl?: string;
accessToken: string;
refreshToken: string;
}>;
signOut(session: InternalSession): Promise<void>;
getClientUserByToken(session: InternalSession): Promise<CurrentUserCrud["Client"]["Read"] | null>;
listTeamInvitations(options: {
teamId: string;
}, session: InternalSession): Promise<TeamInvitationCrud['Client']['Read'][]>;
revokeTeamInvitation(invitationId: string, teamId: string, session: InternalSession): Promise<void>;
listTeamMemberProfiles(options: {
teamId?: string;
userId?: string;
}, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read'][]>;
getTeamMemberProfile(options: {
teamId: string;
userId: string;
}, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read']>;
leaveTeam(teamId: string, session: InternalSession): Promise<void>;
updateTeamMemberProfile(options: {
teamId: string;
userId: string;
profile: TeamMemberProfilesCrud['Client']['Update'];
}, session: InternalSession): Promise<void>;
updateTeam(options: {
teamId: string;
data: TeamsCrud['Client']['Update'];
}, session: InternalSession): Promise<void>;
listCurrentUserTeamPermissions(options: {
teamId: string;
recursive: boolean;
}, session: InternalSession): Promise<TeamPermissionsCrud['Client']['Read'][]>;
listCurrentUserProjectPermissions(options: {
recursive: boolean;
}, session: InternalSession): Promise<ProjectPermissionsCrud['Client']['Read'][]>;
listCurrentUserTeams(session: InternalSession): Promise<TeamsCrud["Client"]["Read"][]>;
getClientProject(): Promise<Result<ClientProjectsCrud['Client']['Read'], KnownErrors["ProjectNotFound"]>>;
updateClientUser(update: CurrentUserCrud["Client"]["Update"], session: InternalSession): Promise<void>;
listProjects(session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read'][]>;
createProject(project: AdminUserProjectsCrud['Client']['Create'], session: InternalSession): Promise<AdminUserProjectsCrud['Client']['Read']>;
createProviderAccessToken(provider: string, scope: string, session: InternalSession): Promise<ConnectedAccountAccessTokenCrud['Client']['Read']>;
createClientTeam(data: TeamsCrud['Client']['Create'], session: InternalSession): Promise<TeamsCrud['Client']['Read']>;
deleteTeam(teamId: string, session: InternalSession): Promise<void>;
deleteCurrentUser(session: InternalSession): Promise<void>;
createClientContactChannel(data: ContactChannelsCrud['Client']['Create'], session: InternalSession): Promise<ContactChannelsCrud['Client']['Read']>;
updateClientContactChannel(id: string, data: ContactChannelsCrud['Client']['Update'], session: InternalSession): Promise<ContactChannelsCrud['Client']['Read']>;
deleteClientContactChannel(id: string, session: InternalSession): Promise<void>;
deleteSession(sessionId: string, session: InternalSession): Promise<void>;
listSessions(session: InternalSession): Promise<SessionsCrud['Client']['List']>;
listClientContactChannels(session: InternalSession): Promise<ContactChannelsCrud['Client']['Read'][]>;
sendCurrentUserContactChannelVerificationEmail(contactChannelId: string, callbackUrl: string, session: InternalSession): Promise<Result<undefined, KnownErrors["EmailAlreadyVerified"]>>;
cliLogin(loginCode: string, refreshToken: string, session: InternalSession): Promise<Result<undefined, KnownErrors["SchemaError"]>>;
private _getApiKeyRequestInfo;
listProjectApiKeys(options: {
user_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'][]>;
listProjectApiKeys(options: {
team_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read'][]>;
listProjectApiKeys(options: {
user_id: string;
} | {
team_id: string;
}, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<(UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read'])[]>;
createProjectApiKey(data: yup.InferType<typeof userApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof userApiKeysCreateOutputSchema>>;
createProjectApiKey(data: yup.InferType<typeof teamApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof teamApiKeysCreateOutputSchema>>;
createProjectApiKey(data: yup.InferType<typeof userApiKeysCreateInputSchema> | yup.InferType<typeof teamApiKeysCreateInputSchema>, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<yup.InferType<typeof userApiKeysCreateOutputSchema> | yup.InferType<typeof teamApiKeysCreateOutputSchema>>;
getProjectApiKey(options: {
user_id: string | null;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read']>;
getProjectApiKey(options: {
team_id: string;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read']>;
getProjectApiKey(options: {
user_id: string | null;
} | {
team_id: string;
}, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
user_id: string;
}, keyId: string, data: UserApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
team_id: string;
}, keyId: string, data: TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read']>;
updateProjectApiKey(options: {
user_id: string;
} | {
team_id: string;
}, keyId: string, data: UserApiKeysCrud['Client']['Update'] | TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read']>;
checkProjectApiKey(type: "user", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | null>;
checkProjectApiKey(type: "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<TeamApiKeysCrud['Client']['Read'] | null>;
checkProjectApiKey(type: "user" | "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read'] | null>;
}
export { type ClientInterfaceOptions, StackClientInterface };

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,180 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const contactChannelsClientReadSchema: yup.ObjectSchema<{
user_id: string;
id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_verified: boolean;
is_primary: boolean;
}, yup.AnyObject, {
user_id: undefined;
id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_verified: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudClientUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudServerUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
declare const contactChannelsCrudClientCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudServerCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
declare const contactChannelsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const contactChannelsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
user_id: string;
id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_verified: boolean;
is_primary: boolean;
}, yup.AnyObject, {
user_id: undefined;
id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_verified: undefined;
is_primary: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientCreate: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ContactChannelsCrud = CrudTypeOf<typeof contactChannelsCrud>;
export { type ContactChannelsCrud, contactChannelsClientReadSchema, contactChannelsCrud, contactChannelsCrudClientCreateSchema, contactChannelsCrudClientDeleteSchema, contactChannelsCrudClientUpdateSchema, contactChannelsCrudServerCreateSchema, contactChannelsCrudServerUpdateSchema };

View file

@ -0,0 +1,180 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const contactChannelsClientReadSchema: yup.ObjectSchema<{
user_id: string;
id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_verified: boolean;
is_primary: boolean;
}, yup.AnyObject, {
user_id: undefined;
id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_verified: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudClientUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudServerUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
declare const contactChannelsCrudClientCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
declare const contactChannelsCrudServerCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
declare const contactChannelsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const contactChannelsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
user_id: string;
id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_verified: boolean;
is_primary: boolean;
}, yup.AnyObject, {
user_id: undefined;
id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_verified: undefined;
is_primary: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverUpdateSchema: yup.ObjectSchema<{
value: string | undefined;
type: "email" | undefined;
used_for_auth: boolean | undefined;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
user_id: string;
value: string;
type: "email";
used_for_auth: boolean;
is_primary: boolean | undefined;
} & {
is_verified: boolean | undefined;
}, yup.AnyObject, {
user_id: undefined;
value: undefined;
type: undefined;
used_for_auth: undefined;
is_primary: undefined;
is_verified: undefined;
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientCreate: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ContactChannelsCrud = CrudTypeOf<typeof contactChannelsCrud>;
export { type ContactChannelsCrud, contactChannelsClientReadSchema, contactChannelsCrud, contactChannelsCrudClientCreateSchema, contactChannelsCrudClientDeleteSchema, contactChannelsCrudClientUpdateSchema, contactChannelsCrudServerCreateSchema, contactChannelsCrudServerUpdateSchema };

View file

@ -0,0 +1,108 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/contact-channels.ts
var contact_channels_exports = {};
__export(contact_channels_exports, {
contactChannelsClientReadSchema: () => contactChannelsClientReadSchema,
contactChannelsCrud: () => contactChannelsCrud,
contactChannelsCrudClientCreateSchema: () => contactChannelsCrudClientCreateSchema,
contactChannelsCrudClientDeleteSchema: () => contactChannelsCrudClientDeleteSchema,
contactChannelsCrudClientUpdateSchema: () => contactChannelsCrudClientUpdateSchema,
contactChannelsCrudServerCreateSchema: () => contactChannelsCrudServerCreateSchema,
contactChannelsCrudServerUpdateSchema: () => contactChannelsCrudServerUpdateSchema
});
module.exports = __toCommonJS(contact_channels_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var contactChannelsClientReadSchema = (0, import_schema_fields.yupObject)({
user_id: import_schema_fields.userIdSchema.defined(),
id: import_schema_fields.contactChannelIdSchema.defined(),
value: import_schema_fields.contactChannelValueSchema.defined(),
type: import_schema_fields.contactChannelTypeSchema.defined(),
used_for_auth: import_schema_fields.contactChannelUsedForAuthSchema.defined(),
is_verified: import_schema_fields.contactChannelIsVerifiedSchema.defined(),
is_primary: import_schema_fields.contactChannelIsPrimarySchema.defined()
}).defined();
var contactChannelsCrudClientUpdateSchema = (0, import_schema_fields.yupObject)({
value: import_schema_fields.contactChannelValueSchema.optional(),
type: import_schema_fields.contactChannelTypeSchema.optional(),
used_for_auth: import_schema_fields.contactChannelUsedForAuthSchema.optional(),
is_primary: import_schema_fields.contactChannelIsPrimarySchema.optional()
}).defined();
var contactChannelsCrudServerUpdateSchema = contactChannelsCrudClientUpdateSchema.concat((0, import_schema_fields.yupObject)({
is_verified: import_schema_fields.contactChannelIsVerifiedSchema.optional()
}));
var contactChannelsCrudClientCreateSchema = (0, import_schema_fields.yupObject)({
user_id: import_schema_fields.userIdOrMeSchema.defined(),
value: import_schema_fields.contactChannelValueSchema.defined(),
type: import_schema_fields.contactChannelTypeSchema.defined(),
used_for_auth: import_schema_fields.contactChannelUsedForAuthSchema.defined(),
is_primary: import_schema_fields.contactChannelIsPrimarySchema.optional()
}).defined();
var contactChannelsCrudServerCreateSchema = contactChannelsCrudClientCreateSchema.concat((0, import_schema_fields.yupObject)({
is_verified: import_schema_fields.contactChannelIsVerifiedSchema.optional()
}));
var contactChannelsCrudClientDeleteSchema = (0, import_schema_fields.yupMixed)();
var contactChannelsCrud = (0, import_crud.createCrud)({
clientReadSchema: contactChannelsClientReadSchema,
clientUpdateSchema: contactChannelsCrudClientUpdateSchema,
clientCreateSchema: contactChannelsCrudClientCreateSchema,
clientDeleteSchema: contactChannelsCrudClientDeleteSchema,
serverUpdateSchema: contactChannelsCrudServerUpdateSchema,
serverCreateSchema: contactChannelsCrudServerCreateSchema,
docs: {
clientRead: {
summary: "Get a contact channel",
description: "Retrieves a specific contact channel by the user ID and the contact channel ID.",
tags: ["Contact Channels"]
},
clientCreate: {
summary: "Create a contact channel",
description: "Add a new contact channel for a user.",
tags: ["Contact Channels"]
},
clientUpdate: {
summary: "Update a contact channel",
description: "Updates an existing contact channel. Only the values provided will be updated.",
tags: ["Contact Channels"]
},
clientDelete: {
summary: "Delete a contact channel",
description: "Removes a contact channel for a given user.",
tags: ["Contact Channels"]
},
clientList: {
summary: "List contact channels",
description: "Retrieves a list of all contact channels for a user.",
tags: ["Contact Channels"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
contactChannelsClientReadSchema,
contactChannelsCrud,
contactChannelsCrudClientCreateSchema,
contactChannelsCrudClientDeleteSchema,
contactChannelsCrudClientUpdateSchema,
contactChannelsCrudServerCreateSchema,
contactChannelsCrudServerUpdateSchema
});
//# sourceMappingURL=contact-channels.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/contact-channels.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { contactChannelIdSchema, contactChannelIsPrimarySchema, contactChannelIsVerifiedSchema, contactChannelTypeSchema, contactChannelUsedForAuthSchema, contactChannelValueSchema, userIdOrMeSchema, userIdSchema, yupMixed, yupObject } from \"../../schema-fields\";\n\nexport const contactChannelsClientReadSchema = yupObject({\n user_id: userIdSchema.defined(),\n id: contactChannelIdSchema.defined(),\n value: contactChannelValueSchema.defined(),\n type: contactChannelTypeSchema.defined(),\n used_for_auth: contactChannelUsedForAuthSchema.defined(),\n is_verified: contactChannelIsVerifiedSchema.defined(),\n is_primary: contactChannelIsPrimarySchema.defined(),\n}).defined();\n\nexport const contactChannelsCrudClientUpdateSchema = yupObject({\n value: contactChannelValueSchema.optional(),\n type: contactChannelTypeSchema.optional(),\n used_for_auth: contactChannelUsedForAuthSchema.optional(),\n is_primary: contactChannelIsPrimarySchema.optional(),\n}).defined();\n\nexport const contactChannelsCrudServerUpdateSchema = contactChannelsCrudClientUpdateSchema.concat(yupObject({\n is_verified: contactChannelIsVerifiedSchema.optional(),\n}));\n\nexport const contactChannelsCrudClientCreateSchema = yupObject({\n user_id: userIdOrMeSchema.defined(),\n value: contactChannelValueSchema.defined(),\n type: contactChannelTypeSchema.defined(),\n used_for_auth: contactChannelUsedForAuthSchema.defined(),\n is_primary: contactChannelIsPrimarySchema.optional(),\n}).defined();\n\nexport const contactChannelsCrudServerCreateSchema = contactChannelsCrudClientCreateSchema.concat(yupObject({\n is_verified: contactChannelIsVerifiedSchema.optional(),\n}));\n\nexport const contactChannelsCrudClientDeleteSchema = yupMixed();\n\nexport const contactChannelsCrud = createCrud({\n clientReadSchema: contactChannelsClientReadSchema,\n clientUpdateSchema: contactChannelsCrudClientUpdateSchema,\n clientCreateSchema: contactChannelsCrudClientCreateSchema,\n clientDeleteSchema: contactChannelsCrudClientDeleteSchema,\n serverUpdateSchema: contactChannelsCrudServerUpdateSchema,\n serverCreateSchema: contactChannelsCrudServerCreateSchema,\n docs: {\n clientRead: {\n summary: \"Get a contact channel\",\n description: \"Retrieves a specific contact channel by the user ID and the contact channel ID.\",\n tags: [\"Contact Channels\"],\n },\n clientCreate: {\n summary: \"Create a contact channel\",\n description: \"Add a new contact channel for a user.\",\n tags: [\"Contact Channels\"],\n },\n clientUpdate: {\n summary: \"Update a contact channel\",\n description: \"Updates an existing contact channel. Only the values provided will be updated.\",\n tags: [\"Contact Channels\"],\n },\n clientDelete: {\n summary: \"Delete a contact channel\",\n description: \"Removes a contact channel for a given user.\",\n tags: [\"Contact Channels\"],\n },\n clientList: {\n summary: \"List contact channels\",\n description: \"Retrieves a list of all contact channels for a user.\",\n tags: [\"Contact Channels\"],\n }\n }\n});\nexport type ContactChannelsCrud = CrudTypeOf<typeof contactChannelsCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAiP;AAE1O,IAAM,sCAAkC,gCAAU;AAAA,EACvD,SAAS,kCAAa,QAAQ;AAAA,EAC9B,IAAI,4CAAuB,QAAQ;AAAA,EACnC,OAAO,+CAA0B,QAAQ;AAAA,EACzC,MAAM,8CAAyB,QAAQ;AAAA,EACvC,eAAe,qDAAgC,QAAQ;AAAA,EACvD,aAAa,oDAA+B,QAAQ;AAAA,EACpD,YAAY,mDAA8B,QAAQ;AACpD,CAAC,EAAE,QAAQ;AAEJ,IAAM,4CAAwC,gCAAU;AAAA,EAC7D,OAAO,+CAA0B,SAAS;AAAA,EAC1C,MAAM,8CAAyB,SAAS;AAAA,EACxC,eAAe,qDAAgC,SAAS;AAAA,EACxD,YAAY,mDAA8B,SAAS;AACrD,CAAC,EAAE,QAAQ;AAEJ,IAAM,wCAAwC,sCAAsC,WAAO,gCAAU;AAAA,EAC1G,aAAa,oDAA+B,SAAS;AACvD,CAAC,CAAC;AAEK,IAAM,4CAAwC,gCAAU;AAAA,EAC7D,SAAS,sCAAiB,QAAQ;AAAA,EAClC,OAAO,+CAA0B,QAAQ;AAAA,EACzC,MAAM,8CAAyB,QAAQ;AAAA,EACvC,eAAe,qDAAgC,QAAQ;AAAA,EACvD,YAAY,mDAA8B,SAAS;AACrD,CAAC,EAAE,QAAQ;AAEJ,IAAM,wCAAwC,sCAAsC,WAAO,gCAAU;AAAA,EAC1G,aAAa,oDAA+B,SAAS;AACvD,CAAC,CAAC;AAEK,IAAM,4CAAwC,+BAAS;AAEvD,IAAM,0BAAsB,wBAAW;AAAA,EAC5C,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,kBAAkB;AAAA,IAC3B;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,205 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const currentUserCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
signed_up_at_millis: number;
has_password: boolean;
auth_with_email: boolean;
requires_totp_mfa: boolean;
} & {
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
id: string;
display_name: string;
profile_image_url: string | null;
} | null;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
serverReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
passkey_auth_enabled: boolean | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;
export { type CurrentUserCrud, currentUserCrud };

View file

@ -0,0 +1,205 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const currentUserCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
signed_up_at_millis: number;
has_password: boolean;
auth_with_email: boolean;
requires_totp_mfa: boolean;
} & {
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
id: string;
display_name: string;
profile_image_url: string | null;
} | null;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
serverReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
passkey_auth_enabled: boolean | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;
export { type CurrentUserCrud, currentUserCrud };

View file

@ -0,0 +1,90 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/current-user.ts
var current_user_exports = {};
__export(current_user_exports, {
currentUserCrud: () => currentUserCrud
});
module.exports = __toCommonJS(current_user_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var import_teams = require("./teams");
var import_users = require("./users");
var clientUpdateSchema = import_users.usersCrudServerUpdateSchema.pick([
"display_name",
"profile_image_url",
"client_metadata",
"selected_team_id",
"totp_secret_base64",
"otp_auth_enabled",
"passkey_auth_enabled"
]).defined();
var serverUpdateSchema = import_users.usersCrudServerUpdateSchema;
var clientReadSchema = import_users.usersCrudServerReadSchema.pick([
"id",
"primary_email",
"primary_email_verified",
"display_name",
"client_metadata",
"client_read_only_metadata",
"profile_image_url",
"signed_up_at_millis",
"has_password",
"auth_with_email",
"oauth_providers",
"selected_team_id",
"requires_totp_mfa",
"otp_auth_enabled",
"passkey_auth_enabled",
"is_anonymous"
]).concat((0, import_schema_fields.yupObject)({
selected_team: import_teams.teamsCrudClientReadSchema.nullable().defined()
})).defined();
var serverReadSchema = import_users.usersCrudServerReadSchema.defined();
var clientDeleteSchema = import_users.usersCrudServerDeleteSchema;
var currentUserCrud = (0, import_crud.createCrud)({
clientReadSchema,
serverReadSchema,
clientUpdateSchema,
serverUpdateSchema,
clientDeleteSchema,
docs: {
clientRead: {
summary: "Get current user",
description: "Gets the currently authenticated user.",
tags: ["Users"]
},
clientUpdate: {
summary: "Update current user",
description: "Updates the currently authenticated user. Only the values provided will be updated.",
tags: ["Users"]
},
clientDelete: {
summary: "Delete current user",
description: "Deletes the currently authenticated user. Use this with caution.",
tags: ["Users"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
currentUserCrud
});
//# sourceMappingURL=current-user.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/current-user.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupObject } from \"../../schema-fields\";\nimport { teamsCrudClientReadSchema } from \"./teams\";\nimport { usersCrudServerDeleteSchema, usersCrudServerReadSchema, usersCrudServerUpdateSchema } from \"./users\";\n\nconst clientUpdateSchema = usersCrudServerUpdateSchema.pick([\n \"display_name\",\n \"profile_image_url\",\n \"client_metadata\",\n \"selected_team_id\",\n \"totp_secret_base64\",\n \"otp_auth_enabled\",\n \"passkey_auth_enabled\",\n]).defined();\n\nconst serverUpdateSchema = usersCrudServerUpdateSchema;\n\nconst clientReadSchema = usersCrudServerReadSchema.pick([\n \"id\",\n \"primary_email\",\n \"primary_email_verified\",\n \"display_name\",\n \"client_metadata\",\n \"client_read_only_metadata\",\n \"profile_image_url\",\n \"signed_up_at_millis\",\n \"has_password\",\n \"auth_with_email\",\n \"oauth_providers\",\n \"selected_team_id\",\n \"requires_totp_mfa\",\n \"otp_auth_enabled\",\n \"passkey_auth_enabled\",\n \"is_anonymous\",\n]).concat(yupObject({\n selected_team: teamsCrudClientReadSchema.nullable().defined(),\n})).defined();\n\nconst serverReadSchema = usersCrudServerReadSchema.defined();\n\nconst clientDeleteSchema = usersCrudServerDeleteSchema;\n\nexport const currentUserCrud = createCrud({\n clientReadSchema,\n serverReadSchema,\n clientUpdateSchema,\n serverUpdateSchema,\n clientDeleteSchema,\n docs: {\n clientRead: {\n summary: 'Get current user',\n description: 'Gets the currently authenticated user.',\n tags: ['Users'],\n },\n clientUpdate: {\n summary: 'Update current user',\n description: 'Updates the currently authenticated user. Only the values provided will be updated.',\n tags: ['Users'],\n },\n clientDelete: {\n summary: 'Delete current user',\n description: 'Deletes the currently authenticated user. Use this with caution.',\n tags: ['Users'],\n },\n },\n});\nexport type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAA0B;AAC1B,mBAA0C;AAC1C,mBAAoG;AAEpG,IAAM,qBAAqB,yCAA4B,KAAK;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,EAAE,QAAQ;AAEX,IAAM,qBAAqB;AAE3B,IAAM,mBAAmB,uCAA0B,KAAK;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,EAAE,WAAO,gCAAU;AAAA,EAClB,eAAe,uCAA0B,SAAS,EAAE,QAAQ;AAC9D,CAAC,CAAC,EAAE,QAAQ;AAEZ,IAAM,mBAAmB,uCAA0B,QAAQ;AAE3D,IAAM,qBAAqB;AAEpB,IAAM,sBAAkB,wBAAW;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,84 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
type EmailTemplateType = typeof emailTemplateTypes[number];
declare const emailTemplateTypes: readonly ["email_verification", "password_reset", "magic_link", "team_invitation"];
declare const emailTemplateAdminReadSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
subject: string;
content: {} | null;
is_default: boolean;
}, yup.AnyObject, {
type: undefined;
subject: undefined;
content: undefined;
is_default: undefined;
}, "">;
declare const emailTemplateCrudAdminUpdateSchema: yup.ObjectSchema<{
content: {} | undefined;
subject: string | undefined;
}, yup.AnyObject, {
content: undefined;
subject: undefined;
}, "">;
declare const emailTemplateCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const emailTemplateCrudAdminCreateSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
content: {} | null;
subject: string;
}, yup.AnyObject, {
type: undefined;
content: undefined;
subject: undefined;
}, "">;
declare const emailTemplateCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
subject: string;
content: {} | null;
is_default: boolean;
}, yup.AnyObject, {
type: undefined;
subject: undefined;
content: undefined;
is_default: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
content: {} | undefined;
subject: string | undefined;
}, yup.AnyObject, {
content: undefined;
subject: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
content: {} | null;
subject: string;
}, yup.AnyObject, {
type: undefined;
content: undefined;
subject: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminRead: {
hidden: true;
};
adminCreate: {
hidden: true;
};
adminUpdate: {
hidden: true;
};
adminDelete: {
hidden: true;
};
adminList: {
hidden: true;
};
};
}>;
type EmailTemplateCrud = CrudTypeOf<typeof emailTemplateCrud>;
export { type EmailTemplateCrud, type EmailTemplateType, emailTemplateAdminReadSchema, emailTemplateCrud, emailTemplateCrudAdminCreateSchema, emailTemplateCrudAdminDeleteSchema, emailTemplateCrudAdminUpdateSchema, emailTemplateTypes };

View file

@ -0,0 +1,84 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
type EmailTemplateType = typeof emailTemplateTypes[number];
declare const emailTemplateTypes: readonly ["email_verification", "password_reset", "magic_link", "team_invitation"];
declare const emailTemplateAdminReadSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
subject: string;
content: {} | null;
is_default: boolean;
}, yup.AnyObject, {
type: undefined;
subject: undefined;
content: undefined;
is_default: undefined;
}, "">;
declare const emailTemplateCrudAdminUpdateSchema: yup.ObjectSchema<{
content: {} | undefined;
subject: string | undefined;
}, yup.AnyObject, {
content: undefined;
subject: undefined;
}, "">;
declare const emailTemplateCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const emailTemplateCrudAdminCreateSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
content: {} | null;
subject: string;
}, yup.AnyObject, {
type: undefined;
content: undefined;
subject: undefined;
}, "">;
declare const emailTemplateCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
subject: string;
content: {} | null;
is_default: boolean;
}, yup.AnyObject, {
type: undefined;
subject: undefined;
content: undefined;
is_default: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
content: {} | undefined;
subject: string | undefined;
}, yup.AnyObject, {
content: undefined;
subject: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
type: "email_verification" | "password_reset" | "magic_link" | "team_invitation";
content: {} | null;
subject: string;
}, yup.AnyObject, {
type: undefined;
content: undefined;
subject: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminRead: {
hidden: true;
};
adminCreate: {
hidden: true;
};
adminUpdate: {
hidden: true;
};
adminDelete: {
hidden: true;
};
adminList: {
hidden: true;
};
};
}>;
type EmailTemplateCrud = CrudTypeOf<typeof emailTemplateCrud>;
export { type EmailTemplateCrud, type EmailTemplateType, emailTemplateAdminReadSchema, emailTemplateCrud, emailTemplateCrudAdminCreateSchema, emailTemplateCrudAdminDeleteSchema, emailTemplateCrudAdminUpdateSchema, emailTemplateTypes };

View file

@ -0,0 +1,82 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/email-templates.ts
var email_templates_exports = {};
__export(email_templates_exports, {
emailTemplateAdminReadSchema: () => emailTemplateAdminReadSchema,
emailTemplateCrud: () => emailTemplateCrud,
emailTemplateCrudAdminCreateSchema: () => emailTemplateCrudAdminCreateSchema,
emailTemplateCrudAdminDeleteSchema: () => emailTemplateCrudAdminDeleteSchema,
emailTemplateCrudAdminUpdateSchema: () => emailTemplateCrudAdminUpdateSchema,
emailTemplateTypes: () => emailTemplateTypes
});
module.exports = __toCommonJS(email_templates_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var emailTemplateTypes = ["email_verification", "password_reset", "magic_link", "team_invitation"];
var emailTemplateAdminReadSchema = (0, import_schema_fields.yupObject)({
type: (0, import_schema_fields.yupString)().oneOf(emailTemplateTypes).defined(),
subject: (0, import_schema_fields.yupString)().defined(),
content: import_schema_fields.jsonSchema.defined(),
is_default: (0, import_schema_fields.yupBoolean)().defined()
}).defined();
var emailTemplateCrudAdminUpdateSchema = (0, import_schema_fields.yupObject)({
content: import_schema_fields.jsonSchema.nonNullable().optional(),
subject: (0, import_schema_fields.yupString)().optional()
}).defined();
var emailTemplateCrudAdminDeleteSchema = (0, import_schema_fields.yupMixed)();
var emailTemplateCrudAdminCreateSchema = (0, import_schema_fields.yupObject)({
type: (0, import_schema_fields.yupString)().oneOf(emailTemplateTypes).defined(),
content: import_schema_fields.jsonSchema.defined(),
subject: (0, import_schema_fields.yupString)().defined()
}).defined();
var emailTemplateCrud = (0, import_crud.createCrud)({
adminReadSchema: emailTemplateAdminReadSchema,
adminUpdateSchema: emailTemplateCrudAdminUpdateSchema,
adminCreateSchema: emailTemplateCrudAdminCreateSchema,
adminDeleteSchema: emailTemplateCrudAdminDeleteSchema,
docs: {
adminRead: {
hidden: true
},
adminCreate: {
hidden: true
},
adminUpdate: {
hidden: true
},
adminDelete: {
hidden: true
},
adminList: {
hidden: true
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
emailTemplateAdminReadSchema,
emailTemplateCrud,
emailTemplateCrudAdminCreateSchema,
emailTemplateCrudAdminDeleteSchema,
emailTemplateCrudAdminUpdateSchema,
emailTemplateTypes
});
//# sourceMappingURL=email-templates.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/email-templates.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { jsonSchema, yupBoolean, yupMixed, yupObject, yupString } from \"../../schema-fields\";\n\nexport type EmailTemplateType = typeof emailTemplateTypes[number];\nexport const emailTemplateTypes = ['email_verification', 'password_reset', 'magic_link', 'team_invitation'] as const;\n\nexport const emailTemplateAdminReadSchema = yupObject({\n type: yupString().oneOf(emailTemplateTypes).defined(),\n subject: yupString().defined(),\n content: jsonSchema.defined(),\n is_default: yupBoolean().defined(),\n}).defined();\n\nexport const emailTemplateCrudAdminUpdateSchema = yupObject({\n content: jsonSchema.nonNullable().optional(),\n subject: yupString().optional(),\n}).defined();\n\nexport const emailTemplateCrudAdminDeleteSchema = yupMixed();\n\nexport const emailTemplateCrudAdminCreateSchema = yupObject({\n type: yupString().oneOf(emailTemplateTypes).defined(),\n content: jsonSchema.defined(),\n subject: yupString().defined(),\n}).defined();\n\nexport const emailTemplateCrud = createCrud({\n adminReadSchema: emailTemplateAdminReadSchema,\n adminUpdateSchema: emailTemplateCrudAdminUpdateSchema,\n adminCreateSchema: emailTemplateCrudAdminCreateSchema,\n adminDeleteSchema: emailTemplateCrudAdminDeleteSchema,\n docs: {\n adminRead: {\n hidden: true,\n },\n adminCreate: {\n hidden: true,\n },\n adminUpdate: {\n hidden: true,\n },\n adminDelete: {\n hidden: true,\n },\n adminList: {\n hidden: true,\n }\n }\n});\nexport type EmailTemplateCrud = CrudTypeOf<typeof emailTemplateCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAuE;AAGhE,IAAM,qBAAqB,CAAC,sBAAsB,kBAAkB,cAAc,iBAAiB;AAEnG,IAAM,mCAA+B,gCAAU;AAAA,EACpD,UAAM,gCAAU,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,EACpD,aAAS,gCAAU,EAAE,QAAQ;AAAA,EAC7B,SAAS,gCAAW,QAAQ;AAAA,EAC5B,gBAAY,iCAAW,EAAE,QAAQ;AACnC,CAAC,EAAE,QAAQ;AAEJ,IAAM,yCAAqC,gCAAU;AAAA,EAC1D,SAAS,gCAAW,YAAY,EAAE,SAAS;AAAA,EAC3C,aAAS,gCAAU,EAAE,SAAS;AAChC,CAAC,EAAE,QAAQ;AAEJ,IAAM,yCAAqC,+BAAS;AAEpD,IAAM,yCAAqC,gCAAU;AAAA,EAC1D,UAAM,gCAAU,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,EACpD,SAAS,gCAAW,QAAQ;AAAA,EAC5B,aAAS,gCAAU,EAAE,QAAQ;AAC/B,CAAC,EAAE,QAAQ;AAEJ,IAAM,wBAAoB,wBAAW;AAAA,EAC1C,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,MAAM;AAAA,IACJ,WAAW;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,69 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const sentEmailReadSchema: yup.ObjectSchema<{
id: string;
subject: string;
sent_at_millis: number;
to: string[] | undefined;
sender_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
error: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
subject: undefined;
sent_at_millis: undefined;
to: undefined;
sender_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
error: undefined;
}, "">;
declare const internalEmailsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
subject: string;
sent_at_millis: number;
to: string[] | undefined;
sender_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
error: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
subject: undefined;
sent_at_millis: undefined;
to: undefined;
sender_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
error: undefined;
}, "">;
}>;
type InternalEmailsCrud = CrudTypeOf<typeof internalEmailsCrud>;
export { type InternalEmailsCrud, internalEmailsCrud, sentEmailReadSchema };

View file

@ -0,0 +1,69 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const sentEmailReadSchema: yup.ObjectSchema<{
id: string;
subject: string;
sent_at_millis: number;
to: string[] | undefined;
sender_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
error: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
subject: undefined;
sent_at_millis: undefined;
to: undefined;
sender_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
error: undefined;
}, "">;
declare const internalEmailsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
subject: string;
sent_at_millis: number;
to: string[] | undefined;
sender_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
error: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
subject: undefined;
sent_at_millis: undefined;
to: undefined;
sender_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
error: undefined;
}, "">;
}>;
type InternalEmailsCrud = CrudTypeOf<typeof internalEmailsCrud>;
export { type InternalEmailsCrud, internalEmailsCrud, sentEmailReadSchema };

View file

@ -0,0 +1,56 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/emails.ts
var emails_exports = {};
__export(emails_exports, {
internalEmailsCrud: () => internalEmailsCrud,
sentEmailReadSchema: () => sentEmailReadSchema
});
module.exports = __toCommonJS(emails_exports);
var import_crud = require("../../crud");
var fieldSchema = __toESM(require("../../schema-fields"));
var import_projects = require("./projects");
var sentEmailReadSchema = fieldSchema.yupObject({
id: fieldSchema.yupString().defined(),
subject: fieldSchema.yupString().defined(),
sent_at_millis: fieldSchema.yupNumber().defined(),
to: fieldSchema.yupArray(fieldSchema.yupString().defined()),
sender_config: import_projects.emailConfigWithoutPasswordSchema.defined(),
error: fieldSchema.yupMixed().nullable().optional()
}).defined();
var internalEmailsCrud = (0, import_crud.createCrud)({
adminReadSchema: sentEmailReadSchema
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
internalEmailsCrud,
sentEmailReadSchema
});
//# sourceMappingURL=emails.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/emails.ts"],"sourcesContent":["import { createCrud, CrudTypeOf } from \"../../crud\";\nimport * as fieldSchema from \"../../schema-fields\";\nimport { emailConfigWithoutPasswordSchema } from \"./projects\";\n\n\nexport const sentEmailReadSchema = fieldSchema.yupObject({\n id: fieldSchema.yupString().defined(),\n subject: fieldSchema.yupString().defined(),\n sent_at_millis: fieldSchema.yupNumber().defined(),\n to: fieldSchema.yupArray(fieldSchema.yupString().defined()),\n sender_config: emailConfigWithoutPasswordSchema.defined(),\n error: fieldSchema.yupMixed().nullable().optional(),\n}).defined();\n\nexport const internalEmailsCrud = createCrud({\n adminReadSchema: sentEmailReadSchema,\n});\n\nexport type InternalEmailsCrud = CrudTypeOf<typeof internalEmailsCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,kBAA6B;AAC7B,sBAAiD;AAG1C,IAAM,sBAAkC,sBAAU;AAAA,EACvD,IAAgB,sBAAU,EAAE,QAAQ;AAAA,EACpC,SAAqB,sBAAU,EAAE,QAAQ;AAAA,EACzC,gBAA4B,sBAAU,EAAE,QAAQ;AAAA,EAChD,IAAgB,qBAAqB,sBAAU,EAAE,QAAQ,CAAC;AAAA,EAC1D,eAAe,iDAAiC,QAAQ;AAAA,EACxD,OAAmB,qBAAS,EAAE,SAAS,EAAE,SAAS;AACpD,CAAC,EAAE,QAAQ;AAEJ,IAAM,yBAAqB,wBAAW;AAAA,EAC3C,iBAAiB;AACnB,CAAC;","names":[]}

View file

@ -0,0 +1,139 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const internalApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number;
has_publishable_client_key: boolean;
has_secret_server_key: boolean;
has_super_secret_admin_key: boolean;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
has_publishable_client_key: undefined;
has_secret_server_key: undefined;
has_super_secret_admin_key: undefined;
}, "">;
declare const internalApiKeysCreateOutputSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: string | undefined;
secret_server_key: string | undefined;
super_secret_admin_key: string | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: undefined;
secret_server_key: undefined;
super_secret_admin_key: undefined;
}, "">;
declare const internalApiKeysCrudAdminObfuscatedReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: {
last_four: string;
} | undefined;
secret_server_key: {
last_four: string;
} | undefined;
super_secret_admin_key: {
last_four: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: {
last_four: undefined;
};
secret_server_key: {
last_four: undefined;
};
super_secret_admin_key: {
last_four: undefined;
};
}, "">;
declare const internalApiKeysCrudAdminUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
declare const internalApiKeysCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const internalApiKeysCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: {
last_four: string;
} | undefined;
secret_server_key: {
last_four: string;
} | undefined;
super_secret_admin_key: {
last_four: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: {
last_four: undefined;
};
secret_server_key: {
last_four: undefined;
};
super_secret_admin_key: {
last_four: undefined;
};
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
hidden: true;
};
adminRead: {
hidden: true;
};
adminCreate: {
hidden: true;
};
adminUpdate: {
hidden: true;
};
adminDelete: {
hidden: true;
};
};
}>;
type InternalApiKeysCrud = CrudTypeOf<typeof internalApiKeysCrud>;
export { type InternalApiKeysCrud, internalApiKeysCreateInputSchema, internalApiKeysCreateOutputSchema, internalApiKeysCrud, internalApiKeysCrudAdminDeleteSchema, internalApiKeysCrudAdminObfuscatedReadSchema, internalApiKeysCrudAdminUpdateSchema };

View file

@ -0,0 +1,139 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const internalApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number;
has_publishable_client_key: boolean;
has_secret_server_key: boolean;
has_super_secret_admin_key: boolean;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
has_publishable_client_key: undefined;
has_secret_server_key: undefined;
has_super_secret_admin_key: undefined;
}, "">;
declare const internalApiKeysCreateOutputSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: string | undefined;
secret_server_key: string | undefined;
super_secret_admin_key: string | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: undefined;
secret_server_key: undefined;
super_secret_admin_key: undefined;
}, "">;
declare const internalApiKeysCrudAdminObfuscatedReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: {
last_four: string;
} | undefined;
secret_server_key: {
last_four: string;
} | undefined;
super_secret_admin_key: {
last_four: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: {
last_four: undefined;
};
secret_server_key: {
last_four: undefined;
};
super_secret_admin_key: {
last_four: undefined;
};
}, "">;
declare const internalApiKeysCrudAdminUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
declare const internalApiKeysCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const internalApiKeysCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
} & {
publishable_client_key: {
last_four: string;
} | undefined;
secret_server_key: {
last_four: string;
} | undefined;
super_secret_admin_key: {
last_four: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
publishable_client_key: {
last_four: undefined;
};
secret_server_key: {
last_four: undefined;
};
super_secret_admin_key: {
last_four: undefined;
};
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
hidden: true;
};
adminRead: {
hidden: true;
};
adminCreate: {
hidden: true;
};
adminUpdate: {
hidden: true;
};
adminDelete: {
hidden: true;
};
};
}>;
type InternalApiKeysCrud = CrudTypeOf<typeof internalApiKeysCrud>;
export { type InternalApiKeysCrud, internalApiKeysCreateInputSchema, internalApiKeysCreateOutputSchema, internalApiKeysCrud, internalApiKeysCrudAdminDeleteSchema, internalApiKeysCrudAdminObfuscatedReadSchema, internalApiKeysCrudAdminUpdateSchema };

View file

@ -0,0 +1,99 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/internal-api-keys.ts
var internal_api_keys_exports = {};
__export(internal_api_keys_exports, {
internalApiKeysCreateInputSchema: () => internalApiKeysCreateInputSchema,
internalApiKeysCreateOutputSchema: () => internalApiKeysCreateOutputSchema,
internalApiKeysCrud: () => internalApiKeysCrud,
internalApiKeysCrudAdminDeleteSchema: () => internalApiKeysCrudAdminDeleteSchema,
internalApiKeysCrudAdminObfuscatedReadSchema: () => internalApiKeysCrudAdminObfuscatedReadSchema,
internalApiKeysCrudAdminUpdateSchema: () => internalApiKeysCrudAdminUpdateSchema
});
module.exports = __toCommonJS(internal_api_keys_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var baseInternalApiKeysReadSchema = (0, import_schema_fields.yupObject)({
id: (0, import_schema_fields.yupString)().defined(),
description: (0, import_schema_fields.yupString)().defined(),
expires_at_millis: (0, import_schema_fields.yupNumber)().defined(),
manually_revoked_at_millis: (0, import_schema_fields.yupNumber)().optional(),
created_at_millis: (0, import_schema_fields.yupNumber)().defined()
});
var internalApiKeysCreateInputSchema = (0, import_schema_fields.yupObject)({
description: (0, import_schema_fields.yupString)().defined(),
expires_at_millis: (0, import_schema_fields.yupNumber)().defined(),
has_publishable_client_key: (0, import_schema_fields.yupBoolean)().defined(),
has_secret_server_key: (0, import_schema_fields.yupBoolean)().defined(),
has_super_secret_admin_key: (0, import_schema_fields.yupBoolean)().defined()
});
var internalApiKeysCreateOutputSchema = baseInternalApiKeysReadSchema.concat((0, import_schema_fields.yupObject)({
publishable_client_key: (0, import_schema_fields.yupString)().optional(),
secret_server_key: (0, import_schema_fields.yupString)().optional(),
super_secret_admin_key: (0, import_schema_fields.yupString)().optional()
}).defined());
var internalApiKeysCrudAdminObfuscatedReadSchema = baseInternalApiKeysReadSchema.concat((0, import_schema_fields.yupObject)({
publishable_client_key: (0, import_schema_fields.yupObject)({
last_four: (0, import_schema_fields.yupString)().defined()
}).optional(),
secret_server_key: (0, import_schema_fields.yupObject)({
last_four: (0, import_schema_fields.yupString)().defined()
}).optional(),
super_secret_admin_key: (0, import_schema_fields.yupObject)({
last_four: (0, import_schema_fields.yupString)().defined()
}).optional()
}));
var internalApiKeysCrudAdminUpdateSchema = (0, import_schema_fields.yupObject)({
description: (0, import_schema_fields.yupString)().optional(),
revoked: (0, import_schema_fields.yupBoolean)().oneOf([true]).optional()
}).defined();
var internalApiKeysCrudAdminDeleteSchema = (0, import_schema_fields.yupMixed)();
var internalApiKeysCrud = (0, import_crud.createCrud)({
adminReadSchema: internalApiKeysCrudAdminObfuscatedReadSchema,
adminUpdateSchema: internalApiKeysCrudAdminUpdateSchema,
adminDeleteSchema: internalApiKeysCrudAdminDeleteSchema,
docs: {
adminList: {
hidden: true
},
adminRead: {
hidden: true
},
adminCreate: {
hidden: true
},
adminUpdate: {
hidden: true
},
adminDelete: {
hidden: true
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
internalApiKeysCreateInputSchema,
internalApiKeysCreateOutputSchema,
internalApiKeysCrud,
internalApiKeysCrudAdminDeleteSchema,
internalApiKeysCrudAdminObfuscatedReadSchema,
internalApiKeysCrudAdminUpdateSchema
});
//# sourceMappingURL=internal-api-keys.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/internal-api-keys.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupBoolean, yupMixed, yupNumber, yupObject, yupString } from \"../../schema-fields\";\n\nconst baseInternalApiKeysReadSchema = yupObject({\n id: yupString().defined(),\n description: yupString().defined(),\n expires_at_millis: yupNumber().defined(),\n manually_revoked_at_millis: yupNumber().optional(),\n created_at_millis: yupNumber().defined(),\n});\n\n// Used for the result of the create endpoint\nexport const internalApiKeysCreateInputSchema = yupObject({\n description: yupString().defined(),\n expires_at_millis: yupNumber().defined(),\n has_publishable_client_key: yupBoolean().defined(),\n has_secret_server_key: yupBoolean().defined(),\n has_super_secret_admin_key: yupBoolean().defined(),\n});\n\nexport const internalApiKeysCreateOutputSchema = baseInternalApiKeysReadSchema.concat(yupObject({\n publishable_client_key: yupString().optional(),\n secret_server_key: yupString().optional(),\n super_secret_admin_key: yupString().optional(),\n}).defined());\n\n// Used for list, read and update endpoints after the initial creation\nexport const internalApiKeysCrudAdminObfuscatedReadSchema = baseInternalApiKeysReadSchema.concat(yupObject({\n publishable_client_key: yupObject({\n last_four: yupString().defined(),\n }).optional(),\n secret_server_key: yupObject({\n last_four: yupString().defined(),\n }).optional(),\n super_secret_admin_key: yupObject({\n last_four: yupString().defined(),\n }).optional(),\n}));\n\nexport const internalApiKeysCrudAdminUpdateSchema = yupObject({\n description: yupString().optional(),\n revoked: yupBoolean().oneOf([true]).optional(),\n}).defined();\n\nexport const internalApiKeysCrudAdminDeleteSchema = yupMixed();\n\nexport const internalApiKeysCrud = createCrud({\n adminReadSchema: internalApiKeysCrudAdminObfuscatedReadSchema,\n adminUpdateSchema: internalApiKeysCrudAdminUpdateSchema,\n adminDeleteSchema: internalApiKeysCrudAdminDeleteSchema,\n docs: {\n adminList: {\n hidden: true,\n },\n adminRead: {\n hidden: true,\n },\n adminCreate: {\n hidden: true,\n },\n adminUpdate: {\n hidden: true,\n },\n adminDelete: {\n hidden: true,\n },\n },\n});\nexport type InternalApiKeysCrud = CrudTypeOf<typeof internalApiKeysCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAsE;AAEtE,IAAM,oCAAgC,gCAAU;AAAA,EAC9C,QAAI,gCAAU,EAAE,QAAQ;AAAA,EACxB,iBAAa,gCAAU,EAAE,QAAQ;AAAA,EACjC,uBAAmB,gCAAU,EAAE,QAAQ;AAAA,EACvC,gCAA4B,gCAAU,EAAE,SAAS;AAAA,EACjD,uBAAmB,gCAAU,EAAE,QAAQ;AACzC,CAAC;AAGM,IAAM,uCAAmC,gCAAU;AAAA,EACxD,iBAAa,gCAAU,EAAE,QAAQ;AAAA,EACjC,uBAAmB,gCAAU,EAAE,QAAQ;AAAA,EACvC,gCAA4B,iCAAW,EAAE,QAAQ;AAAA,EACjD,2BAAuB,iCAAW,EAAE,QAAQ;AAAA,EAC5C,gCAA4B,iCAAW,EAAE,QAAQ;AACnD,CAAC;AAEM,IAAM,oCAAoC,8BAA8B,WAAO,gCAAU;AAAA,EAC9F,4BAAwB,gCAAU,EAAE,SAAS;AAAA,EAC7C,uBAAmB,gCAAU,EAAE,SAAS;AAAA,EACxC,4BAAwB,gCAAU,EAAE,SAAS;AAC/C,CAAC,EAAE,QAAQ,CAAC;AAGL,IAAM,+CAA+C,8BAA8B,WAAO,gCAAU;AAAA,EACzG,4BAAwB,gCAAU;AAAA,IAChC,eAAW,gCAAU,EAAE,QAAQ;AAAA,EACjC,CAAC,EAAE,SAAS;AAAA,EACZ,uBAAmB,gCAAU;AAAA,IAC3B,eAAW,gCAAU,EAAE,QAAQ;AAAA,EACjC,CAAC,EAAE,SAAS;AAAA,EACZ,4BAAwB,gCAAU;AAAA,IAChC,eAAW,gCAAU,EAAE,QAAQ;AAAA,EACjC,CAAC,EAAE,SAAS;AACd,CAAC,CAAC;AAEK,IAAM,2CAAuC,gCAAU;AAAA,EAC5D,iBAAa,gCAAU,EAAE,SAAS;AAAA,EAClC,aAAS,iCAAW,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS;AAC/C,CAAC,EAAE,QAAQ;AAEJ,IAAM,2CAAuC,+BAAS;AAEtD,IAAM,0BAAsB,wBAAW;AAAA,EAC5C,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,MAAM;AAAA,IACJ,WAAW;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,34 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const connectedAccountAccessTokenReadSchema: yup.ObjectSchema<{
access_token: string;
}, yup.AnyObject, {
access_token: undefined;
}, "">;
declare const connectedAccountAccessTokenCreateSchema: yup.ObjectSchema<{
scope: string | undefined;
}, yup.AnyObject, {
scope: undefined;
}, "">;
declare const connectedAccountAccessTokenCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
access_token: string;
}, yup.AnyObject, {
access_token: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
scope: string | undefined;
}, yup.AnyObject, {
scope: undefined;
}, "">;
docs: {
clientCreate: {
hidden: true;
};
};
}>;
type ConnectedAccountAccessTokenCrud = CrudTypeOf<typeof connectedAccountAccessTokenCrud>;
export { type ConnectedAccountAccessTokenCrud, connectedAccountAccessTokenCreateSchema, connectedAccountAccessTokenCrud, connectedAccountAccessTokenReadSchema };

View file

@ -0,0 +1,34 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const connectedAccountAccessTokenReadSchema: yup.ObjectSchema<{
access_token: string;
}, yup.AnyObject, {
access_token: undefined;
}, "">;
declare const connectedAccountAccessTokenCreateSchema: yup.ObjectSchema<{
scope: string | undefined;
}, yup.AnyObject, {
scope: undefined;
}, "">;
declare const connectedAccountAccessTokenCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
access_token: string;
}, yup.AnyObject, {
access_token: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
scope: string | undefined;
}, yup.AnyObject, {
scope: undefined;
}, "">;
docs: {
clientCreate: {
hidden: true;
};
};
}>;
type ConnectedAccountAccessTokenCrud = CrudTypeOf<typeof connectedAccountAccessTokenCrud>;
export { type ConnectedAccountAccessTokenCrud, connectedAccountAccessTokenCreateSchema, connectedAccountAccessTokenCrud, connectedAccountAccessTokenReadSchema };

View file

@ -0,0 +1,51 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/oauth.ts
var oauth_exports = {};
__export(oauth_exports, {
connectedAccountAccessTokenCreateSchema: () => connectedAccountAccessTokenCreateSchema,
connectedAccountAccessTokenCrud: () => connectedAccountAccessTokenCrud,
connectedAccountAccessTokenReadSchema: () => connectedAccountAccessTokenReadSchema
});
module.exports = __toCommonJS(oauth_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var connectedAccountAccessTokenReadSchema = (0, import_schema_fields.yupObject)({
access_token: (0, import_schema_fields.yupString)().defined()
}).defined();
var connectedAccountAccessTokenCreateSchema = (0, import_schema_fields.yupObject)({
scope: (0, import_schema_fields.yupString)().optional()
}).defined();
var connectedAccountAccessTokenCrud = (0, import_crud.createCrud)({
clientReadSchema: connectedAccountAccessTokenReadSchema,
clientCreateSchema: connectedAccountAccessTokenCreateSchema,
docs: {
clientCreate: {
hidden: true
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
connectedAccountAccessTokenCreateSchema,
connectedAccountAccessTokenCrud,
connectedAccountAccessTokenReadSchema
});
//# sourceMappingURL=oauth.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/oauth.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupObject, yupString } from \"../../schema-fields\";\n\nexport const connectedAccountAccessTokenReadSchema = yupObject({\n access_token: yupString().defined(),\n}).defined();\n\nexport const connectedAccountAccessTokenCreateSchema = yupObject({\n scope: yupString().optional(),\n}).defined();\n\nexport const connectedAccountAccessTokenCrud = createCrud({\n clientReadSchema: connectedAccountAccessTokenReadSchema,\n clientCreateSchema: connectedAccountAccessTokenCreateSchema,\n docs: {\n clientCreate: {\n hidden: true,\n }\n },\n});\nexport type ConnectedAccountAccessTokenCrud = CrudTypeOf<typeof connectedAccountAccessTokenCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAqC;AAE9B,IAAM,4CAAwC,gCAAU;AAAA,EAC7D,kBAAc,gCAAU,EAAE,QAAQ;AACpC,CAAC,EAAE,QAAQ;AAEJ,IAAM,8CAA0C,gCAAU;AAAA,EAC/D,WAAO,gCAAU,EAAE,SAAS;AAC9B,CAAC,EAAE,QAAQ;AAEJ,IAAM,sCAAkC,wBAAW;AAAA,EACxD,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,MAAM;AAAA,IACJ,cAAc;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,206 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const userApiKeysCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
is_public: boolean;
value: {
last_four: string;
};
type: "user";
user_id: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: {
last_four: undefined;
};
type: undefined;
user_id: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
docs: {
clientCreate: {
description: string;
displayName: string;
tags: string[];
summary: string;
};
clientList: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientRead: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientUpdate: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
serverDelete: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
};
}>;
declare const userApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number | null;
is_public: boolean | undefined;
user_id: string;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
is_public: undefined;
user_id: undefined;
}, "">;
declare const userApiKeysCreateOutputSchema: yup.ObjectSchema<{
type: "user";
description: string;
id: string;
created_at_millis: number;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
user_id: string;
is_public: boolean;
} & {
value: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: undefined;
type: undefined;
user_id: undefined;
}, "">;
type UserApiKeysCrud = CrudTypeOf<typeof userApiKeysCrud>;
declare const teamApiKeysCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
is_public: boolean;
value: {
last_four: string;
};
type: "team";
team_id: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: {
last_four: undefined;
};
type: undefined;
team_id: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
docs: {
clientCreate: {
description: string;
displayName: string;
tags: string[];
summary: string;
};
clientList: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientRead: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientUpdate: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
serverDelete: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
};
}>;
declare const teamApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number | null;
is_public: boolean | undefined;
team_id: string;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
is_public: undefined;
team_id: undefined;
}, "">;
declare const teamApiKeysCreateOutputSchema: yup.ObjectSchema<{
type: "team";
description: string;
id: string;
created_at_millis: number;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
team_id: string;
is_public: boolean;
} & {
value: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: undefined;
type: undefined;
team_id: undefined;
}, "">;
type TeamApiKeysCrud = CrudTypeOf<typeof teamApiKeysCrud>;
export { type TeamApiKeysCrud, type UserApiKeysCrud, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema, teamApiKeysCrud, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema, userApiKeysCrud };

View file

@ -0,0 +1,206 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const userApiKeysCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
is_public: boolean;
value: {
last_four: string;
};
type: "user";
user_id: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: {
last_four: undefined;
};
type: undefined;
user_id: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
docs: {
clientCreate: {
description: string;
displayName: string;
tags: string[];
summary: string;
};
clientList: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientRead: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientUpdate: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
serverDelete: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
};
}>;
declare const userApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number | null;
is_public: boolean | undefined;
user_id: string;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
is_public: undefined;
user_id: undefined;
}, "">;
declare const userApiKeysCreateOutputSchema: yup.ObjectSchema<{
type: "user";
description: string;
id: string;
created_at_millis: number;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
user_id: string;
is_public: boolean;
} & {
value: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: undefined;
type: undefined;
user_id: undefined;
}, "">;
type UserApiKeysCrud = CrudTypeOf<typeof userApiKeysCrud>;
declare const teamApiKeysCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
description: string;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
created_at_millis: number;
is_public: boolean;
value: {
last_four: string;
};
type: "team";
team_id: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: {
last_four: undefined;
};
type: undefined;
team_id: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
description: string | undefined;
revoked: boolean | undefined;
}, yup.AnyObject, {
description: undefined;
revoked: undefined;
}, "">;
docs: {
clientCreate: {
description: string;
displayName: string;
tags: string[];
summary: string;
};
clientList: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientRead: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
clientUpdate: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
serverDelete: {
description: string;
displayName: string;
summary: string;
tags: string[];
};
};
}>;
declare const teamApiKeysCreateInputSchema: yup.ObjectSchema<{
description: string;
expires_at_millis: number | null;
is_public: boolean | undefined;
team_id: string;
}, yup.AnyObject, {
description: undefined;
expires_at_millis: undefined;
is_public: undefined;
team_id: undefined;
}, "">;
declare const teamApiKeysCreateOutputSchema: yup.ObjectSchema<{
type: "team";
description: string;
id: string;
created_at_millis: number;
expires_at_millis: number | undefined;
manually_revoked_at_millis: number | undefined;
team_id: string;
is_public: boolean;
} & {
value: string;
}, yup.AnyObject, {
id: undefined;
description: undefined;
expires_at_millis: undefined;
manually_revoked_at_millis: undefined;
created_at_millis: undefined;
is_public: undefined;
value: undefined;
type: undefined;
team_id: undefined;
}, "">;
type TeamApiKeysCrud = CrudTypeOf<typeof teamApiKeysCrud>;
export { type TeamApiKeysCrud, type UserApiKeysCrud, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema, teamApiKeysCrud, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema, userApiKeysCrud };

View file

@ -0,0 +1,128 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/project-api-keys.ts
var project_api_keys_exports = {};
__export(project_api_keys_exports, {
teamApiKeysCreateInputSchema: () => teamApiKeysCreateInputSchema,
teamApiKeysCreateOutputSchema: () => teamApiKeysCreateOutputSchema,
teamApiKeysCrud: () => teamApiKeysCrud,
userApiKeysCreateInputSchema: () => userApiKeysCreateInputSchema,
userApiKeysCreateOutputSchema: () => userApiKeysCreateOutputSchema,
userApiKeysCrud: () => userApiKeysCrud
});
module.exports = __toCommonJS(project_api_keys_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var import_objects = require("../../utils/objects");
function createApiKeyCrud(type, idFieldName, idSchema) {
const projectApiKeysReadSchema = (0, import_schema_fields.yupObject)({
id: (0, import_schema_fields.yupString)().defined(),
description: (0, import_schema_fields.yupString)().defined(),
expires_at_millis: (0, import_schema_fields.yupNumber)().optional(),
manually_revoked_at_millis: (0, import_schema_fields.yupNumber)().optional(),
created_at_millis: (0, import_schema_fields.yupNumber)().defined(),
is_public: (0, import_schema_fields.yupBoolean)().defined(),
value: (0, import_schema_fields.yupObject)({
last_four: (0, import_schema_fields.yupString)().defined()
}).defined(),
type: (0, import_schema_fields.yupString)().oneOf([type]).defined(),
...(0, import_objects.typedFromEntries)([[idFieldName, idSchema]])
});
const projectApiKeysUpdateSchema = (0, import_schema_fields.yupObject)({
description: (0, import_schema_fields.yupString)().optional(),
revoked: (0, import_schema_fields.yupBoolean)().oneOf([true]).optional()
}).defined();
const projectApiKeysCrud = (0, import_crud.createCrud)({
clientReadSchema: projectApiKeysReadSchema,
clientUpdateSchema: projectApiKeysUpdateSchema,
docs: {
clientCreate: {
description: `Create a new ${type} API key`,
displayName: `Create ${type} API key`,
tags: ["API Keys"],
summary: `Create ${type} API key`
},
clientList: {
description: `List all ${type} API keys for the project with their metadata and status`,
displayName: `List ${type} API keys`,
summary: `List ${type} API keys`,
tags: ["API Keys"]
},
clientRead: {
description: `Get details of a specific ${type} API key`,
displayName: `Get ${type} API key`,
summary: `Get ${type} API key details`,
tags: ["API Keys"]
},
clientUpdate: {
description: `Update an ${type} API key`,
displayName: `Update ${type} API key`,
summary: `Update ${type} API key`,
tags: ["API Keys"]
},
serverDelete: {
description: `Delete an ${type} API key`,
displayName: `Delete ${type} API key`,
summary: `Delete ${type} API key`,
tags: ["API Keys"]
}
}
});
const projectApiKeysCreateInputSchema = (0, import_schema_fields.yupObject)({
description: (0, import_schema_fields.yupString)().defined(),
expires_at_millis: (0, import_schema_fields.yupNumber)().nullable().defined(),
is_public: (0, import_schema_fields.yupBoolean)().optional(),
/*
prefix: yupString().optional().nonEmpty().test("prefix", "Prefix must contain only alphanumeric characters and underscores", (value) => {
if (!value) return true;
return /^[a-zA-Z0-9_]+$/.test(value);
}),
*/
...(0, import_objects.typedFromEntries)([[idFieldName, idSchema]])
});
const projectApiKeysCreateOutputSchema = projectApiKeysReadSchema.omit(["value"]).concat((0, import_schema_fields.yupObject)({
value: (0, import_schema_fields.yupString)().defined()
}));
return {
crud: projectApiKeysCrud,
createInputSchema: projectApiKeysCreateInputSchema,
createOutputSchema: projectApiKeysCreateOutputSchema
};
}
var {
crud: userApiKeysCrud,
createInputSchema: userApiKeysCreateInputSchema,
createOutputSchema: userApiKeysCreateOutputSchema
} = createApiKeyCrud("user", "user_id", import_schema_fields.userIdOrMeSchema.defined());
var {
crud: teamApiKeysCrud,
createInputSchema: teamApiKeysCreateInputSchema,
createOutputSchema: teamApiKeysCreateOutputSchema
} = createApiKeyCrud("team", "team_id", (0, import_schema_fields.yupString)().defined());
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamApiKeysCreateInputSchema,
teamApiKeysCreateOutputSchema,
teamApiKeysCrud,
userApiKeysCreateInputSchema,
userApiKeysCreateOutputSchema,
userApiKeysCrud
});
//# sourceMappingURL=project-api-keys.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,160 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const projectPermissionsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
declare const projectPermissionsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const projectPermissionsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const projectPermissionsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectPermissionsCrud = CrudTypeOf<typeof projectPermissionsCrud>;
declare const projectPermissionCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const projectPermissionDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const projectPermissionDefinitionsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const projectPermissionDefinitionsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
summary: string;
description: string;
tags: string[];
};
adminCreate: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectPermissionDefinitionsCrud = CrudTypeOf<typeof projectPermissionDefinitionsCrud>;
export { type ProjectPermissionDefinitionsCrud, type ProjectPermissionsCrud, projectPermissionCreatedWebhookEvent, projectPermissionDefinitionsCrud, projectPermissionDefinitionsCrudAdminCreateSchema, projectPermissionDefinitionsCrudAdminDeleteSchema, projectPermissionDefinitionsCrudAdminReadSchema, projectPermissionDefinitionsCrudAdminUpdateSchema, projectPermissionDeletedWebhookEvent, projectPermissionsCrud, projectPermissionsCrudClientReadSchema, projectPermissionsCrudServerCreateSchema, projectPermissionsCrudServerDeleteSchema };

View file

@ -0,0 +1,160 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const projectPermissionsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
declare const projectPermissionsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const projectPermissionsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const projectPermissionsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectPermissionsCrud = CrudTypeOf<typeof projectPermissionsCrud>;
declare const projectPermissionCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const projectPermissionDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const projectPermissionDefinitionsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const projectPermissionDefinitionsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const projectPermissionDefinitionsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
summary: string;
description: string;
tags: string[];
};
adminCreate: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectPermissionDefinitionsCrud = CrudTypeOf<typeof projectPermissionDefinitionsCrud>;
export { type ProjectPermissionDefinitionsCrud, type ProjectPermissionsCrud, projectPermissionCreatedWebhookEvent, projectPermissionDefinitionsCrud, projectPermissionDefinitionsCrudAdminCreateSchema, projectPermissionDefinitionsCrudAdminDeleteSchema, projectPermissionDefinitionsCrudAdminReadSchema, projectPermissionDefinitionsCrudAdminUpdateSchema, projectPermissionDeletedWebhookEvent, projectPermissionsCrud, projectPermissionsCrudClientReadSchema, projectPermissionsCrudServerCreateSchema, projectPermissionsCrudServerDeleteSchema };

View file

@ -0,0 +1,158 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/project-permissions.ts
var project_permissions_exports = {};
__export(project_permissions_exports, {
projectPermissionCreatedWebhookEvent: () => projectPermissionCreatedWebhookEvent,
projectPermissionDefinitionsCrud: () => projectPermissionDefinitionsCrud,
projectPermissionDefinitionsCrudAdminCreateSchema: () => projectPermissionDefinitionsCrudAdminCreateSchema,
projectPermissionDefinitionsCrudAdminDeleteSchema: () => projectPermissionDefinitionsCrudAdminDeleteSchema,
projectPermissionDefinitionsCrudAdminReadSchema: () => projectPermissionDefinitionsCrudAdminReadSchema,
projectPermissionDefinitionsCrudAdminUpdateSchema: () => projectPermissionDefinitionsCrudAdminUpdateSchema,
projectPermissionDeletedWebhookEvent: () => projectPermissionDeletedWebhookEvent,
projectPermissionsCrud: () => projectPermissionsCrud,
projectPermissionsCrudClientReadSchema: () => projectPermissionsCrudClientReadSchema,
projectPermissionsCrudServerCreateSchema: () => projectPermissionsCrudServerCreateSchema,
projectPermissionsCrudServerDeleteSchema: () => projectPermissionsCrudServerDeleteSchema
});
module.exports = __toCommonJS(project_permissions_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var projectPermissionsCrudClientReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.permissionDefinitionIdSchema.defined(),
user_id: schemaFields.userIdSchema.defined()
}).defined();
var projectPermissionsCrudServerCreateSchema = (0, import_schema_fields.yupObject)({}).defined();
var projectPermissionsCrudServerDeleteSchema = (0, import_schema_fields.yupMixed)();
var projectPermissionsCrud = (0, import_crud.createCrud)({
clientReadSchema: projectPermissionsCrudClientReadSchema,
serverCreateSchema: projectPermissionsCrudServerCreateSchema,
serverDeleteSchema: projectPermissionsCrudServerDeleteSchema,
docs: {
clientList: {
summary: "List project permissions",
description: "List global permissions of the current user. `user_id=me` must be set for client requests. `(user_id, permission_id)` together uniquely identify a permission.",
tags: ["Permissions"]
},
serverList: {
summary: "List project permissions",
description: "Query and filter the permission with `user_id` and `permission_id`. `(user_id, permission_id)` together uniquely identify a permission.",
tags: ["Permissions"]
},
serverCreate: {
summary: "Grant a global permission to a user",
description: "Grant a global permission to a user (the permission must be created first on the Stack dashboard)",
tags: ["Permissions"]
},
serverDelete: {
summary: "Revoke a global permission from a user",
description: "Revoke a global permission from a user",
tags: ["Permissions"]
}
}
});
var projectPermissionCreatedWebhookEvent = {
type: "project_permission.created",
schema: projectPermissionsCrud.server.readSchema,
metadata: {
summary: "Project Permission Created",
description: "This event is triggered when a project permission is created.",
tags: ["Users"]
}
};
var projectPermissionDeletedWebhookEvent = {
type: "project_permission.deleted",
schema: projectPermissionsCrud.server.readSchema,
metadata: {
summary: "Project Permission Deleted",
description: "This event is triggered when a project permission is deleted.",
tags: ["Users"]
}
};
var projectPermissionDefinitionsCrudAdminReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.permissionDefinitionIdSchema.defined(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.defined()
}).defined();
var projectPermissionDefinitionsCrudAdminCreateSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.customPermissionDefinitionIdSchema.defined(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional()
}).defined();
var projectPermissionDefinitionsCrudAdminUpdateSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.customPermissionDefinitionIdSchema.optional(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional()
}).defined();
var projectPermissionDefinitionsCrudAdminDeleteSchema = (0, import_schema_fields.yupMixed)();
var projectPermissionDefinitionsCrud = (0, import_crud.createCrud)({
adminReadSchema: projectPermissionDefinitionsCrudAdminReadSchema,
adminCreateSchema: projectPermissionDefinitionsCrudAdminCreateSchema,
adminUpdateSchema: projectPermissionDefinitionsCrudAdminUpdateSchema,
adminDeleteSchema: projectPermissionDefinitionsCrudAdminDeleteSchema,
docs: {
adminList: {
summary: "List project permission definitions",
description: "Query and filter project permission definitions (the equivalent of listing permissions on the Stack dashboard)",
tags: ["Permissions"]
},
adminCreate: {
summary: "Create a new project permission definition",
description: "Create a new project permission definition (the equivalent of creating a new permission on the Stack dashboard)",
tags: ["Permissions"]
},
adminUpdate: {
summary: "Update a project permission definition",
description: "Update a project permission definition (the equivalent of updating a permission on the Stack dashboard)",
tags: ["Permissions"]
},
adminDelete: {
summary: "Delete a project permission definition",
description: "Delete a project permission definition (the equivalent of deleting a permission on the Stack dashboard)",
tags: ["Permissions"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
projectPermissionCreatedWebhookEvent,
projectPermissionDefinitionsCrud,
projectPermissionDefinitionsCrudAdminCreateSchema,
projectPermissionDefinitionsCrudAdminDeleteSchema,
projectPermissionDefinitionsCrudAdminReadSchema,
projectPermissionDefinitionsCrudAdminUpdateSchema,
projectPermissionDeletedWebhookEvent,
projectPermissionsCrud,
projectPermissionsCrudClientReadSchema,
projectPermissionsCrudServerCreateSchema,
projectPermissionsCrudServerDeleteSchema
});
//# sourceMappingURL=project-permissions.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,627 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const emailConfigSchema: yup.ObjectSchema<{
type: "shared" | "standard";
host: string | undefined;
port: number | undefined;
username: string | undefined;
password: string | undefined;
sender_name: string | undefined;
sender_email: string | undefined;
}, yup.AnyObject, {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
}, "">;
declare const emailConfigWithoutPasswordSchema: yup.ObjectSchema<{
type: "shared" | "standard";
host: string | undefined;
port: number | undefined;
username: string | undefined;
sender_name: string | undefined;
sender_email: string | undefined;
}, yup.AnyObject, {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
}, "">;
declare const projectsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
declare const projectsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
config: {
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
config: {
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
enabled_oauth_providers: undefined;
};
}, "">;
declare const projectsCrudAdminUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
declare const projectsCrudAdminCreateSchema: yup.ObjectSchema<{
display_name: string;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
} & {
display_name: string;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
declare const projectsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const clientProjectsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
config: {
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
config: {
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
enabled_oauth_providers: undefined;
};
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ClientProjectsCrud = CrudTypeOf<typeof clientProjectsCrud>;
declare const projectsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminRead: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectsCrud = CrudTypeOf<typeof projectsCrud>;
declare const adminUserProjectsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
clientCreateSchema: yup.ObjectSchema<{
display_name: string;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
} & {
display_name: string;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
docs: {
clientList: {
hidden: true;
};
clientCreate: {
hidden: true;
};
};
}>;
type AdminUserProjectsCrud = CrudTypeOf<typeof adminUserProjectsCrud>;
export { type AdminUserProjectsCrud, type ClientProjectsCrud, type ProjectsCrud, adminUserProjectsCrud, clientProjectsCrud, emailConfigSchema, emailConfigWithoutPasswordSchema, projectsCrud, projectsCrudAdminCreateSchema, projectsCrudAdminDeleteSchema, projectsCrudAdminReadSchema, projectsCrudAdminUpdateSchema, projectsCrudClientReadSchema };

View file

@ -0,0 +1,627 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const emailConfigSchema: yup.ObjectSchema<{
type: "shared" | "standard";
host: string | undefined;
port: number | undefined;
username: string | undefined;
password: string | undefined;
sender_name: string | undefined;
sender_email: string | undefined;
}, yup.AnyObject, {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
}, "">;
declare const emailConfigWithoutPasswordSchema: yup.ObjectSchema<{
type: "shared" | "standard";
host: string | undefined;
port: number | undefined;
username: string | undefined;
sender_name: string | undefined;
sender_email: string | undefined;
}, yup.AnyObject, {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
}, "">;
declare const projectsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
declare const projectsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
config: {
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
config: {
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
enabled_oauth_providers: undefined;
};
}, "">;
declare const projectsCrudAdminUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
declare const projectsCrudAdminCreateSchema: yup.ObjectSchema<{
display_name: string;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
} & {
display_name: string;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
declare const projectsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const clientProjectsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
config: {
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
config: {
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
enabled_oauth_providers: undefined;
};
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ClientProjectsCrud = CrudTypeOf<typeof clientProjectsCrud>;
declare const projectsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminRead: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type ProjectsCrud = CrudTypeOf<typeof projectsCrud>;
declare const adminUserProjectsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
description: string;
created_at_millis: number;
user_count: number;
is_production_mode: boolean;
config: {
allow_localhost: boolean;
sign_up_enabled: boolean;
credential_enabled: boolean;
magic_link_enabled: boolean;
passkey_enabled: boolean;
client_team_creation_enabled: boolean;
client_user_deletion_enabled: boolean;
allow_user_api_keys: boolean;
allow_team_api_keys: boolean;
oauth_providers: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
enabled_oauth_providers: {
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[];
domains: {
domain: string;
handler_path: string;
}[];
email_config: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
};
create_team_on_sign_up: boolean;
team_creator_default_permissions: {
id: string;
}[];
team_member_default_permissions: {
id: string;
}[];
user_default_permissions: {
id: string;
}[];
oauth_account_merge_strategy: "link_method" | "raise_error" | "allow_duplicates";
};
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
description: undefined;
created_at_millis: undefined;
user_count: undefined;
is_production_mode: undefined;
config: {
allow_localhost: undefined;
sign_up_enabled: undefined;
credential_enabled: undefined;
magic_link_enabled: undefined;
passkey_enabled: undefined;
client_team_creation_enabled: undefined;
client_user_deletion_enabled: undefined;
allow_user_api_keys: undefined;
allow_team_api_keys: undefined;
oauth_providers: undefined;
enabled_oauth_providers: undefined;
domains: undefined;
email_config: {
type: undefined;
host: undefined;
port: undefined;
username: undefined;
password: undefined;
sender_name: undefined;
sender_email: undefined;
};
create_team_on_sign_up: undefined;
team_creator_default_permissions: undefined;
team_member_default_permissions: undefined;
user_default_permissions: undefined;
oauth_account_merge_strategy: undefined;
};
}, "">;
clientCreateSchema: yup.ObjectSchema<{
display_name: string;
description: string | null | undefined;
is_production_mode: boolean | undefined;
config: {
allow_localhost?: boolean | undefined;
sign_up_enabled?: boolean | undefined;
credential_enabled?: boolean | undefined;
magic_link_enabled?: boolean | undefined;
passkey_enabled?: boolean | undefined;
client_team_creation_enabled?: boolean | undefined;
client_user_deletion_enabled?: boolean | undefined;
allow_user_api_keys?: boolean | undefined;
allow_team_api_keys?: boolean | undefined;
oauth_providers?: {
client_id?: string | undefined;
client_secret?: string | undefined;
facebook_config_id?: string | undefined;
microsoft_tenant_id?: string | undefined;
type: "shared" | "standard";
id: "apple" | "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin";
}[] | undefined;
domains?: {
domain: string;
handler_path: string;
}[] | undefined;
email_config?: {
host?: string | undefined;
port?: number | undefined;
username?: string | undefined;
password?: string | undefined;
sender_name?: string | undefined;
sender_email?: string | undefined;
type: "shared" | "standard";
} | undefined;
create_team_on_sign_up?: boolean | undefined;
team_creator_default_permissions?: {
id: string;
}[] | undefined;
team_member_default_permissions?: {
id: string;
}[] | undefined;
user_default_permissions?: {
id: string;
}[] | undefined;
oauth_account_merge_strategy?: "link_method" | "raise_error" | "allow_duplicates" | undefined;
} | undefined;
} & {
display_name: string;
}, yup.AnyObject, {
display_name: undefined;
description: undefined;
is_production_mode: undefined;
config: undefined;
}, "">;
docs: {
clientList: {
hidden: true;
};
clientCreate: {
hidden: true;
};
};
}>;
type AdminUserProjectsCrud = CrudTypeOf<typeof adminUserProjectsCrud>;
export { type AdminUserProjectsCrud, type ClientProjectsCrud, type ProjectsCrud, adminUserProjectsCrud, clientProjectsCrud, emailConfigSchema, emailConfigWithoutPasswordSchema, projectsCrud, projectsCrudAdminCreateSchema, projectsCrudAdminDeleteSchema, projectsCrudAdminReadSchema, projectsCrudAdminUpdateSchema, projectsCrudClientReadSchema };

View file

@ -0,0 +1,225 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/projects.ts
var projects_exports = {};
__export(projects_exports, {
adminUserProjectsCrud: () => adminUserProjectsCrud,
clientProjectsCrud: () => clientProjectsCrud,
emailConfigSchema: () => emailConfigSchema,
emailConfigWithoutPasswordSchema: () => emailConfigWithoutPasswordSchema,
projectsCrud: () => projectsCrud,
projectsCrudAdminCreateSchema: () => projectsCrudAdminCreateSchema,
projectsCrudAdminDeleteSchema: () => projectsCrudAdminDeleteSchema,
projectsCrudAdminReadSchema: () => projectsCrudAdminReadSchema,
projectsCrudAdminUpdateSchema: () => projectsCrudAdminUpdateSchema,
projectsCrudClientReadSchema: () => projectsCrudClientReadSchema
});
module.exports = __toCommonJS(projects_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var teamPermissionSchema = (0, import_schema_fields.yupObject)({
id: (0, import_schema_fields.yupString)().defined()
}).defined();
var oauthProviderSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.oauthIdSchema.defined(),
type: schemaFields.oauthTypeSchema.defined(),
client_id: schemaFields.yupDefinedAndNonEmptyWhen(
schemaFields.oauthClientIdSchema,
{ type: "standard" }
),
client_secret: schemaFields.yupDefinedAndNonEmptyWhen(
schemaFields.oauthClientSecretSchema,
{ type: "standard" }
),
// extra params
facebook_config_id: schemaFields.oauthFacebookConfigIdSchema.optional(),
microsoft_tenant_id: schemaFields.oauthMicrosoftTenantIdSchema.optional()
});
var enabledOAuthProviderSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.oauthIdSchema.defined()
});
var emailConfigSchema = (0, import_schema_fields.yupObject)({
type: schemaFields.emailTypeSchema.defined(),
host: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailHostSchema, {
type: "standard"
}),
port: schemaFields.yupDefinedWhen(schemaFields.emailPortSchema, {
type: "standard"
}),
username: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailUsernameSchema, {
type: "standard"
}),
password: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailPasswordSchema, {
type: "standard"
}),
sender_name: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailSenderNameSchema, {
type: "standard"
}),
sender_email: schemaFields.yupDefinedAndNonEmptyWhen(schemaFields.emailSenderEmailSchema, {
type: "standard"
})
});
var emailConfigWithoutPasswordSchema = emailConfigSchema.pick(["type", "host", "port", "username", "sender_name", "sender_email"]);
var domainSchema = (0, import_schema_fields.yupObject)({
domain: schemaFields.urlSchema.defined().matches(/^https?:\/\//, "URL must start with http:// or https://").meta({ openapiField: { description: "URL. Must start with http:// or https://", exampleValue: "https://example.com" } }),
handler_path: schemaFields.handlerPathSchema.defined()
});
var projectsCrudAdminReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.projectIdSchema.defined(),
display_name: schemaFields.projectDisplayNameSchema.defined(),
description: schemaFields.projectDescriptionSchema.nonNullable().defined(),
created_at_millis: schemaFields.projectCreatedAtMillisSchema.defined(),
user_count: schemaFields.projectUserCountSchema.defined(),
is_production_mode: schemaFields.projectIsProductionModeSchema.defined(),
/** @deprecated */
config: (0, import_schema_fields.yupObject)({
allow_localhost: schemaFields.projectAllowLocalhostSchema.defined(),
sign_up_enabled: schemaFields.projectSignUpEnabledSchema.defined(),
credential_enabled: schemaFields.projectCredentialEnabledSchema.defined(),
magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.defined(),
passkey_enabled: schemaFields.projectPasskeyEnabledSchema.defined(),
// TODO: remove this
client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.defined(),
client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.defined(),
allow_user_api_keys: schemaFields.yupBoolean().defined(),
allow_team_api_keys: schemaFields.yupBoolean().defined(),
oauth_providers: (0, import_schema_fields.yupArray)(oauthProviderSchema.defined()).defined(),
enabled_oauth_providers: (0, import_schema_fields.yupArray)(enabledOAuthProviderSchema.defined()).defined().meta({ openapiField: { hidden: true } }),
domains: (0, import_schema_fields.yupArray)(domainSchema.defined()).defined(),
email_config: emailConfigSchema.defined(),
create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.defined(),
team_creator_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).defined(),
team_member_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).defined(),
user_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).defined(),
oauth_account_merge_strategy: schemaFields.oauthAccountMergeStrategySchema.defined()
}).defined().meta({ openapiField: { hidden: true } })
}).defined();
var projectsCrudClientReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.projectIdSchema.defined(),
display_name: schemaFields.projectDisplayNameSchema.defined(),
config: (0, import_schema_fields.yupObject)({
sign_up_enabled: schemaFields.projectSignUpEnabledSchema.defined(),
credential_enabled: schemaFields.projectCredentialEnabledSchema.defined(),
magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.defined(),
passkey_enabled: schemaFields.projectPasskeyEnabledSchema.defined(),
client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.defined(),
client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.defined(),
allow_user_api_keys: schemaFields.yupBoolean().defined(),
allow_team_api_keys: schemaFields.yupBoolean().defined(),
enabled_oauth_providers: (0, import_schema_fields.yupArray)(enabledOAuthProviderSchema.defined()).defined().meta({ openapiField: { hidden: true } })
}).defined().meta({ openapiField: { hidden: true } })
}).defined();
var projectsCrudAdminUpdateSchema = (0, import_schema_fields.yupObject)({
display_name: schemaFields.projectDisplayNameSchema.optional(),
description: schemaFields.projectDescriptionSchema.optional(),
is_production_mode: schemaFields.projectIsProductionModeSchema.optional(),
config: (0, import_schema_fields.yupObject)({
sign_up_enabled: schemaFields.projectSignUpEnabledSchema.optional(),
credential_enabled: schemaFields.projectCredentialEnabledSchema.optional(),
magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.optional(),
passkey_enabled: schemaFields.projectPasskeyEnabledSchema.optional(),
client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.optional(),
client_user_deletion_enabled: schemaFields.projectClientUserDeletionEnabledSchema.optional(),
allow_localhost: schemaFields.projectAllowLocalhostSchema.optional(),
allow_user_api_keys: schemaFields.yupBoolean().optional(),
allow_team_api_keys: schemaFields.yupBoolean().optional(),
email_config: emailConfigSchema.optional().default(void 0),
domains: (0, import_schema_fields.yupArray)(domainSchema.defined()).optional().default(void 0),
oauth_providers: (0, import_schema_fields.yupArray)(oauthProviderSchema.defined()).optional().default(void 0),
create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.optional(),
team_creator_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).optional(),
team_member_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).optional(),
user_default_permissions: (0, import_schema_fields.yupArray)(teamPermissionSchema.defined()).optional(),
oauth_account_merge_strategy: schemaFields.oauthAccountMergeStrategySchema.optional()
}).optional().default(void 0)
}).defined();
var projectsCrudAdminCreateSchema = projectsCrudAdminUpdateSchema.concat((0, import_schema_fields.yupObject)({
display_name: schemaFields.projectDisplayNameSchema.defined()
}).defined());
var projectsCrudAdminDeleteSchema = schemaFields.yupMixed();
var clientProjectsCrud = (0, import_crud.createCrud)({
clientReadSchema: projectsCrudClientReadSchema,
docs: {
clientRead: {
summary: "Get the current project",
description: "Get the current project information including display name, OAuth providers and authentication methods. Useful for display the available login options to the user.",
tags: ["Projects"]
}
}
});
var projectsCrud = (0, import_crud.createCrud)({
adminReadSchema: projectsCrudAdminReadSchema,
adminUpdateSchema: projectsCrudAdminUpdateSchema,
adminDeleteSchema: projectsCrudAdminDeleteSchema,
docs: {
adminRead: {
summary: "Get the current project",
description: "Get the current project information and configuration including display name, OAuth providers, email configuration, etc.",
tags: ["Projects"]
},
adminUpdate: {
summary: "Update the current project",
description: "Update the current project information and configuration including display name, OAuth providers, email configuration, etc.",
tags: ["Projects"]
},
adminDelete: {
summary: "Delete the current project",
description: "Delete the current project and all associated data (including users, teams, API keys, project configs, etc.). Be careful, this action is irreversible.",
tags: ["Projects"]
}
}
});
var adminUserProjectsCrud = (0, import_crud.createCrud)({
clientReadSchema: projectsCrudAdminReadSchema,
clientCreateSchema: projectsCrudAdminCreateSchema,
docs: {
clientList: {
hidden: true
},
clientCreate: {
hidden: true
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
adminUserProjectsCrud,
clientProjectsCrud,
emailConfigSchema,
emailConfigWithoutPasswordSchema,
projectsCrud,
projectsCrudAdminCreateSchema,
projectsCrudAdminDeleteSchema,
projectsCrudAdminReadSchema,
projectsCrudAdminUpdateSchema,
projectsCrudClientReadSchema
});
//# sourceMappingURL=projects.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,149 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const sessionsCrudServerCreateSchema: yup.ObjectSchema<{
user_id: string;
expires_in_millis: number;
is_impersonation: boolean;
}, yup.AnyObject, {
user_id: undefined;
expires_in_millis: number;
is_impersonation: false;
}, "">;
declare const sessionsCreateOutputSchema: yup.ObjectSchema<{
refresh_token: string;
access_token: string;
}, yup.AnyObject, {
refresh_token: undefined;
access_token: undefined;
}, "">;
declare const sessionsCrudReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
declare const sessionsCrudDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const sessionsCrud: CrudSchemaFromOptions<{
serverReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
serverList: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type SessionsCrud = CrudTypeOf<typeof sessionsCrud>;
export { type SessionsCrud, sessionsCreateOutputSchema, sessionsCrud, sessionsCrudDeleteSchema, sessionsCrudReadSchema, sessionsCrudServerCreateSchema };

View file

@ -0,0 +1,149 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const sessionsCrudServerCreateSchema: yup.ObjectSchema<{
user_id: string;
expires_in_millis: number;
is_impersonation: boolean;
}, yup.AnyObject, {
user_id: undefined;
expires_in_millis: number;
is_impersonation: false;
}, "">;
declare const sessionsCreateOutputSchema: yup.ObjectSchema<{
refresh_token: string;
access_token: string;
}, yup.AnyObject, {
refresh_token: undefined;
access_token: undefined;
}, "">;
declare const sessionsCrudReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
declare const sessionsCrudDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const sessionsCrud: CrudSchemaFromOptions<{
serverReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
created_at: number;
is_impersonation: boolean;
last_used_at: number | undefined;
is_current_session: boolean | undefined;
last_used_at_end_user_ip_info: {
countryCode?: string | null | undefined;
regionCode?: string | null | undefined;
cityName?: string | null | undefined;
latitude?: number | null | undefined;
longitude?: number | null | undefined;
tzIdentifier?: string | null | undefined;
ip: string;
} | undefined;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
created_at: undefined;
is_impersonation: undefined;
last_used_at: undefined;
is_current_session: undefined;
last_used_at_end_user_ip_info: {
ip: undefined;
countryCode: undefined;
regionCode: undefined;
cityName: undefined;
latitude: undefined;
longitude: undefined;
tzIdentifier: undefined;
};
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
serverList: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type SessionsCrud = CrudTypeOf<typeof sessionsCrud>;
export { type SessionsCrud, sessionsCreateOutputSchema, sessionsCrud, sessionsCrudDeleteSchema, sessionsCrudReadSchema, sessionsCrudServerCreateSchema };

View file

@ -0,0 +1,91 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/sessions.ts
var sessions_exports = {};
__export(sessions_exports, {
sessionsCreateOutputSchema: () => sessionsCreateOutputSchema,
sessionsCrud: () => sessionsCrud,
sessionsCrudDeleteSchema: () => sessionsCrudDeleteSchema,
sessionsCrudReadSchema: () => sessionsCrudReadSchema,
sessionsCrudServerCreateSchema: () => sessionsCrudServerCreateSchema
});
module.exports = __toCommonJS(sessions_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var import_geo = require("../../utils/geo");
var sessionsCrudServerCreateSchema = (0, import_schema_fields.yupObject)({
user_id: (0, import_schema_fields.yupString)().uuid().defined(),
expires_in_millis: (0, import_schema_fields.yupNumber)().max(1e3 * 60 * 60 * 24 * 367).default(1e3 * 60 * 60 * 24 * 365),
is_impersonation: (0, import_schema_fields.yupBoolean)().default(false)
}).defined();
var sessionsCreateOutputSchema = (0, import_schema_fields.yupObject)({
refresh_token: (0, import_schema_fields.yupString)().defined(),
access_token: (0, import_schema_fields.yupString)().defined()
}).defined();
var sessionsCrudReadSchema = (0, import_schema_fields.yupObject)({
id: (0, import_schema_fields.yupString)().defined(),
user_id: (0, import_schema_fields.yupString)().uuid().defined(),
created_at: (0, import_schema_fields.yupNumber)().defined(),
is_impersonation: (0, import_schema_fields.yupBoolean)().defined(),
last_used_at: (0, import_schema_fields.yupNumber)().optional(),
is_current_session: (0, import_schema_fields.yupBoolean)(),
// TODO move this to a shared type
// TODO: what about if not trusted?
last_used_at_end_user_ip_info: import_geo.geoInfoSchema.optional()
}).defined();
var sessionsCrudDeleteSchema = (0, import_schema_fields.yupMixed)();
var sessionsCrud = (0, import_crud.createCrud)({
// serverCreateSchema: sessionsCrudServerCreateSchema,
serverReadSchema: sessionsCrudReadSchema,
serverDeleteSchema: sessionsCrudDeleteSchema,
clientReadSchema: sessionsCrudReadSchema,
clientDeleteSchema: sessionsCrudDeleteSchema,
docs: {
serverList: {
summary: "List sessions",
description: "List all sessions for the current user.",
tags: ["Sessions"]
},
serverDelete: {
summary: "Delete session",
description: "Delete a session by ID.",
tags: ["Sessions"]
},
clientList: {
summary: "List sessions",
description: "List all sessions for the current user.",
tags: ["Sessions"]
},
clientDelete: {
summary: "Delete session",
description: "Delete a session by ID.",
tags: ["Sessions"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
sessionsCreateOutputSchema,
sessionsCrud,
sessionsCrudDeleteSchema,
sessionsCrudReadSchema,
sessionsCrudServerCreateSchema
});
//# sourceMappingURL=sessions.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/sessions.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupBoolean, yupMixed, yupNumber, yupObject, yupString } from \"../../schema-fields\";\nimport { geoInfoSchema } from \"../../utils/geo\";\n\n\n// Create\nexport const sessionsCrudServerCreateSchema = yupObject({\n user_id: yupString().uuid().defined(),\n expires_in_millis: yupNumber().max(1000 * 60 * 60 * 24 * 367).default(1000 * 60 * 60 * 24 * 365),\n is_impersonation: yupBoolean().default(false),\n}).defined();\n\n\nexport const sessionsCreateOutputSchema = yupObject({\n refresh_token: yupString().defined(),\n access_token: yupString().defined(),\n}).defined();\n\n\nexport const sessionsCrudReadSchema = yupObject({\n id: yupString().defined(),\n user_id: yupString().uuid().defined(),\n created_at: yupNumber().defined(),\n is_impersonation: yupBoolean().defined(),\n last_used_at: yupNumber().optional(),\n is_current_session: yupBoolean(),\n // TODO move this to a shared type\n // TODO: what about if not trusted?\n last_used_at_end_user_ip_info: geoInfoSchema.optional(),\n}).defined();\n\n\n// Delete\nexport const sessionsCrudDeleteSchema = yupMixed();\n\n\nexport const sessionsCrud = createCrud({\n // serverCreateSchema: sessionsCrudServerCreateSchema,\n serverReadSchema: sessionsCrudReadSchema,\n serverDeleteSchema: sessionsCrudDeleteSchema,\n clientReadSchema: sessionsCrudReadSchema,\n clientDeleteSchema: sessionsCrudDeleteSchema,\n docs: {\n serverList: {\n summary: \"List sessions\",\n description: \"List all sessions for the current user.\",\n tags: [\"Sessions\"],\n },\n serverDelete: {\n summary: \"Delete session\",\n description: \"Delete a session by ID.\",\n tags: [\"Sessions\"],\n },\n clientList: {\n summary: \"List sessions\",\n description: \"List all sessions for the current user.\",\n tags: [\"Sessions\"],\n },\n clientDelete: {\n summary: \"Delete session\",\n description: \"Delete a session by ID.\",\n tags: [\"Sessions\"],\n },\n },\n});\nexport type SessionsCrud = CrudTypeOf<typeof sessionsCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAsE;AACtE,iBAA8B;AAIvB,IAAM,qCAAiC,gCAAU;AAAA,EACtD,aAAS,gCAAU,EAAE,KAAK,EAAE,QAAQ;AAAA,EACpC,uBAAmB,gCAAU,EAAE,IAAI,MAAO,KAAK,KAAK,KAAK,GAAG,EAAE,QAAQ,MAAO,KAAK,KAAK,KAAK,GAAG;AAAA,EAC/F,sBAAkB,iCAAW,EAAE,QAAQ,KAAK;AAC9C,CAAC,EAAE,QAAQ;AAGJ,IAAM,iCAA6B,gCAAU;AAAA,EAClD,mBAAe,gCAAU,EAAE,QAAQ;AAAA,EACnC,kBAAc,gCAAU,EAAE,QAAQ;AACpC,CAAC,EAAE,QAAQ;AAGJ,IAAM,6BAAyB,gCAAU;AAAA,EAC9C,QAAI,gCAAU,EAAE,QAAQ;AAAA,EACxB,aAAS,gCAAU,EAAE,KAAK,EAAE,QAAQ;AAAA,EACpC,gBAAY,gCAAU,EAAE,QAAQ;AAAA,EAChC,sBAAkB,iCAAW,EAAE,QAAQ;AAAA,EACvC,kBAAc,gCAAU,EAAE,SAAS;AAAA,EACnC,wBAAoB,iCAAW;AAAA;AAAA;AAAA,EAG/B,+BAA+B,yBAAc,SAAS;AACxD,CAAC,EAAE,QAAQ;AAIJ,IAAM,+BAA2B,+BAAS;AAG1C,IAAM,mBAAe,wBAAW;AAAA;AAAA,EAErC,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,UAAU;AAAA,IACnB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,UAAU;AAAA,IACnB;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,UAAU;AAAA,IACnB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,UAAU;AAAA,IACnB;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,26 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const svixTokenAdminReadSchema: yup.ObjectSchema<{
token: string;
}, yup.AnyObject, {
token: undefined;
}, "">;
declare const svixTokenAdminCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const svixTokenCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
token: string;
}, yup.AnyObject, {
token: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
docs: {
adminCreate: {
hidden: true;
};
};
}>;
type SvixTokenCrud = CrudTypeOf<typeof svixTokenCrud>;
export { type SvixTokenCrud, svixTokenAdminCreateSchema, svixTokenAdminReadSchema, svixTokenCrud };

View file

@ -0,0 +1,26 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const svixTokenAdminReadSchema: yup.ObjectSchema<{
token: string;
}, yup.AnyObject, {
token: undefined;
}, "">;
declare const svixTokenAdminCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const svixTokenCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
token: string;
}, yup.AnyObject, {
token: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
docs: {
adminCreate: {
hidden: true;
};
};
}>;
type SvixTokenCrud = CrudTypeOf<typeof svixTokenCrud>;
export { type SvixTokenCrud, svixTokenAdminCreateSchema, svixTokenAdminReadSchema, svixTokenCrud };

View file

@ -0,0 +1,49 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/svix-token.ts
var svix_token_exports = {};
__export(svix_token_exports, {
svixTokenAdminCreateSchema: () => svixTokenAdminCreateSchema,
svixTokenAdminReadSchema: () => svixTokenAdminReadSchema,
svixTokenCrud: () => svixTokenCrud
});
module.exports = __toCommonJS(svix_token_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var svixTokenAdminReadSchema = (0, import_schema_fields.yupObject)({
token: (0, import_schema_fields.yupString)().defined()
}).defined();
var svixTokenAdminCreateSchema = (0, import_schema_fields.yupObject)({}).defined();
var svixTokenCrud = (0, import_crud.createCrud)({
adminReadSchema: svixTokenAdminReadSchema,
adminCreateSchema: svixTokenAdminCreateSchema,
docs: {
adminCreate: {
hidden: true
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
svixTokenAdminCreateSchema,
svixTokenAdminReadSchema,
svixTokenCrud
});
//# sourceMappingURL=svix-token.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/svix-token.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupObject, yupString } from \"../../schema-fields\";\n\nexport const svixTokenAdminReadSchema = yupObject({\n token: yupString().defined(),\n}).defined();\n\nexport const svixTokenAdminCreateSchema = yupObject({}).defined();\n\nexport const svixTokenCrud = createCrud({\n adminReadSchema: svixTokenAdminReadSchema,\n adminCreateSchema: svixTokenAdminCreateSchema,\n docs: {\n adminCreate: {\n hidden: true,\n },\n }\n});\nexport type SvixTokenCrud = CrudTypeOf<typeof svixTokenCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAAqC;AAE9B,IAAM,+BAA2B,gCAAU;AAAA,EAChD,WAAO,gCAAU,EAAE,QAAQ;AAC7B,CAAC,EAAE,QAAQ;AAEJ,IAAM,iCAA6B,gCAAU,CAAC,CAAC,EAAE,QAAQ;AAEzD,IAAM,oBAAgB,wBAAW;AAAA,EACtC,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,MAAM;AAAA,IACJ,aAAa;AAAA,MACX,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,30 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamInvitationDetailsClientReadSchema: yup.ObjectSchema<{
team_id: string;
team_display_name: string;
}, yup.AnyObject, {
team_id: undefined;
team_display_name: undefined;
}, "">;
declare const teamInvitationDetailsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
team_display_name: string;
}, yup.AnyObject, {
team_id: undefined;
team_display_name: undefined;
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamInvitationDetailsCrud = CrudTypeOf<typeof teamInvitationDetailsCrud>;
export { type TeamInvitationDetailsCrud, teamInvitationDetailsClientReadSchema, teamInvitationDetailsCrud };

View file

@ -0,0 +1,30 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamInvitationDetailsClientReadSchema: yup.ObjectSchema<{
team_id: string;
team_display_name: string;
}, yup.AnyObject, {
team_id: undefined;
team_display_name: undefined;
}, "">;
declare const teamInvitationDetailsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
team_display_name: string;
}, yup.AnyObject, {
team_id: undefined;
team_display_name: undefined;
}, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamInvitationDetailsCrud = CrudTypeOf<typeof teamInvitationDetailsCrud>;
export { type TeamInvitationDetailsCrud, teamInvitationDetailsClientReadSchema, teamInvitationDetailsCrud };

View file

@ -0,0 +1,59 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/team-invitation-details.ts
var team_invitation_details_exports = {};
__export(team_invitation_details_exports, {
teamInvitationDetailsClientReadSchema: () => teamInvitationDetailsClientReadSchema,
teamInvitationDetailsCrud: () => teamInvitationDetailsCrud
});
module.exports = __toCommonJS(team_invitation_details_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var teamInvitationDetailsClientReadSchema = (0, import_schema_fields.yupObject)({
team_id: schemaFields.teamIdSchema.defined(),
team_display_name: schemaFields.teamDisplayNameSchema.defined()
}).defined();
var teamInvitationDetailsCrud = (0, import_crud.createCrud)({
clientReadSchema: teamInvitationDetailsClientReadSchema,
docs: {
clientRead: {
summary: "Get the team details with invitation code",
description: "",
tags: ["Teams"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamInvitationDetailsClientReadSchema,
teamInvitationDetailsCrud
});
//# sourceMappingURL=team-invitation-details.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/team-invitation-details.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport * as schemaFields from \"../../schema-fields\";\nimport { yupObject } from \"../../schema-fields\";\n\n\nexport const teamInvitationDetailsClientReadSchema = yupObject({\n team_id: schemaFields.teamIdSchema.defined(),\n team_display_name: schemaFields.teamDisplayNameSchema.defined(),\n}).defined();\n\nexport const teamInvitationDetailsCrud = createCrud({\n clientReadSchema: teamInvitationDetailsClientReadSchema,\n docs: {\n clientRead: {\n summary: \"Get the team details with invitation code\",\n description: \"\",\n tags: [\"Teams\"],\n },\n },\n});\n\nexport type TeamInvitationDetailsCrud = CrudTypeOf<typeof teamInvitationDetailsCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,mBAA8B;AAC9B,2BAA0B;AAGnB,IAAM,4CAAwC,gCAAU;AAAA,EAC7D,SAAsB,0BAAa,QAAQ;AAAA,EAC3C,mBAAgC,mCAAsB,QAAQ;AAChE,CAAC,EAAE,QAAQ;AAEJ,IAAM,gCAA4B,wBAAW;AAAA,EAClD,kBAAkB;AAAA,EAClB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,49 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamInvitationDetailsClientReadSchema: yup.ObjectSchema<{
id: string;
team_id: string;
expires_at_millis: number;
recipient_email: string;
}, yup.AnyObject, {
id: undefined;
team_id: undefined;
expires_at_millis: undefined;
recipient_email: undefined;
}, "">;
declare const teamInvitationCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
team_id: string;
expires_at_millis: number;
recipient_email: string;
}, yup.AnyObject, {
id: undefined;
team_id: undefined;
expires_at_millis: undefined;
recipient_email: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<any, yup.AnyObject, undefined, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamInvitationCrud = CrudTypeOf<typeof teamInvitationCrud>;
export { type TeamInvitationCrud, teamInvitationCrud, teamInvitationDetailsClientReadSchema };

View file

@ -0,0 +1,49 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamInvitationDetailsClientReadSchema: yup.ObjectSchema<{
id: string;
team_id: string;
expires_at_millis: number;
recipient_email: string;
}, yup.AnyObject, {
id: undefined;
team_id: undefined;
expires_at_millis: undefined;
recipient_email: undefined;
}, "">;
declare const teamInvitationCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
team_id: string;
expires_at_millis: number;
recipient_email: string;
}, yup.AnyObject, {
id: undefined;
team_id: undefined;
expires_at_millis: undefined;
recipient_email: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<any, yup.AnyObject, undefined, "">;
docs: {
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientList: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamInvitationCrud = CrudTypeOf<typeof teamInvitationCrud>;
export { type TeamInvitationCrud, teamInvitationCrud, teamInvitationDetailsClientReadSchema };

View file

@ -0,0 +1,72 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/team-invitation.ts
var team_invitation_exports = {};
__export(team_invitation_exports, {
teamInvitationCrud: () => teamInvitationCrud,
teamInvitationDetailsClientReadSchema: () => teamInvitationDetailsClientReadSchema
});
module.exports = __toCommonJS(team_invitation_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var teamInvitationDetailsClientReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.yupString().uuid().defined(),
team_id: schemaFields.teamIdSchema.defined(),
expires_at_millis: schemaFields.yupNumber().defined(),
recipient_email: schemaFields.emailSchema.defined()
}).defined();
var teamInvitationCrud = (0, import_crud.createCrud)({
clientReadSchema: teamInvitationDetailsClientReadSchema,
clientDeleteSchema: schemaFields.yupMixed(),
docs: {
clientRead: {
summary: "Get the team details with invitation code",
description: "",
tags: ["Teams"]
},
clientList: {
summary: "List team invitations",
description: "",
tags: ["Teams"]
},
clientDelete: {
summary: "Delete a team invitation",
description: "",
tags: ["Teams"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamInvitationCrud,
teamInvitationDetailsClientReadSchema
});
//# sourceMappingURL=team-invitation.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/team-invitation.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport * as schemaFields from \"../../schema-fields\";\nimport { yupObject } from \"../../schema-fields\";\n\nexport const teamInvitationDetailsClientReadSchema = yupObject({\n id: schemaFields.yupString().uuid().defined(),\n team_id: schemaFields.teamIdSchema.defined(),\n expires_at_millis: schemaFields.yupNumber().defined(),\n recipient_email: schemaFields.emailSchema.defined(),\n}).defined();\n\nexport const teamInvitationCrud = createCrud({\n clientReadSchema: teamInvitationDetailsClientReadSchema,\n clientDeleteSchema: schemaFields.yupMixed(),\n docs: {\n clientRead: {\n summary: \"Get the team details with invitation code\",\n description: \"\",\n tags: [\"Teams\"],\n },\n clientList: {\n summary: \"List team invitations\",\n description: \"\",\n tags: [\"Teams\"],\n },\n clientDelete: {\n summary: \"Delete a team invitation\",\n description: \"\",\n tags: [\"Teams\"],\n },\n },\n});\n\nexport type TeamInvitationCrud = CrudTypeOf<typeof teamInvitationCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,mBAA8B;AAC9B,2BAA0B;AAEnB,IAAM,4CAAwC,gCAAU;AAAA,EAC7D,IAAiB,uBAAU,EAAE,KAAK,EAAE,QAAQ;AAAA,EAC5C,SAAsB,0BAAa,QAAQ;AAAA,EAC3C,mBAAgC,uBAAU,EAAE,QAAQ;AAAA,EACpD,iBAA8B,yBAAY,QAAQ;AACpD,CAAC,EAAE,QAAQ;AAEJ,IAAM,yBAAqB,wBAAW;AAAA,EAC3C,kBAAkB;AAAA,EAClB,oBAAiC,sBAAS;AAAA,EAC1C,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,229 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamMemberProfilesCrudClientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
}, "">;
declare const teamMemberProfilesCrudServerReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
} & {
user: {
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
signed_up_at_millis: number;
has_password: boolean;
last_active_at_millis: number;
auth_with_email: boolean;
requires_totp_mfa: boolean;
};
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
user: {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
};
}, "">;
declare const teamMemberProfilesCrudClientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
}, "">;
declare const teamMemberProfilesCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
}, "">;
serverReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
} & {
user: {
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
signed_up_at_millis: number;
has_password: boolean;
last_active_at_millis: number;
auth_with_email: boolean;
requires_totp_mfa: boolean;
};
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
user: {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
};
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
}, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
clientRead: {
summary: string;
description: string;
tags: string[];
};
serverRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
serverUpdate: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamMemberProfilesCrud = CrudTypeOf<typeof teamMemberProfilesCrud>;
export { type TeamMemberProfilesCrud, teamMemberProfilesCrud, teamMemberProfilesCrudClientReadSchema, teamMemberProfilesCrudClientUpdateSchema, teamMemberProfilesCrudServerReadSchema };

View file

@ -0,0 +1,229 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamMemberProfilesCrudClientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
}, "">;
declare const teamMemberProfilesCrudServerReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
} & {
user: {
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
signed_up_at_millis: number;
has_password: boolean;
last_active_at_millis: number;
auth_with_email: boolean;
requires_totp_mfa: boolean;
};
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
user: {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
};
}, "">;
declare const teamMemberProfilesCrudClientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
}, "">;
declare const teamMemberProfilesCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
}, "">;
serverReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
display_name: string | null;
profile_image_url: string | null;
} & {
user: {
id: string;
display_name: string | null;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
profile_image_url: string | null;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
passkey_auth_enabled: boolean;
otp_auth_enabled: boolean;
selected_team_id: string | null;
is_anonymous: boolean;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
signed_up_at_millis: number;
has_password: boolean;
last_active_at_millis: number;
auth_with_email: boolean;
requires_totp_mfa: boolean;
};
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
display_name: undefined;
profile_image_url: undefined;
user: {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
};
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
}, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
clientRead: {
summary: string;
description: string;
tags: string[];
};
serverRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
serverUpdate: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamMemberProfilesCrud = CrudTypeOf<typeof teamMemberProfilesCrud>;
export { type TeamMemberProfilesCrud, teamMemberProfilesCrud, teamMemberProfilesCrudClientReadSchema, teamMemberProfilesCrudClientUpdateSchema, teamMemberProfilesCrudServerReadSchema };

View file

@ -0,0 +1,100 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/team-member-profiles.ts
var team_member_profiles_exports = {};
__export(team_member_profiles_exports, {
teamMemberProfilesCrud: () => teamMemberProfilesCrud,
teamMemberProfilesCrudClientReadSchema: () => teamMemberProfilesCrudClientReadSchema,
teamMemberProfilesCrudClientUpdateSchema: () => teamMemberProfilesCrudClientUpdateSchema,
teamMemberProfilesCrudServerReadSchema: () => teamMemberProfilesCrudServerReadSchema
});
module.exports = __toCommonJS(team_member_profiles_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var import_users = require("./users");
var teamMemberProfilesCrudClientReadSchema = (0, import_schema_fields.yupObject)({
team_id: schemaFields.teamIdSchema.defined(),
user_id: schemaFields.userIdSchema.defined(),
display_name: schemaFields.teamMemberDisplayNameSchema.nullable().defined(),
profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().defined()
}).defined();
var teamMemberProfilesCrudServerReadSchema = teamMemberProfilesCrudClientReadSchema.concat((0, import_schema_fields.yupObject)({
user: import_users.usersCrudServerReadSchema.defined()
})).defined();
var teamMemberProfilesCrudClientUpdateSchema = (0, import_schema_fields.yupObject)({
display_name: schemaFields.teamMemberDisplayNameSchema.optional(),
profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().optional()
}).defined();
var teamMemberProfilesCrud = (0, import_crud.createCrud)({
clientReadSchema: teamMemberProfilesCrudClientReadSchema,
serverReadSchema: teamMemberProfilesCrudServerReadSchema,
clientUpdateSchema: teamMemberProfilesCrudClientUpdateSchema,
docs: {
clientList: {
summary: "List team members profiles",
description: "List team members profiles. You always need to specify a `team_id` that your are a member of on the client. You can always filter for your own profile by setting `me` as the `user_id` in the path parameters. If you want list all the profiles in a team, you need to have the `$read_members` permission in that team.",
tags: ["Teams"]
},
serverList: {
summary: "List team members profiles",
description: "List team members profiles and filter by team ID and user ID",
tags: ["Teams"]
},
clientRead: {
summary: "Get a team member profile",
description: "Get a team member profile. you can always get your own profile by setting `me` as the `user_id` in the path parameters on the client. If you want to get someone else's profile in a team, you need to have the `$read_members` permission in that team.",
tags: ["Teams"]
},
serverRead: {
summary: "Get a team member profile",
description: "Get a team member profile by user ID",
tags: ["Teams"]
},
clientUpdate: {
summary: "Update your team member profile",
description: "Update your own team member profile. `user_id` must be `me` in the path parameters on the client.",
tags: ["Teams"]
},
serverUpdate: {
summary: "Update a team member profile",
description: "Update a team member profile by user ID",
tags: ["Teams"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamMemberProfilesCrud,
teamMemberProfilesCrudClientReadSchema,
teamMemberProfilesCrudClientUpdateSchema,
teamMemberProfilesCrudServerReadSchema
});
//# sourceMappingURL=team-member-profiles.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/team-member-profiles.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport * as schemaFields from \"../../schema-fields\";\nimport { yupObject } from \"../../schema-fields\";\nimport { usersCrudServerReadSchema } from \"./users\";\n\n\nexport const teamMemberProfilesCrudClientReadSchema = yupObject({\n team_id: schemaFields.teamIdSchema.defined(),\n user_id: schemaFields.userIdSchema.defined(),\n display_name: schemaFields.teamMemberDisplayNameSchema.nullable().defined(),\n profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().defined(),\n}).defined();\n\nexport const teamMemberProfilesCrudServerReadSchema = teamMemberProfilesCrudClientReadSchema.concat(yupObject({\n user: usersCrudServerReadSchema.defined(),\n})).defined();\n\nexport const teamMemberProfilesCrudClientUpdateSchema = yupObject({\n display_name: schemaFields.teamMemberDisplayNameSchema.optional(),\n profile_image_url: schemaFields.teamMemberProfileImageUrlSchema.nullable().optional(),\n}).defined();\n\nexport const teamMemberProfilesCrud = createCrud({\n clientReadSchema: teamMemberProfilesCrudClientReadSchema,\n serverReadSchema: teamMemberProfilesCrudServerReadSchema,\n clientUpdateSchema: teamMemberProfilesCrudClientUpdateSchema,\n docs: {\n clientList: {\n summary: \"List team members profiles\",\n description: \"List team members profiles. You always need to specify a `team_id` that your are a member of on the client. You can always filter for your own profile by setting `me` as the `user_id` in the path parameters. If you want list all the profiles in a team, you need to have the `$read_members` permission in that team.\",\n tags: [\"Teams\"],\n },\n serverList: {\n summary: \"List team members profiles\",\n description: \"List team members profiles and filter by team ID and user ID\",\n tags: [\"Teams\"],\n },\n clientRead: {\n summary: \"Get a team member profile\",\n description: \"Get a team member profile. you can always get your own profile by setting `me` as the `user_id` in the path parameters on the client. If you want to get someone else's profile in a team, you need to have the `$read_members` permission in that team.\",\n tags: [\"Teams\"],\n },\n serverRead: {\n summary: \"Get a team member profile\",\n description: \"Get a team member profile by user ID\",\n tags: [\"Teams\"],\n },\n clientUpdate: {\n summary: \"Update your team member profile\",\n description: \"Update your own team member profile. `user_id` must be `me` in the path parameters on the client.\",\n tags: [\"Teams\"],\n },\n serverUpdate: {\n summary: \"Update a team member profile\",\n description: \"Update a team member profile by user ID\",\n tags: [\"Teams\"],\n },\n },\n});\n\nexport type TeamMemberProfilesCrud = CrudTypeOf<typeof teamMemberProfilesCrud>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,mBAA8B;AAC9B,2BAA0B;AAC1B,mBAA0C;AAGnC,IAAM,6CAAyC,gCAAU;AAAA,EAC9D,SAAsB,0BAAa,QAAQ;AAAA,EAC3C,SAAsB,0BAAa,QAAQ;AAAA,EAC3C,cAA2B,yCAA4B,SAAS,EAAE,QAAQ;AAAA,EAC1E,mBAAgC,6CAAgC,SAAS,EAAE,QAAQ;AACrF,CAAC,EAAE,QAAQ;AAEJ,IAAM,yCAAyC,uCAAuC,WAAO,gCAAU;AAAA,EAC5G,MAAM,uCAA0B,QAAQ;AAC1C,CAAC,CAAC,EAAE,QAAQ;AAEL,IAAM,+CAA2C,gCAAU;AAAA,EAChE,cAA2B,yCAA4B,SAAS;AAAA,EAChE,mBAAgC,6CAAgC,SAAS,EAAE,SAAS;AACtF,CAAC,EAAE,QAAQ;AAEJ,IAAM,6BAAyB,wBAAW;AAAA,EAC/C,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,YAAY;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}

View file

@ -0,0 +1,74 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamMembershipsCrudClientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
declare const teamMembershipsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const teamMembershipsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamMembershipsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
docs: {
serverCreate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamMembershipsCrud = CrudTypeOf<typeof teamMembershipsCrud>;
declare const teamMembershipCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamMembershipDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type TeamMembershipsCrud, teamMembershipCreatedWebhookEvent, teamMembershipDeletedWebhookEvent, teamMembershipsCrud, teamMembershipsCrudClientDeleteSchema, teamMembershipsCrudClientReadSchema, teamMembershipsCrudServerCreateSchema };

View file

@ -0,0 +1,74 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamMembershipsCrudClientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
declare const teamMembershipsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const teamMembershipsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamMembershipsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
docs: {
serverCreate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamMembershipsCrud = CrudTypeOf<typeof teamMembershipsCrud>;
declare const teamMembershipCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamMembershipDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type TeamMembershipsCrud, teamMembershipCreatedWebhookEvent, teamMembershipDeletedWebhookEvent, teamMembershipsCrud, teamMembershipsCrudClientDeleteSchema, teamMembershipsCrudClientReadSchema, teamMembershipsCrudServerCreateSchema };

View file

@ -0,0 +1,90 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/team-memberships.ts
var team_memberships_exports = {};
__export(team_memberships_exports, {
teamMembershipCreatedWebhookEvent: () => teamMembershipCreatedWebhookEvent,
teamMembershipDeletedWebhookEvent: () => teamMembershipDeletedWebhookEvent,
teamMembershipsCrud: () => teamMembershipsCrud,
teamMembershipsCrudClientDeleteSchema: () => teamMembershipsCrudClientDeleteSchema,
teamMembershipsCrudClientReadSchema: () => teamMembershipsCrudClientReadSchema,
teamMembershipsCrudServerCreateSchema: () => teamMembershipsCrudServerCreateSchema
});
module.exports = __toCommonJS(team_memberships_exports);
var import_crud = require("../../crud");
var import_schema_fields = require("../../schema-fields");
var teamMembershipsCrudClientReadSchema = (0, import_schema_fields.yupObject)({
team_id: (0, import_schema_fields.yupString)().defined(),
user_id: (0, import_schema_fields.yupString)().defined()
}).defined();
var teamMembershipsCrudServerCreateSchema = (0, import_schema_fields.yupObject)({}).defined();
var teamMembershipsCrudClientDeleteSchema = (0, import_schema_fields.yupMixed)();
var teamMembershipsCrud = (0, import_crud.createCrud)({
// Client
clientReadSchema: teamMembershipsCrudClientReadSchema,
clientDeleteSchema: teamMembershipsCrudClientDeleteSchema,
// Server
serverCreateSchema: teamMembershipsCrudServerCreateSchema,
docs: {
serverCreate: {
summary: "Add a user to a team",
description: "",
tags: ["Teams"]
},
clientDelete: {
summary: "Remove a user from a team",
description: "All the users are allowed to remove themselves from a team (`user_id=me`). Only the users who have the `$remove_members` permission are allowed to remove other users from a team. `team_id` is must an ID of a team that the user is a member of.",
tags: ["Teams"]
},
serverDelete: {
summary: "Remove a user from a team",
description: "",
tags: ["Teams"]
}
}
});
var teamMembershipCreatedWebhookEvent = {
type: "team_membership.created",
schema: teamMembershipsCrud.server.readSchema,
metadata: {
summary: "Team Membership Created",
description: "This event is triggered when a user is added to a team.",
tags: ["Teams"]
}
};
var teamMembershipDeletedWebhookEvent = {
type: "team_membership.deleted",
schema: teamMembershipsCrud.server.readSchema,
metadata: {
summary: "Team Membership Deleted",
description: "This event is triggered when a user is removed from a team.",
tags: ["Teams"]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamMembershipCreatedWebhookEvent,
teamMembershipDeletedWebhookEvent,
teamMembershipsCrud,
teamMembershipsCrudClientDeleteSchema,
teamMembershipsCrudClientReadSchema,
teamMembershipsCrudServerCreateSchema
});
//# sourceMappingURL=team-memberships.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/interface/crud/team-memberships.ts"],"sourcesContent":["import { CrudTypeOf, createCrud } from \"../../crud\";\nimport { yupMixed, yupObject, yupString } from \"../../schema-fields\";\nimport { WebhookEvent } from \"../webhooks\";\n\nexport const teamMembershipsCrudClientReadSchema = yupObject({\n team_id: yupString().defined(),\n user_id: yupString().defined(),\n}).defined();\nexport const teamMembershipsCrudServerCreateSchema = yupObject({}).defined();\nexport const teamMembershipsCrudClientDeleteSchema = yupMixed();\n\nexport const teamMembershipsCrud = createCrud({\n // Client\n clientReadSchema: teamMembershipsCrudClientReadSchema,\n clientDeleteSchema: teamMembershipsCrudClientDeleteSchema,\n // Server\n serverCreateSchema: teamMembershipsCrudServerCreateSchema,\n docs: {\n serverCreate: {\n summary: \"Add a user to a team\",\n description: \"\",\n tags: [\"Teams\"],\n },\n clientDelete: {\n summary: \"Remove a user from a team\",\n description: \"All the users are allowed to remove themselves from a team (`user_id=me`). Only the users who have the `$remove_members` permission are allowed to remove other users from a team. `team_id` is must an ID of a team that the user is a member of.\",\n tags: [\"Teams\"],\n },\n serverDelete: {\n summary: \"Remove a user from a team\",\n description: \"\",\n tags: [\"Teams\"],\n },\n },\n});\nexport type TeamMembershipsCrud = CrudTypeOf<typeof teamMembershipsCrud>;\n\nexport const teamMembershipCreatedWebhookEvent = {\n type: \"team_membership.created\",\n schema: teamMembershipsCrud.server.readSchema,\n metadata: {\n summary: \"Team Membership Created\",\n description: \"This event is triggered when a user is added to a team.\",\n tags: [\"Teams\"],\n },\n} satisfies WebhookEvent<typeof teamMembershipsCrud.server.readSchema>;\n\nexport const teamMembershipDeletedWebhookEvent = {\n type: \"team_membership.deleted\",\n schema: teamMembershipsCrud.server.readSchema,\n metadata: {\n summary: \"Team Membership Deleted\",\n description: \"This event is triggered when a user is removed from a team.\",\n tags: [\"Teams\"],\n },\n} satisfies WebhookEvent<typeof teamMembershipsCrud.server.readSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,2BAA+C;AAGxC,IAAM,0CAAsC,gCAAU;AAAA,EAC3D,aAAS,gCAAU,EAAE,QAAQ;AAAA,EAC7B,aAAS,gCAAU,EAAE,QAAQ;AAC/B,CAAC,EAAE,QAAQ;AACJ,IAAM,4CAAwC,gCAAU,CAAC,CAAC,EAAE,QAAQ;AACpE,IAAM,4CAAwC,+BAAS;AAEvD,IAAM,0BAAsB,wBAAW;AAAA;AAAA,EAE5C,kBAAkB;AAAA,EAClB,oBAAoB;AAAA;AAAA,EAEpB,oBAAoB;AAAA,EACpB,MAAM;AAAA,IACJ,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAGM,IAAM,oCAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ,oBAAoB,OAAO;AAAA,EACnC,UAAU;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM,CAAC,OAAO;AAAA,EAChB;AACF;AAEO,IAAM,oCAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ,oBAAoB,OAAO;AAAA,EACnC,UAAU;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,IACb,MAAM,CAAC,OAAO;AAAA,EAChB;AACF;","names":[]}

View file

@ -0,0 +1,168 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamPermissionsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
declare const teamPermissionsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const teamPermissionsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamPermissionsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamPermissionsCrud = CrudTypeOf<typeof teamPermissionsCrud>;
declare const teamPermissionCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamPermissionDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamPermissionDefinitionsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamPermissionDefinitionsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
summary: string;
description: string;
tags: string[];
};
adminCreate: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamPermissionDefinitionsCrud = CrudTypeOf<typeof teamPermissionDefinitionsCrud>;
export { type TeamPermissionDefinitionsCrud, type TeamPermissionsCrud, teamPermissionCreatedWebhookEvent, teamPermissionDefinitionsCrud, teamPermissionDefinitionsCrudAdminCreateSchema, teamPermissionDefinitionsCrudAdminDeleteSchema, teamPermissionDefinitionsCrudAdminReadSchema, teamPermissionDefinitionsCrudAdminUpdateSchema, teamPermissionDeletedWebhookEvent, teamPermissionsCrud, teamPermissionsCrudClientReadSchema, teamPermissionsCrudServerCreateSchema, teamPermissionsCrudServerDeleteSchema };

View file

@ -0,0 +1,168 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamPermissionsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
declare const teamPermissionsCrudServerCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
declare const teamPermissionsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamPermissionsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamPermissionsCrud = CrudTypeOf<typeof teamPermissionsCrud>;
declare const teamPermissionCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamPermissionDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamPermissionDefinitionsCrudAdminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
declare const teamPermissionDefinitionsCrudAdminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamPermissionDefinitionsCrud: CrudSchemaFromOptions<{
adminReadSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[];
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminCreateSchema: yup.ObjectSchema<{
id: string;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminUpdateSchema: yup.ObjectSchema<{
id: string | undefined;
description: string | undefined;
contained_permission_ids: string[] | undefined;
}, yup.AnyObject, {
id: undefined;
description: undefined;
contained_permission_ids: undefined;
}, "">;
adminDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
adminList: {
summary: string;
description: string;
tags: string[];
};
adminCreate: {
summary: string;
description: string;
tags: string[];
};
adminUpdate: {
summary: string;
description: string;
tags: string[];
};
adminDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamPermissionDefinitionsCrud = CrudTypeOf<typeof teamPermissionDefinitionsCrud>;
export { type TeamPermissionDefinitionsCrud, type TeamPermissionsCrud, teamPermissionCreatedWebhookEvent, teamPermissionDefinitionsCrud, teamPermissionDefinitionsCrudAdminCreateSchema, teamPermissionDefinitionsCrudAdminDeleteSchema, teamPermissionDefinitionsCrudAdminReadSchema, teamPermissionDefinitionsCrudAdminUpdateSchema, teamPermissionDeletedWebhookEvent, teamPermissionsCrud, teamPermissionsCrudClientReadSchema, teamPermissionsCrudServerCreateSchema, teamPermissionsCrudServerDeleteSchema };

View file

@ -0,0 +1,159 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/team-permissions.ts
var team_permissions_exports = {};
__export(team_permissions_exports, {
teamPermissionCreatedWebhookEvent: () => teamPermissionCreatedWebhookEvent,
teamPermissionDefinitionsCrud: () => teamPermissionDefinitionsCrud,
teamPermissionDefinitionsCrudAdminCreateSchema: () => teamPermissionDefinitionsCrudAdminCreateSchema,
teamPermissionDefinitionsCrudAdminDeleteSchema: () => teamPermissionDefinitionsCrudAdminDeleteSchema,
teamPermissionDefinitionsCrudAdminReadSchema: () => teamPermissionDefinitionsCrudAdminReadSchema,
teamPermissionDefinitionsCrudAdminUpdateSchema: () => teamPermissionDefinitionsCrudAdminUpdateSchema,
teamPermissionDeletedWebhookEvent: () => teamPermissionDeletedWebhookEvent,
teamPermissionsCrud: () => teamPermissionsCrud,
teamPermissionsCrudClientReadSchema: () => teamPermissionsCrudClientReadSchema,
teamPermissionsCrudServerCreateSchema: () => teamPermissionsCrudServerCreateSchema,
teamPermissionsCrudServerDeleteSchema: () => teamPermissionsCrudServerDeleteSchema
});
module.exports = __toCommonJS(team_permissions_exports);
var import_crud = require("../../crud");
var schemaFields = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var teamPermissionsCrudClientReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.permissionDefinitionIdSchema.defined(),
user_id: schemaFields.userIdSchema.defined(),
team_id: schemaFields.teamIdSchema.defined()
}).defined();
var teamPermissionsCrudServerCreateSchema = (0, import_schema_fields.yupObject)({}).defined();
var teamPermissionsCrudServerDeleteSchema = (0, import_schema_fields.yupMixed)();
var teamPermissionsCrud = (0, import_crud.createCrud)({
clientReadSchema: teamPermissionsCrudClientReadSchema,
serverCreateSchema: teamPermissionsCrudServerCreateSchema,
serverDeleteSchema: teamPermissionsCrudServerDeleteSchema,
docs: {
clientList: {
summary: "List team permissions",
description: "List team permissions of the current user. `user_id=me` must be set for client requests. Note that this might contain the permissions with the same permission ID across different teams. `(team_id, user_id, permission_id)` together uniquely identify a permission.",
tags: ["Permissions"]
},
serverList: {
summary: "List team permissions of a user",
description: "Query and filter the permission with `team_id`, `user_id`, and `permission_id`. Note that this might contain the permissions with the same permission ID across different teams and users. `(team_id, user_id, permission_id)` together uniquely identify a permission.",
tags: ["Permissions"]
},
serverCreate: {
summary: "Grant a team permission to a user",
description: "Grant a team permission to a user (the team permission must be created first on the Stack dashboard)",
tags: ["Permissions"]
},
serverDelete: {
summary: "Revoke a team permission from a user",
description: "Revoke a team permission from a user",
tags: ["Permissions"]
}
}
});
var teamPermissionCreatedWebhookEvent = {
type: "team_permission.created",
schema: teamPermissionsCrud.server.readSchema,
metadata: {
summary: "Team Permission Created",
description: "This event is triggered when a team permission is created.",
tags: ["Teams"]
}
};
var teamPermissionDeletedWebhookEvent = {
type: "team_permission.deleted",
schema: teamPermissionsCrud.server.readSchema,
metadata: {
summary: "Team Permission Deleted",
description: "This event is triggered when a team permission is deleted.",
tags: ["Teams"]
}
};
var teamPermissionDefinitionsCrudAdminReadSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.permissionDefinitionIdSchema.defined(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.defined()
}).defined();
var teamPermissionDefinitionsCrudAdminCreateSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.customPermissionDefinitionIdSchema.defined(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional()
}).defined();
var teamPermissionDefinitionsCrudAdminUpdateSchema = (0, import_schema_fields.yupObject)({
id: schemaFields.customPermissionDefinitionIdSchema.optional(),
description: schemaFields.teamPermissionDescriptionSchema.optional(),
contained_permission_ids: schemaFields.containedPermissionIdsSchema.optional()
}).defined();
var teamPermissionDefinitionsCrudAdminDeleteSchema = (0, import_schema_fields.yupMixed)();
var teamPermissionDefinitionsCrud = (0, import_crud.createCrud)({
adminReadSchema: teamPermissionDefinitionsCrudAdminReadSchema,
adminCreateSchema: teamPermissionDefinitionsCrudAdminCreateSchema,
adminUpdateSchema: teamPermissionDefinitionsCrudAdminUpdateSchema,
adminDeleteSchema: teamPermissionDefinitionsCrudAdminDeleteSchema,
docs: {
adminList: {
summary: "List team permission definitions",
description: "Query and filter the permission with team_id, user_id, and permission_id (the equivalent of listing permissions on the Stack dashboard)",
tags: ["Permissions"]
},
adminCreate: {
summary: "Create a new team permission definition",
description: "Create a new permission definition (the equivalent of creating a new permission on the Stack dashboard)",
tags: ["Permissions"]
},
adminUpdate: {
summary: "Update a team permission definition",
description: "Update a permission definition (the equivalent of updating a permission on the Stack dashboard)",
tags: ["Permissions"]
},
adminDelete: {
summary: "Delete a team permission definition",
description: "Delete a permission definition (the equivalent of deleting a permission on the Stack dashboard)",
tags: ["Permissions"]
}
}
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamPermissionCreatedWebhookEvent,
teamPermissionDefinitionsCrud,
teamPermissionDefinitionsCrudAdminCreateSchema,
teamPermissionDefinitionsCrudAdminDeleteSchema,
teamPermissionDefinitionsCrudAdminReadSchema,
teamPermissionDefinitionsCrudAdminUpdateSchema,
teamPermissionDeletedWebhookEvent,
teamPermissionsCrud,
teamPermissionsCrudClientReadSchema,
teamPermissionsCrudServerCreateSchema,
teamPermissionsCrudServerDeleteSchema
});
//# sourceMappingURL=team-permissions.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,298 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const teamsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
}, "">;
declare const teamsCrudServerReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
declare const teamsCrudClientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
}, "">;
declare const teamsCrudServerUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
}, "">;
declare const teamsCrudClientCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
creator_user_id: undefined;
}, "">;
declare const teamsCrudServerCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
creator_user_id: undefined;
}, "">;
declare const teamsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
creator_user_id: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
creator_user_id: undefined;
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
clientCreate: {
summary: string;
description: string;
tags: string[];
};
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverRead: {
summary: string;
description: string;
tags: string[];
};
serverUpdate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamsCrud = CrudTypeOf<typeof teamsCrud>;
declare const teamCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamUpdatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
}, yup.AnyObject, {
id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type TeamsCrud, teamCreatedWebhookEvent, teamDeletedWebhookEvent, teamUpdatedWebhookEvent, teamsCrud, teamsCrudClientCreateSchema, teamsCrudClientDeleteSchema, teamsCrudClientReadSchema, teamsCrudClientUpdateSchema, teamsCrudServerCreateSchema, teamsCrudServerDeleteSchema, teamsCrudServerReadSchema, teamsCrudServerUpdateSchema };

View file

@ -0,0 +1,298 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const teamsCrudClientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
}, "">;
declare const teamsCrudServerReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
declare const teamsCrudClientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
}, "">;
declare const teamsCrudServerUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
}, "">;
declare const teamsCrudClientCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
creator_user_id: undefined;
}, "">;
declare const teamsCrudServerCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
creator_user_id: undefined;
}, "">;
declare const teamsCrudClientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamsCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const teamsCrud: CrudSchemaFromOptions<{
clientReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
}, "">;
clientUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
}, "">;
clientCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
creator_user_id: undefined;
}, "">;
clientDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
serverReadSchema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
} & {
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
display_name: string;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
} & {
display_name: string;
creator_user_id: string | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
creator_user_id: undefined;
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
clientList: {
summary: string;
description: string;
tags: string[];
};
clientCreate: {
summary: string;
description: string;
tags: string[];
};
clientRead: {
summary: string;
description: string;
tags: string[];
};
clientUpdate: {
summary: string;
description: string;
tags: string[];
};
clientDelete: {
summary: string;
description: string;
tags: string[];
};
serverCreate: {
summary: string;
description: string;
tags: string[];
};
serverList: {
summary: string;
description: string;
tags: string[];
};
serverRead: {
summary: string;
description: string;
tags: string[];
};
serverUpdate: {
summary: string;
description: string;
tags: string[];
};
serverDelete: {
summary: string;
description: string;
tags: string[];
};
};
}>;
type TeamsCrud = CrudTypeOf<typeof teamsCrud>;
declare const teamCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamUpdatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const teamDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
}, yup.AnyObject, {
id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type TeamsCrud, teamCreatedWebhookEvent, teamDeletedWebhookEvent, teamUpdatedWebhookEvent, teamsCrud, teamsCrudClientCreateSchema, teamsCrudClientDeleteSchema, teamsCrudClientReadSchema, teamsCrudClientUpdateSchema, teamsCrudServerCreateSchema, teamsCrudServerDeleteSchema, teamsCrudServerReadSchema, teamsCrudServerUpdateSchema };

View file

@ -0,0 +1,189 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/teams.ts
var teams_exports = {};
__export(teams_exports, {
teamCreatedWebhookEvent: () => teamCreatedWebhookEvent,
teamDeletedWebhookEvent: () => teamDeletedWebhookEvent,
teamUpdatedWebhookEvent: () => teamUpdatedWebhookEvent,
teamsCrud: () => teamsCrud,
teamsCrudClientCreateSchema: () => teamsCrudClientCreateSchema,
teamsCrudClientDeleteSchema: () => teamsCrudClientDeleteSchema,
teamsCrudClientReadSchema: () => teamsCrudClientReadSchema,
teamsCrudClientUpdateSchema: () => teamsCrudClientUpdateSchema,
teamsCrudServerCreateSchema: () => teamsCrudServerCreateSchema,
teamsCrudServerDeleteSchema: () => teamsCrudServerDeleteSchema,
teamsCrudServerReadSchema: () => teamsCrudServerReadSchema,
teamsCrudServerUpdateSchema: () => teamsCrudServerUpdateSchema
});
module.exports = __toCommonJS(teams_exports);
var import_crud = require("../../crud");
var fieldSchema = __toESM(require("../../schema-fields"));
var import_schema_fields = require("../../schema-fields");
var teamsCrudClientReadSchema = (0, import_schema_fields.yupObject)({
id: fieldSchema.teamIdSchema.defined(),
display_name: fieldSchema.teamDisplayNameSchema.defined(),
profile_image_url: fieldSchema.teamProfileImageUrlSchema.nullable().defined(),
client_metadata: fieldSchema.teamClientMetadataSchema.optional(),
client_read_only_metadata: fieldSchema.teamClientReadOnlyMetadataSchema.optional()
}).defined();
var teamsCrudServerReadSchema = teamsCrudClientReadSchema.concat((0, import_schema_fields.yupObject)({
created_at_millis: fieldSchema.teamCreatedAtMillisSchema.defined(),
server_metadata: fieldSchema.teamServerMetadataSchema.optional()
}).defined());
var teamsCrudClientUpdateSchema = (0, import_schema_fields.yupObject)({
display_name: fieldSchema.teamDisplayNameSchema.optional(),
profile_image_url: fieldSchema.teamProfileImageUrlSchema.nullable().optional(),
client_metadata: fieldSchema.teamClientMetadataSchema.optional()
}).defined();
var teamsCrudServerUpdateSchema = teamsCrudClientUpdateSchema.concat((0, import_schema_fields.yupObject)({
client_read_only_metadata: fieldSchema.teamClientReadOnlyMetadataSchema.optional(),
server_metadata: fieldSchema.teamServerMetadataSchema.optional()
}).defined());
var teamsCrudClientCreateSchema = teamsCrudClientUpdateSchema.concat((0, import_schema_fields.yupObject)({
display_name: fieldSchema.teamDisplayNameSchema.defined(),
creator_user_id: fieldSchema.teamCreatorUserIdSchema.optional()
}).defined());
var teamsCrudServerCreateSchema = teamsCrudServerUpdateSchema.concat((0, import_schema_fields.yupObject)({
display_name: fieldSchema.teamDisplayNameSchema.defined(),
creator_user_id: fieldSchema.teamCreatorUserIdSchema.optional()
}).defined());
var teamsCrudClientDeleteSchema = fieldSchema.yupMixed();
var teamsCrudServerDeleteSchema = teamsCrudClientDeleteSchema;
var teamsCrud = (0, import_crud.createCrud)({
// Client
clientReadSchema: teamsCrudClientReadSchema,
clientUpdateSchema: teamsCrudClientUpdateSchema,
clientCreateSchema: teamsCrudClientCreateSchema,
clientDeleteSchema: teamsCrudClientDeleteSchema,
// Server
serverReadSchema: teamsCrudServerReadSchema,
serverUpdateSchema: teamsCrudServerUpdateSchema,
serverCreateSchema: teamsCrudServerCreateSchema,
serverDeleteSchema: teamsCrudServerDeleteSchema,
docs: {
clientList: {
summary: "List teams",
description: "List all the teams that the current user is a member of. `user_id=me` must be passed in the query parameters.",
tags: ["Teams"]
},
clientCreate: {
summary: "Create a team",
description: "Create a new team and optionally add the current user as a member.",
tags: ["Teams"]
},
clientRead: {
summary: "Get a team",
description: "Get a team that the current user is a member of.",
tags: ["Teams"]
},
clientUpdate: {
summary: "Update a team",
description: "Update the team information. Only allowed if the current user is a member of the team and has the `$update_team` permission.",
tags: ["Teams"]
},
clientDelete: {
summary: "Delete a team",
description: "Delete a team. Only allowed if the current user is a member of the team and has the `$delete_team` permission.",
tags: ["Teams"]
},
serverCreate: {
summary: "Create a team",
description: "Create a new team and optionally add the current user as a member.",
tags: ["Teams"]
},
serverList: {
summary: "List teams",
description: "List all the teams in the project.",
tags: ["Teams"]
},
serverRead: {
summary: "Get a team",
description: "Get a team by ID.",
tags: ["Teams"]
},
serverUpdate: {
summary: "Update a team",
description: "Update the team information by ID.",
tags: ["Teams"]
},
serverDelete: {
summary: "Delete a team",
description: "Delete a team by ID.",
tags: ["Teams"]
}
}
});
var teamCreatedWebhookEvent = {
type: "team.created",
schema: teamsCrud.server.readSchema,
metadata: {
summary: "Team Created",
description: "This event is triggered when a team is created.",
tags: ["Teams"]
}
};
var teamUpdatedWebhookEvent = {
type: "team.updated",
schema: teamsCrud.server.readSchema,
metadata: {
summary: "Team Updated",
description: "This event is triggered when a team is updated.",
tags: ["Teams"]
}
};
var webhookTeamDeletedSchema = fieldSchema.yupObject({
id: fieldSchema.userIdSchema.defined()
}).defined();
var teamDeletedWebhookEvent = {
type: "team.deleted",
schema: webhookTeamDeletedSchema,
metadata: {
summary: "Team Deleted",
description: "This event is triggered when a team is deleted.",
tags: ["Teams"]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
teamCreatedWebhookEvent,
teamDeletedWebhookEvent,
teamUpdatedWebhookEvent,
teamsCrud,
teamsCrudClientCreateSchema,
teamsCrudClientDeleteSchema,
teamsCrudClientReadSchema,
teamsCrudClientUpdateSchema,
teamsCrudServerCreateSchema,
teamsCrudServerDeleteSchema,
teamsCrudServerReadSchema,
teamsCrudServerUpdateSchema
});
//# sourceMappingURL=teams.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,469 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.mjs';
import * as yup from 'yup';
import '../../utils/types.mjs';
declare const usersCrudServerUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
declare const usersCrudServerReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
declare const usersCrudServerCreateSchema: yup.ObjectSchema<{
password: string | null | undefined;
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
is_anonymous: boolean | undefined;
} & {
oauth_providers: {
id: string;
account_id: string;
email: string | null;
}[] | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
}, "">;
declare const usersCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const usersCrud: CrudSchemaFromOptions<{
serverReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
password: string | null | undefined;
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
is_anonymous: boolean | undefined;
} & {
oauth_providers: {
id: string;
account_id: string;
email: string | null;
}[] | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
serverCreate: {
tags: string[];
summary: string;
description: string;
};
serverRead: {
tags: string[];
summary: string;
description: string;
};
serverUpdate: {
tags: string[];
summary: string;
description: string;
};
serverDelete: {
tags: string[];
summary: string;
description: string;
};
serverList: {
tags: string[];
summary: string;
description: string;
};
};
}>;
type UsersCrud = CrudTypeOf<typeof usersCrud>;
declare const userCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const userUpdatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const userDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
teams: {
id: string;
}[];
}, yup.AnyObject, {
id: undefined;
teams: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type UsersCrud, userCreatedWebhookEvent, userDeletedWebhookEvent, userUpdatedWebhookEvent, usersCrud, usersCrudServerCreateSchema, usersCrudServerDeleteSchema, usersCrudServerReadSchema, usersCrudServerUpdateSchema };

View file

@ -0,0 +1,469 @@
import { CrudSchemaFromOptions, CrudTypeOf } from '../../crud.js';
import * as yup from 'yup';
import '../../utils/types.js';
declare const usersCrudServerUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
declare const usersCrudServerReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
declare const usersCrudServerCreateSchema: yup.ObjectSchema<{
password: string | null | undefined;
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
is_anonymous: boolean | undefined;
} & {
oauth_providers: {
id: string;
account_id: string;
email: string | null;
}[] | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
}, "">;
declare const usersCrudServerDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
declare const usersCrud: CrudSchemaFromOptions<{
serverReadSchema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
serverUpdateSchema: yup.ObjectSchema<{
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password: string | null | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
selected_team_id: string | null | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
}, "">;
serverCreateSchema: yup.ObjectSchema<{
password: string | null | undefined;
display_name: string | null | undefined;
profile_image_url: string | null | undefined;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
server_metadata: {} | null | undefined;
primary_email: string | null | undefined;
primary_email_verified: boolean | undefined;
primary_email_auth_enabled: boolean | undefined;
passkey_auth_enabled: boolean | undefined;
password_hash: string | undefined;
otp_auth_enabled: boolean | undefined;
totp_secret_base64: string | null | undefined;
is_anonymous: boolean | undefined;
} & {
oauth_providers: {
id: string;
account_id: string;
email: string | null;
}[] | undefined;
is_anonymous: boolean | undefined;
}, yup.AnyObject, {
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
passkey_auth_enabled: undefined;
password: undefined;
password_hash: undefined;
otp_auth_enabled: undefined;
totp_secret_base64: undefined;
selected_team_id: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
}, "">;
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
docs: {
serverCreate: {
tags: string[];
summary: string;
description: string;
};
serverRead: {
tags: string[];
summary: string;
description: string;
};
serverUpdate: {
tags: string[];
summary: string;
description: string;
};
serverDelete: {
tags: string[];
summary: string;
description: string;
};
serverList: {
tags: string[];
summary: string;
description: string;
};
};
}>;
type UsersCrud = CrudTypeOf<typeof usersCrud>;
declare const userCreatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const userUpdatedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
declare const userDeletedWebhookEvent: {
type: string;
schema: yup.ObjectSchema<{
id: string;
teams: {
id: string;
}[];
}, yup.AnyObject, {
id: undefined;
teams: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
};
export { type UsersCrud, userCreatedWebhookEvent, userDeletedWebhookEvent, userUpdatedWebhookEvent, usersCrud, usersCrudServerCreateSchema, usersCrudServerDeleteSchema, usersCrudServerReadSchema, usersCrudServerUpdateSchema };

View file

@ -0,0 +1,181 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/crud/users.ts
var users_exports = {};
__export(users_exports, {
userCreatedWebhookEvent: () => userCreatedWebhookEvent,
userDeletedWebhookEvent: () => userDeletedWebhookEvent,
userUpdatedWebhookEvent: () => userUpdatedWebhookEvent,
usersCrud: () => usersCrud,
usersCrudServerCreateSchema: () => usersCrudServerCreateSchema,
usersCrudServerDeleteSchema: () => usersCrudServerDeleteSchema,
usersCrudServerReadSchema: () => usersCrudServerReadSchema,
usersCrudServerUpdateSchema: () => usersCrudServerUpdateSchema
});
module.exports = __toCommonJS(users_exports);
var import_crud = require("../../crud");
var fieldSchema = __toESM(require("../../schema-fields"));
var import_teams = require("./teams");
var usersCrudServerUpdateSchema = fieldSchema.yupObject({
display_name: fieldSchema.userDisplayNameSchema.optional(),
profile_image_url: fieldSchema.profileImageUrlSchema.nullable().optional(),
client_metadata: fieldSchema.userClientMetadataSchema.optional(),
client_read_only_metadata: fieldSchema.userClientReadOnlyMetadataSchema.optional(),
server_metadata: fieldSchema.userServerMetadataSchema.optional(),
primary_email: fieldSchema.primaryEmailSchema.nullable().optional().nonEmpty(),
primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.optional(),
primary_email_auth_enabled: fieldSchema.primaryEmailAuthEnabledSchema.optional(),
passkey_auth_enabled: fieldSchema.userOtpAuthEnabledSchema.optional(),
password: fieldSchema.userPasswordMutationSchema.optional(),
password_hash: fieldSchema.userPasswordHashMutationSchema.optional(),
otp_auth_enabled: fieldSchema.userOtpAuthEnabledMutationSchema.optional(),
totp_secret_base64: fieldSchema.userTotpSecretMutationSchema.optional(),
selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().optional(),
is_anonymous: fieldSchema.yupBoolean().oneOf([false]).optional()
}).defined();
var usersCrudServerReadSchema = fieldSchema.yupObject({
id: fieldSchema.userIdSchema.defined(),
primary_email: fieldSchema.primaryEmailSchema.nullable().defined(),
primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.defined(),
primary_email_auth_enabled: fieldSchema.primaryEmailAuthEnabledSchema.defined(),
display_name: fieldSchema.userDisplayNameSchema.nullable().defined(),
selected_team: import_teams.teamsCrudServerReadSchema.nullable().defined(),
selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().defined(),
profile_image_url: fieldSchema.profileImageUrlSchema.nullable().defined(),
signed_up_at_millis: fieldSchema.signedUpAtMillisSchema.defined(),
has_password: fieldSchema.userHasPasswordSchema.defined(),
otp_auth_enabled: fieldSchema.userOtpAuthEnabledSchema.defined(),
passkey_auth_enabled: fieldSchema.userOtpAuthEnabledSchema.defined(),
client_metadata: fieldSchema.userClientMetadataSchema,
client_read_only_metadata: fieldSchema.userClientReadOnlyMetadataSchema,
server_metadata: fieldSchema.userServerMetadataSchema,
last_active_at_millis: fieldSchema.userLastActiveAtMillisSchema.nonNullable().defined(),
is_anonymous: fieldSchema.yupBoolean().defined(),
oauth_providers: fieldSchema.yupArray(fieldSchema.yupObject({
id: fieldSchema.yupString().defined(),
account_id: fieldSchema.yupString().defined(),
email: fieldSchema.yupString().nullable()
}).defined()).defined().meta({ openapiField: { hidden: true } }),
/**
* @deprecated
*/
auth_with_email: fieldSchema.yupBoolean().defined().meta({ openapiField: { hidden: true, description: "Whether the user can authenticate with their primary e-mail. If set to true, the user can log-in with credentials and/or magic link, if enabled in the project settings.", exampleValue: true } }),
/**
* @deprecated
*/
requires_totp_mfa: fieldSchema.yupBoolean().defined().meta({ openapiField: { hidden: true, description: "Whether the user is required to use TOTP MFA to sign in", exampleValue: false } })
}).defined();
var usersCrudServerCreateSchema = usersCrudServerUpdateSchema.omit(["selected_team_id"]).concat(fieldSchema.yupObject({
oauth_providers: fieldSchema.yupArray(fieldSchema.yupObject({
id: fieldSchema.yupString().defined(),
account_id: fieldSchema.yupString().defined(),
email: fieldSchema.yupString().nullable().defined().default(null)
}).defined()).optional().meta({ openapiField: { hidden: true } }),
is_anonymous: fieldSchema.yupBoolean().optional()
}).defined());
var usersCrudServerDeleteSchema = fieldSchema.yupMixed();
var usersCrud = (0, import_crud.createCrud)({
serverReadSchema: usersCrudServerReadSchema,
serverUpdateSchema: usersCrudServerUpdateSchema,
serverCreateSchema: usersCrudServerCreateSchema,
serverDeleteSchema: usersCrudServerDeleteSchema,
docs: {
serverCreate: {
tags: ["Users"],
summary: "Create user",
description: "Creates a new user. E-mail authentication is always enabled, and no password is set, meaning the only way to authenticate the newly created user is through magic link."
},
serverRead: {
tags: ["Users"],
summary: "Get user",
description: "Gets a user by user ID."
},
serverUpdate: {
tags: ["Users"],
summary: "Update user",
description: "Updates a user. Only the values provided will be updated."
},
serverDelete: {
tags: ["Users"],
summary: "Delete user",
description: "Deletes a user. Use this with caution."
},
serverList: {
tags: ["Users"],
summary: "List users",
description: "Lists all the users in the project."
}
}
});
var userCreatedWebhookEvent = {
type: "user.created",
schema: usersCrud.server.readSchema,
metadata: {
summary: "User Created",
description: "This event is triggered when a user is created.",
tags: ["Users"]
}
};
var userUpdatedWebhookEvent = {
type: "user.updated",
schema: usersCrud.server.readSchema,
metadata: {
summary: "User Updated",
description: "This event is triggered when a user is updated.",
tags: ["Users"]
}
};
var webhookUserDeletedSchema = fieldSchema.yupObject({
id: fieldSchema.userIdSchema.defined(),
teams: fieldSchema.yupArray(fieldSchema.yupObject({
id: fieldSchema.yupString().defined()
})).defined()
}).defined();
var userDeletedWebhookEvent = {
type: "user.deleted",
schema: webhookUserDeletedSchema,
metadata: {
summary: "User Deleted",
description: "This event is triggered when a user is deleted.",
tags: ["Users"]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
userCreatedWebhookEvent,
userDeletedWebhookEvent,
userUpdatedWebhookEvent,
usersCrud,
usersCrudServerCreateSchema,
usersCrudServerDeleteSchema,
usersCrudServerReadSchema,
usersCrudServerUpdateSchema
});
//# sourceMappingURL=users.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,130 @@
import { KnownErrors } from '../known-errors.mjs';
import { InternalSession, AccessToken, RefreshToken } from '../sessions.mjs';
import { Result } from '../utils/results.mjs';
import { ClientInterfaceOptions, StackClientInterface } from './clientInterface.mjs';
import { ContactChannelsCrud } from './crud/contact-channels.mjs';
import { CurrentUserCrud } from './crud/current-user.mjs';
import { ConnectedAccountAccessTokenCrud } from './crud/oauth.mjs';
import { ProjectPermissionsCrud } from './crud/project-permissions.mjs';
import { SessionsCrud } from './crud/sessions.mjs';
import { TeamInvitationCrud } from './crud/team-invitation.mjs';
import { TeamMemberProfilesCrud } from './crud/team-member-profiles.mjs';
import { TeamMembershipsCrud } from './crud/team-memberships.mjs';
import { TeamPermissionsCrud } from './crud/team-permissions.mjs';
import { TeamsCrud } from './crud/teams.mjs';
import { UsersCrud } from './crud/users.mjs';
import '../utils/errors.mjs';
import '../utils/json.mjs';
import 'jose';
import 'yup';
import '@simplewebauthn/types';
import './crud/project-api-keys.mjs';
import '../crud.mjs';
import '../utils/types.mjs';
import './crud/projects.mjs';
type ServerAuthApplicationOptions = (ClientInterfaceOptions & ({
readonly secretServerKey: string;
} | {
readonly projectOwnerSession: InternalSession;
}));
declare class StackServerInterface extends StackClientInterface {
options: ServerAuthApplicationOptions;
constructor(options: ServerAuthApplicationOptions);
protected sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "server" | "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
protected sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise<Result<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}, InstanceType<E>>>;
createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']>;
getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null>;
getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>>;
listServerTeamInvitations(options: {
teamId: string;
}): Promise<TeamInvitationCrud['Server']['Read'][]>;
revokeServerTeamInvitation(invitationId: string, teamId: string): Promise<void>;
listServerTeamMemberProfiles(options: {
teamId: string;
}): Promise<TeamMemberProfilesCrud['Server']['Read'][]>;
getServerTeamMemberProfile(options: {
teamId: string;
userId: string;
}): Promise<TeamMemberProfilesCrud['Client']['Read']>;
listServerTeamPermissions(options: {
userId?: string;
teamId?: string;
recursive: boolean;
}, session: InternalSession | null): Promise<TeamPermissionsCrud['Server']['Read'][]>;
listServerProjectPermissions(options: {
userId?: string;
recursive: boolean;
}, session: InternalSession | null): Promise<ProjectPermissionsCrud['Server']['Read'][]>;
listServerUsers(options: {
cursor?: string;
limit?: number;
orderBy?: 'signedUpAt';
desc?: boolean;
query?: string;
}): Promise<UsersCrud['Server']['List']>;
listServerTeams(options?: {
userId?: string;
}): Promise<TeamsCrud['Server']['Read'][]>;
getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']>;
listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]>;
createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']>;
updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']>;
deleteServerTeam(teamId: string): Promise<void>;
addServerUserToTeam(options: {
userId: string;
teamId: string;
}): Promise<TeamMembershipsCrud['Server']['Read']>;
removeServerUserFromTeam(options: {
userId: string;
teamId: string;
}): Promise<void>;
updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']>;
createServerProviderAccessToken(userId: string, provider: string, scope: string): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']>;
createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{
accessToken: string;
refreshToken: string;
}>;
leaveServerTeam(options: {
teamId: string;
userId: string;
}): Promise<void>;
updateServerTeamMemberProfile(options: {
teamId: string;
userId: string;
profile: TeamMemberProfilesCrud['Server']['Update'];
}): Promise<void>;
grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise<void>;
grantServerProjectPermission(userId: string, permissionId: string): Promise<void>;
revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise<void>;
revokeServerProjectPermission(userId: string, permissionId: string): Promise<void>;
deleteServerUser(userId: string): Promise<void>;
createServerContactChannel(data: ContactChannelsCrud['Server']['Create']): Promise<ContactChannelsCrud['Server']['Read']>;
updateServerContactChannel(userId: string, contactChannelId: string, data: ContactChannelsCrud['Server']['Update']): Promise<ContactChannelsCrud['Server']['Read']>;
deleteServerContactChannel(userId: string, contactChannelId: string): Promise<void>;
listServerContactChannels(userId: string): Promise<ContactChannelsCrud['Server']['Read'][]>;
sendServerContactChannelVerificationEmail(userId: string, contactChannelId: string, callbackUrl: string): Promise<void>;
listServerSessions(userId: string): Promise<SessionsCrud['Server']['Read'][]>;
deleteServerSession(sessionId: string): Promise<void>;
sendServerTeamInvitation(options: {
email: string;
teamId: string;
callbackUrl: string;
}): Promise<void>;
updatePassword(options: {
oldPassword: string;
newPassword: string;
}): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
}
export { type ServerAuthApplicationOptions, StackServerInterface };

View file

@ -0,0 +1,130 @@
import { KnownErrors } from '../known-errors.js';
import { InternalSession, AccessToken, RefreshToken } from '../sessions.js';
import { Result } from '../utils/results.js';
import { ClientInterfaceOptions, StackClientInterface } from './clientInterface.js';
import { ContactChannelsCrud } from './crud/contact-channels.js';
import { CurrentUserCrud } from './crud/current-user.js';
import { ConnectedAccountAccessTokenCrud } from './crud/oauth.js';
import { ProjectPermissionsCrud } from './crud/project-permissions.js';
import { SessionsCrud } from './crud/sessions.js';
import { TeamInvitationCrud } from './crud/team-invitation.js';
import { TeamMemberProfilesCrud } from './crud/team-member-profiles.js';
import { TeamMembershipsCrud } from './crud/team-memberships.js';
import { TeamPermissionsCrud } from './crud/team-permissions.js';
import { TeamsCrud } from './crud/teams.js';
import { UsersCrud } from './crud/users.js';
import '../utils/errors.js';
import '../utils/json.js';
import 'jose';
import 'yup';
import '@simplewebauthn/types';
import './crud/project-api-keys.js';
import '../crud.js';
import '../utils/types.js';
import './crud/projects.js';
type ServerAuthApplicationOptions = (ClientInterfaceOptions & ({
readonly secretServerKey: string;
} | {
readonly projectOwnerSession: InternalSession;
}));
declare class StackServerInterface extends StackClientInterface {
options: ServerAuthApplicationOptions;
constructor(options: ServerAuthApplicationOptions);
protected sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "server" | "admin"): Promise<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}>;
protected sendServerRequestAndCatchKnownError<E extends typeof KnownErrors[keyof KnownErrors]>(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise<Result<Response & {
usedTokens: {
accessToken: AccessToken;
refreshToken: RefreshToken | null;
} | null;
}, InstanceType<E>>>;
createServerUser(data: UsersCrud['Server']['Create']): Promise<UsersCrud['Server']['Read']>;
getServerUserByToken(session: InternalSession): Promise<CurrentUserCrud['Server']['Read'] | null>;
getServerUserById(userId: string): Promise<Result<UsersCrud['Server']['Read']>>;
listServerTeamInvitations(options: {
teamId: string;
}): Promise<TeamInvitationCrud['Server']['Read'][]>;
revokeServerTeamInvitation(invitationId: string, teamId: string): Promise<void>;
listServerTeamMemberProfiles(options: {
teamId: string;
}): Promise<TeamMemberProfilesCrud['Server']['Read'][]>;
getServerTeamMemberProfile(options: {
teamId: string;
userId: string;
}): Promise<TeamMemberProfilesCrud['Client']['Read']>;
listServerTeamPermissions(options: {
userId?: string;
teamId?: string;
recursive: boolean;
}, session: InternalSession | null): Promise<TeamPermissionsCrud['Server']['Read'][]>;
listServerProjectPermissions(options: {
userId?: string;
recursive: boolean;
}, session: InternalSession | null): Promise<ProjectPermissionsCrud['Server']['Read'][]>;
listServerUsers(options: {
cursor?: string;
limit?: number;
orderBy?: 'signedUpAt';
desc?: boolean;
query?: string;
}): Promise<UsersCrud['Server']['List']>;
listServerTeams(options?: {
userId?: string;
}): Promise<TeamsCrud['Server']['Read'][]>;
getServerTeam(teamId: string): Promise<TeamsCrud['Server']['Read']>;
listServerTeamUsers(teamId: string): Promise<UsersCrud['Server']['Read'][]>;
createServerTeam(data: TeamsCrud['Server']['Create']): Promise<TeamsCrud['Server']['Read']>;
updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise<TeamsCrud['Server']['Read']>;
deleteServerTeam(teamId: string): Promise<void>;
addServerUserToTeam(options: {
userId: string;
teamId: string;
}): Promise<TeamMembershipsCrud['Server']['Read']>;
removeServerUserFromTeam(options: {
userId: string;
teamId: string;
}): Promise<void>;
updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise<UsersCrud['Server']['Read']>;
createServerProviderAccessToken(userId: string, provider: string, scope: string): Promise<ConnectedAccountAccessTokenCrud['Server']['Read']>;
createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{
accessToken: string;
refreshToken: string;
}>;
leaveServerTeam(options: {
teamId: string;
userId: string;
}): Promise<void>;
updateServerTeamMemberProfile(options: {
teamId: string;
userId: string;
profile: TeamMemberProfilesCrud['Server']['Update'];
}): Promise<void>;
grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise<void>;
grantServerProjectPermission(userId: string, permissionId: string): Promise<void>;
revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise<void>;
revokeServerProjectPermission(userId: string, permissionId: string): Promise<void>;
deleteServerUser(userId: string): Promise<void>;
createServerContactChannel(data: ContactChannelsCrud['Server']['Create']): Promise<ContactChannelsCrud['Server']['Read']>;
updateServerContactChannel(userId: string, contactChannelId: string, data: ContactChannelsCrud['Server']['Update']): Promise<ContactChannelsCrud['Server']['Read']>;
deleteServerContactChannel(userId: string, contactChannelId: string): Promise<void>;
listServerContactChannels(userId: string): Promise<ContactChannelsCrud['Server']['Read'][]>;
sendServerContactChannelVerificationEmail(userId: string, contactChannelId: string, callbackUrl: string): Promise<void>;
listServerSessions(userId: string): Promise<SessionsCrud['Server']['Read'][]>;
deleteServerSession(sessionId: string): Promise<void>;
sendServerTeamInvitation(options: {
email: string;
teamId: string;
callbackUrl: string;
}): Promise<void>;
updatePassword(options: {
oldPassword: string;
newPassword: string;
}): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
}
export { type ServerAuthApplicationOptions, StackServerInterface };

View file

@ -0,0 +1,534 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/serverInterface.ts
var serverInterface_exports = {};
__export(serverInterface_exports, {
StackServerInterface: () => StackServerInterface
});
module.exports = __toCommonJS(serverInterface_exports);
var import_known_errors = require("../known-errors");
var import_errors = require("../utils/errors");
var import_objects = require("../utils/objects");
var import_results = require("../utils/results");
var import_urls = require("../utils/urls");
var import_clientInterface = require("./clientInterface");
var StackServerInterface = class extends import_clientInterface.StackClientInterface {
constructor(options) {
super(options);
this.options = options;
}
async sendServerRequest(path, options, session, requestType = "server") {
return await this.sendClientRequest(
path,
{
...options,
headers: {
"x-stack-secret-server-key": "secretServerKey" in this.options ? this.options.secretServerKey : "",
...options.headers
}
},
session,
requestType
);
}
async sendServerRequestAndCatchKnownError(path, requestOptions, tokenStoreOrNull, errorsToCatch) {
try {
return import_results.Result.ok(await this.sendServerRequest(path, requestOptions, tokenStoreOrNull));
} catch (e) {
for (const errorType of errorsToCatch) {
if (errorType.isInstance(e)) {
return import_results.Result.error(e);
}
}
throw e;
}
}
async createServerUser(data) {
const response = await this.sendServerRequest(
"/users",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async getServerUserByToken(session) {
const responseOrError = await this.sendServerRequestAndCatchKnownError(
"/users/me",
{},
session,
[import_known_errors.KnownErrors.CannotGetOwnUserWithoutUser]
);
if (responseOrError.status === "error") {
if (import_known_errors.KnownErrors.CannotGetOwnUserWithoutUser.isInstance(responseOrError.error)) {
return null;
} else {
throw new import_errors.StackAssertionError("Unexpected uncaught error", { cause: responseOrError.error });
}
}
const response = responseOrError.data;
const user = await response.json();
if (!user) throw new import_errors.StackAssertionError("User endpoint returned null; this should never happen");
return user;
}
async getServerUserById(userId) {
const responseOrError = await this.sendServerRequestAndCatchKnownError(
import_urls.urlString`/users/${userId}`,
{},
null,
[import_known_errors.KnownErrors.UserNotFound]
);
if (responseOrError.status === "error") {
return import_results.Result.error(responseOrError.error);
}
const user = await responseOrError.data.json();
return import_results.Result.ok(user);
}
async listServerTeamInvitations(options) {
const response = await this.sendServerRequest(
import_urls.urlString`/team-invitations?team_id=${options.teamId}`,
{},
null
);
const result = await response.json();
return result.items;
}
async revokeServerTeamInvitation(invitationId, teamId) {
await this.sendServerRequest(
import_urls.urlString`/team-invitations/${invitationId}?team_id=${teamId}`,
{ method: "DELETE" },
null
);
}
async listServerTeamMemberProfiles(options) {
const response = await this.sendServerRequest(
import_urls.urlString`/team-member-profiles?team_id=${options.teamId}`,
{},
null
);
const result = await response.json();
return result.items;
}
async getServerTeamMemberProfile(options) {
const response = await this.sendServerRequest(
import_urls.urlString`/team-member-profiles/${options.teamId}/${options.userId}`,
{},
null
);
return await response.json();
}
async listServerTeamPermissions(options, session) {
const response = await this.sendServerRequest(
`/team-permissions?${new URLSearchParams((0, import_objects.filterUndefined)({
user_id: options.userId,
team_id: options.teamId,
recursive: options.recursive.toString()
}))}`,
{},
session
);
const result = await response.json();
return result.items;
}
async listServerProjectPermissions(options, session) {
const response = await this.sendServerRequest(
`/project-permissions?${new URLSearchParams((0, import_objects.filterUndefined)({
user_id: options.userId,
recursive: options.recursive.toString()
}))}`,
{},
session
);
const result = await response.json();
return result.items;
}
async listServerUsers(options) {
const searchParams = new URLSearchParams((0, import_objects.filterUndefined)({
cursor: options.cursor,
limit: options.limit?.toString(),
desc: options.desc?.toString(),
...options.orderBy ? {
order_by: {
signedUpAt: "signed_up_at"
}[options.orderBy]
} : {},
...options.query ? {
query: options.query
} : {}
}));
const response = await this.sendServerRequest("/users?" + searchParams.toString(), {}, null);
return await response.json();
}
async listServerTeams(options) {
const response = await this.sendServerRequest(
`/teams?${new URLSearchParams((0, import_objects.filterUndefined)({
user_id: options?.userId
}))}`,
{},
null
);
const result = await response.json();
return result.items;
}
async getServerTeam(teamId) {
const response = await this.sendServerRequest(
`/teams/${teamId}`,
{},
null
);
return await response.json();
}
async listServerTeamUsers(teamId) {
const response = await this.sendServerRequest(`/users?team_id=${teamId}`, {}, null);
const result = await response.json();
return result.items;
}
/* when passing a session, the user will be added to the team */
async createServerTeam(data) {
const response = await this.sendServerRequest(
"/teams",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async updateServerTeam(teamId, data) {
const response = await this.sendServerRequest(
import_urls.urlString`/teams/${teamId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async deleteServerTeam(teamId) {
await this.sendServerRequest(
import_urls.urlString`/teams/${teamId}`,
{ method: "DELETE" },
null
);
}
async addServerUserToTeam(options) {
const response = await this.sendServerRequest(
import_urls.urlString`/team-memberships/${options.teamId}/${options.userId}`,
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
return await response.json();
}
async removeServerUserFromTeam(options) {
await this.sendServerRequest(
import_urls.urlString`/team-memberships/${options.teamId}/${options.userId}`,
{
method: "DELETE",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async updateServerUser(userId, update) {
const response = await this.sendServerRequest(
import_urls.urlString`/users/${userId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(update)
},
null
);
return await response.json();
}
async createServerProviderAccessToken(userId, provider, scope) {
const response = await this.sendServerRequest(
import_urls.urlString`/connected-accounts/${userId}/${provider}/access-token`,
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({ scope })
},
null
);
return await response.json();
}
async createServerUserSession(userId, expiresInMillis, isImpersonation) {
const response = await this.sendServerRequest(
"/auth/sessions",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({
user_id: userId,
expires_in_millis: expiresInMillis,
is_impersonation: isImpersonation
})
},
null
);
const result = await response.json();
return {
accessToken: result.access_token,
refreshToken: result.refresh_token
};
}
async leaveServerTeam(options) {
await this.sendClientRequest(
import_urls.urlString`/team-memberships/${options.teamId}/${options.userId}`,
{
method: "DELETE",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async updateServerTeamMemberProfile(options) {
await this.sendServerRequest(
import_urls.urlString`/team-member-profiles/${options.teamId}/${options.userId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(options.profile)
},
null
);
}
async grantServerTeamUserPermission(teamId, userId, permissionId) {
await this.sendServerRequest(
import_urls.urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async grantServerProjectPermission(userId, permissionId) {
await this.sendServerRequest(
import_urls.urlString`/project-permissions/${userId}/${permissionId}`,
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async revokeServerTeamUserPermission(teamId, userId, permissionId) {
await this.sendServerRequest(
import_urls.urlString`/team-permissions/${teamId}/${userId}/${permissionId}`,
{
method: "DELETE",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async revokeServerProjectPermission(userId, permissionId) {
await this.sendServerRequest(
import_urls.urlString`/project-permissions/${userId}/${permissionId}`,
{
method: "DELETE",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async deleteServerUser(userId) {
await this.sendServerRequest(
import_urls.urlString`/users/${userId}`,
{
method: "DELETE",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({})
},
null
);
}
async createServerContactChannel(data) {
const response = await this.sendServerRequest(
"/contact-channels",
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async updateServerContactChannel(userId, contactChannelId, data) {
const response = await this.sendServerRequest(
import_urls.urlString`/contact-channels/${userId}/${contactChannelId}`,
{
method: "PATCH",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(data)
},
null
);
return await response.json();
}
async deleteServerContactChannel(userId, contactChannelId) {
await this.sendServerRequest(
import_urls.urlString`/contact-channels/${userId}/${contactChannelId}`,
{
method: "DELETE"
},
null
);
}
async listServerContactChannels(userId) {
const response = await this.sendServerRequest(
import_urls.urlString`/contact-channels?user_id=${userId}`,
{
method: "GET"
},
null
);
const json = await response.json();
return json.items;
}
async sendServerContactChannelVerificationEmail(userId, contactChannelId, callbackUrl) {
await this.sendServerRequest(
import_urls.urlString`/contact-channels/${userId}/${contactChannelId}/send-verification-code`,
{
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify({ callback_url: callbackUrl })
},
null
);
}
async listServerSessions(userId) {
const response = await this.sendServerRequest(
import_urls.urlString`/auth/sessions?user_id=${userId}`,
{
method: "GET"
},
null
);
return await response.json();
}
async deleteServerSession(sessionId) {
await this.sendServerRequest(
import_urls.urlString`/auth/sessions/${sessionId}`,
{
method: "DELETE"
},
null
);
}
async sendServerTeamInvitation(options) {
await this.sendServerRequest(
"/team-invitations/send-code",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: options.email,
team_id: options.teamId,
callback_url: options.callbackUrl
})
},
null
);
}
async updatePassword(options) {
const res = await this.sendServerRequestAndCatchKnownError(
"/auth/password/update",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
old_password: options.oldPassword,
new_password: options.newPassword
})
},
null,
[import_known_errors.KnownErrors.PasswordConfirmationMismatch, import_known_errors.KnownErrors.PasswordRequirementsNotMet]
);
if (res.status === "error") {
return res.error;
}
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
StackServerInterface
});
//# sourceMappingURL=serverInterface.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,292 @@
import * as yup from 'yup';
type WebhookEvent<S extends yup.Schema> = {
type: string;
schema: S;
metadata: {
summary: string;
description: string;
tags?: string[];
};
};
declare const webhookEvents: readonly [{
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
teams: {
id: string;
}[];
}, yup.AnyObject, {
id: undefined;
teams: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
}, yup.AnyObject, {
id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}];
export { type WebhookEvent, webhookEvents };

View file

@ -0,0 +1,292 @@
import * as yup from 'yup';
type WebhookEvent<S extends yup.Schema> = {
type: string;
schema: S;
metadata: {
summary: string;
description: string;
tags?: string[];
};
};
declare const webhookEvents: readonly [{
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
primary_email: string | null;
primary_email_verified: boolean;
primary_email_auth_enabled: boolean;
display_name: string | null;
selected_team: {
client_metadata?: {} | null | undefined;
client_read_only_metadata?: {} | null | undefined;
server_metadata?: {} | null | undefined;
id: string;
display_name: string;
created_at_millis: number;
profile_image_url: string | null;
} | null;
selected_team_id: string | null;
profile_image_url: string | null;
signed_up_at_millis: number;
has_password: boolean;
otp_auth_enabled: boolean;
passkey_auth_enabled: boolean;
client_metadata: {} | null;
client_read_only_metadata: {} | null;
server_metadata: {} | null;
last_active_at_millis: number;
is_anonymous: boolean;
oauth_providers: {
email?: string | null | undefined;
id: string;
account_id: string;
}[];
auth_with_email: boolean;
requires_totp_mfa: boolean;
}, yup.AnyObject, {
id: undefined;
primary_email: undefined;
primary_email_verified: undefined;
primary_email_auth_enabled: undefined;
display_name: undefined;
selected_team: {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
};
selected_team_id: undefined;
profile_image_url: undefined;
signed_up_at_millis: undefined;
has_password: undefined;
otp_auth_enabled: undefined;
passkey_auth_enabled: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
server_metadata: undefined;
last_active_at_millis: undefined;
is_anonymous: undefined;
oauth_providers: undefined;
auth_with_email: undefined;
requires_totp_mfa: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
teams: {
id: string;
}[];
}, yup.AnyObject, {
id: undefined;
teams: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
display_name: string;
profile_image_url: string | null;
client_metadata: {} | null | undefined;
client_read_only_metadata: {} | null | undefined;
} & {
created_at_millis: number;
server_metadata: {} | null | undefined;
}, yup.AnyObject, {
id: undefined;
display_name: undefined;
profile_image_url: undefined;
client_metadata: undefined;
client_read_only_metadata: undefined;
created_at_millis: undefined;
server_metadata: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
}, yup.AnyObject, {
id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
team_id: string;
user_id: string;
}, yup.AnyObject, {
team_id: undefined;
user_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}, {
type: string;
schema: yup.ObjectSchema<{
id: string;
user_id: string;
team_id: string;
}, yup.AnyObject, {
id: undefined;
user_id: undefined;
team_id: undefined;
}, "">;
metadata: {
summary: string;
description: string;
tags: string[];
};
}];
export { type WebhookEvent, webhookEvents };

View file

@ -0,0 +1,46 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/interface/webhooks.ts
var webhooks_exports = {};
__export(webhooks_exports, {
webhookEvents: () => webhookEvents
});
module.exports = __toCommonJS(webhooks_exports);
var import_team_memberships = require("./crud/team-memberships");
var import_team_permissions = require("./crud/team-permissions");
var import_teams = require("./crud/teams");
var import_users = require("./crud/users");
var webhookEvents = [
import_users.userCreatedWebhookEvent,
import_users.userUpdatedWebhookEvent,
import_users.userDeletedWebhookEvent,
import_teams.teamCreatedWebhookEvent,
import_teams.teamUpdatedWebhookEvent,
import_teams.teamDeletedWebhookEvent,
import_team_memberships.teamMembershipCreatedWebhookEvent,
import_team_memberships.teamMembershipDeletedWebhookEvent,
import_team_permissions.teamPermissionCreatedWebhookEvent,
import_team_permissions.teamPermissionDeletedWebhookEvent
];
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
webhookEvents
});
//# sourceMappingURL=webhooks.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["../../src/interface/webhooks.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { teamMembershipCreatedWebhookEvent, teamMembershipDeletedWebhookEvent } from \"./crud/team-memberships\";\nimport { teamPermissionCreatedWebhookEvent, teamPermissionDeletedWebhookEvent } from \"./crud/team-permissions\";\nimport { teamCreatedWebhookEvent, teamDeletedWebhookEvent, teamUpdatedWebhookEvent } from \"./crud/teams\";\nimport { userCreatedWebhookEvent, userDeletedWebhookEvent, userUpdatedWebhookEvent } from \"./crud/users\";\n\nexport type WebhookEvent<S extends yup.Schema> = {\n type: string,\n schema: S,\n metadata: {\n summary: string,\n description: string,\n tags?: string[],\n },\n};\n\nexport const webhookEvents = [\n userCreatedWebhookEvent,\n userUpdatedWebhookEvent,\n userDeletedWebhookEvent,\n teamCreatedWebhookEvent,\n teamUpdatedWebhookEvent,\n teamDeletedWebhookEvent,\n teamMembershipCreatedWebhookEvent,\n teamMembershipDeletedWebhookEvent,\n teamPermissionCreatedWebhookEvent,\n teamPermissionDeletedWebhookEvent,\n] as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAAqF;AACrF,8BAAqF;AACrF,mBAA0F;AAC1F,mBAA0F;AAYnF,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}