@directus/api
Version:
Directus is a real-time API and App dashboard for managing SQL database content
115 lines (114 loc) • 5.63 kB
TypeScript
import type { Item, Query } from '@directus/types';
import { z } from 'zod';
export declare const WebSocketResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodString;
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
status: z.ZodLiteral<"ok">;
}, z.core.$loose>, z.ZodObject<{
type: z.ZodString;
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
status: z.ZodLiteral<"error">;
error: z.ZodObject<{
code: z.ZodString;
message: z.ZodString;
}, z.core.$loose>;
}, z.core.$loose>], "status">;
export type WebSocketResponse = z.infer<typeof WebSocketResponse>;
export declare const ConnectionParams: z.ZodObject<{
access_token: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type ConnectionParams = z.infer<typeof ConnectionParams>;
export declare const BasicAuthMessage: z.ZodUnion<readonly [z.ZodObject<{
email: z.ZodString;
password: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
access_token: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
refresh_token: z.ZodString;
}, z.core.$strip>]>;
export type BasicAuthMessage = z.infer<typeof BasicAuthMessage>;
export declare const WebSocketAuthMessage: z.ZodIntersection<z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"auth">;
}, z.core.$loose>, z.ZodUnion<readonly [z.ZodObject<{
email: z.ZodString;
password: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
access_token: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
refresh_token: z.ZodString;
}, z.core.$strip>]>>;
export type WebSocketAuthMessage = z.infer<typeof WebSocketAuthMessage>;
export declare const WebSocketSubscribeMessage: z.ZodDiscriminatedUnion<[z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"subscribe">;
collection: z.ZodString;
event: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"create">, z.ZodLiteral<"update">, z.ZodLiteral<"delete">]>>;
item: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, z.core.$loose>, z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"unsubscribe">;
}, z.core.$loose>], "type">;
export type WebSocketSubscribeMessage = z.infer<typeof WebSocketSubscribeMessage>;
export declare const WebSocketLogsMessage: z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"subscribe">;
log_level: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"unsubscribe">;
}, z.core.$loose>]>;
export type WebSocketLogsMessage = z.infer<typeof WebSocketLogsMessage>;
export declare const WebSocketItemsMessage: z.ZodUnion<readonly [z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"items">;
collection: z.ZodString;
action: z.ZodLiteral<"create">;
data: z.ZodUnion<readonly [z.ZodArray<z.ZodCustom<Partial<Item>, Partial<Item>>>, z.ZodCustom<Partial<Item>, Partial<Item>>]>;
query: z.ZodOptional<z.ZodCustom<Query, Query>>;
}, z.core.$strip>, z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"items">;
collection: z.ZodString;
action: z.ZodLiteral<"read">;
ids: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
query: z.ZodOptional<z.ZodCustom<Query, Query>>;
}, z.core.$strip>, z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"items">;
collection: z.ZodString;
action: z.ZodLiteral<"update">;
data: z.ZodCustom<Partial<Item>, Partial<Item>>;
ids: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
query: z.ZodOptional<z.ZodCustom<Query, Query>>;
}, z.core.$strip>, z.ZodObject<{
uid: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
type: z.ZodLiteral<"items">;
collection: z.ZodString;
action: z.ZodLiteral<"delete">;
ids: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
query: z.ZodOptional<z.ZodCustom<Query, Query>>;
}, z.core.$strip>]>;
export type WebSocketItemsMessage = z.infer<typeof WebSocketItemsMessage>;
export declare const WebSocketEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
action: z.ZodLiteral<"create">;
collection: z.ZodString;
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
key: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
}, z.core.$strip>, z.ZodObject<{
action: z.ZodLiteral<"update">;
collection: z.ZodString;
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
keys: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
}, z.core.$strip>, z.ZodObject<{
action: z.ZodLiteral<"delete">;
collection: z.ZodString;
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
keys: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
}, z.core.$strip>], "action">;
export type WebSocketEvent = z.infer<typeof WebSocketEvent>;
export declare const AuthMode: z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodLiteral<"handshake">, z.ZodLiteral<"strict">]>;
export type AuthMode = z.infer<typeof AuthMode>;